diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-12-19 18:32:12 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-12-19 18:32:12 +0300 |
commit | e60c63aff64e87843ab9ab314c370f8017b7e931 (patch) | |
tree | baffb054e9725620482dc80b429570bbdc4f7657 /src/microhttpd | |
parent | 1e7ad3010da7d2be1afe219da0ba84dd129f9c4e (diff) | |
download | libmicrohttpd-e60c63aff64e87843ab9ab314c370f8017b7e931.tar.gz libmicrohttpd-e60c63aff64e87843ab9ab314c370f8017b7e931.zip |
Always close connection after reply if both Content-Length and chucked are used
When both headers are used, the real length of the request may not be
determined unambiguously, the start of the next request is unclear.
Diffstat (limited to 'src/microhttpd')
-rw-r--r-- | src/microhttpd/connection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 16c5fb93..e6c93f25 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -3953,15 +3953,17 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
3953 | REQUEST_LENGTH_WITH_TR_ENCODING); | 3953 | REQUEST_LENGTH_WITH_TR_ENCODING); |
3954 | return; | 3954 | return; |
3955 | } | 3955 | } |
3956 | #ifdef HAVE_MESSAGES | ||
3957 | else | 3956 | else |
3958 | { | 3957 | { |
3958 | /* Must close connection after reply to prevent potential attack */ | ||
3959 | connection->keepalive = MHD_CONN_MUST_CLOSE; | ||
3960 | #ifdef HAVE_MESSAGES | ||
3959 | MHD_DLOG (connection->daemon, | 3961 | MHD_DLOG (connection->daemon, |
3960 | _ ("The 'Content-Length' request header is ignored " | 3962 | _ ("The 'Content-Length' request header is ignored " |
3961 | "as chunked Transfer-Encoding is used " | 3963 | "as chunked Transfer-Encoding is used " |
3962 | "for this request.\n")); | 3964 | "for this request.\n")); |
3963 | } | ||
3964 | #endif /* HAVE_MESSAGES */ | 3965 | #endif /* HAVE_MESSAGES */ |
3966 | } | ||
3965 | } | 3967 | } |
3966 | connection->rq.have_chunked_upload = true; | 3968 | connection->rq.have_chunked_upload = true; |
3967 | connection->rq.remaining_upload_size = MHD_SIZE_UNKNOWN; | 3969 | connection->rq.remaining_upload_size = MHD_SIZE_UNKNOWN; |