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 filename containing '"' |
| 30 | </name> |
| 31 | <command> |
| 32 | http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --form-escape -F "file=@\"log/test%TESTNUMBER\\\".txt\";type=mo/foo;filename=\"test%TESTNUMBER\\\".txt\"" -F 'file2=@"log/test%TESTNUMBER\".txt"' -F 'file3=@"log/test%TESTNUMBER\".txt";type=m/f,"log/test%TESTNUMBER\".txt"' |
| 33 | </command> |
| 34 | <precheck> |
| 35 | perl -e "print 'Test requires a system supporting double quotes in file names' if ($^O eq 'msys');" |
| 36 | </precheck> |
| 37 | # We create this file before the command is invoked! |
| 38 | <file name=log/test%TESTNUMBER".txt> |
| 39 | foo bar |
| 40 | This is a bar foo |
| 41 | bar |
| 42 | foo |
| 43 | </file> |
| 44 | </client> |
| 45 | |
| 46 | # Verify data after the test has been "shot" |
| 47 | <verify> |
| 48 | <strip> |
| 49 | ^(Content-Type: multipart/form-data;|Content-Type: multipart/mixed; boundary=|-------).* |
| 50 | </strip> |
| 51 | <protocol> |
| 52 | POST /we/want/%TESTNUMBER HTTP/1.1
|
| 53 | Host: %HOSTIP:%HTTPPORT
|
| 54 | User-Agent: curl/%VERSION
|
| 55 | Accept: */*
|
| 56 | Content-Length: 954
|
| 57 | Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
|
| 58 |
|
| 59 | ------------------------------24e78000bd32
|
| 60 | Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER\".txt"
|
| 61 | Content-Type: mo/foo
|
| 62 |
|
| 63 | foo bar |
| 64 | This is a bar foo |
| 65 | bar |
| 66 | foo |
| 67 |
|
| 68 | ------------------------------24e78000bd32
|
| 69 | Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER\".txt"
|
| 70 | Content-Type: text/plain
|
| 71 |
|
| 72 | foo bar |
| 73 | This is a bar foo |
| 74 | bar |
| 75 | foo |
| 76 |
|
| 77 | ------------------------------24e78000bd32
|
| 78 | Content-Disposition: form-data; name="file3"
|
| 79 | Content-Type: multipart/mixed; boundary=----------------------------7f0e85a48b0b
|
| 80 |
|
| 81 | Content-Disposition: attachment; filename="test%TESTNUMBER\".txt"
|
| 82 | Content-Type: m/f
|
| 83 |
|
| 84 | foo bar |
| 85 | This is a bar foo |
| 86 | bar |
| 87 | foo |
| 88 |
|
| 89 | Content-Disposition: attachment; filename="test%TESTNUMBER\".txt"
|
| 90 | Content-Type: text/plain
|
| 91 |
|
| 92 | foo bar |
| 93 | This is a bar foo |
| 94 | bar |
| 95 | foo |
| 96 |
|
| 97 |
|
| 98 | ------------------------------24e78000bd32--
|
| 99 | </protocol> |
| 100 | </verify> |
| 101 | </testcase> |