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