xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 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: Tue, 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 | <features> |
| 23 | Mime |
| 24 | </features> |
| 25 | <server> |
| 26 | http |
| 27 | </server> |
| 28 | <name> |
| 29 | Multipart formposting with backslash-escaping of name= and filename= |
| 30 | </name> |
| 31 | <command> |
| 32 | http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --form-escape -F name=daniel -F tool=curl --form-string "str1=@literal" --form-string "str2=<verbatim;type=xxx/yyy" -F "file=@log/test%TESTNUMBER.txt;type=moo/foobar;filename=fakerfile" -F file2=@log/test%TESTNUMBER.txt -F "file3=@\"log/test%TESTNUMBER.txt\";type=mo/foo;filename=\"f\\\\\\\\ak\\\\\\er,\\\\an\\d;.t\\\"xt\"" -F 'file4=@"log/test%TESTNUMBER.txt"; filename="A\\AA\"\"\\\"ZZZ"' |
| 33 | </command> |
| 34 | # We create this file before the command is invoked! |
| 35 | <file name="log/test%TESTNUMBER.txt"> |
| 36 | foo bar |
| 37 | This is a bar foo |
| 38 | bar |
| 39 | foo |
| 40 | </file> |
| 41 | </client> |
| 42 | |
| 43 | # Verify data after the test has been "shot" |
| 44 | <verify> |
| 45 | <strip> |
| 46 | ^(Content-Type: multipart/form-data;|-------).* |
| 47 | </strip> |
| 48 | <protocol> |
| 49 | POST /we/want/%TESTNUMBER HTTP/1.1
|
| 50 | Host: %HOSTIP:%HTTPPORT
|
| 51 | User-Agent: curl/%VERSION
|
| 52 | Accept: */*
|
| 53 | Content-Length: 1186
|
| 54 | Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
|
| 55 |
|
| 56 | ------------------------------24e78000bd32
|
| 57 | Content-Disposition: form-data; name="name"
|
| 58 |
|
| 59 | daniel
|
| 60 | ------------------------------24e78000bd32
|
| 61 | Content-Disposition: form-data; name="tool"
|
| 62 |
|
| 63 | curl
|
| 64 | ------------------------------24e78000bd32
|
| 65 | Content-Disposition: form-data; name="str1"
|
| 66 |
|
| 67 | @literal
|
| 68 | ------------------------------24e78000bd32
|
| 69 | Content-Disposition: form-data; name="str2"
|
| 70 |
|
| 71 | <verbatim;type=xxx/yyy
|
| 72 | ------------------------------24e78000bd32
|
| 73 | Content-Disposition: form-data; name="file"; filename="fakerfile"
|
| 74 | Content-Type: moo/foobar
|
| 75 |
|
| 76 | foo bar |
| 77 | This is a bar foo |
| 78 | bar |
| 79 | foo |
| 80 |
|
| 81 | ------------------------------24e78000bd32
|
| 82 | Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER.txt"
|
| 83 | Content-Type: text/plain
|
| 84 |
|
| 85 | foo bar |
| 86 | This is a bar foo |
| 87 | bar |
| 88 | foo |
| 89 |
|
| 90 | ------------------------------24e78000bd32
|
| 91 | Content-Disposition: form-data; name="file3"; filename="f\\\\ak\\\\er,\\an\\d;.t\"xt"
|
| 92 | Content-Type: mo/foo
|
| 93 |
|
| 94 | foo bar |
| 95 | This is a bar foo |
| 96 | bar |
| 97 | foo |
| 98 |
|
| 99 | ------------------------------24e78000bd32
|
| 100 | Content-Disposition: form-data; name="file4"; filename="A\\AA\"\"\\\"ZZZ"
|
| 101 | Content-Type: text/plain
|
| 102 |
|
| 103 | foo bar |
| 104 | This is a bar foo |
| 105 | bar |
| 106 | foo |
| 107 |
|
| 108 | ------------------------------24e78000bd32--
|
| 109 | </protocol> |
| 110 | </verify> |
| 111 | </testcase> |