xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 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: Tue, 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: Tue, 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: Tue, 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 | <features> |
| 42 | Mime |
| 43 | </features> |
| 44 | <server> |
| 45 | http |
| 46 | </server> |
| 47 | # tool is what to use instead of 'curl' |
| 48 | <tool> |
| 49 | lib%TESTNUMBER |
| 50 | </tool> |
| 51 | |
| 52 | <name> |
| 53 | HTTP multi-part formpost using read callback for the file part |
| 54 | </name> |
| 55 | <command> |
| 56 | http://%HOSTIP:%HTTPPORT/%TESTNUMBER |
| 57 | </command> |
| 58 | </client> |
| 59 | |
| 60 | # |
| 61 | # Verify data after the test has been "shot" |
| 62 | <verify> |
| 63 | <strippart> |
| 64 | s/^--------------------------[a-z0-9]*/------------------------------/ |
| 65 | s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ |
| 66 | </strippart> |
| 67 | # Note that the stripping above removes 12 bytes from every occurrence of the |
| 68 | # boundary string and since 5 of them are in the body contents, we see |
| 69 | # (5*12) == 60 bytes less |
| 70 | <protocol> |
| 71 | POST /%TESTNUMBER HTTP/1.1
|
| 72 | Host: %HOSTIP:%HTTPPORT
|
| 73 | Accept: */*
|
| 74 | Content-Length: 744
|
| 75 | Content-Type: multipart/form-data; boundary=----------------------------
|
| 76 |
|
| 77 | ------------------------------
|
| 78 | Content-Disposition: form-data; name="sendfile"; filename="postit2.c"
|
| 79 |
|
| 80 | this is what we post to the silly web server |
| 81 |
|
| 82 | ------------------------------
|
| 83 | Content-Disposition: form-data; name="callbackdata"
|
| 84 |
|
| 85 | this is what we post to the silly web server |
| 86 |
|
| 87 | ------------------------------
|
| 88 | Content-Disposition: form-data; name="filename"
|
| 89 |
|
| 90 | postit2.c
|
| 91 | ------------------------------
|
| 92 | Content-Disposition: form-data; name="submit"
|
| 93 | Content-Type: text/plain
|
| 94 |
|
| 95 | send
|
| 96 | ------------------------------
|
| 97 | Content-Disposition: form-data; name="somename"; filename="somefile.txt"
|
| 98 | Content-Type: text/plain
|
| 99 |
|
| 100 | blah blah
|
| 101 | --------------------------------
|
| 102 | POST /%TESTNUMBER HTTP/1.1
|
| 103 | Host: %HOSTIP:%HTTPPORT
|
| 104 | Accept: */*
|
| 105 | Content-Length: 758
|
| 106 | Content-Type: multipart/form-data; boundary=----------------------------
|
| 107 |
|
| 108 | ------------------------------
|
| 109 | Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"
|
| 110 |
|
| 111 | this is what we post to the silly web server |
| 112 |
|
| 113 | ------------------------------
|
| 114 | Content-Disposition: form-data; name="callbackdata"
|
| 115 |
|
| 116 | this is what we post to the silly web server |
| 117 |
|
| 118 | ------------------------------
|
| 119 | Content-Disposition: form-data; name="filename"
|
| 120 |
|
| 121 | postit2.c
|
| 122 | ------------------------------
|
| 123 | Content-Disposition: form-data; name="submit"
|
| 124 | Content-Type: text/plain
|
| 125 |
|
| 126 | send
|
| 127 | ------------------------------
|
| 128 | Content-Disposition: form-data; name="somename"; filename="somefile.txt"
|
| 129 | Content-Type: text/plain
|
| 130 |
|
| 131 | blah blah
|
| 132 | --------------------------------
|
| 133 | </protocol> |
| 134 | </verify> |
| 135 | </testcase> |