]> granicus.if.org Git - curl/commitdiff
libcurl: Add testcase for gopher redirects
authorLinos Giannopoulos <lgian@skroutz.gr>
Wed, 10 Jul 2019 11:11:57 +0000 (14:11 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 14 Jul 2019 14:30:28 +0000 (16:30 +0200)
The testcase ensures that redirects to CURLPROTO_GOPHER won't be
allowed, by default, in the future. Also, curl is being used
for convenience while keeping the testcases DRY.

The expected error code is CURLE_UNSUPPORTED_PROTOCOL when the client is
redirected to CURLPROTO_GOPHER

Signed-off-by: Linos Giannopoulos <lgian@skroutz.gr>
tests/data/Makefile.inc
tests/data/test1563 [new file with mode: 0644]

index a8f85af54ef98691de0b497b7b785dad0e1af33f..6c5ace0b6089bacd6dc17c48f7594743aa95c3ff 100644 (file)
@@ -175,7 +175,7 @@ test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
 test1533 test1534 test1535 test1536 test1537 test1538 \
 test1540 test1541 \
 test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 \
-test1558 test1559 test1560 test1561 test1562 \
+test1558 test1559 test1560 test1561 test1562 test1563 \
 \
 test1590 test1591 test1592 test1593 \
 \
diff --git a/tests/data/test1563 b/tests/data/test1563
new file mode 100644 (file)
index 0000000..a3597b9
--- /dev/null
@@ -0,0 +1,51 @@
+<testcase>
+<info>
+<keywords>
+GOPHER
+HTTP GET
+followlocation
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data1>
+HTTP/1.1 302 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Content-Length: 7
+Location: gopher://www.example.co.uk
+
+nomnom
+</data1>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+Make sure redirects to CURLPROTO_GOPHER are forbidden by default
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/15630001 -L -H "Host: www.example.com"
+</command>
+</client>
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<errorcode>
+1
+</errorcode>
+<protocol>
+GET /15630001 HTTP/1.1\r
+Host: www.example.com\r
+Accept: */*\r
+\r
+</protocol>
+
+</verify>
+
+</testcase>