blob: 6dfd2d268d16fea42cbeb121985ca413deda0482 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001<testcase>
2<info>
3<keywords>
4HTTP
5HTTP GET
6cookies
7cookiejar
8</keywords>
9</info>
10# Server-side
11#
12# The cookies set come in two versions. This is because when curl is built
13# with Hyper, the API provides the headers already "sanitized" so we cannot
14# compapare with the exact server contents unlesss it too sends the data
15# "clean".
16
17<reply>
18<data>
19HTTP/1.1 200 OK
20Date: Tue, 09 Nov 2010 14:49:00 GMT
21Server: test-server/fake
22Content-Length: 4
23Content-Type: text/html
24Funny-head: yesyes
25Set-Cookie: blankdomain=sure; domain=; path=/
26%if !hyper
27Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
28Set-Cookie:ismatch=this ; domain=test31.curl; path=/silly/
29Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
30Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
31Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
32Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
33Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
34Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
35Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
36Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
37Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
38Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
39Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
40Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
41Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
42Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
43Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
44Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
45Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
46Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
47Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
48Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
49Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
50Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
51Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
52Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
53Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
54Set-Cookie:eat=this; domain=moo.foo.moo;
55Set-Cookie: eat=this-too; domain=.foo.moo;
56Set-Cookie: nodomainnovalue
57Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
58Set-Cookie: novalue; domain=reallysilly
59Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
60Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
61Set-Cookie: magic=yessir; path=/silly/; HttpOnly
62Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
63Set-Cookie: partialip=nono; domain=.0.0.1;
64Set-Cookie: withspaces= yes within and around ;
65Set-Cookie: withspaces2 =before equals;
66Set-Cookie: prespace= yes before;
67Set-Cookie: securewithspace=after ; secure =
68%else
69Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
70Set-Cookie: ismatch=this ; domain=test31.curl; path=/silly/
71Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
72Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
73Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
74Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
75Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
76Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
77Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
78Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
79Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
80Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
81Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
82Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
83Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
84Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
85Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
86Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
87Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
88Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
89Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
90Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
91Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
92Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
93Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
94Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
95Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
96Set-Cookie: eat=this; domain=moo.foo.moo;
97Set-Cookie: eat=this-too; domain=.foo.moo;
98Set-Cookie: nodomainnovalue
99Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
100Set-Cookie: novalue; domain=reallysilly
101Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
102Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
103Set-Cookie: magic=yessir; path=/silly/; HttpOnly
104Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
105Set-Cookie: partialip=nono; domain=.0.0.1;
106Set-Cookie: withspaces= yes within and around ;
107Set-Cookie: withspaces2 =before equals;
108Set-Cookie: prespace= yes before;
109Set-Cookie: securewithspace=after ; secure =
110%endif
111
112boo
113</data>
114</reply>
115
116# Client-side
117<client>
118<server>
119http
120</server>
121 <name>
122HTTP with weirdly formatted cookies and cookiejar storage
123 </name>
124# Explicitly set the time zone to a known good one, in case the user is
125# using one of the 'right' zones that take into account leap seconds
126# which causes the cookie expiry times to be different.
127<setenv>
128TZ=GMT
129</setenv>
130 <command>
131http://test31.curl:%HTTPPORT/we/want/%TESTNUMBER -b none -c log/jar%TESTNUMBER.txt --resolve test31.curl:%HTTPPORT:127.0.0.1
132</command>
133<precheck>
134perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
135</precheck>
136</client>
137
138# Verify data after the test has been "shot"
139<verify>
140<protocol>
141GET /we/want/%TESTNUMBER HTTP/1.1
142Host: test31.curl:%HTTPPORT
143User-Agent: curl/%VERSION
144Accept: */*
145
146</protocol>
147<file name="log/jar%TESTNUMBER.txt" mode="text">
148# Netscape HTTP Cookie File
149# https://curl.se/docs/http-cookies.html
150# This file was generated by libcurl! Edit at your own risk.
151
152test31.curl FALSE /we/want/ FALSE 0 prespace yes before
153test31.curl FALSE /we/want/ FALSE 0 withspaces2 before equals
154test31.curl FALSE /we/want/ FALSE 0 withspaces yes within and around
155.test31.curl TRUE /we/want/ FALSE 0 blexp yesyes
156#HttpOnly_test31.curl FALSE /silly/ FALSE 0 magic yessir
157test31.curl FALSE /we/want/ FALSE 2118138987 nodomain value
158.test31.curl TRUE / FALSE 0 partmatch present
159#HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httponly myvalue1
160#HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httpo4 value4
161#HttpOnly_.test31.curl TRUE /p3/ FALSE 0 httpo3 value3
162#HttpOnly_.test31.curl TRUE /p2/ FALSE 0 httpo2 value2
163#HttpOnly_.test31.curl TRUE /p1/ FALSE 0 httpo1 value1
164.test31.curl TRUE /overwrite FALSE 0 overwrite this2
165.test31.curl TRUE /silly/ FALSE 0 ismatch this
166test31.curl FALSE / FALSE 0 blankdomain sure
167</file>
168</verify>
169</testcase>