mirror of
https://github.com/curl/curl.git
synced 2026-08-24 18:33:34 +03:00
http: added options for allowing HTTP/0.9 responses
Added CURLOPT_HTTP09_ALLOWED and --http0.9 for this purpose. For now, both the tool and library allow HTTP/0.9 by default. docs/DEPRECATE.md lays out the plan for when to reverse that default: 6 months after the 7.64.0 release. The options are added already now so that applications/scripts can start using them already now. Fixes #2873 Closes #3383
This commit is contained in:
parent
db9776ea00
commit
006ff62d8c
36 changed files with 396 additions and 59 deletions
|
|
@ -130,7 +130,8 @@ test1144 test1145 test1146 test1147 test1148 test1149 test1150 test1151 \
|
|||
test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 \
|
||||
\
|
||||
test1160 test1161 test1162 test1163 test1164 \
|
||||
test1170 test1171 \
|
||||
test1170 test1171 test1172 \
|
||||
\
|
||||
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
|
||||
test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
|
||||
test1216 test1217 test1218 test1219 \
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<keywords>
|
||||
HTTP
|
||||
HTTP HEAD
|
||||
HTTP/0.9
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
|
|
@ -46,7 +47,7 @@ http
|
|||
HTTP HEAD, receive no headers only body
|
||||
</name>
|
||||
<command>
|
||||
-I http://%HOSTIP:%HTTPPORT/1144
|
||||
-I http://%HOSTIP:%HTTPPORT/1144 --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ http
|
|||
HTTP/0.9 GET and all zeroes
|
||||
</name>
|
||||
<command option="force-output">
|
||||
http://%HOSTIP:%HTTPPORT/1164 -w '%{size_download}\n'
|
||||
http://%HOSTIP:%HTTPPORT/1164 -w '%{size_download}\n' --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
50
tests/data/test1172
Normal file
50
tests/data/test1172
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP/0.9
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
-foo- swsclose
|
||||
</data>
|
||||
<datacheck>
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP/0.9 GET response denied
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1172 --no-http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET /1172 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
# unsupported protocol
|
||||
<errorcode>
|
||||
1
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
@ -26,7 +26,7 @@ http
|
|||
HTTP GET with a single-byte HTTP/0.9 response
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1266
|
||||
http://%HOSTIP:%HTTPPORT/1266 --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ http
|
|||
HTTP GET with a invalid HTTP/1 response line start
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1267
|
||||
http://%HOSTIP:%HTTPPORT/1267 --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ s/(USERAGENT, \")[^\"]+/${1}stripped/
|
|||
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
||||
$_ = '' if /CURLOPT_HTTP_VERSION/
|
||||
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
|
||||
</stripfile>
|
||||
<file name="log/test1400.c" mode="text">
|
||||
/********* Sample code generated by the curl command line tool **********
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ int main(int argc, char *argv[])
|
|||
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ int main(int argc, char *argv[])
|
|||
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ int main(int argc, char *argv[])
|
|||
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1403?foo=bar&baz=quux");
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ int main(int argc, char *argv[])
|
|||
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1);
|
||||
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ $_ = '' if /CURLOPT_MAXREDIRS/
|
|||
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
||||
$_ = '' if /CURLOPT_HTTP_VERSION/
|
||||
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
|
||||
</stripfile>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ $_ = '' if /CURLOPT_MAXREDIRS/
|
|||
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
||||
$_ = '' if /CURLOPT_HTTP_VERSION/
|
||||
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
|
||||
</stripfile>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ $_ = '' if /CURLOPT_MAXREDIRS/
|
|||
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
||||
$_ = '' if /CURLOPT_HTTP_VERSION/
|
||||
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
|
||||
</stripfile>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ int main(int argc, char *argv[])
|
|||
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/1420/;MAILINDEX=1");
|
||||
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
|
||||
curl_easy_setopt(hnd, CURLOPT_HTTP09_ALLOWED, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
HTTP/0.9
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ http
|
|||
HTTP GET with 4-digit response code
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1429 --write-out '%{response_code}'
|
||||
http://%HOSTIP:%HTTPPORT/1429 --write-out '%{response_code}' --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ https
|
|||
HTTPS GET, receive no headers only data!
|
||||
</name>
|
||||
<command>
|
||||
-k https://%HOSTIP:%HTTPSPORT/306
|
||||
-k https://%HOSTIP:%HTTPSPORT/306 --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
HTTP/0.9
|
||||
</keywords>
|
||||
</info>
|
||||
# Server-side
|
||||
|
|
@ -21,7 +22,7 @@ http
|
|||
HTTP GET without headers in the response
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/66
|
||||
http://%HOSTIP:%HTTPPORT/66 --http0.9
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue