xref: /curl/tests/data/test506 (revision 1fe081ab)
1<testcase>
2<info>
3<keywords>
4HTTP
5HTTP GET
6cookies
7shared cookies
8</keywords>
9</info>
10
11# Server-side
12<reply>
13<data1>
14HTTP/1.1 200 OK
15Date: Tue, 09 Nov 2010 14:49:00 GMT
16Server: test-server/fake
17Content-Type: text/html
18Set-Cookie: test1=one; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
19Set-Cookie: test2=two; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
20Set-Cookie: test3=three; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
21Content-Length: 29
22
23run 1: set cookie 1, 2 and 3
24</data1>
25<data2>
26HTTP/1.1 200 OK
27Date: Tue, 09 Nov 2010 14:49:01 GMT
28Server: test-server/fake
29Content-Type: text/html
30Set-Cookie: test4=four; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
31Set-Cookie: test5=five; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
32Content-Length: 26
33
34run 2: set cookie 4 and 5
35</data2>
36<data3>
37HTTP/1.1 200 OK
38Date: Tue, 09 Nov 2010 14:49:02 GMT
39Server: test-server/fake
40Content-Type: text/html
41Funny-head: yesyes
42Set-Cookie: test4=overwritten4; domain=host.foo.com; expires=Sat May 5 GMT 11:56:27 2035
43Set-Cookie: test1=overwritten1; domain=foo.com; expires=Thu Mar 3 GMT 11:56:27 2033
44Set-Cookie: test6=six; domain=.www.host.foo.com; expires=Thu Mar 3 GMT 11:56:27 2033
45Set-Cookie: test6=six_more; expires=Thu Mar 3 GMT 11:56:27 2033
46Content-Type: text/html
47Content-Length: 73
48
49run 3: overwrite cookie 1 and 4, set cookie 6 with and without tailmatch
50</data3>
51</reply>
52
53# Client-side
54<client>
55<server>
56http
57</server>
58# don't run this with the threaded-resolver or c-ares since the events might
59# trigger in a different order!
60<features>
61!threaded-resolver
62!c-ares
63</features>
64<name>
65HTTP with shared cookie list (and dns cache)
66</name>
67# Explicitly set the time zone to a known good one, in case the user is
68# using one of the 'right' zones that take into account leap seconds
69# which causes the cookie expiry times to be different.
70<setenv>
71TZ=GMT
72</setenv>
73<tool>
74lib%TESTNUMBER
75</tool>
76<command>
77http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/jar%TESTNUMBER
78</command>
79</client>
80
81# Verify data after the test has been "shot"
82<verify>
83<stdout>
84GLOBAL_INIT
85SHARE_INIT
86CURLSHOPT_LOCKFUNC
87CURLSHOPT_UNLOCKFUNC
88CURLSHOPT_USERDATA
89CURL_LOCK_DATA_COOKIE
90CURL_LOCK_DATA_DNS
91CURLOPT_SHARE
92lock:   share  [Pigs in space]: 0
93unlock: share  [Pigs in space]: 1
94CURLOPT_COOKIELIST injected_and_clobbered
95lock:   cookie [Pigs in space]: 2
96unlock: cookie [Pigs in space]: 3
97CURLOPT_COOKIELIST ALL
98lock:   cookie [Pigs in space]: 4
99unlock: cookie [Pigs in space]: 5
100CURLOPT_COOKIELIST session
101lock:   cookie [Pigs in space]: 6
102unlock: cookie [Pigs in space]: 7
103CURLOPT_COOKIELIST injected
104lock:   cookie [Pigs in space]: 8
105unlock: cookie [Pigs in space]: 9
106CURLOPT_COOKIELIST SESS
107lock:   cookie [Pigs in space]: 10
108unlock: cookie [Pigs in space]: 11
109CLEANUP
110lock:   cookie [Pigs in space]: 12
111unlock: cookie [Pigs in space]: 13
112lock:   share  [Pigs in space]: 14
113unlock: share  [Pigs in space]: 15
114*** run 1
115CURLOPT_SHARE
116lock:   share  [Pigs in space]: 16
117unlock: share  [Pigs in space]: 17
118PERFORM
119lock:   cookie [Pigs in space]: 18
120unlock: cookie [Pigs in space]: 19
121lock:   dns    [Pigs in space]: 20
122unlock: dns    [Pigs in space]: 21
123lock:   dns    [Pigs in space]: 22
124unlock: dns    [Pigs in space]: 23
125lock:   cookie [Pigs in space]: 24
126unlock: cookie [Pigs in space]: 25
127lock:   cookie [Pigs in space]: 26
128unlock: cookie [Pigs in space]: 27
129lock:   cookie [Pigs in space]: 28
130unlock: cookie [Pigs in space]: 29
131lock:   cookie [Pigs in space]: 30
132unlock: cookie [Pigs in space]: 31
133run 1: set cookie 1, 2 and 3
134lock:   dns    [Pigs in space]: 32
135unlock: dns    [Pigs in space]: 33
136lock:   dns    [Pigs in space]: 34
137unlock: dns    [Pigs in space]: 35
138CLEANUP
139lock:   cookie [Pigs in space]: 36
140unlock: cookie [Pigs in space]: 37
141lock:   share  [Pigs in space]: 38
142unlock: share  [Pigs in space]: 39
143*** run 2
144CURLOPT_SHARE
145lock:   share  [Pigs in space]: 40
146unlock: share  [Pigs in space]: 41
147PERFORM
148lock:   cookie [Pigs in space]: 42
149unlock: cookie [Pigs in space]: 43
150lock:   dns    [Pigs in space]: 44
151unlock: dns    [Pigs in space]: 45
152lock:   cookie [Pigs in space]: 46
153unlock: cookie [Pigs in space]: 47
154lock:   cookie [Pigs in space]: 48
155unlock: cookie [Pigs in space]: 49
156lock:   cookie [Pigs in space]: 50
157unlock: cookie [Pigs in space]: 51
158run 2: set cookie 4 and 5
159lock:   dns    [Pigs in space]: 52
160unlock: dns    [Pigs in space]: 53
161lock:   dns    [Pigs in space]: 54
162unlock: dns    [Pigs in space]: 55
163CLEANUP
164lock:   cookie [Pigs in space]: 56
165unlock: cookie [Pigs in space]: 57
166lock:   share  [Pigs in space]: 58
167unlock: share  [Pigs in space]: 59
168*** run 3
169CURLOPT_SHARE
170lock:   share  [Pigs in space]: 60
171unlock: share  [Pigs in space]: 61
172CURLOPT_COOKIEJAR
173CURLOPT_COOKIELIST FLUSH
174lock:   cookie [Pigs in space]: 62
175unlock: cookie [Pigs in space]: 63
176PERFORM
177lock:   dns    [Pigs in space]: 64
178unlock: dns    [Pigs in space]: 65
179lock:   cookie [Pigs in space]: 66
180unlock: cookie [Pigs in space]: 67
181lock:   cookie [Pigs in space]: 68
182unlock: cookie [Pigs in space]: 69
183lock:   cookie [Pigs in space]: 70
184unlock: cookie [Pigs in space]: 71
185lock:   cookie [Pigs in space]: 72
186unlock: cookie [Pigs in space]: 73
187lock:   cookie [Pigs in space]: 74
188unlock: cookie [Pigs in space]: 75
189run 3: overwrite cookie 1 and 4, set cookie 6 with and without tailmatch
190lock:   dns    [Pigs in space]: 76
191unlock: dns    [Pigs in space]: 77
192lock:   dns    [Pigs in space]: 78
193unlock: dns    [Pigs in space]: 79
194CLEANUP
195lock:   cookie [Pigs in space]: 80
196unlock: cookie [Pigs in space]: 81
197lock:   share  [Pigs in space]: 82
198unlock: share  [Pigs in space]: 83
199CURLOPT_SHARE
200lock:   share  [Pigs in space]: 84
201unlock: share  [Pigs in space]: 85
202CURLOPT_COOKIELIST ALL
203lock:   cookie [Pigs in space]: 86
204unlock: cookie [Pigs in space]: 87
205CURLOPT_COOKIEJAR
206CURLOPT_COOKIELIST RELOAD
207lock:   cookie [Pigs in space]: 88
208unlock: cookie [Pigs in space]: 89
209lock:   cookie [Pigs in space]: 90
210unlock: cookie [Pigs in space]: 91
211loaded cookies:
212-----------------
213  www.host.foo.com	FALSE	/	FALSE	1993463787	test6	six_more
214  .www.host.foo.com	TRUE	/	FALSE	1993463787	test6	six
215  .host.foo.com	TRUE	/	FALSE	1896263787	test5	five
216  .host.foo.com	TRUE	/	FALSE	2061978987	test4	overwritten4
217  .foo.com	TRUE	/	FALSE	1896263787	test3	three
218  .host.foo.com	TRUE	/	FALSE	1896263787	test2	two
219  .foo.com	TRUE	/	FALSE	1993463787	test1	overwritten1
220  .host.foo.com	TRUE	/	FALSE	1896263787	injected	yes
221-----------------
222try SHARE_CLEANUP...
223lock:   share  [Pigs in space]: 92
224unlock: share  [Pigs in space]: 93
225SHARE_CLEANUP failed, correct
226CLEANUP
227lock:   cookie [Pigs in space]: 94
228unlock: cookie [Pigs in space]: 95
229lock:   share  [Pigs in space]: 96
230unlock: share  [Pigs in space]: 97
231SHARE_CLEANUP
232lock:   share  [Pigs in space]: 98
233unlock: share  [Pigs in space]: 99
234GLOBAL_CLEANUP
235</stdout>
236<file name="%LOGDIR/jar%TESTNUMBER" mode="text">
237# Netscape HTTP Cookie File
238# https://curl.se/docs/http-cookies.html
239# This file was generated by libcurl! Edit at your own risk.
240
241www.host.foo.com	FALSE	/	FALSE	1993463787	test6	six_more
242.www.host.foo.com	TRUE	/	FALSE	1993463787	test6	six
243.host.foo.com	TRUE	/	FALSE	1896263787	test5	five
244.host.foo.com	TRUE	/	FALSE	2061978987	test4	overwritten4
245.foo.com	TRUE	/	FALSE	1896263787	test3	three
246.host.foo.com	TRUE	/	FALSE	1896263787	test2	two
247.foo.com	TRUE	/	FALSE	1993463787	test1	overwritten1
248.host.foo.com	TRUE	/	FALSE	1896263787	injected	yes
249</file>
250</verify>
251</testcase>
252