1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

handling body of chunked requests without content-length and content-type correctly

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1714751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Eissing
2015-11-17 10:26:38 +00:00
parent 181e0dbc89
commit 83f29ab6d1

View File

@@ -254,18 +254,21 @@ apr_status_t h2_request_end_headers(h2_request *req, apr_pool_t *pool, int eos)
else {
/* no content-length given */
req->content_length = -1;
s = apr_table_get(req->headers, "Content-Type");
if (eos && s) {
req->chunked = 0;
apr_table_setn(req->headers, "Content-Length", "0");
}
else if (s) {
/* We have not seen a content-length, but a content-type.
* must pass any request content in chunked form.
if (!eos) {
/* We have not seen a content-length and have no eos,
* simulate a chunked encoding for our HTTP/1.1 infrastructure,
* in case we have "H2SerializeHeaders on" here
*/
req->chunked = 1;
apr_table_mergen(req->headers, "Transfer-Encoding", "chunked");
}
else if (apr_table_get(req->headers, "Content-Type")) {
/* If we have a content-type, but already see eos, no more
* data will come. Signal a zero content length explicitly.
*/
req->chunked = 0;
apr_table_setn(req->headers, "Content-Length", "0");
}
}
req->eoh = 1;