curl/tests/data/test2106
alhudz 7de0a7e71a
chunked: reject invalid bytes in trailer
Trailers are delivered to the application as headers via
CLIENTWRITE_TRAILER, but unlike regular response headers they skipped
the verify_header() checks, so a server could smuggle a nul byte (or
stray CR) into a header reaching CURLOPT_HEADERFUNCTION and
curl_easy_header().

Run each assembled trailer line through Curl_verify_header(), the same
validation used for normal headers.

Covered by the new test 2106.

Closes #21896
2026-06-08 13:56:10 +02:00

53 lines
764 B
XML

<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
HTTP GET
chunked Transfer-Encoding
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK%CR
Server: test%CR
Transfer-Encoding: chunked%CR
Trailer: chunky-trailer%CR
%CR
6%CR
-foo-%CR
0%CR
chunky-trailer: he%hex[%00]hex%llo%CR
%CR
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
HTTP chunked response with a nul byte in the trailer
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</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>
<errorcode>
8
</errorcode>
</verify>
</testcase>