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 occurance 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: 718 72 Expect: 100-continue 73 Content-Type: multipart/form-data; boundary=---------------------------- 74 75 ------------------------------ 76 Content-Disposition: form-data; name="sendfile"; filename="postit2.c" 77 78 this is what we post to the silly web server 79 80 ------------------------------ 81 Content-Disposition: form-data; name="callbackdata" 82 83 this is what we post to the silly web server 84 85 ------------------------------ 86 Content-Disposition: form-data; name="filename" 87 88 postit2.c 89 ------------------------------ 90 Content-Disposition: form-data; name="submit" 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: 732 103 Expect: 100-continue 104 Content-Type: multipart/form-data; boundary=---------------------------- 105 106 ------------------------------ 107 Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2" 108 109 this is what we post to the silly web server 110 111 ------------------------------ 112 Content-Disposition: form-data; name="callbackdata" 113 114 this is what we post to the silly web server 115 116 ------------------------------ 117 Content-Disposition: form-data; name="filename" 118 119 postit2.c 120 ------------------------------ 121 Content-Disposition: form-data; name="submit" 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