remove Request::post_tab and add Request::http_status
Instead of Reqest::post_tab we use now Request::post_in (pt::Space). Request::http_status will be used instead Request::status, but at the moment is not changed in all places. Request::status has been marked as depracated. While here: - Check for root dir in App and not in FunctionParser, let FunctionParser only log the root dir. - Read post variables after parsing url parameters, this allows winix functions to set limits for post input. - Set limits when parsing input json format, new options added to config: post_max_object_items, post_max_table_items, post_max_all_items, post_max_nested_objects. There are similar options in each winix function (they are in FunctionBase). - Some refactoring in App. - Add config option: log_whole_http_post if true then the whole parsed post input is logged. - Add config option: post_json_max - max length of input stream for parsing json. - Add config option: templates_request_status, default request_status.html this is an ezc template used as [content] when the request status is not 200_ok. - Fix: Sort winix function didn't show items to sort (fix and do some refactoring as well) - Properly sort items in: ImgCrop, Ls, Sort, Upload - Remove ezc templates: err_404.html, err_per_denied.html - now request_status.html is used.
This commit is contained in:
@@ -395,17 +395,10 @@ void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
||||
|
||||
void PostMultiParser::AddNormalPostVar()
|
||||
{
|
||||
if( post_tab->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
ConvStr(name, namew);
|
||||
ConvStr(content, contentw);
|
||||
|
||||
bool added = InsertPostVar(*post_tab, namew, contentw);
|
||||
bool added = request->AddPostVar(namew, contentw);
|
||||
|
||||
log << log2 << "PMP: POST var, name: \"" << namew << "\"";
|
||||
|
||||
@@ -418,7 +411,7 @@ void PostMultiParser::AddNormalPostVar()
|
||||
|
||||
void PostMultiParser::AddFilePostVar()
|
||||
{
|
||||
if( post_file_tab->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
if( request->post_file_tab.size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post file variables (skipping)" << logend;
|
||||
@@ -430,7 +423,7 @@ void PostMultiParser::AddFilePostVar()
|
||||
post_file_temp.tmp_filename = tmp_filename;
|
||||
post_file_temp.file_size = content_len;
|
||||
|
||||
bool added = InsertPostVar(*post_file_tab, namew, post_file_temp);
|
||||
bool added = InsertPostVar(request->post_file_tab, namew, post_file_temp);
|
||||
|
||||
log << log2 << "PMP: POST FILE var, name: \"" << namew << "\"";
|
||||
|
||||
@@ -581,7 +574,7 @@ void PostMultiParser::ReadChar()
|
||||
|
||||
|
||||
|
||||
Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab & post_file_tab_)
|
||||
Error PostMultiParser::Parse(FCGX_Stream * in_, Request & request)
|
||||
{
|
||||
in = in_;
|
||||
last = 0;
|
||||
@@ -590,8 +583,7 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab
|
||||
line_end_dos = false;
|
||||
in_buffer_ind = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
in_buffer_len = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
post_tab = &post_tab_;
|
||||
post_file_tab = &post_file_tab_;
|
||||
this->request = &request;
|
||||
tmp_filename_postfix = 1;
|
||||
|
||||
ReadChar();
|
||||
@@ -605,9 +597,8 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab
|
||||
|
||||
if( err != WINIX_ERR_OK )
|
||||
{
|
||||
RemovePostFileTmp(*post_file_tab);
|
||||
post_tab->clear();
|
||||
post_file_tab->clear();
|
||||
RemovePostFileTmp(request.post_file_tab);
|
||||
request.post_in.clear();
|
||||
|
||||
if( err != WINIX_ERR_INPUT_TOO_LARGE && err != WINIX_ERR_CANT_CREATE_FILE )
|
||||
log << log1 << "PMP: syntax error" << logend;
|
||||
|
Reference in New Issue
Block a user