chiark / gitweb /
Import curl_7.56.1.orig.tar.gz
[curl.git] / tests / data / test1053
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\r
16 Date: Thu, 29 Jul 2008 14:49:00 GMT\r
17 Server: test-server/fake\r
18 Location: data/10530002.txt?coolsite=yes\r
19 Content-Length: 0\r
20 Connection: close\r
21 \r
22 </data>
23 <data2>
24 HTTP/1.1 200 OK swsclose\r
25 Date: Thu, 09 Nov 2010 14:49:00 GMT\r
26 Server: test-server/fake\r
27 Content-Length: 11\r
28 Connection: close\r
29 \r
30 blablabla
31
32 </data2>
33 <datacheck>
34 HTTP/1.1 307 Redirect swsclose\r
35 Date: Thu, 29 Jul 2008 14:49:00 GMT\r
36 Server: test-server/fake\r
37 Location: data/10530002.txt?coolsite=yes\r
38 Content-Length: 0\r
39 Connection: close\r
40 \r
41 HTTP/1.1 200 OK swsclose\r
42 Date: Thu, 09 Nov 2010 14:49:00 GMT\r
43 Server: test-server/fake\r
44 Content-Length: 11\r
45 Connection: close\r
46 \r
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\r
78 User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4\r
79 Host: %HOSTIP:%HTTPPORT\r
80 Accept: */*\r
81 Content-Length: 410\r
82 Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
83 \r
84 ------------------------------9ef8d6205763\r
85 Content-Disposition: form-data; name="name"\r
86 \r
87 daniel\r
88 ------------------------------9ef8d6205763\r
89 Content-Disposition: form-data; name="tool"\r
90 \r
91 curl\r
92 ------------------------------9ef8d6205763\r
93 Content-Disposition: form-data; name="file"; filename="test1053.txt"\r
94 Content-Type: text/plain\r
95 \r
96 foo-
97 This is a moo-
98 bar
99 \r
100 ------------------------------9ef8d6205763--\r
101 POST /we/want/data/10530002.txt?coolsite=yes HTTP/1.1\r
102 User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4\r
103 Host: %HOSTIP:%HTTPPORT\r
104 Accept: */*\r
105 Content-Length: 410\r
106 Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763\r
107 \r
108 ------------------------------9ef8d6205763\r
109 Content-Disposition: form-data; name="name"\r
110 \r
111 daniel\r
112 ------------------------------9ef8d6205763\r
113 Content-Disposition: form-data; name="tool"\r
114 \r
115 curl\r
116 ------------------------------9ef8d6205763\r
117 Content-Disposition: form-data; name="file"; filename="test1053.txt"\r
118 Content-Type: text/plain\r
119 \r
120 foo-
121 This is a moo-
122 bar
123 \r
124 ------------------------------9ef8d6205763--\r
125 </protocol>
126 </verify>
127 </testcase>