http: better error message for HTTP/1.x response without status line

If a response without a status line is received, and the connection is
known to use HTTP/1.x (not HTTP/0.9), report the error "Invalid status
line" instead of "Received HTTP/0.9 when not allowed".

Closes #13045
This commit is contained in:
Michael Kaufmann 2024-03-04 18:15:08 +01:00 committed by Daniel Stenberg
parent a54d0bdc65
commit df1fcb41e2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 134 additions and 0 deletions

67
tests/data/test1479 Normal file
View file

@ -0,0 +1,67 @@
<testcase>
<info>
<keywords>
HTTP
HTTP/0.9
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 200 OK
Content-Length: 5
Data
</data>
<data2>
Data
Data
Data
</data2>
<datacheck>
</datacheck>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP/1.1 response followed by an HTTP/0.9 response over the same connection
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER0002
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /%TESTNUMBER0002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
# Hyper curl returns unsupported protocol
# built-in curl returns weird_server_reply
<errorcode>
%if hyper
1
%else
8
%endif
</errorcode>
</verify>
</testcase>