tests: Add tests to validate that path is ignored with -J

curl is correctly dropping the Content-Disposition: filename path, but
there was no test ensuring that.

Ref: https://hackerone.com/reports/3408126
This commit is contained in:
Dan Fandrich 2025-11-04 08:25:41 -08:00
parent 60dd72b1be
commit e6e1899b6e
3 changed files with 111 additions and 1 deletions

View file

@ -209,7 +209,7 @@ test1548 test1549 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 test1581 test1582 test1583 \
test1580 test1581 test1582 test1583 test1584 test1585 \
\
test1590 test1591 test1592 test1593 test1594 test1595 test1596 test1597 \
test1598 test1599 test1600 test1601 test1602 test1603 test1604 test1605 \

55
tests/data/test1584 Normal file
View file

@ -0,0 +1,55 @@
<testcase>
<!-- Based on test 1311 -->
<info>
<keywords>
HTTP
HTTP GET
-J
</keywords>
</info>
#
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 6
Connection: close
Content-Type: text/html
Content-Disposition: filename=log/server/name%TESTNUMBER
12345
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP GET with -J and Content-Disposition including path
</name>
<command option="no-output,no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O --output-dir %LOGDIR
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<file name="%LOGDIR/name%TESTNUMBER">
12345
</file>
</verify>
</testcase>

55
tests/data/test1585 Normal file
View file

@ -0,0 +1,55 @@
<testcase>
<!-- Based on test 1584 -->
<info>
<keywords>
HTTP
HTTP GET
-J
</keywords>
</info>
#
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 6
Connection: close
Content-Type: text/html
Content-Disposition: filename=log\server\name%TESTNUMBER
12345
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP GET with -J and Content-Disposition including DOS path
</name>
<command option="no-output,no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -J -O --output-dir %LOGDIR
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<file name="%LOGDIR/name%TESTNUMBER">
12345
</file>
</verify>
</testcase>