--- parser3/src/main/pa_request.C 2001/04/10 11:24:00 1.109 +++ parser3/src/main/pa_request.C 2001/04/18 16:46:37 1.114 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.C,v 1.109 2001/04/10 11:24:00 paf Exp $ + $Id: pa_request.C,v 1.114 2001/04/18 16:46:37 paf Exp $ */ #include "pa_config_includes.h" @@ -22,7 +22,7 @@ #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" @@ -126,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); } } @@ -284,7 +283,7 @@ void Request::core(const char *root_auto TRY { // log the beast const String *problem_source=e.problem_source(); - if(problem_source) + if(problem_source && problem_source->size()) SAPI::log(pool(), #ifndef NO_STRING_ORIGIN "%s(%d): " @@ -331,7 +330,7 @@ void Request::core(const char *root_auto // origin Value *origin_value=0; #ifndef NO_STRING_ORIGIN - if(problem_source) { + if(problem_source && problem_source->size()) { const Origin& origin=problem_source->origin(); if(origin.file) { char *buf=(char *)malloc(MAX_STRING); @@ -348,7 +347,7 @@ void Request::core(const char *root_auto // source Value *source_value=0; - if(problem_source) { + if(problem_source && problem_source->size()) { String& problem_source_copy=*NEW String(pool()); problem_source_copy.append(*problem_source, flang, true); @@ -474,19 +473,6 @@ VStateless_class *Request::use_buf(const return &cclass; } -/** - - fail_if_junction(true, junction = fail - - fail_if_junction(false, not junction = fail -*/ -void Request::fail_if_junction_(bool is, Value& value, - const String& method_name, const char *msg) { - - if((value.get_junction()!=0) ^ !is) - THROW(0, 0, - &method_name, - msg); -} - const String& Request::relative(const char *apath, const String& relative_name) { int lpath_buf_size=strlen(apath)+1; char *lpath=(char *)malloc(lpath_buf_size); @@ -538,11 +524,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);