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:
2022-05-30 01:29:18 +02:00
parent 9e222f5b80
commit 7d1fb3c04e
46 changed files with 1224 additions and 835 deletions

View File

@@ -38,7 +38,7 @@
#include <fcgiapp.h>
#include <string>
#include "httpsimpleparser.h"
#include "requesttypes.h"
#include "request.h"
#include "misc.h"
#include "utf8/utf8.h"
#include "convert/text.h"
@@ -52,7 +52,7 @@ namespace Winix
class PostParser : public HttpSimpleParser
{
FCGX_Stream * in;
PostTab * post_tab;
Request * request;
size_t log_value_size;
int var_index;
bool has_winix_post_params_msg;
@@ -99,24 +99,10 @@ protected:
virtual void Parameter(std::wstring & name, std::wstring & value)
{
bool added;
std::pair<PostTab::iterator, bool> res;
if( has_winix_post_params_msg )
plugin->Call(0, WINIX_POST_PARAMS, &name, &value);
res = post_tab->insert( std::make_pair(name, value) );
added = res.second;
if( !added )
{
name += L"_inc";
pt::Toa(var_index, name, false, 10, 5);
res = post_tab->insert( std::make_pair(name, value) );
added = res.second;
var_index += 1;
}
bool added = request->AddPostVar(name, value);
CreateLog(added, name, value);
}
@@ -134,10 +120,10 @@ public:
log_value_size = s;
}
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
void Parse(FCGX_Stream * in, Request & request)
{
in = in_;
post_tab = &post_tab_;
this->in = in;
this->request = &request;
var_index = 1;
raw_post.clear();