--- parser3/src/main/pa_request.C 2001/04/09 14:01:58 1.108 +++ parser3/src/main/pa_request.C 2001/04/11 07:44:15 1.110 @@ -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.110 2001/04/11 07:44:15 paf Exp $ */ #include "pa_config_includes.h" @@ -29,8 +29,9 @@ #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); } }