lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | <testcase> |
| 2 | # Based on test 9 |
| 3 | <info> |
| 4 | <keywords> |
| 5 | HTTP |
| 6 | HTTP FORMPOST |
| 7 | HTTP file upload |
| 8 | followlocation |
| 9 | </keywords> |
| 10 | </info> |
| 11 | |
| 12 | # Server-side |
| 13 | <reply> |
| 14 | <data> |
| 15 | HTTP/1.1 307 Redirect swsclose
|
| 16 | Date: Thu, 29 Jul 2008 14:49:00 GMT
|
| 17 | Server: test-server/fake
|
| 18 | Location: data/10530002.txt?coolsite=yes
|
| 19 | Content-Length: 0
|
| 20 | Connection: close
|
| 21 |
|
| 22 | </data> |
| 23 | <data2> |
| 24 | HTTP/1.1 200 OK swsclose
|
| 25 | Date: Thu, 09 Nov 2010 14:49:00 GMT
|
| 26 | Server: test-server/fake
|
| 27 | Content-Length: 11
|
| 28 | Connection: close
|
| 29 |
|
| 30 | blablabla |
| 31 | |
| 32 | </data2> |
| 33 | <datacheck> |
| 34 | HTTP/1.1 307 Redirect swsclose
|
| 35 | Date: Thu, 29 Jul 2008 14:49:00 GMT
|
| 36 | Server: test-server/fake
|
| 37 | Location: data/10530002.txt?coolsite=yes
|
| 38 | Content-Length: 0
|
| 39 | Connection: close
|
| 40 |
|
| 41 | HTTP/1.1 200 OK swsclose
|
| 42 | Date: Thu, 09 Nov 2010 14:49:00 GMT
|
| 43 | Server: test-server/fake
|
| 44 | Content-Length: 11
|
| 45 | Connection: close
|
| 46 |
|
| 47 | blablabla |
| 48 | |
| 49 | </datacheck> |
| 50 | </reply> |
| 51 | |
| 52 | # Client-side |
| 53 | <client> |
| 54 | <server> |
| 55 | http |
| 56 | </server> |
| 57 | <name> |
| 58 | HTTP RFC1867-type formposting from file with Location: following |
| 59 | </name> |
| 60 | <command> |
| 61 | http://%HOSTIP:%HTTPPORT/we/want/1053 -L -F name=daniel -F tool=curl -F file=@log/test1053.txt |
| 62 | </command> |
| 63 | # We create this file before the command is invoked! |
| 64 | <file name="log/test1053.txt"> |
| 65 | foo- |
| 66 | This is a moo- |
| 67 | bar |
| 68 | </file> |
| 69 | </client> |
| 70 | |
| 71 | # Verify data after the test has been "shot" |
| 72 | <verify> |
| 73 | <strip> |
| 74 | ^(User-Agent:|Content-Type: multipart/form-data;|------------).* |
| 75 | </strip> |
| 76 | <protocol> |
| 77 | POST /we/want/1053 HTTP/1.1
|
| 78 | User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
| 79 | Host: %HOSTIP:%HTTPPORT
|
| 80 | Accept: */*
|
| 81 | Content-Length: 410
|
| 82 | Expect: 100-continue
|
| 83 | Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
|
| 84 |
|
| 85 | ------------------------------9ef8d6205763
|
| 86 | Content-Disposition: form-data; name="name"
|
| 87 |
|
| 88 | daniel
|
| 89 | ------------------------------9ef8d6205763
|
| 90 | Content-Disposition: form-data; name="tool"
|
| 91 |
|
| 92 | curl
|
| 93 | ------------------------------9ef8d6205763
|
| 94 | Content-Disposition: form-data; name="file"; filename="test1053.txt"
|
| 95 | Content-Type: text/plain
|
| 96 |
|
| 97 | foo- |
| 98 | This is a moo- |
| 99 | bar |
| 100 |
|
| 101 | ------------------------------9ef8d6205763--
|
| 102 | POST /we/want/data/10530002.txt?coolsite=yes HTTP/1.1
|
| 103 | User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
| 104 | Host: %HOSTIP:%HTTPPORT
|
| 105 | Accept: */*
|
| 106 | Content-Length: 410
|
| 107 | Expect: 100-continue
|
| 108 | Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
|
| 109 |
|
| 110 | ------------------------------9ef8d6205763
|
| 111 | Content-Disposition: form-data; name="name"
|
| 112 |
|
| 113 | daniel
|
| 114 | ------------------------------9ef8d6205763
|
| 115 | Content-Disposition: form-data; name="tool"
|
| 116 |
|
| 117 | curl
|
| 118 | ------------------------------9ef8d6205763
|
| 119 | Content-Disposition: form-data; name="file"; filename="test1053.txt"
|
| 120 | Content-Type: text/plain
|
| 121 |
|
| 122 | foo- |
| 123 | This is a moo- |
| 124 | bar |
| 125 |
|
| 126 | ------------------------------9ef8d6205763--
|
| 127 | </protocol> |
| 128 | </verify> |
| 129 | </testcase> |