81 Commits
Author SHA1 Message Date
Evgeny Grin (Karlson2k) eaf1fa0889 Re-implemented parsing of the request headers and footers from scratch.
* The new algorithm parse the headers in one pass (including folded
headers) thus multiple passes over the same memory area are avoided
(efficiency for large headers should be improved).
* Strict implementation of RFC 9110 and 9112 requirements, including
replacing or reporting error for unacceptable characters.
* Implemented various levels of strictness for requests interpretations:
three levels within RFC requirements (more strict and more secure; less
strict and more compatible with various clients; balanced (default)),
one more relaxed level with violation of RFC's SHOULD/SHOULD NOT,
one even more relaxed level with violation of MUST/MUST NOT,
one stricter level then required by RFC, but absolutely compatible with
clients following RFC's MUST/MUST NOT, and one more even stricter level
compatible with clients following both MUST/MUST NOT and
SHOULD/SHOULD NOT.
* Added detection and handling of more erroneous situations, like space
at the start of the first line (as recommended by RFC).
* Added more detailed responses for invalid requests with descriptions
of the found problems (as recommended by RFC).
* If many chars have been replaced, only summary is reported instead
of flooding logs with messages when request is badly constructed.
* Whitespaces in headers values are trimmed at start and at the end. No
need to handle extra spaces in the app or when using headers in other
MHD parts, like cookie parsing.
* In overall: increased flexibility, the security must be improved,
much better compliance with the standards.
2023-06-20 22:59:07 +03:00
Evgeny Grin (Karlson2k) 9141692ad5 Renamed connection state for clarity 2023-06-20 22:59:07 +03:00
Evgeny Grin (Karlson2k) 677e6e431a configure: fixed checks for tsearch() and related
New check works correctly with new compilers.
Added known problematic implementations.
Added more checks for correct behaviour.
Removed some m4 macros.
2023-03-03 13:23:01 +03:00
Rosen Penev 0498e99f7f use ifdef for several HAVE header macros
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-04-04 07:49:52 +02:00
Christian Grothoff dbe1d76d9c -fix tests for libmagic (and uncrustify indentation) 2021-12-08 14:11:31 +01:00
Alexander Irion f5d387df7e Fix busy waiting up to one second using connection timeout
MHD_daemon_get_timeout computes the time to wait as:
timeout = (last_activity + connection_timeout - MHD_monotonic_sec_counter ()) * 1000

After sleeping timeout milliseconds, MHD_monotonic_sec_counter () will be:

MHD_monotonic_sec_counter () = last_activity + connection_timeout

With that (timeout < (MHD_monotonic_sec_counter () - connection->last_activity)) evaluates to false and the MHD_connection_close_ is not done.
For the next cycle, MHD_daemon_get_timeout() will return 0 and this goes on, until MHD_monotonic_sec_counter jumps to the next second.

