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