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: Tue, 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<features> 27Mime 28</features> 29<server> 30http 31</server> 32# tool is what to use instead of 'curl' 33<tool> 34lib%TESTNUMBER 35</tool> 36 37 <name> 38HTTP formpost using form API 39 </name> 40<stdin> 41 Some data from stdin 42</stdin> 43 <command> 44http://%HOSTIP:%HTTPPORT/%TESTNUMBER log/test%TESTNUMBER.filedata 45</command> 46<file name="log/test%TESTNUMBER.filedata"> 47This is data from a file. 48</file> 49</client> 50 51# 52# Verify data after the test has been "shot" 53<verify> 54<strippart> 55s/^--------------------------[a-z0-9]*/------------------------------/ 56s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ 57</strippart> 58# Note that the stripping above removes 12 bytes from every occurrence of the 59# boundary string and since 5 of them are in the body contents, we see 60# (5*12) == 60 bytes less 61<protocol> 62POST /%TESTNUMBER HTTP/1.1 63Host: %HOSTIP:%HTTPPORT 64Accept: */* 65Transfer-Encoding: chunked 66Content-Type: multipart/form-data; boundary=---------------------------- 67Expect: 100-continue 68 69361 70------------------------------ 71Content-Disposition: form-data; name="fieldname" 72Content-Type: text/plain 73X-customheader-1: Header 1 data 74X-customheader-2: Header 2 data 75 76this is what we post to the silly web server 77------------------------------ 78Content-Disposition: form-data; name="fieldnam" 79 80uhis is what we post to the silly web serve 81------------------------------ 82Content-Disposition: form-data; name="multifile" 83Content-Type: multipart/mixed; boundary=---------------------------- 84 85------------------------------ 86Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 87Content-Type: application/octet-stream 88 89This is data from a file. 90 91------------------------------ 92Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 93Content-Type: text/whatever 94 95 96%if hyper 97A5 98%else 99a5 100%endif 101This is data from a file. 102 103------------------------------ 104Content-Disposition: attachment; filename="test%TESTNUMBER.filedata" 105Content-Type: text/whatever 106 107 108%if hyper 109AF 110%else 111af 112%endif 113This is data from a file. 114 115-------------------------------- 116 117------------------------------ 118Content-Disposition: form-data; name="filecontents" 119 120 121%if hyper 12210F 123%else 12410f 125%endif 126This is data from a file. 127 128------------------------------ 129Content-Disposition: form-data; name="formlength" 130 1311367 132------------------------------ 133Content-Disposition: form-data; name="standardinput" 134Content-Type: application/octet-stream 135 136 13716 138 Some data from stdin 139 14030 141 142-------------------------------- 143 1440 145 146</protocol> 147</verify> 148</testcase> 149