commit 0a4537e86c880b08eca49f9ca383a1eb242a88d0
parent 8391cfa210f8e5b6cac2fff9d8e49f1003c91a44
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sat, 12 Jun 2021 20:46:52 +0300
connection.c: fixed wrong caseless HTTP method comparison
Method strings much much be matched as case-sensitive
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -1491,9 +1491,7 @@ build_header_response (struct MHD_Connection *connection)
MHD_get_response_header (response,
MHD_HTTP_HEADER_CONTENT_LENGTH)) &&
(may_add_content_length) &&
- ( (NULL == connection->method) ||
- (! MHD_str_equal_caseless_ (connection->method,
- MHD_HTTP_METHOD_CONNECT)) ) )
+ (MHD_HTTP_MTHD_CONNECT != connection->http_mthd) )
{
/*
Here we add a content-length if one is missing; however,
@@ -4326,9 +4324,7 @@ MHD_queue_response (struct MHD_Connection *connection,
/* FIXME: if 'is_pipe' is set, TLS is off, and we have *splice*, we could use splice()
to avoid two user-space copies... */
- if ( ( (NULL != connection->method) &&
- (MHD_str_equal_caseless_ (connection->method,
- MHD_HTTP_METHOD_HEAD)) ) ||
+ if ( (MHD_HTTP_MTHD_HEAD == connection->http_mthd) ||
(MHD_HTTP_OK > status_code) ||
(MHD_HTTP_NO_CONTENT == status_code) ||
(MHD_HTTP_NOT_MODIFIED == status_code) )