summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinos Giannopoulos <lgian@skroutz.gr>2019-07-10 14:11:57 +0300
committerDaniel Stenberg <daniel@haxx.se>2019-07-14 16:30:28 +0200
commit797e549d0d6009b60786ac82465df26e1fc52ac6 (patch)
treeb8eacedc66cfeb3eaebf5a1ed731e3e2abc4e41b
parent6080ea098d97393da32c6f66eb95c7144620298c (diff)
downloadgnurl-797e549d0d6009b60786ac82465df26e1fc52ac6.tar.gz
gnurl-797e549d0d6009b60786ac82465df26e1fc52ac6.tar.bz2
gnurl-797e549d0d6009b60786ac82465df26e1fc52ac6.zip
libcurl: Add testcase for gopher redirects
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>
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test156351
2 files changed, 52 insertions, 1 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index a8f85af54..6c5ace0b6 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -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
index 000000000..a3597b9b5
--- /dev/null
+++ b/tests/data/test1563
@@ -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
+Host: www.example.com
+Accept: */*
+
+</protocol>
+
+</verify>
+
+</testcase>