--- parser3/src/main/pa_request.C 2001/03/26 10:36:55 1.82 +++ parser3/src/main/pa_request.C 2001/03/29 08:28:04 1.86 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.C,v 1.82 2001/03/26 10:36:55 paf Exp $ + $Id: pa_request.C,v 1.86 2001/03/29 08:28:04 paf Exp $ */ #include "pa_config_includes.h" @@ -47,8 +47,10 @@ Request::Request(Pool& apool, fclasses(apool), fdefault_lang(adefault_lang), flang(adefault_lang), info(ainfo), + used_files(apool), default_content_type(0), - used_files(apool) + mime_types(0), + html_typo_table(0) { // root superclass, // parent of all classes, @@ -112,13 +114,13 @@ void Request::core(const char *root_auto main_class_name, main_class); } - // $MAIN:limits hash used here, + // $MAIN:LIMITS hash used here, // until someone with less privileges have overriden them { Value *limits=main_class?main_class->get_element(*limits_name):0; // $limits.post_max_size default 10M Value *element=limits?limits->get_element(*post_max_size_name):0; - size_t value=element?(size_t)element->get_double():0; + size_t value=element?(size_t)element->as_double():0; size_t post_max_size=value?value:MAX_POST_SIZE_DEFAULT; form.fill_fields(*this, post_max_size); @@ -144,14 +146,17 @@ void Request::core(const char *root_auto /* /document/root */ char *file_spec= (char *)malloc(strlen(info.path_translated)+strlen(AUTO_FILE_NAME)+1); - strcpy(file_spec, info.document_root); + size_t document_root_size=strlen(info.document_root); + if(info.document_root[document_root_size-1]=='/') + document_root_size--; + memcpy(file_spec, info.document_root, document_root_size); /* /requested/file.html */ char *branches=(char *)malloc(strlen(info.path_translated)+1); - strcpy(branches, info.path_translated+strlen(info.document_root)); + strcpy(branches, info.path_translated+document_root_size); char *next=branches; + char *append_here=file_spec+document_root_size; - char *append_here=file_spec+strlen(file_spec); size_t slash_auto_p_size=strlen("/" AUTO_FILE_NAME); while(true) { char *step=lsplit(&next, '/'); @@ -177,14 +182,18 @@ void Request::core(const char *root_auto main_class=use_file(spath_translated, true/*don't ignore read problem*/, main_class_name, main_class); - // $MAIN:defaults + // $MAIN:DEFAULTS Value *defaults=main_class->get_element(*defaults_name); // value must be allocated on request's pool for that pool used on // meaning constructing @see attributed_meaning_to_string default_content_type=defaults?defaults->get_element(*content_type_name):0; if(Value *element=main_class->get_element(*html_typo_name)) - if(VTable *vtable=element->get_vtable()) - pool().set_tag(&vtable->table()); + html_typo_table=element->get_table(); + + // $MAIN:MIME-TYPES + if(Value *element=main_class->get_element(*mime_types_name)) + if(Table *table=element->get_table()) + mime_types=table; // execute @main[] const String *body_string=execute_method(*main_class, *main_method_name);