libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 2ebe7a859cdfa1860067bca65bbd642a04687e95
parent e74fad60005e8fb18b67ea77e84c9875a94d18a3
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri, 11 Mar 2022 15:57:41 +0300

Disallowed successful responses for CONNECT requests

MHD currently does not support CONNECT pass-through.
However, support could be added relatively easily.
Contact MHD maintainers if you need CONNECT support.

Diffstat:
Msrc/microhttpd/connection.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -5264,6 +5264,17 @@ MHD_queue_response (struct MHD_Connection *connection, return MHD_NO; } } + if ( (MHD_HTTP_MTHD_CONNECT == connection->http_mthd) && + (2 == status_code / 100) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _ ("Successful (%u) response code cannot be used to answer " \ + "\"CONNECT\" request!\n"), + (status_code)); +#endif + return MHD_NO; + } #ifdef HAVE_MESSAGES if ( (0 != (MHD_RF_INSANITY_HEADER_CONTENT_LENGTH & response->flags)) &&