1<testcase> 2<info> 3<keywords> 4HTTP 5HTTP POST 6</keywords> 7</info> 8 9# 10# Server-side 11<reply> 12<data> 13HTTP/1.1 200 OK 14Date: Thu, 09 Nov 2010 14:49:00 GMT 15Server: test-server/fake swsclose 16Connection: close 17Content-Type: text/html 18 19hello 20</data> 21<datacheck> 22HTTP/1.1 200 OK 23Date: Thu, 09 Nov 2010 14:49:00 GMT 24Server: test-server/fake swsclose 25Connection: close 26Content-Type: text/html 27 28hello 29HTTP/1.1 200 OK 30Date: Thu, 09 Nov 2010 14:49:00 GMT 31Server: test-server/fake swsclose 32Connection: close 33Content-Type: text/html 34 35hello 36</datacheck> 37</reply> 38 39# Client-side 40<client> 41<server> 42http 43</server> 44# tool is what to use instead of 'curl' 45<tool> 46lib554 47</tool> 48 49 <name> 50HTTP multi-part formpost using read callback for the file part 51 </name> 52 <command> 53http://%HOSTIP:%HTTPPORT/554 54</command> 55</client> 56 57# 58# Verify data after the test has been "shot" 59<verify> 60<strippart> 61s/^--------------------------[a-z0-9]*/------------------------------/ 62s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ 63</strippart> 64# Note that the stripping above removes 12 bytes from every occurrence of the 65# boundary string and since 5 of them are in the body contents, we see 66# (5*12) == 60 bytes less 67<protocol> 68POST /554 HTTP/1.1 69Host: %HOSTIP:%HTTPPORT 70Accept: */* 71Content-Length: 744 72Content-Type: multipart/form-data; boundary=---------------------------- 73 74------------------------------ 75Content-Disposition: form-data; name="sendfile"; filename="postit2.c" 76 77this is what we post to the silly web server 78 79------------------------------ 80Content-Disposition: form-data; name="callbackdata" 81 82this is what we post to the silly web server 83 84------------------------------ 85Content-Disposition: form-data; name="filename" 86 87postit2.c 88------------------------------ 89Content-Disposition: form-data; name="submit" 90Content-Type: text/plain 91 92send 93------------------------------ 94Content-Disposition: form-data; name="somename"; filename="somefile.txt" 95Content-Type: text/plain 96 97blah blah 98-------------------------------- 99POST /554 HTTP/1.1 100Host: %HOSTIP:%HTTPPORT 101Accept: */* 102Content-Length: 758 103Content-Type: multipart/form-data; boundary=---------------------------- 104 105------------------------------ 106Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2" 107 108this is what we post to the silly web server 109 110------------------------------ 111Content-Disposition: form-data; name="callbackdata" 112 113this is what we post to the silly web server 114 115------------------------------ 116Content-Disposition: form-data; name="filename" 117 118postit2.c 119------------------------------ 120Content-Disposition: form-data; name="submit" 121Content-Type: text/plain 122 123send 124------------------------------ 125Content-Disposition: form-data; name="somename"; filename="somefile.txt" 126Content-Type: text/plain 127 128blah blah 129-------------------------------- 130</protocol> 131</verify> 132</testcase> 133