From: Stefan Eissing Date: Tue, 17 Nov 2015 10:26:38 +0000 (+0000) Subject: handling body of chunked requests without content-length and content-type correctly X-Git-Tag: 2.5.0-alpha~2643 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83f29ab6d18144cf0d69c90a64d30bc223ce7c4c;p=apache 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 --- diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index 27c5757702..2d8dcda27c 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -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;