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