Commit Graph

191 Commits

Author SHA1 Message Date
Tomasz Sowa 1c850b12ec
add a q_encode(...) method to misc 2024-04-28 16:14:57 +02:00
Tomasz Sowa dbf7dfab82
improve the startup help messages 2024-03-08 22:01:33 +01:00
Tomasz Sowa b753464608
add some operators to the Log class
add:
virtual Log & operator<<(long double);
virtual Log & operator<<(float);
virtual Log & operator<<(long long unsigned int);
virtual Log & operator<<(unsigned int);
virtual Log & operator<<(short unsigned int);
virtual Log & operator<<(long long int);
virtual Log & operator<<(short int);
virtual Log & operator<<(bool);
virtual Log & operator<<(unsigned char);
virtual Log & operator<<(const pt::Stream &);
2024-02-13 22:29:22 +01:00
Tomasz Sowa f4470ccbe7
allow to not set the res value from a plugin function
Add PluginInfo::has_res (bool, default true). If set to false by a plugin function
then the PluginInfo::res value is not taken into account when calculating how many plugins
have returned true or false.
2024-01-04 15:57:29 +01:00
Tomasz Sowa 71ad4869ce
fix: take into account hours when calculating a relative timezone dst 2023-12-27 16:25:54 +01:00
Tomasz Sowa 09dc6782c8
fix: remember the first/last weekday flags from a timezone DST
If a date is given in a relative form with first/last parameters,
we must remember them in order to select the appropriate day
of the week from the appropriate year.
2023-12-24 14:55:39 +01:00
Tomasz Sowa 0cebb2dc52
allow to use a first|last weekday name when defining a timezone dst
the format of a 'start' or 'end' field in a dst is:
MM-[first|last]:[monday|tuesday|wednesday|thursday|friday|saturday|sunday] HH:MM:SS
or just as beforehand: MM-DD HH:MM:SS

a sample timezone:
{
name = "tz_+01:00d"
id = "40"
offset_str = "+01:00"

dst = (

{
year = "2001"
has_dst = true
offset_str = "+01:00"
start  	   = "03-last-sunday 01:00"
end    	   = "10-last-sunday 01:00"
}

) # end of dst
}
2023-12-20 03:58:21 +01:00
Tomasz Sowa a54d70bed4
add a 422 Header status - Unprocessable Entity 2023-11-08 17:59:40 +01:00
Tomasz Sowa 79babc916a
add a Request::raw_post buffer
This buffer is used when a Function::NeedToCopyRawPost() method returned true.

while here:
- remove WINIX_POST_PARAMS and WINIX_RAW_POST_STRING plugin messages
2023-11-02 05:14:48 +01:00
Tomasz Sowa e600aebaae
add a RequestJobBase base class for requests jobs 2023-09-28 07:47:06 +02:00
Tomasz Sowa 79e971cb76
parse the input body for the PUT and PATCH methods too 2023-09-15 10:04:25 +02:00
Tomasz Sowa f7e077a7c5
add a TimeZone::PrintOffset(...) method 2023-08-29 15:02:37 +02:00
Tomasz Sowa 6d256e6512
fix: correctly set a Request::RunState::job_run flag to the background request
The flag should be set to the task.request and not to the cur->request.
The cur->request could have been already changed by the main thread.
2023-08-25 16:24:27 +02:00
Tomasz Sowa 52f9d399ca
add a Header::text_xml and text_xml_utf8 types 2023-07-31 17:31:22 +02:00
Tomasz Sowa bf79e46411
add a GetUTF8File(...) method with a pt::WTextStream & content to the misc 2023-07-04 22:59:57 +02:00
Tomasz Sowa 1655ae3562
fix: correctly clear after a request when an exception has been thrown 2023-05-16 15:31:13 +02:00
Tomasz Sowa 2e455f97ac
add support for serializing to xml 2023-02-27 00:34:29 +01:00
Tomasz Sowa 99fbf6ca27 add WINIX_STARTED plugin message 2022-10-19 14:26:34 +02:00
Tomasz Sowa f050fc2316 make more virtual functions is BaseThread 2022-10-19 14:26:18 +02:00
Tomasz Sowa 77a00f5989 fix: return a correct status from Dirs::AddDirectory() 2022-10-17 08:13:20 +02:00
Tomasz Sowa 8edd0ef07a fix: use the base_url as a domain when creating a session cookie if a cookie domain is empty 2022-09-28 19:28:17 +02:00
Tomasz Sowa 6138497fe0 change how origin header is treated
Now check whether the origin is in allowed_origins table,
and if not check allow_all_origins config parameter.

While here:
- add are_cors_preflight_requests_available - if true then preflight
  requests are available (default false)
2022-09-09 01:01:39 +02:00
Tomasz Sowa 05ecac8426 add support for more cookie flags in Request::AddCookie() method
changed in config options:
- renamed: http_session_id_name to session_cookie_name
- add config options: session_cookie_path, session_cookie_domain, session_cookie_same_site,
  session_cookie_http_only, session_cookie_secure
