fixup add test 1581 to verify OBEYCODE + CURL_REDIR_POST_301

This commit is contained in:
Daniel Stenberg 2025-02-28 22:50:35 +01:00
parent 8d3f947df6
commit 1cddf7e20b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 102 additions and 2 deletions

View File

@ -208,7 +208,7 @@ test1540 test1541 test1542 test1543 test1544 test1545 test1546 \
test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 \
test1558 test1559 test1560 test1561 test1562 test1563 test1564 test1565 \
test1566 test1567 test1568 test1569 test1570 test1571 test1572 test1573 \
test1574 test1575 test1576 test1577 test1578 test1579 test1580 \
test1574 test1575 test1576 test1577 test1578 test1579 test1580 test1581 \
\
test1590 test1591 test1592 test1593 test1594 test1595 test1596 test1597 \
test1598 \

97
tests/data/test1581 Normal file
View File

@ -0,0 +1,97 @@
<testcase>
<info>
<keywords>
CURLFOLLOW_OBEYCODE
CURLOPT_FOLLOWLOCATION
</keywords>
</info>
#
# Server-side
<reply>
<data crlf="yes">
HTTP/1.1 301 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
Location: %TESTNUMBER0001
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
<data1 crlf="yes">
HTTP/1.1 200 OK
Content-Length: 6
Connection: close
Content-Type: text/html
-bar-
</data>
<datacheck crlf="yes">
HTTP/1.1 301 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
Location: %TESTNUMBER0001
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
HTTP/1.1 200 OK
Content-Length: 6
Connection: close
Content-Type: text/html
-bar-
</datacheck>
</reply>
# Client-side
<client>
<server>
http
</server>
<features>
http
</features>
<tool>
lib1571
</tool>
<name>
CURLFOLLOW_OBEYCODE with custom POST301 method, 301 => custom
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1581
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol nonewline="yes" crlf="yes">
IGLOO /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 3
Content-Type: application/x-www-form-urlencoded
mooIGLOO /%TESTNUMBER0001 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 3
Content-Type: application/x-www-form-urlencoded
moo
</protocol>
</verify>
</testcase>

View File

@ -46,9 +46,12 @@ CURLcode test(char *URL)
test_setopt(curl, CURLOPT_HEADER, 1L);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_URL, URL);
if((testno == 1571) || (testno == 1575)) {
if((testno == 1571) || (testno == 1575) || (testno == 1581)) {
test_setopt(curl, CURLOPT_POSTFIELDS, "moo");
}
if(testno == 1581) {
test_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_301);
}
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "IGLOO");
if((testno == 1574) || (testno == 1575)) {