From 797e549d0d6009b60786ac82465df26e1fc52ac6 Mon Sep 17 00:00:00 2001 From: Linos Giannopoulos Date: Wed, 10 Jul 2019 14:11:57 +0300 Subject: 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 --- tests/data/Makefile.inc | 2 +- tests/data/test1563 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/data/test1563 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 @@ + + + +GOPHER +HTTP GET +followlocation + + + +# Server-side + + +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 + + + +# Client-side + + +http + + +Make sure redirects to CURLPROTO_GOPHER are forbidden by default + + +http://%HOSTIP:%HTTPPORT/15630001 -L -H "Host: www.example.com" + + + + +^User-Agent:.* + + +1 + + +GET /15630001 HTTP/1.1 +Host: www.example.com +Accept: */* + + + + + + -- cgit v1.2.3