--- parser3/src/targets/cgi/parser3.C 2001/03/18 14:45:30 1.19 +++ parser3/src/targets/cgi/parser3.C 2001/03/18 20:32:53 1.22 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: parser3.C,v 1.19 2001/03/18 14:45:30 paf Exp $ + $Id: parser3.C,v 1.22 2001/03/18 20:32:53 paf Exp $ */ #ifdef HAVE_CONFIG_H @@ -25,6 +25,7 @@ #include "pa_common.h" Pool pool; // global pool +bool cgi; #ifdef WIN32 # if _MSC_VER @@ -71,11 +72,14 @@ int read_post(char *buf, int max_bytes) } void output_header_attribute(const char *key, const char *value) { - printf("%s: %s\n", key, value); + if(cgi) + printf("%s: %s\n", key, value); } void output_body(const char *buf, size_t size) { - puts(""); // header | body delimiter + if(cgi) // header | body delimiter + puts(""); + stdout_write(buf, size); } @@ -95,7 +99,7 @@ int main(int argc, char *argv[]) { service_funcs.output_body=output_body; // were we started as CGI? - bool cgi= + cgi= getenv("SERVER_SOFTWARE") || getenv("SERVER_NAME") || getenv("GATEWAY_INTERFACE") || @@ -146,11 +150,12 @@ int main(int argc, char *argv[]) { request_info.content_type=getenv("CONTENT_TYPE"); const char *content_length=getenv("CONTENT_LENGTH"); request_info.content_length=(content_length?atoi(content_length):0); + request_info.cookie=getenv("HTTP_COOKIE"); // prepare to process request Request request(Pool(), request_info, - 1||cgi ? String::Untaint_lang::HTML_TYPO : String::Untaint_lang::NO + cgi ? String::Untaint_lang::HTML_TYPO : String::Untaint_lang::NO ); // some root-controlled location @@ -179,7 +184,7 @@ int main(int argc, char *argv[]) { // request.exception not not handled here, but all // request' data are associated with it's pool=exception - // must be last in PTRY{}PCATCH + // must be last in PTRY{}PCATCH #ifdef WIN32 # if _MSC_VER SetUnhandledExceptionFilter(0); @@ -188,11 +193,6 @@ int main(int argc, char *argv[]) { return 0; #endif } PCATCH(e) { // global problem - // @globals fill - // @Request create - // @prepare to .core() - // @request.core when reporting request exception - // @write result const char *body=e.comment(); int content_length=strlen(body);