1<testcase>
2<info>
3<keywords>
4HTTP
5HTTP POST
6FORM
7</keywords>
8</info>
9
10#
11# Server-side
12<reply>
13<data>
14HTTP/1.1 200 OK
15Date: Thu, 09 Nov 2010 14:49:00 GMT
16Server: test-server/fake swsclose
17Connection: close
18Content-Type: text/html
19
20hello
21</data>
22</reply>
23
24# Client-side
25<client>
26<server>
27http
28</server>
29# tool is what to use instead of 'curl'
30<tool>
31lib650
32</tool>
33
34 <name>
35HTTP formpost using form API
36 </name>
37<stdin>
38 Some data from stdin
39</stdin>
40 <command>
41http://%HOSTIP:%HTTPPORT/650 log/test650.filedata
42</command>
43<file name="log/test650.filedata">
44This is data from a file.
45</file>
46</client>
47
48#
49# Verify data after the test has been "shot"
50<verify>
51<strippart>
52s/^--------------------------[a-z0-9]*/------------------------------/
53s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
54</strippart>
55# Note that the stripping above removes 12 bytes from every occurrence of the
56# boundary string and since 5 of them are in the body contents, we see
57# (5*12) == 60 bytes less
58<protocol>
59POST /650 HTTP/1.1
60Host: %HOSTIP:%HTTPPORT
61Accept: */*
62Transfer-Encoding: chunked
63Content-Type: multipart/form-data; boundary=----------------------------
64Expect: 100-continue
65
6660a
67------------------------------
68Content-Disposition: form-data; name="fieldname"
69Content-Type: text/plain
70X-customheader-1: Header 1 data
71X-customheader-2: Header 2 data
72
73this is what we post to the silly web server
74------------------------------
75Content-Disposition: form-data; name="fieldnam"
76
77uhis is what we post to the silly web serve
78------------------------------
79Content-Disposition: form-data; name="multifile"
80Content-Type: multipart/mixed; boundary=----------------------------
81
82------------------------------
83Content-Disposition: attachment; filename="test650.filedata"
84Content-Type: application/octet-stream
85
86This is data from a file.
87
88------------------------------
89Content-Disposition: attachment; filename="test650.filedata"
90Content-Type: text/whatever
91
92This is data from a file.
93
94------------------------------
95Content-Disposition: attachment; filename="test650.filedata"
96Content-Type: text/whatever
97
98This is data from a file.
99
100--------------------------------
101
102------------------------------
103Content-Disposition: form-data; name="filecontents"
104
105This is data from a file.
106
107------------------------------
108Content-Disposition: form-data; name="formlength"
109
1101367
111------------------------------
112Content-Disposition: form-data; name="standardinput"
113Content-Type: application/octet-stream
114
115 Some data from stdin
116
117--------------------------------
118
1190
120
121</protocol>
122</verify>
123</testcase>
124