mirror of
https://github.com/curl/curl.git
synced 2026-08-24 10:43:32 +03:00
curl: named globs in output file name for upload glob references
Use parts of text from the upload filename field when that uses globbing
by giving it a name the same way we do it for URL globs. For example, if
you upload three files to a HTTP URL and want to save the corresponding
responses in separate files:
curl -T 'file{<num>1,2,3}' https://upload.example/ -o 'response-#<num>'
Verified by test 2014
Closes #21407
This commit is contained in:
parent
89f38c168c
commit
2238f0921c
7 changed files with 145 additions and 22 deletions
|
|
@ -245,7 +245,7 @@ test1970 test1971 test1972 test1973 test1974 test1975 test1976 test1977 \
|
|||
test1978 test1979 test1980 test1981 test1982 test1983 test1984 \
|
||||
\
|
||||
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
|
||||
test2008 test2009 test2010 test2011 test2012 test2013 \
|
||||
test2008 test2009 test2010 test2011 test2012 test2013 test2014 \
|
||||
\
|
||||
test2023 \
|
||||
test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \
|
||||
|
|
|
|||
97
tests/data/test2014
Normal file
97
tests/data/test2014
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP PUT
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data crlf="headers" nocheck="yes">
|
||||
HTTP/1.1 200 OK swsbounce
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Content-Type: text/html
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
<data1 crlf="headers" nocheck="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Content-Length: 20
|
||||
Content-Type: text/html
|
||||
|
||||
the second response
|
||||
</data1>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
upload with glob, output name based on upload glob
|
||||
</name>
|
||||
<command option="no-output">
|
||||
-T '%LOGDIR/upload{%LThej%GT1,2}' http://%HOSTIP:%HTTPPORT/%TESTNUMBER --silent '--output=%LOGDIR/out-#%LThej%GT'
|
||||
</command>
|
||||
|
||||
<file name="%LOGDIR/upload1">
|
||||
first!
|
||||
</file>
|
||||
|
||||
<file2 name="%LOGDIR/upload2">
|
||||
second
|
||||
</file2>
|
||||
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol crlf="headers">
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 7
|
||||
|
||||
first!
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 7
|
||||
|
||||
second
|
||||
</protocol>
|
||||
<stdout>
|
||||
%EMPTY
|
||||
</stdout>
|
||||
|
||||
<file name="%LOGDIR/out-1" crlf="headers">
|
||||
HTTP/1.1 200 OK swsbounce
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Content-Type: text/html
|
||||
|
||||
-foo-
|
||||
</file>
|
||||
|
||||
<file2 name="%LOGDIR/out-2" crlf="headers">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Content-Length: 20
|
||||
Content-Type: text/html
|
||||
|
||||
the second response
|
||||
</file2>
|
||||
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue