← Commit list

c0609c5a4f

Daniel Stenberg
Daniel Stenberg
2026-09-18
SUCCESS Duration: 396s

Subject

http: abide to close-rules when transfer-encoding off

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/http.c+2 -2
@@ -3248,7 +3248,7 @@ static CURLcode http_header_c(struct Curl_easy *data,
list also is fine and then we should accept them all as long as they are
the same value. Different values trigger error.
*/
- v = (!k->http_bodyless && !data->set.ignorecl) ?
+ v = (!k->http_bodyless && !data->set.ignorecl && !k->ignore_cl) ?
HD_VAL(hd, hdlen, "Content-Length:") : NULL;
if(v) {
do {
@@ -3621,7 +3621,7 @@ static CURLcode http_header_t(struct Curl_easy *data,
CURLcode result = Curl_build_unencoding_stack(data, v, TRUE);
if(result)
return result;
- if(!k->chunk && data->set.http_transfer_encoding) {
+ if(!k->chunk) {
/* if this is not chunked, only close can signal the end of this
* transfer as Content-Length is said not to be trusted for
* transfer-encoding! */
tests/data/Makefile.am+1 -0
@@ -2014,6 +2014,7 @@ TESTCASES = \
test2723 \
test2805 \
test2885 \
+ test2918 \
test2924 \
test3000 \
test3001 \
tests/data/test1494+1 -1
@@ -11,7 +11,7 @@ DELAY
# Server-side
<reply>
<data crlf="headers">
-HTTP/1.1 200 funky chunky!
+HTTP/1.1 200 funky chunky! swsclose
Server: fakeit/0.9 fakeitbad/1.0
Transfer-Encoding: identity, identity
Content-Length: 19
tests/data/test2918+55 -0
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+Transfer-Encoding
+--raw
+</keywords>
+</info>
+# Server-side
+<reply>
+
+# Similar to test 319 but receives headers in a different order
+<data crlf="headers">
+HTTP/1.1 200 OK swsclose
+Date: Mon, 29 Nov 2004 21:56:53 GMT
+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
+Content-Type: text/html; charset=ISO-8859-1
+Content-Length: 4400
+Transfer-Encoding: gobbledigook
+
+This is data
+that is encoded
+but the client
+does not know
+how to decode
+</data>
+
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+Ignore content-length with Transfer-Encoding
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER --raw
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="headers">
+GET /%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+
+</protocol>
+</verify>
+</testcase>
tests/data/test319+7 -11
@@ -16,19 +16,15 @@ Date: Mon, 29 Nov 2004 21:56:53 GMT
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
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: gobbledigook
-Content-Length: 44
+Content-Length: 4400
-%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%
-%hex[%10%86%31%17%00]hex%
-%hex[%02%71%60%18%00%00%00]hex%
+This is data
+that is encoded
+but the client
+does not know
+how to decode
</data>
-<datacheck nonewline="yes">
-%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%
-%hex[%10%86%31%17%00]hex%
-%hex[%02%71%60%18%00%00%00]hex%
-</datacheck>
-
</reply>
# Client-side
@@ -39,7 +35,7 @@ http
<name>
HTTP GET gobbledigook transfer-encoded data in raw mode
</name>
-<command option="no-include">
+<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --raw
</command>
</client>