]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: Add tests to validate that path is ignored with -J
authorDan Fandrich <dan@coneharvesters.com>
Tue, 4 Nov 2025 16:25:41 +0000 (08:25 -0800)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 5 Nov 2025 19:03:35 +0000 (11:03 -0800)
curl is correctly dropping the Content-Disposition: filename path, but
there was no test ensuring that.

Ref: https://hackerone.com/reports/3408126

tests/data/Makefile.am
tests/data/test1584 [new file with mode: 0644]
tests/data/test1585 [new file with mode: 0644]

index 22d6eca2356b9ef009f9b759104d20f5853555ff..bbd97853a33b40d6f11d773dd591a7dcfe5aafa6 100644 (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 \
diff --git a/tests/data/test1584 b/tests/data/test1584
new file mode 100644 (file)
index 0000000..ab8ba1e
--- /dev/null
@@ -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>
diff --git a/tests/data/test1585 b/tests/data/test1585
new file mode 100644 (file)
index 0000000..6875ac8
--- /dev/null
@@ -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>