http: stop dropping large custom headers

Closes #22336
This commit is contained in:
Graham Campbell 2026-07-16 13:29:44 +01:00 committed by Daniel Stenberg
parent f0f84d1251
commit 5bb7d7a4f2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 126 additions and 10 deletions

View file

@ -284,7 +284,7 @@ test3100 test3101 test3102 test3103 test3104 test3105 test3106 \
test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 \
test3208 test3209 test3210 test3211 test3212 test3213 test3214 test3215 \
test3216 test3217 test3218 test3219 test3220 test3221 test3222 \
test3223 test3224 test3225 test3226 test3227 \
test3223 test3224 test3225 test3226 test3227 test3228 test3229 \
\
test3300 test3301 test3302 test3303 test3304 test3305 \
\

58
tests/data/test3228 Normal file
View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
HTTP GET
HTTP added headers
</keywords>
</info>
# Server-side
<reply>
<data>
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 6
Connection: close
-foo-
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
Send custom request headers larger than the response header limit
</name>
<stdin>
header "X-Large: %repeat[307200 x x]%"
header "Connection: %repeat[307200 x x]%"
header "%repeat[307201 x X]%;"
</stdin>
<command>
-K - http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol crlf="yes">
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
X-Large: %repeat[307200 x x]%
%repeat[307201 x X]%:
Connection: %repeat[307200 x x]%
</protocol>
<limits>
Maximum allocated: 4000000
</limits>
</verify>
</testcase>

37
tests/data/test3229 Normal file
View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
HTTP GET
HTTP added headers
</keywords>
</info>
# Client-side
<client>
<server>
http
</server>
<name>
Reject a custom request header larger than the request buffer
</name>
<stdin>
header "X-Large: %repeat[1048576 x x]%"
</stdin>
<command>
-K - http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
# 100 == CURLE_TOO_LARGE
<errorcode>
100
</errorcode>
<limits>
Maximum allocated: 6000000
</limits>
</verify>
</testcase>