http: don't parse body-related headers bodyless responses

Responses with status codes 1xx, 204 or 304 don't have a response body. For
these, don't parse these headers:

- Content-Encoding
- Content-Length
- Content-Range
- Last-Modified
- Transfer-Encoding

This change ensures that HTTP/2 upgrades work even if a
"Content-Length: 0" or a "Transfer-Encoding: chunked" header is present.

Co-authored-by: Daniel Stenberg
Closes #3702
Fixes #3968
Closes #3977
This commit is contained in:
Michael Kaufmann 2019-06-02 15:16:52 +02:00 committed by Daniel Stenberg
parent 7e590b3ecd
commit 2e5ceb3934
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 13 additions and 13 deletions

View file

@ -9,7 +9,7 @@ HTTP/0.9
<reply>
<data nocheck="yes">
HTTP/1.1 1234 OK
HTTP/1.1 2345 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
@ -43,7 +43,7 @@ http://%HOSTIP:%HTTPPORT/1429 --write-out '%{response_code}' --http0.9
# Verify data after the test has been "shot"
<verify>
<stdout nonewline="yes">
HTTP/1.1 1234 OK
HTTP/1.1 2345 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
@ -55,7 +55,7 @@ Content-Type: text/html
Funny-head: yesyes
-foo-
123
234
</stdout>
<strip>
^User-Agent:.*