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

@@ -127,17 +127,10 @@ public:
private:
enum Header
{
h_200,
h_404,
h_403
};
PostParser post_parser;
PostMultiParser post_multi_parser;
pt::SpaceParser space_parser;
std::string post_buffer;
pt::TextStream post_buffer;
CookieParser cookie_parser;
AcceptBaseParser accept_base_parser;
@@ -154,6 +147,7 @@ private:
//std::wstring html_filtered;
//std::string output_8bit;
pt::TextStream serialized_model;
pt::WTextStream post_log_tmp_buffer;
pt::WTextStream output_tmp_filtered_stream;
BinaryPage output_8bit;
@@ -196,6 +190,8 @@ private:
bool DropPrivileges(char * user, char * group);
bool DropPrivileges(const char * user, uid_t uid, gid_t gid, bool additional_groups);
bool CheckAccessFromPlugins();
void MakeRenameMeToABetterName();
bool AddRootDir();
void ProcessRequestThrow();
void ProcessRequest();
void BaseUrlRedirect(int code, bool add_subdomain);
@@ -205,7 +201,6 @@ private:
void CheckPostRedirect();
void UseEzcGenerator();
void AddDefaultModels();
void Make();
void SaveSessionsIfNeeded(); // !! IMPROVE ME wywalic do menagera sesji??
void LogAccess();
void SendData(const BinaryPage & page, FCGX_Stream * out);
@@ -251,6 +246,8 @@ private:
void ReadEnvHTTPVariables();
bool SaveEnvHTTPVariable(const char * env);
void ReadEnvRemoteIP();
void ReadInputPostToBuffer();
void ParsePostJson();
void ReadPostJson();
void ReadPostVars();
@@ -263,7 +260,7 @@ private:
bool IsRequestedFrame();
Header GetHTTPStatusCode();
void ModifyStatusCodeIfNeeded();
void PrepareSessionCookie();
void SendHeaders();
void SendCookies();
@@ -271,15 +268,15 @@ private:
bool AddHeader(const std::wstring & name, const std::wstring & value);
bool AddHeader(const wchar_t * name, const pt::WTextStream & value);
bool AddHeader(const std::wstring & name, const pt::WTextStream & value);
bool PrepareHeadersStaticCreateResource(pt::WTextStream & out_path);
void PrepareHeadersStatic();
bool CreateStaticResourcePath(pt::WTextStream & out_path);
void PrepareSendFileHeaderForStaticMountpoint();
void PrepareHeaderContentType();
void PrepareHeadersForbidden();
void PrepareHeadersRedirect();
void PrepareHeadersSendFile();
void PrepareHeadersCompression(int compress_encoding);
void PrepareHeadersNormal(Header header, size_t output_size);
void PrepareHeaders(bool compressing, int compress_encoding, Header header, size_t output_size);
void ModifyStatusForRedirect();
void PrepareSendFileHeader();
void PrepareContentEncodingHeader(int compress_encoding);
void PrepareContentLengthHeader(size_t output_size);
void PrepareHeaderStatus(int http_status);
void PrepareHeaders(bool compressing, int compress_encoding, size_t output_size);
int SelectDeflateVersion();
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
bool CanSendContent();