In order the increase performance and to decrease memory usage, this
commit modifies various parts of the SAPI, URL decoding and query string
parsing to use byte strings instead of Unicode strings. Decision to use
Unicode strings instead of byte strings for these functions was stupid
in the first place, because those strings need to be constantly encoded
and decoded which costs memory and CPU time.
Also added new SAPI/API method IsSecure to Request class which
attempts to find out whether the request was made through HTTPS or not.
As an intresting side note, when this is compiled with GCC 4.9.1 with
-O3 -pipe flags set, the builtin HTTPD crashes after first request
with error message "stack smashing detected". According to Google, this
error message is caused by an buffer overflow, but Valgrind is unable to
detect any and if compiled without those optimization flags HTTPD runs
happily without crashes. Most likely this happens because GCC has just
become so shitty and it's nowdays notorious for it's bugs. Use Clang
everywhere.
In order the increase performance and to decrease memory usage, this commit modifies various parts of the SAPI, URL decoding and query string parsing to use byte strings instead of Unicode strings. Decision to use Unicode strings instead of byte strings for these functions was stupid in the first place, because those strings need to be constantly encoded and decoded which costs memory and CPU time.
Also added new SAPI/API method
IsSecure
toRequest
class which attempts to find out whether the request was made through HTTPS or not.As an intresting side note, when this is compiled with GCC 4.9.1 with
-O3 -pipe
flags set, the builtin HTTPD crashes after first request with error message "stack smashing detected". According to Google, this error message is caused by an buffer overflow, but Valgrind is unable to detect any and if compiled without those optimization flags HTTPD runs happily without crashes. Most likely this happens because GCC has just become so shitty and it's nowdays notorious for it's bugs. Use Clang everywhere.