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:
@@ -36,6 +36,7 @@
|
||||
#define headerfile_winix_core_header
|
||||
|
||||
#include "log.h"
|
||||
#include <textstream/textstream.h>
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -83,9 +84,63 @@ public:
|
||||
static constexpr const wchar_t * text_javascript_utf8 = L"text/javascript; charset=UTF-8";
|
||||
|
||||
|
||||
static const int status_200_ok = 200;
|
||||
static const int status_300_multiple_choices = 300;
|
||||
static const int status_301_moved_permanently = 301;
|
||||
static const int status_302_found = 302;
|
||||
static const int status_303_see_other = 303;
|
||||
static const int status_307_temporary_redirect = 307;
|
||||
static const int status_400_bad_request = 400;
|
||||
static const int status_403_forbidden = 403;
|
||||
static const int status_404_not_found = 404;
|
||||
static const int status_414_uri_too_long = 414;
|
||||
static const int status_500_internal_server_error = 500;
|
||||
|
||||
|
||||
static constexpr const wchar_t * str_status_200 = L"OK";
|
||||
static constexpr const wchar_t * str_status_300 = L"Multiple Choices";
|
||||
static constexpr const wchar_t * str_status_301 = L"Moved Permanently";
|
||||
static constexpr const wchar_t * str_status_302 = L"Found";
|
||||
static constexpr const wchar_t * str_status_303 = L"See Other";
|
||||
static constexpr const wchar_t * str_status_307 = L"Temporary Redirect";
|
||||
static constexpr const wchar_t * str_status_400 = L"Bad Request";
|
||||
static constexpr const wchar_t * str_status_403 = L"Forbidden";
|
||||
static constexpr const wchar_t * str_status_404 = L"Not Found";
|
||||
static constexpr const wchar_t * str_status_414 = L"URI Too Long";
|
||||
static constexpr const wchar_t * str_status_500 = L"Internal Server Error";
|
||||
|
||||
|
||||
static const wchar_t * find_status_string_value(int http_status);
|
||||
static void prepare_status_value(int http_status, pt::WTextStream & value, bool clear_value = true);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
struct StatusIntStringMapHelper
|
||||
{
|
||||
int status_int;
|
||||
const wchar_t * status_str;
|
||||
};
|
||||
|
||||
static constexpr StatusIntStringMapHelper status_int_string_map[] = {
|
||||
{status_200_ok, str_status_200},
|
||||
{status_300_multiple_choices, str_status_300},
|
||||
{status_301_moved_permanently, str_status_301},
|
||||
{status_302_found, str_status_302},
|
||||
{status_303_see_other, str_status_303},
|
||||
{status_307_temporary_redirect, str_status_307},
|
||||
{status_400_bad_request, str_status_400},
|
||||
{status_403_forbidden, str_status_403},
|
||||
{status_404_not_found, str_status_404},
|
||||
{status_414_uri_too_long, str_status_414},
|
||||
{status_500_internal_server_error, str_status_500},
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class HeaderValue
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user