Curl_cwriter_phase phase = is_transfer ?
CURL_CW_TRANSFER_DECODE : CURL_CW_CONTENT_DECODE;
CURLcode result;
+ bool has_chunked = FALSE;
do {
const char *name;
* Exception is "chunked" transfer-encoding which always must happen */
if((is_transfer && !data->set.http_transfer_encoding && !is_chunked) ||
(!is_transfer && data->set.http_ce_skip)) {
+ bool is_identity = strncasecompare(name, "identity", 8);
/* not requested, ignore */
CURL_TRC_WRITE(data, "decoder not requested, ignored: %.*s",
(int)namelen, name);
+ if(is_transfer) {
+ if(has_chunked)
+ failf(data, "A Transfer-Encoding (%.*s) was listed after chunked",
+ (int)namelen, name);
+ else if(is_identity)
+ continue;
+ else
+ failf(data, "Unsolicited Transfer-Encoding (%.*s) found",
+ (int)namelen, name);
+ return CURLE_BAD_CONTENT_ENCODING;
+ }
return CURLE_OK;
}
Curl_cwriter_free(data, writer);
return result;
}
+ if(is_chunked)
+ has_chunked = TRUE;
}
} while(*enclist);
# per line.
# Lines starting with '#' letters are treated as comments.
#
+# PR #16959 makes Transfer-Encoding stricer and thus --raw broke
+319
# Uses SRP to "a server not supporting it" but modern stunnel versions
# will silently accept it and remain happy
323
test1468 test1469 test1470 test1471 test1472 test1473 test1474 test1475 \
test1476 test1477 test1478 test1479 test1480 test1481 test1482 test1483 \
test1484 test1485 test1486 test1487 test1488 test1489 test1490 test1491 \
-test1492 \
+test1492 test1493 test1494 test1495 test1496 \
\
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \
--- /dev/null
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+chunked Transfer-Encoding
+DELAY
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 funky chunky!\r
+Server: fakeit/0.9 fakeitbad/1.0\r
+Transfer-Encoding: identity, chunked\r
+Connection: mooo\r
+\r
+40\r
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r
+30\r
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\r
+21;heresatest=moooo\r
+cccccccccccccccccccccccccccccccc
+\r
+0\r
+chunky-trailer: header data\r
+another-header: yes\r
+\r
+</data>
+<datacheck>
+HTTP/1.1 200 funky chunky!\r
+Server: fakeit/0.9 fakeitbad/1.0\r
+Transfer-Encoding: identity, chunked\r
+Connection: mooo\r
+\r
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccc
+chunky-trailer: header data\r
+another-header: yes\r
+</datacheck>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+HTTP GET with identity + chunked 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\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+<file name="%LOGDIR/heads%TESTNUMBER">
+HTTP/1.1 200 funky chunky!\r
+Server: fakeit/0.9 fakeitbad/1.0\r
+Transfer-Encoding: identity, chunked\r
+Connection: mooo\r
+\r
+chunky-trailer: header data\r
+another-header: yes\r
+</file>
+</verify>
+
+</testcase>
--- /dev/null
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+chunked Transfer-Encoding
+DELAY
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+<data crlf="yes">
+HTTP/1.1 200 funky chunky!
+Server: fakeit/0.9 fakeitbad/1.0
+Transfer-Encoding: identity, identity
+Content-Length: 19
+
+stuff server sends
+</data>
+
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+HTTP GET with identity twice 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\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+
+</testcase>
--- /dev/null
+<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\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+<errorcode>
+61
+</errorcode>
+</verify>
+
+</testcase>
--- /dev/null
+<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: gzip, chunked
+Content-Length: 19
+
+stuff server sends
+</data>
+
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+HTTP GET with gzip + chunked transfer-encoding without being asked
+</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\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+<errorcode>
+61
+</errorcode>
+</verify>
+
+</testcase>
<keywords>
HTTP
HTTP GET
-compressed
Transfer-Encoding
+--raw
</keywords>
</info>
#
Date: Mon, 29 Nov 2004 21:56:53 GMT\r
Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29\r
Content-Type: text/html; charset=ISO-8859-1\r
-Transfer-Encoding: gzip\r
+Transfer-Encoding: gobbledigook\r
Content-Length: 44\r
\r
%hex[%1f%8b%08%08%79%9e%ab%41%00%03%6c%61%6c%61%6c%61%00%cb%c9%cc%4b%55%30%e4%52%c8%01%d1%46%5c]hex%
#
# Client-side
<client>
-<features>
-libz
-</features>
<server>
http
</server>
<name>
-HTTP GET gzip transfer-encoded data in raw mode
+HTTP GET gobbledigook transfer-encoded data in raw mode
</name>
<command option="no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --raw