2022-09-08 05:40:44 +02:00
Tomasz Sowa 222a1c8a1f refactor the algorithm for testing the cors
while here:
- send cors headers even if the status is 404
- add: access_control_expose_headers config option - list of additional headers sent in Access-Control-Expose-Headers
- add: access_control_allow_credentials config option - if true return Access-Control-Allow-Credentials header equal "true"
2022-09-08 03:12:44 +02:00
Tomasz Sowa 04164ff967 add Access-Control-Allow-Credentials for simple requests too 2022-09-07 15:25:48 +02:00
Tomasz Sowa 9f64692ede set Access-Control-Allow-Credentials if available 2022-09-07 14:46:29 +02:00
Tomasz Sowa bff435db9a add WINIX_SAVE_FILELOG plugin message 2022-09-01 07:34:10 +02:00
Tomasz Sowa e378fcfe3b remove not used variables from Request 2022-08-31 21:33:54 +02:00
Tomasz Sowa a7a338f28e fix(Request): allow to prepare integer headers 2022-08-31 21:25:14 +02:00
Tomasz Sowa a19158cb62 add config options for testing the Origin header in cors requests
- allow_all_cors_origins - whether or not to allow all origins
- allowed_cors_origins - a list of allowed origins (used if allow_all_cors_origins is false)
2022-08-31 20:42:42 +02:00
Tomasz Sowa 217f42b7c6 add support for preflight requ (cors) 2022-08-30 01:52:02 +02:00
Tomasz Sowa a34db6505d move some methods from App to Request
methods moved: SetEnv(), ReadEnvVariables(), ReadEnvRemoteIP(), CheckSSL(), SetSubdomain()

while here:
- add the rest of http methods: put, connect, trace, patch
2022-08-29 19:20:41 +02:00
Tomasz Sowa d3a440fa0a add Request::AddPostVar(pt::Space & space, const wchar_t * name) 2022-08-22 16:03:07 +02:00
Tomasz Sowa 5dd34c802e add Request::job_second_id 2022-08-20 00:31:10 +02:00
Tomasz Sowa ceb5336ca1 add support for OPTIONS http method 2022-08-11 08:04:40 +02:00
Tomasz Sowa 6266eac729 use std::wstring_view in SessionIdManager::DecodeToken(...) method 2022-08-10 12:42:16 +02:00
Tomasz Sowa 968660e8ca fix: set correctly request->session
The session cookie was not created because request->session pointed at
a temporary session.

While here:
- do some cleaning in App
- set request->mount too
- add fcgi_cannot_create_request_delay to the config
- fix: in mailregister plugin get model_connector from env (and not from the request)
2022-07-30 18:37:50 +02:00
Tomasz Sowa 9d8d35b64f save logs after a job has finished 2022-07-30 03:35:00 +02:00
Tomasz Sowa 9e6a5b2d37 add use_internal_session_mechanism and use_internal_loggin_mechanism config options 2022-07-26 21:54:33 +02:00
Tomasz Sowa c85a724fec fix(SessionIdManager): take a correct algorithm when decoding a token 2022-07-26 21:09:44 +02:00
Tomasz Sowa 2e8f4d1a26 allow the SessionIdManager to use only two keys 2022-07-26 05:18:42 +02:00
Tomasz Sowa 522b57ade4 fix(Jobs): change request state to prepare_to_finish in case of an error 2022-07-25 18:37:39 +02:00
Tomasz Sowa d4da6aa518 let System::PutUrlProto takes a stream by a reference to pt::Stream 2022-07-25 18:36:28 +02:00
Tomasz Sowa 979ef907fe allow a request to be processed in a job
Now we allow a request to be passed into a job queue,
and after the job finishes the request is passed into
a controller again. In order to achieve this we have
a requests queue in System, when we put a request
to the job this Request structure is preserved in the
queue and for a new request a new Request is added to
the queue.

while here:
- remove App::Lock()/Unlock(), use scoped locking
- fix: Plugin now has a Call method which takes ModelConnector
  and a logger (used in multithreaded environment)
- BaseThread has a main_model_connector pointer
  to the main (from the main thread) model connector
- the FastCGI structure fcgi_request moved from App to Request
- some methods for handling requests moved from App to Request
- small refactoring in main.cpp
- add Http class (a http client)
2022-07-25 14:21:21 +02:00
Tomasz Sowa 31e826d893 put a log message before opening the FastCGI connection socket
FCGX_OpenSocket will call exit() if there was a problem with creating the socket.
2022-06-27 20:52:09 +02:00
Tomasz Sowa e29f912358 add core/postparser.cpp with implementation from core/postparser.h
now we can remove -lfcgi from winix in winixd/Makefile
2022-06-26 06:45:53 +02:00
Tomasz Sowa 26226de865 global winixd/Makefile uses now 'find' for looking for *.cpp files
and we don't need Makefiles in subdirectories anymore (except plugins)
2022-06-26 06:22:27 +02:00
Tomasz Sowa ebfa5f7405 do not try to load sessions if session_file config parameter is empty 2022-05-31 07:49:51 +02:00
Tomasz Sowa 01c10bad0e add use_antispam_mechanism_for_not_logged_users config option 2022-05-30 05:35:05 +02:00
Tomasz Sowa 7d1fb3c04e 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.
2022-05-30 01:29:18 +02:00