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 107ab 108This is data from a file. 109 110------------------------------ 111Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 112Content-Type: text/whatever 113 114 115bb 116This is data from a file. 117 118-------------------------------- 119 120------------------------------ 121Content-Disposition: form-data; name="filecontents" 122 123 12411b 125This is data from a file. 126 127------------------------------ 128Content-Disposition: form-data; name="formlength" 129 1301433 131------------------------------ 132Content-Disposition: form-data; name="standardinput" 133Content-Type: application/octet-stream 134 135 13616 137 Some data from stdin 138 13936 140 141-------------------------------- 142 1430 144 145POST /%TESTNUMBER0002 HTTP/1.1 146Host: %HOSTIP:%HTTPPORT 147Accept: */* 148Transfer-Encoding: chunked 149Content-Type: multipart/form-data; boundary=---------------------------- 150Expect: 100-continue 151 152385 153------------------------------ 154Content-Disposition: form-data; name="fieldname" 155Content-Type: text/plain 156X-customheader-1: Header 1 data 157X-customheader-2: Header 2 data 158 159this is what we post to the silly web server 160------------------------------ 161Content-Disposition: form-data; name="fieldnam" 162 163uhis is what we post to the silly web serve 164------------------------------ 165Content-Disposition: form-data; name="multifile" 166Content-Type: multipart/mixed; boundary=---------------------------- 167 168------------------------------ 169Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 170Content-Type: application/octet-stream 171 172This is data from a file. 173 174------------------------------ 175Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 176Content-Type: text/whatever 177 178 179ab 180This is data from a file. 181 182------------------------------ 183Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 184Content-Type: text/whatever 185 186 187bb 188This is data from a file. 189 190-------------------------------- 191 192------------------------------ 193Content-Disposition: form-data; name="filecontents" 194 195 19611b 197This is data from a file. 198 199------------------------------ 200Content-Disposition: form-data; name="formlength" 201 2021433 203------------------------------ 204Content-Disposition: form-data; name="standardinput" 205Content-Type: application/octet-stream 206 207 20816 209 Some data from stdin 210 21136 212 213-------------------------------- 214 2150 216 217</protocol> 218</verify> 219</testcase> 220