xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 1 | <testcase> |
| 2 | <info> |
| 3 | <keywords> |
| 4 | HTTP |
| 5 | HTTP POST |
| 6 | HTTP MIME POST |
| 7 | </keywords> |
| 8 | </info> |
| 9 | |
| 10 | # |
| 11 | # Server-side |
| 12 | <reply> |
| 13 | <data> |
| 14 | HTTP/1.1 200 OK
|
| 15 | Date: Tue, 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 | <datacheck> |
| 23 | HTTP/1.1 200 OK
|
| 24 | Date: Tue, 09 Nov 2010 14:49:00 GMT
|
| 25 | Server: test-server/fake swsclose
|
| 26 | Connection: close
|
| 27 | Content-Type: text/html
|
| 28 |
|
| 29 | hello |
| 30 | HTTP/1.1 200 OK
|
| 31 | Date: Tue, 09 Nov 2010 14:49:00 GMT
|
| 32 | Server: test-server/fake swsclose
|
| 33 | Connection: close
|
| 34 | Content-Type: text/html
|
| 35 |
|
| 36 | hello |
| 37 | </datacheck> |
| 38 | </reply> |
| 39 | |
| 40 | # Client-side |
| 41 | <client> |
| 42 | <features> |
| 43 | Mime |
| 44 | </features> |
| 45 | <server> |
| 46 | http |
| 47 | </server> |
| 48 | # tool is what to use instead of 'curl' |
| 49 | <tool> |
| 50 | lib%TESTNUMBER |
| 51 | </tool> |
| 52 | |
| 53 | <name> |
| 54 | HTTP multi-part chunked mimepost using read callback for the file part |
| 55 | </name> |
| 56 | <command> |
| 57 | http://%HOSTIP:%HTTPPORT/%TESTNUMBER |
| 58 | </command> |
| 59 | </client> |
| 60 | |
| 61 | # |
| 62 | # Verify data after the test has been "shot" |
| 63 | <verify> |
| 64 | <strippart> |
| 65 | s/^--------------------------[a-z0-9]*/------------------------------/ |
| 66 | s/boundary=------------------------[a-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> |
| 72 | POST /%TESTNUMBER HTTP/1.1
|
| 73 | Host: %HOSTIP:%HTTPPORT
|
| 74 | Accept: */*
|
| 75 | Transfer-Encoding: chunked
|
| 76 | Content-Type: multipart/form-data; boundary=----------------------------
|
| 77 | Expect: 100-continue
|
| 78 |
|
| 79 | 76
|
| 80 | ------------------------------
|
| 81 | Content-Disposition: form-data; name="sendfile"; filename="postit2.c"
|
| 82 |
|
| 83 | d
|
| 84 | 1
|
| 85 | u
|
| 86 | 1
|
| 87 | m
|
| 88 | 1
|
| 89 | m
|
| 90 | 1
|
| 91 | y
|
| 92 | 1
|
| 93 | |
| 94 |
|
| 95 | 65
|
| 96 |
|
| 97 | ------------------------------
|
| 98 | Content-Disposition: form-data; name="callbackdata"
|
| 99 |
|
| 100 |
|
| 101 | 1
|
| 102 | d
|
| 103 | 1
|
| 104 | u
|
| 105 | 1
|
| 106 | m
|
| 107 | 1
|
| 108 | m
|
| 109 | 1
|
| 110 | y
|
| 111 | 1
|
| 112 | |
| 113 |
|
| 114 | %if hyper |
| 115 | 19A
|
| 116 | %else |
| 117 | 19a
|
| 118 | %endif |
| 119 |
|
| 120 | ------------------------------
|
| 121 | Content-Disposition: form-data; name="filename"
|
| 122 |
|
| 123 | postit2.c
|
| 124 | ------------------------------
|
| 125 | Content-Disposition: form-data; name="submit"
|
| 126 |
|
| 127 | send
|
| 128 | ------------------------------
|
| 129 | Content-Disposition: form-data; name="somename"; filename="somefile.txt"
|
| 130 | Content-Type: text/plain
|
| 131 |
|
| 132 | blah blah
|
| 133 | --------------------------------
|
| 134 |
|
| 135 | 0
|
| 136 |
|
| 137 | POST /%TESTNUMBER HTTP/1.1
|
| 138 | Host: %HOSTIP:%HTTPPORT
|
| 139 | Accept: */*
|
| 140 | Transfer-Encoding: chunked
|
| 141 | Content-Type: multipart/form-data; boundary=----------------------------
|
| 142 | Expect: 100-continue
|
| 143 |
|
| 144 | 84
|
| 145 | ------------------------------
|
| 146 | Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"
|
| 147 |
|
| 148 | d
|
| 149 | 1
|
| 150 | u
|
| 151 | 1
|
| 152 | m
|
| 153 | 1
|
| 154 | m
|
| 155 | 1
|
| 156 | y
|
| 157 | 1
|
| 158 | |
| 159 |
|
| 160 | 65
|
| 161 |
|
| 162 | ------------------------------
|
| 163 | Content-Disposition: form-data; name="callbackdata"
|
| 164 |
|
| 165 |
|
| 166 | 1
|
| 167 | d
|
| 168 | 1
|
| 169 | u
|
| 170 | 1
|
| 171 | m
|
| 172 | 1
|
| 173 | m
|
| 174 | 1
|
| 175 | y
|
| 176 | 1
|
| 177 | |
| 178 |
|
| 179 | %if hyper |
| 180 | 19A
|
| 181 | %else |
| 182 | 19a
|
| 183 | %endif |
| 184 |
|
| 185 | ------------------------------
|
| 186 | Content-Disposition: form-data; name="filename"
|
| 187 |
|
| 188 | postit2.c
|
| 189 | ------------------------------
|
| 190 | Content-Disposition: form-data; name="submit"
|
| 191 |
|
| 192 | send
|
| 193 | ------------------------------
|
| 194 | Content-Disposition: form-data; name="somename"; filename="somefile.txt"
|
| 195 | Content-Type: text/plain
|
| 196 |
|
| 197 | blah blah
|
| 198 | --------------------------------
|
| 199 |
|
| 200 | 0
|
| 201 |
|
| 202 | </protocol> |
| 203 | </verify> |
| 204 | </testcase> |