Annotation of parser3/src/targets/cgi/parser3.C, revision 1.210
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.210 ! paf 8: static const char* IDENT_PARSER3_C="$Date: 2002/12/05 10:43:23 $";
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.124 parser 160: exit(1);
1.61 paf 161: }
162:
1.122 parser 163: const char *SAPI::get_env(Pool& , const char *name) {
1.109 parser 164: return getenv(name);
1.28 paf 165: }
166:
1.180 paf 167: const char *const *SAPI::environment(Pool&) {
168: #ifdef _MSC_VER
169: extern char **_environ;
170: return _environ;
171: #else
172: extern char **environ;
173: return environ;
174: #endif
175: }
176:
1.122 parser 177: size_t SAPI::read_post(Pool& , char *buf, size_t max_bytes) {
1.59 paf 178: size_t read_size=0;
1.12 paf 179: do {
1.200 paf 180: ssize_t chunk_size=read(fileno(stdin),
1.42 paf 181: buf+read_size, min(READ_POST_CHUNK_SIZE, max_bytes-read_size));
1.129 paf 182: if(chunk_size<=0)
1.12 paf 183: break;
184: read_size+=chunk_size;
185: } while(read_size<max_bytes);
186:
187: return read_size;
1.10 paf 188: }
189:
1.122 parser 190: void SAPI::add_header_attribute(Pool& , const char *key, const char *value) {
1.68 paf 191: if(cgi)
1.20 paf 192: printf("%s: %s\n", key, value);
1.19 paf 193: }
194:
1.56 paf 195: /// @todo intelligent cache-control
1.122 parser 196: void SAPI::send_header(Pool& ) {
1.33 paf 197: if(cgi) {
1.147 paf 198: // puts("expires: Fri, 23 Mar 2001 09:32:23 GMT");
1.33 paf 199:
200: // header | body delimiter
1.20 paf 201: puts("");
1.33 paf 202: }
1.30 paf 203: }
1.20 paf 204:
1.122 parser 205: void SAPI::send_body(Pool& , const void *buf, size_t size) {
1.19 paf 206: stdout_write(buf, size);
1.58 paf 207: }
208:
1.97 parser 209: //
210:
1.184 paf 211: static void full_file_spec(const char *file_name, char *buf, size_t buf_size) {
1.210 ! paf 212: if(file_name)
1.167 paf 213: if(file_name[0]=='/'
214: #ifdef WIN32
1.210 ! paf 215: || file_name[0] && file_name[1]==':'
1.167 paf 216: #endif
1.210 ! paf 217: )
1.167 paf 218: strncpy(buf, file_name, buf_size);
219: else {
220: char cwd[MAX_STRING]; getcwd(cwd, MAX_STRING);
221: snprintf(buf, buf_size, "%s/%s", cwd, file_name);
222: }
223: else
224: buf[0]=0;
1.166 paf 225: #ifdef WIN32
226: back_slashes_to_slashes(buf);
227: #endif
1.97 parser 228: }
229:
1.205 paf 230: static void log_signal(const char *signal_name) {
231: SAPI::log(global_pool, request? "%s received. uri=%s, qs=%s"
232: :"%s received. no request being processed",
233: signal_name,
1.206 paf 234: request && request->info.uri?request->info.uri:"-",
235: request && request->info.query_string?request->info.query_string:"-");
1.205 paf 236: }
237:
1.201 paf 238: #ifdef SIGUSR1
1.205 paf 239: static void SIGUSR1_handler(int /*sig*/){
240: log_signal("SIGUSR1");
1.201 paf 241: }
242: #endif
243:
244: #ifdef SIGPIPE
1.205 paf 245: static void SIGPIPE_handler(int /*sig*/){
246: log_signal("SIGPIPE");
1.201 paf 247: if(request)
248: request->interrupt();
249: }
250: #endif
251:
1.40 paf 252: /**
1.122 parser 253: main workhorse
1.19 paf 254:
1.122 parser 255: @todo
1.40 paf 256: IIS: remove trailing default-document[index.html] from $request.uri.
257: to do that we need to consult metabase,
258: wich is tested but seems slow.
1.144 paf 259: IIS5 todo find out proper 'illegal call' check
1.40 paf 260: */
1.184 paf 261: static void real_parser_handler(
1.122 parser 262: const char *filespec_to_process,
263: const char *request_method, bool header_only) {
264: // init socks
1.198 paf 265: init_socks(global_pool);
1.122 parser 266:
267: // init global classes
1.198 paf 268: init_methoded_array(global_pool);
1.122 parser 269: // init global variables
1.198 paf 270: pa_globals_init(global_pool);
1.122 parser 271:
1.198 paf 272: // request pool, must be different ptr from global [used in VStateless_class.add_method]
273: Pool request_pool(&global_pool_storage);
274:
1.186 paf 275: if(!filespec_to_process || !*filespec_to_process)
1.144 paf 276: SAPI::die("Parser/%s", PARSER_VERSION);
1.122 parser 277:
278: // Request info
279: Request::Info request_info;
1.166 paf 280: char document_root_buf[MAX_STRING];
1.122 parser 281: if(cgi) {
1.198 paf 282: if(const char *env_document_root=SAPI::get_env(request_pool, "DOCUMENT_ROOT"))
1.122 parser 283: request_info.document_root=env_document_root;
1.198 paf 284: else if(const char *path_info=SAPI::get_env(request_pool, "PATH_INFO")) {
1.122 parser 285: // IIS
1.166 paf 286: size_t len=min(sizeof(document_root_buf)-1, strlen(filespec_to_process)-strlen(path_info));
287: memcpy(document_root_buf, filespec_to_process, len); document_root_buf[len]=0;
288: request_info.document_root=document_root_buf;
1.122 parser 289: } else
1.165 paf 290: throw Exception("parser.runtime",
291: 0,
292: "CGI: no PATH_INFO defined(in reinventing DOCUMENT_ROOT)");
1.122 parser 293: } else {
1.166 paf 294: full_file_spec("", document_root_buf, sizeof(document_root_buf));
295: request_info.document_root=document_root_buf;
1.122 parser 296: }
297: request_info.path_translated=filespec_to_process;
298: request_info.method=request_method ? request_method : "GET";
1.198 paf 299: const char *query_string=SAPI::get_env(request_pool, "QUERY_STRING");
1.122 parser 300: request_info.query_string=query_string;
301: if(cgi) {
1.198 paf 302: if(const char *env_request_uri=SAPI::get_env(request_pool, "REQUEST_URI"))
1.122 parser 303: request_info.uri=env_request_uri;
1.198 paf 304: else if(const char *path_info=SAPI::get_env(request_pool, "PATH_INFO"))
1.122 parser 305: if(query_string) {
1.198 paf 306: char *reconstructed_uri=(char *)request_pool.malloc(
1.122 parser 307: strlen(path_info)+1/*'?'*/+
308: strlen(query_string)+1/*0*/);
309: strcpy(reconstructed_uri, path_info);
310: strcat(reconstructed_uri, "?");
311: strcat(reconstructed_uri, query_string);
312: request_info.uri=reconstructed_uri;
313: } else
314: request_info.uri=path_info;
1.179 paf 315: else
316: throw Exception("parser.runtime",
317: 0,
318: "CGI: no PATH_INFO defined(in reinventing REQUEST_URI)");
1.145 paf 319:
320: // they've changed this under IIS5.
1.198 paf 321: if(const char *script_name=SAPI::get_env(request_pool, "SCRIPT_NAME")) {
1.122 parser 322: size_t script_name_len=strlen(script_name);
323: size_t uri_len=strlen(request_info.uri);
324: if(strncmp(request_info.uri,script_name, script_name_len)==0 &&
325: script_name_len != uri_len) // under IIS they are the same
1.144 paf 326: SAPI::die("CGI: illegal call");
1.122 parser 327: }
328: } else
1.177 paf 329: request_info.uri="";
1.122 parser 330:
1.198 paf 331: request_info.content_type=SAPI::get_env(request_pool, "CONTENT_TYPE");
332: const char *content_length=SAPI::get_env(request_pool, "CONTENT_LENGTH");
1.122 parser 333: request_info.content_length=(content_length?atoi(content_length):0);
1.198 paf 334: request_info.cookie=SAPI::get_env(request_pool, "HTTP_COOKIE");
1.184 paf 335: request_info.mail_received=mail_received;
336:
1.198 paf 337:
1.122 parser 338: // prepare to process request
1.198 paf 339: Request request(request_pool,
1.122 parser 340: request_info,
1.184 paf 341: /*#ifdef _DEBUG
1.143 paf 342: String::UL_HTML|String::UL_OPTIMIZE_BIT
1.184 paf 343: #else*/
1.143 paf 344: cgi ? String::UL_HTML|String::UL_OPTIMIZE_BIT : String::UL_AS_IS
1.184 paf 345: /*#endif*/
1.143 paf 346: ,
1.130 paf 347: true /* status_allowed */);
1.201 paf 348:
349: // get request ptr for signal handlers
350: ::request=&request;
351:
1.181 paf 352: char config_filespec_buf[MAX_STRING];
1.193 paf 353: if(!config_filespec_cstr) {
354: const char *config_by_env=getenv(PARSER_CONFIG_ENV_NAME);
355: if(!config_by_env)
356: config_by_env=getenv(REDIRECT_PREFIX PARSER_CONFIG_ENV_NAME);
357: if(config_by_env)
358: config_filespec_cstr=config_by_env;
359: else {
360: // beside by binary
361: char beside_binary_path[MAX_STRING];
362: strncpy(beside_binary_path, argv0, MAX_STRING-1); beside_binary_path[MAX_STRING-1]=0; // filespec of my binary
363: if(!(
364: rsplit(beside_binary_path, '/') ||
365: rsplit(beside_binary_path, '\\'))) { // strip filename
366: // no path, just filename
367: // @todo full path, not ./!
368: beside_binary_path[0]='.'; beside_binary_path[1]=0;
369: }
370: snprintf(config_filespec_buf, MAX_STRING,
371: "%s/%s",
372: beside_binary_path, AUTO_FILE_NAME);
373: config_filespec_cstr=config_filespec_buf;
1.197 paf 374: fail_on_config_read_problem=entry_exists(config_filespec_cstr);
1.193 paf 375: }
1.122 parser 376: }
377:
378: // process the request
379: request.core(
1.193 paf 380: config_filespec_cstr, fail_on_config_read_problem,
1.122 parser 381: header_only);
1.201 paf 382:
383: // no request [prevent signal handlers from accessing invalid memory]
384: ::request=0;
1.122 parser 385:
386: //
387: done_socks();
388:
389: #ifdef DEBUG_POOL_MALLOC
390: extern void log_pool_stats(Pool& pool);
1.198 paf 391: log_pool_stats(request_pool);
1.122 parser 392: #endif
1.160 paf 393:
394: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
1.198 paf 395: SAPI::log(global_pool,
1.161 paf 396: "string piece appends=%lu, wcontext_result_size=%lu, string_string_shortcut_economy_closer=%lu, total_alloc_size=%lu",
1.160 paf 397: string_piece_appends,
398: wcontext_result_size,
399: string_string_shortcut_economy,
400: total_alloc_size);
401: #endif
402:
1.122 parser 403: }
404:
1.184 paf 405: static void call_real_parser_handler__do_SEH(
1.122 parser 406: const char *filespec_to_process,
407: const char *request_method, bool header_only) {
1.133 paf 408: #if _MSC_VER && !defined(_DEBUG)
1.122 parser 409: LPEXCEPTION_POINTERS system_exception=0;
410: __try {
411: #endif
412: real_parser_handler(
413: filespec_to_process,
414: request_method, header_only);
415:
1.133 paf 416: #if _MSC_VER && !defined(_DEBUG)
1.122 parser 417: } __except (
418: (system_exception=GetExceptionInformation()),
419: EXCEPTION_EXECUTE_HANDLER) {
420:
421: if(system_exception)
422: if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord)
1.165 paf 423: throw Exception(0,
424: 0,
425: "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress);
1.122 parser 426: else
1.165 paf 427: throw Exception(0, 0, "Exception <no exception record>");
1.122 parser 428: else
1.165 paf 429: throw Exception(0, 0, "Exception <no exception information>");
1.122 parser 430: }
431: #endif
432: }
433:
1.139 paf 434: #if _MSC_VER
1.135 paf 435: int failed_new(size_t size) {
436: SAPI::die("out of memory in 'new', failed to allocated %u bytes", size);
437: return 0; // not reached
1.131 paf 438: }
1.135 paf 439: #endif
1.131 paf 440:
1.135 paf 441: #ifdef HAVE_SET_NEW_HANDLER
1.184 paf 442: static void failed_new() {
1.135 paf 443: SAPI::die("out of memory in 'new'");
1.131 paf 444: }
445: #endif
446:
1.184 paf 447: static void usage(const char *program) {
1.188 paf 448: printf(
1.184 paf 449: "Parser/%s Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)\n"
450: "Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)\n"
451: "\n"
452: "Usage: %s [options] file\n"
453: "Options are:\n"
1.185 paf 454: #ifdef WITH_MAILRECEIVE
1.193 paf 455: " -m Parse mail, put received letter to $mail:received\n"
1.184 paf 456: #endif
1.193 paf 457: " -f config_file Use this config file (/path/to/auto.p)\n"
458: " -h Display usage information (this message)\n"
1.184 paf 459: , PARSER_VERSION,
460: program);
461: exit(EINVAL);
462: }
463:
1.195 paf 464: int main(int argc, char *argv[]) {
1.203 paf 465: #ifdef SIGUSR1
1.205 paf 466: if(signal(SIGUSR1, SIGUSR1_handler)==SIG_ERR)
1.203 paf 467: SAPI::die("Can not set handler for SIGUSR1");
468: #endif
469: #ifdef SIGPIPE
1.205 paf 470: if(signal(SIGPIPE, SIGPIPE_handler)==SIG_ERR)
1.203 paf 471: SAPI::die("Can not set handler for SIGPIPE");
472: #endif
473:
474:
1.185 paf 475: #ifdef DEBUG_MAILRECEIVE
476: if(FILE *fake_in=fopen(DEBUG_MAILRECEIVE, "rt")) {
1.184 paf 477: dup2(fake_in->_file, 0/*STDIN_FILENO*/);
478: }
479: #endif
480:
1.178 paf 481: #ifdef _DEBUG
482: // _crtBreakAlloc=33112;
483: #endif
1.144 paf 484: // _asm int 3;
1.193 paf 485: argv0=argv[0];
1.45 paf 486:
1.32 paf 487: umask(2);
488:
1.3 paf 489: // were we started as CGI?
1.146 paf 490: cgi=
1.109 parser 491: getenv("SERVER_SOFTWARE") ||
492: getenv("SERVER_NAME") ||
493: getenv("GATEWAY_INTERFACE") ||
494: getenv("REQUEST_METHOD");
1.5 paf 495:
1.184 paf 496: char *raw_filespec_to_process;
1.210 ! paf 497: if(cgi) {
1.184 paf 498: raw_filespec_to_process=getenv("PATH_TRANSLATED");
1.210 ! paf 499: if(raw_filespec_to_process && !*raw_filespec_to_process)
! 500: raw_filespec_to_process=0;
! 501: } else {
1.184 paf 502: optind = 1;
503: opterr = 0;
504: int c;
1.193 paf 505: while((c = getopt(argc, argv, "hf:"
1.185 paf 506: #ifdef WITH_MAILRECEIVE
1.184 paf 507: "m"
508: #endif
509: )) > 0) {
510: switch (c) {
511: case 'h':
512: usage(argv[0]);
1.193 paf 513: break;
514: case 'f':
515: config_filespec_cstr=optarg;
1.184 paf 516: break;
1.185 paf 517: #ifdef WITH_MAILRECEIVE
1.184 paf 518: case 'm':
519: mail_received=true;
520: break;
521: #endif
522: default:
523: fprintf(stderr, "%s: invalid option '%c'\n", argv[0], optopt);
524: usage(argv[0]);
525: break;
526: }
527: }
528: if (optind != argc - 1) {
529: fprintf(stderr, "%s: file not specified\n", argv[0]);
530: usage(argv[0]);
1.10 paf 531: }
1.184 paf 532:
533: raw_filespec_to_process=argv[optind++];
1.10 paf 534: }
535:
1.100 parser 536: #ifdef WIN32
537: setmode(fileno(stdin), _O_BINARY);
538: setmode(fileno(stdout), _O_BINARY);
539: setmode(fileno(stderr), _O_BINARY);
540: #endif
541:
1.139 paf 542: #if _MSC_VER
1.138 paf 543: _set_new_handler(failed_new);
1.148 paf 544:
545: #ifdef _DEBUG
546: // Get current flag
547: int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
548:
549: // Turn on leak-checking bit
550: tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
551:
552: // Set flag to the new value
553: _CrtSetDbgFlag( tmpFlag );
554: // _CrtSetBreakAlloc(471);
555:
556: #endif
557:
1.138 paf 558: #endif
559:
560: #ifdef HAVE_SET_NEW_HANDLER
561: std::set_new_handler(failed_new);
562: #endif
563:
1.166 paf 564: char filespec_to_process[MAX_STRING];
565: full_file_spec(raw_filespec_to_process, filespec_to_process, sizeof(filespec_to_process));
1.10 paf 566:
1.109 parser 567: const char *request_method=getenv("REQUEST_METHOD");
1.35 paf 568: bool header_only=request_method && strcasecmp(request_method, "HEAD")==0;
1.131 paf 569:
1.122 parser 570: try { // global try
571: call_real_parser_handler__do_SEH(
572: filespec_to_process,
573: request_method, header_only);
574: } catch(const Exception& e) { // global problem
1.44 paf 575: // don't allocate anything on pool here:
576: // possible pool' exception not catch-ed now
577: // and there could be out-of-memory exception
1.43 paf 578:
1.144 paf 579: SAPI::die("exception in request exception handler: %s", e.comment());
1.134 paf 580: #ifndef _DEBUG
1.131 paf 581: } catch(...) {
1.134 paf 582: SAPI::die("<unknown exception>");
1.133 paf 583: #endif
1.16 paf 584: }
1.122 parser 585:
1.109 parser 586:
587: #ifndef WIN32
588: //
589: if(!cgi)
1.198 paf 590: SAPI::send_body(global_pool, "\n", 1);
1.109 parser 591: #endif
1.203 paf 592:
593: //_asm int 3;
1.134 paf 594: return 0;
1.1 paf 595: }
E-mail: