diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-17 15:14:17 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-17 15:14:17 +0300 |
commit | 746dae6ae094664c6ed0fa4bf5c98db7c758e8bc (patch) | |
tree | 4fe516609e8ec7720e12e00531a07ed090c11634 | |
parent | e33dd19d70dbdb4156f6417b05f76495b2787245 (diff) | |
download | libmicrohttpd-746dae6ae094664c6ed0fa4bf5c98db7c758e8bc.tar.gz libmicrohttpd-746dae6ae094664c6ed0fa4bf5c98db7c758e8bc.zip |
Added error response for wrong 'Content-Length' values
-rw-r--r-- | src/microhttpd/connection.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index dee41218..eb161ce7 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -115,6 +115,18 @@ | |||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Response text used when the request HTTP chunked encoding is | ||
119 | * malformed. | ||
120 | */ | ||
121 | #ifdef HAVE_MESSAGES | ||
122 | #define REQUEST_CONTENTLENGTH_MALFORMED \ | ||
123 | "<html><head><title>Request malformed</title></head>" \ | ||
124 | "<body>Your HTTP request has wrong value for <b>Content-Length</b> header.</body></html>" | ||
125 | #else | ||
126 | #define REQUEST_CHUNKED_MALFORMED "" | ||
127 | #endif | ||
128 | |||
129 | /** | ||
118 | * Response text used when there is an internal server error. | 130 | * Response text used when there is an internal server error. |
119 | * | 131 | * |
120 | * Intentionally empty here to keep our memory footprint | 132 | * Intentionally empty here to keep our memory footprint |
@@ -3505,8 +3517,9 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
3505 | _ ( | 3517 | _ ( |
3506 | "Failed to parse `Content-Length' header. Closing connection.\n")); | 3518 | "Failed to parse `Content-Length' header. Closing connection.\n")); |
3507 | #endif | 3519 | #endif |
3508 | CONNECTION_CLOSE_ERROR (connection, | 3520 | transmit_error_response_static (connection, |
3509 | NULL); | 3521 | MHD_HTTP_BAD_REQUEST, |
3522 | REQUEST_CONTENTLENGTH_MALFORMED); | ||
3510 | return; | 3523 | return; |
3511 | } | 3524 | } |
3512 | } | 3525 | } |