1 <testcase> 2 <info> 3 <keywords> 4 HTTP 5 HTTP POST 6 FORM 7 </keywords> 8 </info> 9 10 # 11 # Server-side 12 <reply> 13 <data> 14 HTTP/1.1 200 OK 15 Date: Thu, 09 Nov 2010 14:49:00 GMT 16 Server: test-server/fake swsclose 17 Connection: close 18 Content-Type: text/html 19 20 hello 21 </data> 22 </reply> 23 24 # Client-side 25 <client> 26 <server> 27 http 28 </server> 29 # tool is what to use instead of 'curl' 30 <tool> 31 lib650 32 </tool> 33 34 <name> 35 HTTP formpost using form API 36 </name> 37 <stdin> 38 Some data from stdin 39 </stdin> 40 <command> 41 http://%HOSTIP:%HTTPPORT/650 log/test650.filedata 42 </command> 43 <file name="log/test650.filedata"> 44 This is data from a file. 45 </file> 46 </client> 47 48 # 49 # Verify data after the test has been "shot" 50 <verify> 51 <strippart> 52 s/^--------------------------[a-z0-9]*/------------------------------/ 53 s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ 54 </strippart> 55 # Note that the stripping above removes 12 bytes from every occurrence of the 56 # boundary string and since 5 of them are in the body contents, we see 57 # (5*12) == 60 bytes less 58 <protocol> 59 POST /650 HTTP/1.1 60 Host: %HOSTIP:%HTTPPORT 61 Accept: */* 62 Transfer-Encoding: chunked 63 Content-Type: multipart/form-data; boundary=---------------------------- 64 Expect: 100-continue 65 66 60a 67 ------------------------------ 68 Content-Disposition: form-data; name="fieldname" 69 Content-Type: text/plain 70 X-customheader-1: Header 1 data 71 X-customheader-2: Header 2 data 72 73 this is what we post to the silly web server 74 ------------------------------ 75 Content-Disposition: form-data; name="fieldnam" 76 77 uhis is what we post to the silly web serve 78 ------------------------------ 79 Content-Disposition: form-data; name="multifile" 80 Content-Type: multipart/mixed; boundary=---------------------------- 81 82 ------------------------------ 83 Content-Disposition: attachment; filename="test650.filedata" 84 Content-Type: application/octet-stream 85 86 This is data from a file. 87 88 ------------------------------ 89 Content-Disposition: attachment; filename="test650.filedata" 90 Content-Type: text/whatever 91 92 This is data from a file. 93 94 ------------------------------ 95 Content-Disposition: attachment; filename="test650.filedata" 96 Content-Type: text/whatever 97 98 This is data from a file. 99 100 -------------------------------- 101 102 ------------------------------ 103 Content-Disposition: form-data; name="filecontents" 104 105 This is data from a file. 106 107 ------------------------------ 108 Content-Disposition: form-data; name="formlength" 109 110 1367 111 ------------------------------ 112 Content-Disposition: form-data; name="standardinput" 113 Content-Type: application/octet-stream 114 115 Some data from stdin 116 117 -------------------------------- 118 119 0 120 121 </protocol> 122 </verify> 123 </testcase> 124