Annotation of parser3/src/targets/cgi/parser3.C, revision 1.213
1.27 paf 1: /** @file
2: Parser: scripting and CGI main.
3:
1.155 paf 4: Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.154 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.189 paf 6: */
1.27 paf 7:
1.213 ! paf 8: static const char* IDENT_PARSER3_C="$Date: 2002/12/09 13:05:45 $";
1.1 paf 9:
1.40 paf 10: #include "pa_config_includes.h"
1.3 paf 11:
1.139 paf 12: #if _MSC_VER
1.131 paf 13: # include <new.h>
1.148 paf 14: # include <crtdbg.h>
1.3 paf 15: #endif
1.27 paf 16:
1.37 paf 17: #include "pa_sapi.h"
1.76 paf 18: #include "classes.h"
1.24 paf 19: #include "pa_common.h"
1.2 paf 20: #include "pa_request.h"
1.57 paf 21: #include "pa_socks.h"
1.68 paf 22: #include "pa_version.h"
1.207 paf 23:
1.125 parser 24: #include "pool_storage.h"
1.69 paf 25:
1.149 paf 26: #ifdef WIN32
27: # include <windows.h>
1.184 paf 28: # include "getopt.h"
29: #else
30: # include <getopt.h>
1.120 parser 31: #endif
32:
1.158 paf 33: //#define DEBUG_POOL_MALLOC
1.162 paf 34: //#define DEBUG_STRING_APPENDS_VS_EXPANDS
1.196 paf 35: //#define DEBUG_MAILRECEIVE "mailreceive.eml"
1.160 paf 36:
37: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
38: extern ulong
39: string_piece_appends,
40: wcontext_result_size,
41: total_alloc_size,
42: string_string_shortcut_economy;
43: #endif
1.84 parser 44:
1.109 parser 45: // consts
1.84 parser 46:
1.175 paf 47: #define REDIRECT_PREFIX "REDIRECT_"
1.181 paf 48: #define PARSER_CONFIG_ENV_NAME "CGI_PARSER_CONFIG"
1.159 paf 49:
1.42 paf 50: /// IIS refuses to read bigger chunks
51: const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M
52:
1.184 paf 53: static const char *argv0;
1.193 paf 54: static const char *config_filespec_cstr=0;
55: static bool fail_on_config_read_problem=true;
1.192 paf 56:
1.198 paf 57: static Pool_storage global_pool_storage; ///< global pool storage
58: static Pool global_pool(&global_pool_storage); ///< global pool
1.184 paf 59: static bool cgi; ///< we were started as CGI?
60: static bool mail_received=false; ///< we were started with -m option? [asked to parse incoming message to $mail:received]
1.5 paf 61:
1.201 paf 62: // for signal handlers
63: Request *request=0;
64:
1.46 paf 65: // SAPI
1.86 parser 66:
1.124 parser 67: static void log(const char *fmt, va_list args) {
1.193 paf 68: bool opened=false;
1.61 paf 69: FILE *f=0;
70:
1.193 paf 71: if(config_filespec_cstr) {
72: char beside_config_path[MAX_STRING];
73: strncpy(beside_config_path, config_filespec_cstr, MAX_STRING-1); beside_config_path[MAX_STRING-1]=0;
74: if(!(
75: rsplit(beside_config_path, '/') ||
76: rsplit(beside_config_path, '\\'))) { // strip filename
77: // no path, just filename
78: beside_config_path[0]='.'; beside_config_path[1]=0;
79: }
80:
81: char file_spec[MAX_STRING];
82: snprintf(file_spec, MAX_STRING,
83: "%s/parser3.log", beside_config_path);
84: f=fopen(file_spec, "at");
85: opened=f!=0;
86: }
1.192 paf 87: // fallback to stderr
1.61 paf 88: if(!opened)
89: f=stderr;
1.208 paf 90:
91: // use no memory [so that we could log out-of-memory error]
92: setbuf(f, 0); // stderr stream is unbuffered by default, but still...
1.61 paf 93:
94: // prefix
95: time_t t=time(0);
1.171 paf 96: if(const char *stamp=ctime(&t)) { // never saw that
1.173 paf 97: if(size_t len=strlen(stamp)) // saw once stamp being =""
1.172 paf 98: fprintf(f, "[%.*s] ", len-1, stamp);
1.171 paf 99: }
1.61 paf 100: // message
1.117 parser 101:
102: char buf[MAX_STRING];
103: size_t size=vsnprintf(buf, MAX_STRING, fmt, args);
104: remove_crlf(buf, buf+size);
105:
106: fwrite(buf, size, 1, f);
1.61 paf 107: // newline
108: fprintf(f, "\n");
109:
110: if(opened)
111: fclose(f);
1.85 parser 112: else
113: fflush(f);
1.124 parser 114: }
115:
116: // appends to parser3.log located beside my binary if openable, to stderr otherwize
117: void SAPI::log(Pool& , const char *fmt, ...) {
118: va_list args;
119: va_start(args,fmt);
120: ::log(fmt, args);
121: va_end(args);
122: }
123:
124: void SAPI::die(const char *fmt, ...) {
1.137 paf 125: #ifdef DEBUG_POOL_MALLOC
126: extern void log_pool_stats(Pool& pool);
1.198 paf 127: log_pool_stats(global_pool);
1.137 paf 128: #endif
129:
1.144 paf 130: va_list args;
131: va_start(args,fmt);
1.138 paf 132: // log
133:
134: // logging is more important than user
1.204 paf 135: // she can cancel download, we'd get SIGPIPE,
1.138 paf 136: // nothing would be logged then
1.124 parser 137: ::log(fmt, args);
138:
1.138 paf 139: // inform user
140:
1.134 paf 141: char body[MAX_STRING];
1.138 paf 142: int content_length=vsnprintf(body, MAX_STRING, fmt, args);
1.134 paf 143:
1.144 paf 144: va_end(args);
145:
1.134 paf 146: // prepare header
147: // let's be honest, that's bad we couldn't produce valid output
1.198 paf 148: SAPI::add_header_attribute(global_pool, "status", "500");
149: SAPI::add_header_attribute(global_pool, "content-type", "text/plain");
1.134 paf 150: char content_length_cstr[MAX_NUMBER];
1.168 paf 151: snprintf(content_length_cstr, sizeof(content_length_cstr), "%u", content_length);
1.198 paf 152: SAPI::add_header_attribute(global_pool, "content-length", content_length_cstr);
1.134 paf 153:
154: // send header
1.198 paf 155: SAPI::send_header(global_pool);
1.134 paf 156:
157: // body
1.198 paf 158: SAPI::send_body(global_pool, body, content_length);
1.134 paf 159:
1.211 paf 160: // exit & try to produce core dump
161: abort();
1.61 paf 162: }
163:
1.122 parser 164: const char *SAPI::get_env(Pool& , const char *name) {
1.109 parser 165: return getenv(name);
1.28 paf 166: }
167:
1.180 paf 168: const char *const *SAPI::environment(Pool&) {
169: #ifdef _MSC_VER
170: extern char **_environ;
171: return _environ;
172: #else
173: extern char **environ;
174: return environ;
175: #endif
176: }
177:
1.122 parser 178: size_t SAPI::read_post(Pool& , char *buf, size_t max_bytes) {
1.59 paf 179: size_t read_size=0;
1.12 paf 180: do {
1.200 paf 181: ssize_t chunk_size=read(fileno(stdin),
1.42 paf 182: buf+read_size, min(READ_POST_CHUNK_SIZE, max_bytes-read_size));
1.129 paf 183: if(chunk_size<=0)
1.12 paf 184: break;
185: read_size+=chunk_size;
186: } while(read_size<max_bytes);
187:
188: return read_size;
1.10 paf 189: }
190:
1.122 parser 191: void SAPI::add_header_attribute(Pool& , const char *key, const char *value) {
1.68 paf 192: if(cgi)
1.20 paf 193: printf("%s: %s\n", key, value);
1.19 paf 194: }
195:
1.56 paf 196: /// @todo intelligent cache-control
1.122 parser 197: void SAPI::send_header(Pool& ) {
1.33 paf 198: if(cgi) {
1.147 paf 199: // puts("expires: Fri, 23 Mar 2001 09:32:23 GMT");
1.33 paf 200:
201: // header | body delimiter
1.20 paf 202: puts("");
1.33 paf 203: }
1.30 paf 204: }
1.20 paf 205:
1.122 parser 206: void SAPI::send_body(Pool& , const void *buf, size_t size) {
1.19 paf 207: stdout_write(buf, size);
1.58 paf 208: }
209:
1.97 parser 210: //
211:
1.184 paf 212: static void full_file_spec(const char *file_name, char *buf, size_t buf_size) {
1.210 paf 213: if(file_name)
1.167 paf 214: if(file_name[0]=='/'
215: #ifdef WIN32
1.210 paf 216: || file_name[0] && file_name[1]==':'
1.167 paf 217: #endif
1.210 paf 218: )
1.167 paf 219: strncpy(buf, file_name, buf_size);
220: else {
221: char cwd[MAX_STRING]; getcwd(cwd, MAX_STRING);
222: snprintf(buf, buf_size, "%s/%s", cwd, file_name);
223: }
224: else
225: buf[0]=0;
1.166 paf 226: #ifdef WIN32
227: back_slashes_to_slashes(buf);
228: #endif
1.97 parser 229: }
230:
1.205 paf 231: static void log_signal(const char *signal_name) {
232: SAPI::log(global_pool, request? "%s received. uri=%s, qs=%s"
233: :"%s received. no request being processed",
234: signal_name,
1.206 paf 235: request && request->info.uri?request->info.uri:"-",
236: request && request->info.query_string?request->info.query_string:"-");
1.205 paf 237: }
238:
1.201 paf 239: #ifdef SIGUSR1
1.205 paf 240: static void SIGUSR1_handler(int /*sig*/){
241: log_signal("SIGUSR1");
1.201 paf 242: }
243: #endif
244:
245: #ifdef SIGPIPE
1.205 paf 246: static void SIGPIPE_handler(int /*sig*/){
247: log_signal("SIGPIPE");
1.201 paf 248: if(request)
249: request->interrupt();
250: }
251: #endif
252:
1.40 paf 253: /**
1.122 parser 254: main workhorse
1.19 paf 255:
1.122 parser 256: @todo
1.40 paf 257: IIS: remove trailing default-document[index.html] from $request.uri.
258: to do that we need to consult metabase,
259: wich is tested but seems slow.
1.144 paf 260: IIS5 todo find out proper 'illegal call' check
1.40 paf 261: */
1.184 paf 262: static void real_parser_handler(
1.122 parser 263: const char *filespec_to_process,
264: const char *request_method, bool header_only) {
265: // init socks
1.198 paf 266: init_socks(global_pool);
1.122 parser 267:
268: // init global classes
1.198 paf 269: init_methoded_array(global_pool);
1.122 parser 270: // init global variables
1.198 paf 271: pa_globals_init(global_pool);
1.122 parser 272:
1.198 paf 273: // request pool, must be different ptr from global [used in VStateless_class.add_method]
274: Pool request_pool(&global_pool_storage);
275:
1.186 paf 276: if(!filespec_to_process || !*filespec_to_process)
1.144 paf 277: SAPI::die("Parser/%s", PARSER_VERSION);
1.122 parser 278:
279: // Request info
280: Request::Info request_info;
1.166 paf 281: char document_root_buf[MAX_STRING];
1.122 parser 282: if(cgi) {
1.198 paf 283: if(const char *env_document_root=SAPI::get_env(request_pool, "DOCUMENT_ROOT"))
1.122 parser 284: request_info.document_root=env_document_root;
1.198 paf 285: else if(const char *path_info=SAPI::get_env(request_pool, "PATH_INFO")) {
1.122 parser 286: // IIS
1.166 paf 287: size_t len=min(sizeof(document_root_buf)-1, strlen(filespec_to_process)-strlen(path_info));
288: memcpy(document_root_buf, filespec_to_process, len); document_root_buf[len]=0;
289: request_info.document_root=document_root_buf;
1.122 parser 290: } else
1.165 paf 291: throw Exception("parser.runtime",
292: 0,
293: "CGI: no PATH_INFO defined(in reinventing DOCUMENT_ROOT)");
1.122 parser 294: } else {
1.166 paf 295: full_file_spec("", document_root_buf, sizeof(document_root_buf));
296: request_info.document_root=document_root_buf;
1.122 parser 297: }
298: request_info.path_translated=filespec_to_process;
299: request_info.method=request_method ? request_method : "GET";
1.198 paf 300: const char *query_string=SAPI::get_env(request_pool, "QUERY_STRING");
1.122 parser 301: request_info.query_string=query_string;
302: if(cgi) {
1.198 paf 303: if(const char *env_request_uri=SAPI::get_env(request_pool, "REQUEST_URI"))
1.122 parser 304: request_info.uri=env_request_uri;
1.198 paf 305: else if(const char *path_info=SAPI::get_env(request_pool, "PATH_INFO"))
1.122 parser 306: if(query_string) {
1.198 paf 307: char *reconstructed_uri=(char *)request_pool.malloc(
1.122 parser 308: strlen(path_info)+1/*'?'*/+
309: strlen(query_string)+1/*0*/);
310: strcpy(reconstructed_uri, path_info);
311: strcat(reconstructed_uri, "?");
312: strcat(reconstructed_uri, query_string);
313: request_info.uri=reconstructed_uri;
314: } else
315: request_info.uri=path_info;
1.179 paf 316: else
317: throw Exception("parser.runtime",
318: 0,
319: "CGI: no PATH_INFO defined(in reinventing REQUEST_URI)");
1.145 paf 320:
321: // they've changed this under IIS5.
1.198 paf 322: if(const char *script_name=SAPI::get_env(request_pool, "SCRIPT_NAME")) {
1.122 parser 323: size_t script_name_len=strlen(script_name);
324: size_t uri_len=strlen(request_info.uri);
325: if(strncmp(request_info.uri,script_name, script_name_len)==0 &&
326: script_name_len != uri_len) // under IIS they are the same
1.144 paf 327: SAPI::die("CGI: illegal call");
1.122 parser 328: }
329: } else
1.177 paf 330: request_info.uri="";
1.122 parser 331:
1.198 paf 332: request_info.content_type=SAPI::get_env(request_pool, "CONTENT_TYPE");
333: const char *content_length=SAPI::get_env(request_pool, "CONTENT_LENGTH");
1.122 parser 334: request_info.content_length=(content_length?atoi(content_length):0);
1.198 paf 335: request_info.cookie=SAPI::get_env(request_pool, "HTTP_COOKIE");
1.184 paf 336: request_info.mail_received=mail_received;
337:
1.198 paf 338:
1.122 parser 339: // prepare to process request
1.198 paf 340: Request request(request_pool,
1.122 parser 341: request_info,
1.184 paf 342: /*#ifdef _DEBUG
1.143 paf 343: String::UL_HTML|String::UL_OPTIMIZE_BIT
1.184 paf 344: #else*/
1.143 paf 345: cgi ? String::UL_HTML|String::UL_OPTIMIZE_BIT : String::UL_AS_IS
1.184 paf 346: /*#endif*/
1.143 paf 347: ,
1.130 paf 348: true /* status_allowed */);
1.201 paf 349:
350: // get request ptr for signal handlers
351: ::request=&request;
352:
1.181 paf 353: char config_filespec_buf[MAX_STRING];
1.193 paf 354: if(!config_filespec_cstr) {
355: const char *config_by_env=getenv(PARSER_CONFIG_ENV_NAME);
356: if(!config_by_env)
357: config_by_env=getenv(REDIRECT_PREFIX PARSER_CONFIG_ENV_NAME);
358: if(config_by_env)
359: config_filespec_cstr=config_by_env;
360: else {
361: // beside by binary
362: char beside_binary_path[MAX_STRING];
363: strncpy(beside_binary_path, argv0, MAX_STRING-1); beside_binary_path[MAX_STRING-1]=0; // filespec of my binary
364: if(!(
365: rsplit(beside_binary_path, '/') ||
366: rsplit(beside_binary_path, '\\'))) { // strip filename
367: // no path, just filename
368: // @todo full path, not ./!
369: beside_binary_path[0]='.'; beside_binary_path[1]=0;
370: }
371: snprintf(config_filespec_buf, MAX_STRING,
372: "%s/%s",
373: beside_binary_path, AUTO_FILE_NAME);
374: config_filespec_cstr=config_filespec_buf;
1.197 paf 375: fail_on_config_read_problem=entry_exists(config_filespec_cstr);
1.193 paf 376: }
1.122 parser 377: }
378:
379: // process the request
380: request.core(
1.193 paf 381: config_filespec_cstr, fail_on_config_read_problem,
1.122 parser 382: header_only);
1.201 paf 383:
384: // no request [prevent signal handlers from accessing invalid memory]
385: ::request=0;
1.122 parser 386:
387: //
388: done_socks();
389:
390: #ifdef DEBUG_POOL_MALLOC
391: extern void log_pool_stats(Pool& pool);
1.198 paf 392: log_pool_stats(request_pool);
1.122 parser 393: #endif
1.160 paf 394:
395: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
1.198 paf 396: SAPI::log(global_pool,
1.161 paf 397: "string piece appends=%lu, wcontext_result_size=%lu, string_string_shortcut_economy_closer=%lu, total_alloc_size=%lu",
1.160 paf 398: string_piece_appends,
399: wcontext_result_size,
400: string_string_shortcut_economy,
401: total_alloc_size);
402: #endif
403:
1.122 parser 404: }
405:
1.184 paf 406: static void call_real_parser_handler__do_SEH(
1.122 parser 407: const char *filespec_to_process,
408: const char *request_method, bool header_only) {
1.133 paf 409: #if _MSC_VER && !defined(_DEBUG)
1.122 parser 410: LPEXCEPTION_POINTERS system_exception=0;
411: __try {
412: #endif
413: real_parser_handler(
414: filespec_to_process,
415: request_method, header_only);
416:
1.133 paf 417: #if _MSC_VER && !defined(_DEBUG)
1.122 parser 418: } __except (
419: (system_exception=GetExceptionInformation()),
420: EXCEPTION_EXECUTE_HANDLER) {
421:
422: if(system_exception)
423: if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)
1.165 paf 424: throw Exception(0,
425: 0,
426: "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress);
1.122 parser 427: else
1.165 paf 428: throw Exception(0, 0, "Exception <no exception record>");
1.122 parser 429: else
1.165 paf 430: throw Exception(0, 0, "Exception <no exception information>");
1.122 parser 431: }
432: #endif
433: }
434:
1.139 paf 435: #if _MSC_VER
1.135 paf 436: int failed_new(size_t size) {
437: SAPI::die("out of memory in 'new', failed to allocated %u bytes", size);
438: return 0; // not reached
1.131 paf 439: }
1.135 paf 440: #endif
1.131 paf 441:
1.135 paf 442: #ifdef HAVE_SET_NEW_HANDLER
1.184 paf 443: static void failed_new() {
1.135 paf 444: SAPI::die("out of memory in 'new'");
1.131 paf 445: }
446: #endif
447:
1.184 paf 448: static void usage(const char *program) {
1.188 paf 449: printf(
1.184 paf 450: "Parser/%s Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)\n"
451: "Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)\n"
452: "\n"
453: "Usage: %s [options] file\n"
454: "Options are:\n"
1.185 paf 455: #ifdef WITH_MAILRECEIVE
1.193 paf 456: " -m Parse mail, put received letter to $mail:received\n"
1.184 paf 457: #endif
1.193 paf 458: " -f config_file Use this config file (/path/to/auto.p)\n"
459: " -h Display usage information (this message)\n"
1.184 paf 460: , PARSER_VERSION,
461: program);
462: exit(EINVAL);
463: }
464:
1.195 paf 465: int main(int argc, char *argv[]) {
1.203 paf 466: #ifdef SIGUSR1
1.205 paf 467: if(signal(SIGUSR1, SIGUSR1_handler)==SIG_ERR)
1.203 paf 468: SAPI::die("Can not set handler for SIGUSR1");
469: #endif
470: #ifdef SIGPIPE
1.205 paf 471: if(signal(SIGPIPE, SIGPIPE_handler)==SIG_ERR)
1.203 paf 472: SAPI::die("Can not set handler for SIGPIPE");
473: #endif
474:
475:
1.185 paf 476: #ifdef DEBUG_MAILRECEIVE
477: if(FILE *fake_in=fopen(DEBUG_MAILRECEIVE, "rt")) {
1.184 paf 478: dup2(fake_in->_file, 0/*STDIN_FILENO*/);
479: }
480: #endif
481:
1.178 paf 482: #ifdef _DEBUG
483: // _crtBreakAlloc=33112;
484: #endif
1.144 paf 485: // _asm int 3;
1.193 paf 486: argv0=argv[0];
1.45 paf 487:
1.32 paf 488: umask(2);
489:
1.3 paf 490: // were we started as CGI?
1.146 paf 491: cgi=
1.109 parser 492: getenv("SERVER_SOFTWARE") ||
493: getenv("SERVER_NAME") ||
494: getenv("GATEWAY_INTERFACE") ||
495: getenv("REQUEST_METHOD");
1.5 paf 496:
1.184 paf 497: char *raw_filespec_to_process;
1.210 paf 498: if(cgi) {
1.184 paf 499: raw_filespec_to_process=getenv("PATH_TRANSLATED");
1.210 paf 500: if(raw_filespec_to_process && !*raw_filespec_to_process)
501: raw_filespec_to_process=0;
502: } else {
1.184 paf 503: optind = 1;
504: opterr = 0;
505: int c;
1.193 paf 506: while((c = getopt(argc, argv, "hf:"
1.185 paf 507: #ifdef WITH_MAILRECEIVE
1.184 paf 508: "m"
509: #endif
510: )) > 0) {
511: switch (c) {
512: case 'h':
513: usage(argv[0]);
1.193 paf 514: break;
515: case 'f':
516: config_filespec_cstr=optarg;
1.184 paf 517: break;
1.185 paf 518: #ifdef WITH_MAILRECEIVE
1.184 paf 519: case 'm':
520: mail_received=true;
521: break;
522: #endif
523: default:
524: fprintf(stderr, "%s: invalid option '%c'\n", argv[0], optopt);
525: usage(argv[0]);
526: break;
527: }
528: }
529: if (optind != argc - 1) {
530: fprintf(stderr, "%s: file not specified\n", argv[0]);
531: usage(argv[0]);
1.10 paf 532: }
1.184 paf 533:
534: raw_filespec_to_process=argv[optind++];
1.10 paf 535: }
536:
1.100 parser 537: #ifdef WIN32
538: setmode(fileno(stdin), _O_BINARY);
539: setmode(fileno(stdout), _O_BINARY);
540: setmode(fileno(stderr), _O_BINARY);
541: #endif
542:
1.139 paf 543: #if _MSC_VER
1.138 paf 544: _set_new_handler(failed_new);
1.148 paf 545:
546: #ifdef _DEBUG
547: // Get current flag
548: int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
549:
550: // Turn on leak-checking bit
551: tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
552:
553: // Set flag to the new value
554: _CrtSetDbgFlag( tmpFlag );
555: // _CrtSetBreakAlloc(471);
556:
557: #endif
558:
1.138 paf 559: #endif
560:
561: #ifdef HAVE_SET_NEW_HANDLER
562: std::set_new_handler(failed_new);
563: #endif
564:
1.166 paf 565: char filespec_to_process[MAX_STRING];
566: full_file_spec(raw_filespec_to_process, filespec_to_process, sizeof(filespec_to_process));
1.10 paf 567:
1.109 parser 568: const char *request_method=getenv("REQUEST_METHOD");
1.35 paf 569: bool header_only=request_method && strcasecmp(request_method, "HEAD")==0;
1.131 paf 570:
1.122 parser 571: try { // global try
572: call_real_parser_handler__do_SEH(
573: filespec_to_process,
574: request_method, header_only);
575: } catch(const Exception& e) { // global problem
1.44 paf 576: // don't allocate anything on pool here:
577: // possible pool' exception not catch-ed now
578: // and there could be out-of-memory exception
1.43 paf 579:
1.144 paf 580: SAPI::die("exception in request exception handler: %s", e.comment());
1.134 paf 581: #ifndef _DEBUG
1.131 paf 582: } catch(...) {
1.134 paf 583: SAPI::die("<unknown exception>");
1.133 paf 584: #endif
1.16 paf 585: }
1.122 parser 586:
1.109 parser 587:
588: #ifndef WIN32
589: //
590: if(!cgi)
1.198 paf 591: SAPI::send_body(global_pool, "\n", 1);
1.109 parser 592: #endif
1.203 paf 593: //_asm int 3;
1.134 paf 594: return 0;
1.1 paf 595: }
E-mail: