1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-11 05:58:01 -05:00

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>
This commit is contained in:
Linos Giannopoulos 2019-07-10 14:11:57 +03:00 committed by Daniel Stenberg
parent 6080ea098d
commit 797e549d0d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 52 additions and 1 deletions

View 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 \
\

51
tests/data/test1563 Normal file
View File

@ -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>