--- parser3/src/main/pa_request.C 2001/04/09 14:01:58 1.108 +++ parser3/src/main/pa_request.C 2001/04/11 15:45:51 1.112 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.C,v 1.108 2001/04/09 14:01:58 paf Exp $ + $Id: pa_request.C,v 1.112 2001/04/11 15:45:51 paf Exp $ */ #include "pa_config_includes.h" @@ -22,15 +22,16 @@ #include "_file.h" #include "pa_globals.h" #include "pa_vint.h" -#include "pa_vmframe.h" +#include "pa_vmethod_frame.h" #include "pa_types.h" #include "pa_vtable.h" #include "_random.h" #include "pa_vfile.h" #include "_mail.h" #include "_exec.h" +#include "_image.h" -/// $limits.post_max_size default 10M +/// $LIMITS.post_max_size default 10M const size_t MAX_POST_SIZE_DEFAULT=10*0x400*400; /// content type of exception response, when no @MAIN:exception handler defined @@ -83,6 +84,8 @@ Request::Request(Pool& apool, classes().put(*cookie_class_name, &cookie); // mail class classes().put(*mail_class_name, mail_class); + // image class + classes().put(*image_class_name, image_class); } /** @@ -123,16 +126,15 @@ void Request::core(const char *root_auto size_t value=element?(size_t)element->as_double():0; size_t post_max_size=value?value:MAX_POST_SIZE_DEFAULT; - size_t post_size=max(0, min(info.content_length, post_max_size)); - if(post_size) { + if(size_t limit=max(0, min(info.content_length, post_max_size))) { // read POST data - post_data=(char *)malloc(post_size); - size_t read_size=SAPI::read_post(pool(), post_data, post_size); - if(read_size!=post_size) + post_data=(char *)malloc(limit); + post_size=SAPI::read_post(pool(), post_data, limit); + if(post_size!=limit) THROW(0, 0, 0, - "post_size(%d)!=read_size(%d)", - post_size, read_size); + "post_size(%d)!=limit(%d)", + post_size, limit); } } @@ -535,11 +537,12 @@ void Request::output_result(const VFile& } // content-disposition - if(VString *vfile_name=static_cast(body_file.fields().get(*name_name))) { - VHash& vhash=*NEW VHash(pool()); - vhash.hash().put(*content_disposition_filename_name, vfile_name); - response.fields().put(*content_disposition_name, &vhash); - } + if(VString *vfile_name=static_cast(body_file.fields().get(*name_name))) + if(vfile_name->string()!=NONAME_DAT) { + VHash& vhash=*NEW VHash(pool()); + vhash.hash().put(*content_disposition_filename_name, vfile_name); + response.fields().put(*content_disposition_name, &vhash); + } // prepare header: $response:fields without :body response.fields().for_each(add_header_attribute, /*excluding*/ body_name);