| 1 |
<testcase> |
| 2 |
<info> |
| 3 |
<keywords> |
| 4 |
HTTP |
| 5 |
HTTP FORMPOST |
| 6 |
</keywords> |
| 7 |
</info> |
| 8 |
# Server-side |
| 9 |
<reply> |
| 10 |
<data> |
| 11 |
HTTP/1.1 200 OK |
| 12 |
Date: Thu, 09 Nov 2010 14:49:00 GMT |
| 13 |
Server: test-server/fake |
| 14 |
Content-Length: 10 |
| 15 |
|
| 16 |
blablabla |
| 17 |
</data> |
| 18 |
</reply> |
| 19 |
|
| 20 |
# Client-side |
| 21 |
<client> |
| 22 |
<server> |
| 23 |
http |
| 24 |
</server> |
| 25 |
<name> |
| 26 |
HTTP RFC1867-type formposting with filename/data contains ',', ';', '"' |
| 27 |
</name> |
| 28 |
<command> |
| 29 |
http://%HOSTIP:%HTTPPORT/we/want/1133 -F "file=@\"log/test1133,and;.txt\";type=mo/foo;filename=\"faker,and;.txt\"" -F 'file2=@"log/test1133,and;.txt"' -F 'file3=@"log/test1133,and;.txt";type=m/f,"log/test1133,and;.txt"' -F a="{\"field1\":\"value1\",\"field2\":\"value2\"}" -F 'b=" \\value1;type=\"whatever\" "; type=text/foo; charset=utf-8 ; filename=param_b' |
| 30 |
</command> |
| 31 |
# We create this file before the command is invoked! |
| 32 |
<file name="log/test1133,and;.txt"> |
| 33 |
foo bar |
| 34 |
This is a bar foo |
| 35 |
bar |
| 36 |
foo |
| 37 |
</file> |
| 38 |
</client> |
| 39 |
|
| 40 |
# Verify data after the test has been "shot" |
| 41 |
<verify> |
| 42 |
<strip> |
| 43 |
^(User-Agent:|Content-Type: multipart/form-data;|Content-Type: multipart/mixed; boundary=|-------).* |
| 44 |
</strip> |
| 45 |
<protocol> |
| 46 |
POST /we/want/1133 HTTP/1.1 |
| 47 |
User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3 |
| 48 |
Host: %HOSTIP:%HTTPPORT |
| 49 |
Accept: */* |
| 50 |
Content-Length: 1264 |
| 51 |
Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32 |
| 52 |
|
| 53 |
------------------------------24e78000bd32 |
| 54 |
Content-Disposition: form-data; name="file"; filename="faker,and;.txt" |
| 55 |
Content-Type: mo/foo |
| 56 |
|
| 57 |
foo bar |
| 58 |
This is a bar foo |
| 59 |
bar |
| 60 |
foo |
| 61 |
|
| 62 |
------------------------------24e78000bd32 |
| 63 |
Content-Disposition: form-data; name="file2"; filename="test1133,and;.txt" |
| 64 |
Content-Type: text/plain |
| 65 |
|
| 66 |
foo bar |
| 67 |
This is a bar foo |
| 68 |
bar |
| 69 |
foo |
| 70 |
|
| 71 |
------------------------------24e78000bd32 |
| 72 |
Content-Disposition: form-data; name="file3" |
| 73 |
Content-Type: multipart/mixed; boundary=----------------------------7f0e85a48b0b |
| 74 |
|
| 75 |
Content-Disposition: attachment; filename="test1133,and;.txt" |
| 76 |
Content-Type: m/f |
| 77 |
|
| 78 |
foo bar |
| 79 |
This is a bar foo |
| 80 |
bar |
| 81 |
foo |
| 82 |
|
| 83 |
Content-Disposition: attachment; filename="test1133,and;.txt" |
| 84 |
Content-Type: text/plain |
| 85 |
|
| 86 |
foo bar |
| 87 |
This is a bar foo |
| 88 |
bar |
| 89 |
foo |
| 90 |
|
| 91 |
|
| 92 |
Content-Disposition: form-data; name="a" |
| 93 |
|
| 94 |
{"field1":"value1","field2":"value2"} |
| 95 |
Content-Disposition: form-data; name="b"; filename="param_b" |
| 96 |
Content-Type: text/foo; charset=utf-8 |
| 97 |
|
| 98 |
\value1;type="whatever" |
| 99 |
------------------------------24e78000bd32-- |
| 100 |
</protocol> |
| 101 |
</verify> |
| 102 |
</testcase> |