http: return error for a second Location: header

Unless it is identical to the previous one.

Follow-up to dbcaa00657

Adjusted test 580, added test 772 and 773

Fixes #19130
Reported-by: Jakub Stasiak
Closes #19134
This commit is contained in:
Daniel Stenberg 2025-10-19 10:59:38 +02:00
parent cbd7823fd1
commit 9596c4a258
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 138 additions and 18 deletions

52
tests/data/test772 Normal file
View file

@ -0,0 +1,52 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
Location
</keywords>
</info>
#
# Server-side
<reply>
<data crlf="yes" nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Content-Length: 0
Connection: close
Location: this
Location: that
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP with two Location: headers triggers error
</name>
<command>
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: */*
</protocol>
<errorcode>
8
</errorcode>
</verify>
</testcase>