urldata: don't touch data->set.httpversion at run-time

Rename it to 'httpwant' and make a cloned field in the state struct as
well for run-time updates.

Also: refuse non-supported HTTP versions. Verified with test 129.

Closes #6585
This commit is contained in:
Daniel Stenberg 2021-02-11 16:30:32 +01:00
parent bd6b54ba1f
commit 88dd1a8a11
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
17 changed files with 109 additions and 34 deletions

View file

@ -34,7 +34,7 @@ test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
test100 test101 test102 test103 test104 test105 test106 test107 test108 \
test109 test110 test111 test112 test113 test114 test115 test116 test117 \
test118 test119 test120 test121 test122 test123 test124 test125 test126 \
test127 test128 test130 test131 test132 test133 test134 test135 \
test127 test128 test129 test130 test131 test132 test133 test134 test135 \
test136 test137 test138 test139 test140 test141 test142 test143 test144 \
test145 test146 test147 test148 test149 test150 test151 test152 test153 \
test154 test155 test156 test157 test158 test159 test160 test161 test162 \

57
tests/data/test129 Normal file
View file

@ -0,0 +1,57 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.2 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP/1.2 is rejected
</name>
<command>
http://%HOSTIP:%HTTPPORT/129
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /129 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
# CURLE_UNSUPPORTED_PROTOCOL
<errorcode>
1
</errorcode>
</verify>
</testcase>