This bug causes thousands of unnecessary calls to MHD_run, when a connection timed out.
2021-08-11 22:38:41 +02:00
Christian Grothoff 2968329166 fix #6693: get src/lib/ to build with clang 2021-01-30 12:52:11 +01:00
Christian Grothoff c43779a4be fix typos 2020-10-22 11:48:54 +02:00
Christian Grothoff beb7fa828c fix transmission stall issue with upgraded TLS connections reported by Nguyen Xuan Viet on the mailinglist 2020-09-27 22:12:13 +02:00
Christian Grothoff babda9e9c7 fix misc typos 2020-07-23 00:05:52 +02:00
silvioprog f84bdf0a8c Sanitized all log and error messages. 2020-05-09 14:11:14 -03:00
silvioprog bcffdf809f Applied several spelling fixes. (#6142) 2020-03-31 15:08:34 -03:00
Christian Grothoff 7389c34528 tighten formatting rules 2019-10-31 13:06:08 +01:00
Christian Grothoff 972103dc28 applying uncrustify to ensure uniform indentation 2019-10-17 16:56:41 +02:00
Christian Grothoff 603ecd85bc prefix even potentially exported hash symbols with MHD_ (as proposed by Dirk Brinkmeier) 2019-06-03 23:46:28 +02:00
Evgeny Grin (Karlson2k) 2eb0a5f92d Proper detection of .sin?_len members, fixed build on *BSD 2019-05-25 11:37:38 +03:00
Evgeny Grin (Karlson2k) edfdbbf794 Fixed doxygen comments,
Fixed spelling in comments
2019-05-21 22:22:22 +03:00
Evgeny Grin (Karlson2k) 2c5033377f Spelling fixes 2019-05-21 17:57:04 +03:00
Evgeny Grin (Karlson2k) 6c985f4adc File read block size: move to proper location 2019-04-17 15:54:40 +03:00
Christian Grothoff 83a86be948 fix close() checks 2019-04-08 15:12:20 +02:00
silvioprog 22c08b5fd7 Renamed all occurrences from _model(s)_ to _mode(s)_. 2018-12-06 13:26:39 -03:00
silvioprog b220303691 Optimized the function MHD_create_response_from_callback() for Windows by increasing its internal buffer size and allowed to customize it via macro MHD_FD_BLOCK_SIZE. 2018-12-06 12:54:00 -03:00
Christian Grothoff a145baea79 fix linker error with --with-gnutls path for mhd2 lib 2018-09-12 15:38:14 +02:00
Christian Grothoff 2ade9eaad8 applying W32 fix suggested by Tim 2018-06-26 17:06:03 +02:00
Christian Grothoff 832739556b some minor code cleaning issues 2018-06-22 15:16:11 +02:00
Christian Grothoff 65a322cfe8 mark bug, too tired to fix right now 2018-03-25 20:51:40 +02:00
Christian Grothoff 22895a5504 fix bug 2018-03-25 20:48:45 +02:00
Tim Rühsen ea4b7cd39e add missing mhd_winsock_inited_ to src/lib/init.c 2018-03-15 20:43:30 +01:00
Christian Grothoff 303440c842 fix FTBFS issues on MinGW 2018-03-10 12:02:33 +01:00
Christian Grothoff 8b531fd28c fix misc build issues if various features (poll/epoll/upgrade-support) are disabled 2018-03-05 18:49:56 +01:00
Christian Grothoff 77398cdb55 check for dlfcn.h presence 2018-03-04 13:08:22 +01:00
Christian Grothoff e3ff894618 fix build issue in absence of epoll 2018-03-04 12:56:10 +01:00
Christian Grothoff a6d885783c fix enum inconsistencies 2018-03-02 22:38:19 +01:00
Christian Grothoff 08ca3765b7 use curi instead of uri to avoid passing NULL to memchr, even with len 0 2018-03-02 22:29:12 +01:00
Christian Grothoff fd283b002c fix spacy url check in strict mode 2018-03-02 22:21:28 +01:00
Christian Grothoff 0ebdff94d4 fix test_upgrade transient failures (#5189) 2018-03-02 21:45:26 +01:00
Christian Grothoff 71a67ca959 remove dead IN_CLEANUP state, revert previous patch that called completed callback from wrong thread 2018-03-02 21:45:25 +01:00
Christian Grothoff 7f1dbb2aef postfix 2018-03-01 13:31:58 +01:00
Christian Grothoff 5717a9ec22 expand strictness to cover spaces in URL 2018-03-01 13:29:58 +01:00
Tim Rühsen 37b6d7a491 Fix make distcheck 2018-02-28 22:29:34 +01:00
Christian Grothoff c6a73b72aa fix #5289 (ftbfs without https in src/lib/) 2018-02-28 22:23:28 +01:00
Christian Grothoff 4507f419bd eliminate two more strcpy()s 2018-02-27 23:46:23 +01:00
Christian Grothoff fc495439b4 call completion handler also for upgrade connections 2018-02-27 23:28:01 +01:00
Christian Grothoff 11f599e039 fix ftbfs if https is not enabled in src/lib/ 2018-02-27 21:06:15 +01:00
Christian Grothoff f6c647f638 make checkers happier by reducing use of strcpy and strcat 2018-02-22 18:35:08 +01:00
Christian Grothoff 7868870496 eliminate compiler warnings from dead assignments 2018-02-22 18:25:07 +01:00
Christian Grothoff dae20dfe73 fix fwd ref to MHD_init 2018-02-21 10:22:18 +01:00
Christian Grothoff 21ee7de991 add lib to ordinary build process, rename lib output to libmicrohttpd2.so, do not link libmicrohttpd2.so against gnutls/libgcrypt 2018-02-18 13:00:11 +01:00
Christian Grothoff aa12189a4b simplify init for gnutls-less lib 2018-02-18 12:41:39 +01:00
Christian Grothoff e5c2f9a339 add remaining missing symbols for library to fully link 2018-02-18 12:31:35 +01:00