xref: /curl/tests/data/test1053 (revision 3fd80c7b)
1<testcase>
2# Based on test 9
3<info>
4<keywords>
5HTTP
6HTTP FORMPOST
7HTTP file upload
8followlocation
9</keywords>
10</info>
11
12# Server-side
13<reply>
14<data>
15HTTP/1.1 307 Redirect swsclose
16Date: Thu, 29 Jul 2008 14:49:00 GMT
17Server: test-server/fake
18Location: data/%TESTNUMBER0002.txt?coolsite=yes
19Content-Length: 0
20Connection: close
21
22</data>
23<data2>
24HTTP/1.1 200 OK swsclose
25Date: Tue, 09 Nov 2010 14:49:00 GMT
26Server: test-server/fake
27Content-Length: 11
28Connection: close
29
30blablabla
31
32</data2>
33<datacheck>
34HTTP/1.1 307 Redirect swsclose
35Date: Thu, 29 Jul 2008 14:49:00 GMT
36Server: test-server/fake
37Location: data/%TESTNUMBER0002.txt?coolsite=yes
38Content-Length: 0
39Connection: close
40
41HTTP/1.1 200 OK swsclose
42Date: Tue, 09 Nov 2010 14:49:00 GMT
43Server: test-server/fake
44Content-Length: 11
45Connection: close
46
47blablabla
48
49</datacheck>
50</reply>
51
52# Client-side
53<client>
54<features>
55Mime
56</features>
57<server>
58http
59</server>
60<name>
61HTTP RFC1867-type formposting from file with Location: following
62</name>
63<command>
64http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -L -F name=daniel -F tool=curl -F file=@%LOGDIR/test%TESTNUMBER.txt
65</command>
66# We create this file before the command is invoked!
67<file name="%LOGDIR/test%TESTNUMBER.txt">
68foo-
69This is a moo-
70bar
71</file>
72</client>
73
74# Verify data after the test has been "shot"
75<verify>
76<strip>
77^(Content-Type: multipart/form-data;|------------).*
78</strip>
79<protocol>
80POST /we/want/%TESTNUMBER HTTP/1.1
81Host: %HOSTIP:%HTTPPORT
82User-Agent: curl/%VERSION
83Accept: */*
84Content-Length: 434
85Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
86
87------------------------------9ef8d6205763
88Content-Disposition: form-data; name="name"
89
90daniel
91------------------------------9ef8d6205763
92Content-Disposition: form-data; name="tool"
93
94curl
95------------------------------9ef8d6205763
96Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
97Content-Type: text/plain
98
99foo-
100This is a moo-
101bar
102
103------------------------------9ef8d6205763--
104POST /we/want/data/%TESTNUMBER0002.txt?coolsite=yes HTTP/1.1
105Host: %HOSTIP:%HTTPPORT
106User-Agent: curl/%VERSION
107Accept: */*
108Content-Length: 434
109Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
110
111------------------------------9ef8d6205763
112Content-Disposition: form-data; name="name"
113
114daniel
115------------------------------9ef8d6205763
116Content-Disposition: form-data; name="tool"
117
118curl
119------------------------------9ef8d6205763
120Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
121Content-Type: text/plain
122
123foo-
124This is a moo-
125bar
126
127------------------------------9ef8d6205763--
128</protocol>
129</verify>
130</testcase>
131