--- parser3/src/main/pa_request.C 2001/04/05 19:35:16 1.98 +++ parser3/src/main/pa_request.C 2001/04/07 10:34:45 1.101 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.C,v 1.98 2001/04/05 19:35:16 paf Exp $ + $Id: pa_request.C,v 1.101 2001/04/07 10:34:45 paf Exp $ */ #include "pa_config_includes.h" @@ -17,7 +17,7 @@ #include "pa_request.h" #include "pa_wwrapper.h" #include "pa_vclass.h" -#include "_root.h" +#include "_op.h" #include "_table.h" #include "_file.h" #include "pa_globals.h" @@ -27,6 +27,7 @@ #include "pa_vtable.h" #include "_random.h" #include "pa_vfile.h" +#include "_mail.h" /// $limits.post_max_size default 10M const size_t MAX_POST_SIZE_DEFAULT=10*0x400*400; @@ -42,7 +43,7 @@ Request::Request(Pool& apool, Info& ainfo, String::Untaint_lang adefault_lang) : Pooled(apool), stack(apool), - ROOT(apool), + OP(apool), env(apool), form(apool), request(apool, *this), @@ -59,8 +60,8 @@ Request::Request(Pool& apool, // root superclass, // parent of all classes, // operators holder - initialize_root_class(pool(), ROOT); - classes().put(*root_class_name, &ROOT); + initialize_op_class(pool(), OP); + classes().put(*op_class_name, &OP); // table class classes().put(*table_class_name, table_class); // file class @@ -77,21 +78,8 @@ Request::Request(Pool& apool, classes().put(*response_class_name, &response); // cookie class classes().put(*cookie_class_name, &cookie); -} - -static void add_header_attribute(const Hash::Key& aattribute, Hash::Val *ameaning, - void *info) { - String *attribute_to_exclude=static_cast(info); - if(aattribute==*attribute_to_exclude) - return; - - Value& lmeaning=*static_cast(ameaning); - Pool& pool=lmeaning.pool(); - - String attribute(pool); - SAPI::add_header_attribute(pool, - attribute.append(aattribute, String::UL_HEADER, true).cstr(), - attributed_meaning_to_string(lmeaning).cstr()); + // mail class + classes().put(*mail_class_name, mail_class); } /** @@ -278,17 +266,17 @@ void Request::core(const char *root_auto problem_source->origin().file?problem_source->origin().file:"global", problem_source->origin().line, #endif - problem_source->cstr(), + problem_source->cstr(String::UL_AS_IS), e.comment(), - e.type()?e.type()->cstr():"-", - e.code()?e.code()->cstr():"-" + e.type()?e.type()->cstr(String::UL_AS_IS):"-", + e.code()?e.code()->cstr(String::UL_AS_IS):"-" ); else SAPI::log(pool(), "%s [%s %s]", e.comment(), - e.type()?e.type()->cstr():"-", - e.code()?e.code()->cstr():"-" + e.type()?e.type()->cstr(String::UL_AS_IS):"-", + e.code()?e.code()->cstr(String::UL_AS_IS):"-" ); // reset language to default @@ -388,18 +376,18 @@ void Request::core(const char *root_auto origin.file, 1+origin.line); #endif printed+=snprintf(buf+printed, MAX_STRING-printed, "'%s' ", - problem_source->cstr()); + problem_source->cstr(String::UL_AS_IS)); } printed+=snprintf(buf+printed, MAX_STRING-printed, "%s", e.comment()); const String *type=e.type(); if(type) { printed+=snprintf(buf+printed, MAX_STRING-printed, " type: %s", - type->cstr()); + type->cstr(String::UL_AS_IS)); const String *code=e.code(); if(code) printed+=snprintf(buf+printed, MAX_STRING-printed, ", code: %s", - code->cstr()); + code->cstr(String::UL_AS_IS)); } // future $response:content-type @@ -492,6 +480,20 @@ const String& Request::absolute(const St return relative(info.path_translated, relative_name); } +static void add_header_attribute(const Hash::Key& aattribute, Hash::Val *ameaning, + void *info) { + String *attribute_to_exclude=static_cast(info); + if(aattribute==*attribute_to_exclude) + return; + + Value& lmeaning=*static_cast(ameaning); + Pool& pool=lmeaning.pool(); + + String attribute(pool); + SAPI::add_header_attribute(pool, + attribute.append(aattribute, String::UL_HTTP_HEADER, true).cstr(), + attributed_meaning_to_string(lmeaning, String::UL_HTTP_HEADER).cstr()); +} void Request::output_result(const VFile& body_file, bool header_only) { // header: cookies cookie.output_result();