content_encoding: Transfer-Encoding parser improvements

- allow and ignore "identity" as an encoding

- fail if any other encoder than chunked follows after chunked

- fail on unsolicited encodings - when the server encodes but curl did
  not ask for it

Add test 1493 to 1496 to verify.

Disable test 319 as that is now broken: issue #16974

Reported-by: Jonathan Rosa
Fixes #16956
Closes #16959
This commit is contained in:
Daniel Stenberg 2025-04-04 09:54:49 +02:00
parent 3454844f36
commit b8bd019c6a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
8 changed files with 255 additions and 7 deletions

53
tests/data/test1495 Normal file
View file

@ -0,0 +1,53 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
chunked Transfer-Encoding
DELAY
</keywords>
</info>
#
# Server-side
<reply>
<data crlf="yes" nocheck="yes">
HTTP/1.1 200 funky chunky!
Server: fakeit/0.9 fakeitbad/1.0
Transfer-Encoding: chunked, identity
Content-Length: 19
stuff server sends
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP GET with chunked + identity in TE header
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -D %LOGDIR/heads%TESTNUMBER
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<errorcode>
61
</errorcode>
</verify>
</testcase>