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

@@ -161,11 +161,9 @@ public:
!! CHECK ME may post_tab and cookie_tab should be changed to pt::Space now?
or may change the name to cookie_in? or in_cookie?
*/
PostTab post_tab;
PostFileTab post_file_tab;
CookieTab cookie_tab;
pt::Space post_in;
bool is_postin_used;// temporarily, before all post variables will be put to post_in
// input headers (without cookies)
// at the moment we are using FastCGI and HTTP headers are prefixed with 'HTTP_' string
@@ -337,9 +335,15 @@ public:
std::vector<HeaderValue> accept_languages;
// request status
// !! CHANGE ME it'll be better to use ordinary http result codes
// DEPRECATED, use http_status instead
Error status;
/*
* HTTP result status
* at the moment default is -1 which means it is not used (use status in such a case)
*/
int http_status;
// if not empty means an address for redirecting to
// it should be url-encoded
std::wstring redirect_to;
@@ -443,6 +447,9 @@ public:
void RemoveParam(const wchar_t * param_name);
void RemoveParam(const std::wstring & param_name);
bool AddPostVar(const wchar_t * name, const wchar_t * value);
bool AddPostVar(const std::wstring & name, const std::wstring & value);
bool IsPostVar(const wchar_t * var);
bool IsPostVar(const std::wstring & var);
const std::wstring & PostVar(const wchar_t * var); // returns an empty string if there is no such a parameter
@@ -452,8 +459,6 @@ public:
std::wstring * PostVarp(const wchar_t * var);
std::wstring * PostVarp(const std::wstring & var);
bool AllPostVarEmpty(); // returning true if all post vars are empty
// setting a cookie
// name - cookie name (either const wchar_t, or std::wstring or pt::WTextStream)
@@ -485,6 +490,9 @@ private:
void current_dir(morm::Wrapper & wrapper);
void last_item_wrapper(morm::Wrapper & wrapper);
void http_status_error_title(EzcEnv & env);
void http_status_error_description(EzcEnv & env);
MORM_MEMBER_FIELD(Request)