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