Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Successful zero-body responses discard buffered headers despite -i.
1 open issue
What changed in this PR
Defers curl output-file creation for filename-less Content-Disposition headers to prevent premature truncation with -OJ.
Changes:
- Removes eager file creation and buffered-header writes.
- Adds regression tests for existing-file preservation with
-OJ,-OJi, and-OJL.
| File | Description |
|---|---|
| tests/data/test1719 | Tests existing-file preservation across redirects. |
| tests/data/test1718 | Tests preservation with included headers. |
| tests/data/test1717 | Tests preservation with successive Content-Disposition headers. |
| tests/data/Makefile.am | Registers the three regression tests. |
| src/tool_cb_hdr.c | Defers output creation for filename-less headers. |
Review effort: Balanced
|
@bagder I can't assign you as reviewer |
| test1716 \ | ||
| test1717 \ | ||
| test1718 \ | ||
| test1719 \ |
There was a problem hiding this comment.
I suggest condensing into a single test, or even better include it in an existing one.
4983e6a to
8c09114
Compare
|
Analysis of PR #23501 at 8c091146: Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_01_httpsrr_h1[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_02_httpsrr_h3[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_03_httpsrr_h3[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_04_httpsrr_wrong_target[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_05_httpsrr_no_default_alpn[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_22_httpsrr.py::TestHTTPSRR::test_22_06_httpsrr_proxy[DoH] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Test ../../tests/http/test_30_vsftpd.py::TestVsFTPD::test_30_04_download_10_parallel[data-10m] failed, but it has been 0.2% flaky lately, so it's probably NOT a fault of the PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Note that this CI job has had a number of other flaky tests recently (4, to be specific) so it may be that this failure is rather a systemic issue with this job and not with this specific PR. There are more failures, but that's enough from Gha. Generated by Testclutch |
|
@vszakats is it better like this ? |
|
@matty69v can you take a look at the merge conflicts in here and force-push? |
With -O -J, a Content-Disposition header without a usable filename (for example "inline") made curl create the URL-derived output file right away. When a later Content-Disposition header then named that same file, the no-clobber check refused it, but the file had already been truncated to zero bytes. The same happened when such a header came in a 3xx response before the Location: header with -L. Defer creating the output file until the body arrives (or the transfer ends), like for any other header. When the transfer ends without a body, also write the headers buffered for -i, which were lost before. Test 1718 verifies both.
8c09114 to
25b7328
Compare
|
@bagder Done: rebased on master and force-pushed. The test moved to 1718 since 1717 is now taken. |
|
Thanks! |
Test results with #23571 reverted: ``` data/test301 has too many '<data>' tags (2 vs. 1 maximum) data/test702 has too many '<features>' tags (2 vs. 1 maximum) data/test714 has too many '<features>' tags (2 vs. 1 maximum) data/test715 has too many '<features>' tags (2 vs. 1 maximum) data/test1718 has superfluous comment: '# Client-side' data/test1718 has superfluous comment: '# Verify data after the test has been "shot"' data/test1456 has too many '<features>' tags (2 vs. 1 maximum) data/test1800 has too many '<features>' tags (2 vs. 1 maximum) data/test3202 has too many '<features>' tags (2 vs. 1 maximum) Error: Process completed with exit code 9. ``` Ref: https://github.com/curl/curl/actions/runs/39865646942/job/120127058099?pr=23573#step:44:32 Also: - test1337: delete stray `>`. - test1718: delete superfluous comments. Follow-up to 631ed30 #23501 Follow-up to 95f8e3a #23571 Follow-up to ffca9f6 #23562 Closes #23573


With -O -J, a Content-Disposition header without a usable filename (for example "inline") made curl create the URL-derived output file right away. When a later Content-Disposition header then named that same file, the no-clobber check refused it, but the file had already been truncated to zero bytes. The same happened when such a header came in a 3xx response before the Location: header with -L.
This defers creating the output file until the body arrives (or the transfer ends), like for any other header. Buffered headers for -i are written at that point.
Tests 1717, 1718 and 1719 cover -OJ, -OJi and -OJL. All three fail without the fix