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