xref: /curl/tests/data/test650 (revision 3fd80c7b)
1<testcase>
2<info>
3<keywords>
4HTTP
5HTTP POST
6FORM
7</keywords>
8</info>
9
10#
11# Server-side
12<reply>
13<data nocheck="yes">
14HTTP/1.1 301 OK
15Date: Tue, 09 Nov 2010 14:49:00 GMT
16Server: test-server/fake swsclose
17Connection: close
18Content-Type: text/html
19Location: /%TESTNUMBER0002
20
21hello
22</data>
23<data2 crlf="yes">
24HTTP/1.1 200 OK
25Date: Tue, 09 Nov 2010 14:49:00 GMT
26Server: test-server/fake
27Content-Length: 6
28Connection: close
29Content-Type: text/html
30
31-foo-
32</data2>
33</reply>
34
35# Client-side
36<client>
37<features>
38form-api
39</features>
40<server>
41http
42</server>
43# tool is what to use instead of 'curl'
44<tool>
45lib%TESTNUMBER
46</tool>
47
48<name>
49HTTP formpost using form API - with redirect and re-POST
50</name>
51<stdin>
52 Some data from stdin
53</stdin>
54<command>
55http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/test%TESTNUMBER.filedata
56</command>
57<file name="%LOGDIR/test%TESTNUMBER.filedata">
58This is data from a file.
59</file>
60</client>
61
62#
63# Verify data bbter the test has been "shot"
64<verify>
65<strippart>
66s/^--------------------------[A-Za-z0-9]*/------------------------------/
67s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
68</strippart>
69# Note that the stripping above removes 12 bytes from every occurrence of the
70# boundary string and since 5 of them are in the body contents, we see
71# (5*12) == 60 bytes less
72<protocol>
73POST /%TESTNUMBER HTTP/1.1
74Host: %HOSTIP:%HTTPPORT
75Accept: */*
76Transfer-Encoding: chunked
77Content-Type: multipart/form-data; boundary=----------------------------
78Expect: 100-continue
79
80385
81------------------------------
82Content-Disposition: form-data; name="fieldname"
83Content-Type: text/plain
84X-customheader-1: Header 1 data
85X-customheader-2: Header 2 data
86
87this is what we post to the silly web server
88------------------------------
89Content-Disposition: form-data; name="fieldnam"
90
91uhis is what we post to the silly web serve
92------------------------------
93Content-Disposition: form-data; name="multifile"
94Content-Type: multipart/mixed; boundary=----------------------------
95
96------------------------------
97Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
98Content-Type: application/octet-stream
99
100This is data from a file.
101
102------------------------------
103Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
104Content-Type: text/whatever
105
106
107%if hyper
108AB
109%else
110ab
111%endif
112This is data from a file.
113
114------------------------------
115Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
116Content-Type: text/whatever
117
118
119%if hyper
120BB
121%else
122bb
123%endif
124This is data from a file.
125
126--------------------------------
127
128------------------------------
129Content-Disposition: form-data; name="filecontents"
130
131
132%if hyper
13311B
134%else
13511b
136%endif
137This is data from a file.
138
139------------------------------
140Content-Disposition: form-data; name="formlength"
141
1421433
143------------------------------
144Content-Disposition: form-data; name="standardinput"
145Content-Type: application/octet-stream
146
147
14816
149 Some data from stdin
150
15136
152
153--------------------------------
154
1550
156
157POST /%TESTNUMBER0002 HTTP/1.1
158Host: %HOSTIP:%HTTPPORT
159Accept: */*
160Transfer-Encoding: chunked
161Content-Type: multipart/form-data; boundary=----------------------------
162Expect: 100-continue
163
164385
165------------------------------
166Content-Disposition: form-data; name="fieldname"
167Content-Type: text/plain
168X-customheader-1: Header 1 data
169X-customheader-2: Header 2 data
170
171this is what we post to the silly web server
172------------------------------
173Content-Disposition: form-data; name="fieldnam"
174
175uhis is what we post to the silly web serve
176------------------------------
177Content-Disposition: form-data; name="multifile"
178Content-Type: multipart/mixed; boundary=----------------------------
179
180------------------------------
181Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
182Content-Type: application/octet-stream
183
184This is data from a file.
185
186------------------------------
187Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
188Content-Type: text/whatever
189
190
191%if hyper
192AB
193%else
194ab
195%endif
196This is data from a file.
197
198------------------------------
199Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
200Content-Type: text/whatever
201
202
203%if hyper
204BB
205%else
206bb
207%endif
208This is data from a file.
209
210--------------------------------
211
212------------------------------
213Content-Disposition: form-data; name="filecontents"
214
215
216%if hyper
21711B
218%else
21911b
220%endif
221This is data from a file.
222
223------------------------------
224Content-Disposition: form-data; name="formlength"
225
2261433
227------------------------------
228Content-Disposition: form-data; name="standardinput"
229Content-Type: application/octet-stream
230
231
23216
233 Some data from stdin
234
23536
236
237--------------------------------
238
2390
240
241</protocol>
242</verify>
243</testcase>
244