summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-17 15:14:17 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-17 15:14:17 +0300
commit746dae6ae094664c6ed0fa4bf5c98db7c758e8bc (patch)
tree4fe516609e8ec7720e12e00531a07ed090c11634
parente33dd19d70dbdb4156f6417b05f76495b2787245 (diff)
Added error response for wrong 'Content-Length' values
-rw-r--r--src/microhttpd/connection.c17
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 @@
#endif
/**
+ * Response text used when the request HTTP chunked encoding is
+ * malformed.
+ */
+#ifdef HAVE_MESSAGES
+#define REQUEST_CONTENTLENGTH_MALFORMED \
+ "<html><head><title>Request malformed</title></head>" \
+ "<body>Your HTTP request has wrong value for <b>Content-Length</b> header.</body></html>"
+#else
+#define REQUEST_CHUNKED_MALFORMED ""
+#endif
+
+/**
* Response text used when there is an internal server error.
*
* Intentionally empty here to keep our memory footprint
@@ -3505,8 +3517,9 @@ parse_connection_headers (struct MHD_Connection *connection)
_ (
"Failed to parse `Content-Length' header. Closing connection.\n"));
#endif
- CONNECTION_CLOSE_ERROR (connection,
- NULL);
+ transmit_error_response_static (connection,
+ MHD_HTTP_BAD_REQUEST,
+ REQUEST_CONTENTLENGTH_MALFORMED);
return;
}
}