| 1 |
<testcase> |
| 2 |
# Based on tests 186 and 1053 |
| 3 |
<info> |
| 4 |
<keywords> |
| 5 |
HTTP |
| 6 |
HTTP FORMPOST |
| 7 |
HTTP file upload |
| 8 |
</keywords> |
| 9 |
</info> |
| 10 |
|
| 11 |
# Server-side |
| 12 |
<reply> |
| 13 |
<data> |
| 14 |
HTTP/1.1 200 OK |
| 15 |
Date: Thu, 29 Jul 2008 14:49:00 GMT |
| 16 |
Server: test-server/fake |
| 17 |
Content-Length: 0 |
| 18 |
Connection: close |
| 19 |
|
| 20 |
</data> |
| 21 |
</reply> |
| 22 |
|
| 23 |
# Client-side |
| 24 |
<client> |
| 25 |
<server> |
| 26 |
http |
| 27 |
</server> |
| 28 |
<name> |
| 29 |
HTTP RFC1867-type formposting - -F with three files, one with explicit type |
| 30 |
</name> |
| 31 |
<command> |
| 32 |
http://%HOSTIP:%HTTPPORT/we/want/1315 -F name=value -F 'file=@log/test1315.txt,log/test1315.txt;type=magic/content,log/test1315.txt' |
| 33 |
</command> |
| 34 |
# We create this file before the command is invoked! |
| 35 |
<file name="log/test1315.txt"> |
| 36 |
dummy data |
| 37 |
</file> |
| 38 |
</client> |
| 39 |
|
| 40 |
# Verify data after the test has been "shot" |
| 41 |
<verify> |
| 42 |
<strip> |
| 43 |
(^User-Agent:.*|-----+\w+) |
| 44 |
</strip> |
| 45 |
<protocol> |
| 46 |
POST /we/want/1315 HTTP/1.1 |
| 47 |
User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4 |
| 48 |
Host: %HOSTIP:%HTTPPORT |
| 49 |
Accept: */* |
| 50 |
Content-Length: 797 |
| 51 |
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 |
| 52 |
|
| 53 |
------------------------------9ef8d6205763 |
| 54 |
Content-Disposition: form-data; name="name" |
| 55 |
|
| 56 |
value |
| 57 |
------------------------------9ef8d6205763 |
| 58 |
Content-Disposition: form-data; name="file" |
| 59 |
Content-Type: multipart/mixed; boundary=----------------------------aaaaaaaaaaaa |
| 60 |
|
| 61 |
Content-Disposition: attachment; filename="test1315.txt" |
| 62 |
Content-Type: text/plain |
| 63 |
|
| 64 |
dummy data |
| 65 |
|
| 66 |
------------------------------9ef8d6205763 |
| 67 |
Content-Disposition: attachment; filename="test1315.txt" |
| 68 |
Content-Type: magic/content |
| 69 |
|
| 70 |
dummy data |
| 71 |
|
| 72 |
------------------------------9ef8d6205763 |
| 73 |
Content-Disposition: attachment; filename="test1315.txt" |
| 74 |
Content-Type: text/plain |
| 75 |
|
| 76 |
dummy data |
| 77 |
|
| 78 |
------------------------------aaaaaaaaaaaa-- |
| 79 |
|
| 80 |
------------------------------9ef8d6205763-- |
| 81 |
</protocol> |
| 82 |
</verify> |
| 83 |
</testcase> |