mirror of
https://github.com/curl/curl.git
synced 2026-05-16 19:16:22 +03:00
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
97 lines
1.6 KiB
XML
97 lines
1.6 KiB
XML
<?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>
|