mirror of
https://github.com/curl/curl.git
synced 2026-07-31 09:48:04 +03:00
tool_cb_wrt: fix no-clobber error handling
When saving a file with --no-clobber, make sure the existing file name remains set when creating the name fails. In a retry scenario, it comes back and uses that variable again. Add test 3036 to verify. Reported-by: James Fuller Closes #20939
This commit is contained in:
parent
3525ed9b2f
commit
29cb750fc2
3 changed files with 69 additions and 3 deletions
62
tests/data/test3036
Normal file
62
tests/data/test3036
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
-O
|
||||
-J
|
||||
--output-dir
|
||||
--retry
|
||||
--no-clobber
|
||||
</keywords>
|
||||
</info>
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Content-Disposition: inline; filename="MMM%TESTNUMBERMMM"
|
||||
Content-Type: text/html
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<features>
|
||||
http
|
||||
</features>
|
||||
<name>
|
||||
--no-clobber, --retry and --output-dir identifying a file
|
||||
</name>
|
||||
<command option="no-output">
|
||||
http://%HOSTIP:%HTTPPORT/ --no-clobber --output-dir %LOGDIR/present -OJ --retry 1 --retry-all-errors
|
||||
</command>
|
||||
<file name="%LOGDIR/present">
|
||||
present
|
||||
</file>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
<protocol crlf="headers">
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
GET / HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
# it fails because it cannot create the output file
|
||||
<errorcode>
|
||||
23
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue