diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-06-19 14:10:33 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-06-19 16:39:22 +0200 |
commit | b778ae4c5e5bcb6da4de789e25971f40f0673d86 (patch) | |
tree | 6a710c4bf1a37e78a5b613109af46dd6762369bd /tests | |
parent | 176ec5138277fcda592fa604e499dfd6819eece9 (diff) | |
download | curl-b778ae4c5e5bcb6da4de789e25971f40f0673d86.tar.gz |
http: add --strip-path-slash and CURLOPT_STRIP_PATH_SLASH
... to enable sending "OPTIONS *" which wasn't possible previously.
This option currently only works for HTTP.
Added test cases 1298 + 1299 to verify
Fixes #1280
Closes #1462
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/Makefile.inc | 2 | ||||
-rw-r--r-- | tests/data/test1298 | 56 | ||||
-rw-r--r-- | tests/data/test1299 | 55 | ||||
-rw-r--r-- | tests/server/sws.c | 8 |
4 files changed, 120 insertions, 1 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index b1f947466..64eb0619b 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -133,7 +133,7 @@ test1260 test1261 test1262 \ \ test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \ test1288 \ -\ +test1298 test1299 \ test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ test1316 test1317 test1318 test1319 test1320 test1321 test1322 \ diff --git a/tests/data/test1298 b/tests/data/test1298 new file mode 100644 index 000000000..c9c8b383a --- /dev/null +++ b/tests/data/test1298 @@ -0,0 +1,56 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +--strip-path-slash +</keywords> +</info> + +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 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: 0 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +HTTP GET special path with --strip-path-slash + </name> + <command> +--strip-path-slash "http://%HOSTIP:%HTTPPORT/XXX" -H "Testno: 1298" +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET XXX HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Testno: 1298
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1299 b/tests/data/test1299 new file mode 100644 index 000000000..51bb71248 --- /dev/null +++ b/tests/data/test1299 @@ -0,0 +1,55 @@ +<testcase> +<info> +<keywords> +HTTP +--strip-path-slash +</keywords> +</info> + +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 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: 0 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +Send "OPTIONS *" with --strip-path-slash + </name> + <command> +--strip-path-slash -X OPTIONS http://%HOSTIP:%HTTPPORT/* -H "Testno: 1299" +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +OPTIONS * HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Testno: 1299
+
+</protocol> +</verify> +</testcase> diff --git a/tests/server/sws.c b/tests/server/sws.c index b1199ccc6..bff30f212 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -602,6 +602,14 @@ static int ProcessRequest(struct httprequest *req) } if(req->testno == DOCNUMBER_NOTHING) { + /* check for a Testno: header with the test case number */ + char *testno = strstr(line, "\nTestno: "); + if(testno) { + req->testno = strtol(&testno[9], NULL, 10); + logmsg("Found test number %d in Testno: header!", req->testno); + } + } + if(req->testno == DOCNUMBER_NOTHING) { /* Still no test case number. Try to get the the number off the last dot instead, IE we consider the TLD to be the test number. Test 123 can then be written as "example.com.123". */ |