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