Skip to content

Commit 7353125

Browse files
kanavinptitSeb
authored andcommitted
tests: update cookie expiry dates to far in the future
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expiry errors. Fixes curl#11576 Closes curl#11610
1 parent 9effcad commit 7353125

File tree

16 files changed

+99
-24
lines changed

16 files changed

+99
-24
lines changed

tests/data/test1104

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT
1616
Location: /want/data/%TESTNUMBER0002
1717
Server: test-server/fake
1818
Set-Cookie: test=true; domain=127.0.0.1; path=/; expires=Thu Jan 1 00:00:00 GMT 1970;
19-
Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2037;
19+
Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2525;
2020
Connection: close
2121

2222
This server reply is for testing a set-cookie
@@ -37,7 +37,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT
3737
Location: /want/data/%TESTNUMBER0002
3838
Server: test-server/fake
3939
Set-Cookie: test=true; domain=127.0.0.1; path=/; expires=Thu Jan 1 00:00:00 GMT 1970;
40-
Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2037;
40+
Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2525;
4141
Connection: close
4242

4343
HTTP/1.1 200 Followed here fine swsclose

tests/data/test1216

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ HTTP cookie domains tailmatching the host name
3434
http://example.fake/c/%TESTNUMBER http://bexample.fake/c/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -x %HOSTIP:%HTTPPORT
3535
</command>
3636
<file name="%LOGDIR/injar%TESTNUMBER">
37-
example.fake FALSE /a FALSE 2139150993 mooo indeed
37+
example.fake FALSE /a FALSE 22139150993 mooo indeed
3838
example.fake FALSE /b FALSE 0 moo1 indeed
39-
example.fake FALSE /c FALSE 2139150993 moo2 indeed
40-
example.fake TRUE /c FALSE 2139150993 moo3 indeed
39+
example.fake FALSE /c FALSE 22139150993 moo2 indeed
40+
example.fake TRUE /c FALSE 22139150993 moo3 indeed
4141
</file>
4242
<features>
4343
cookies

tests/data/test1415

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ Content-Length: 4
2020
Content-Type: text/html
2121
Funny-head: yesyes
2222
Set-Cookie: test1value=test1; domain=example.com; path=/;
23+
%if large-time
24+
Set-Cookie: test2value=test2; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/;
25+
Set-Cookie: test3value=test3; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
26+
Set-Cookie: test4value=test4; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/;
27+
Set-Cookie: test5value=test5; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
28+
Set-Cookie: test6value=test6; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
29+
Set-Cookie: test7value=test7; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/;
30+
Set-Cookie: test8value=test8; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
31+
%else
2332
Set-Cookie: test2value=test2; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/;
2433
Set-Cookie: test3value=test3; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
2534
Set-Cookie: test4value=test4; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/;
2635
Set-Cookie: test5value=test5; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
2736
Set-Cookie: test6value=test6; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
2837
Set-Cookie: test7value=test7; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/;
2938
Set-Cookie: test8value=test8; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/;
39+
%endif
3040

3141
boo
3242
</data>
@@ -68,9 +78,15 @@ Proxy-Connection: Keep-Alive
6878
# https://curl.se/docs/http-cookies.html
6979
# This file was generated by libcurl! Edit at your own risk.
7080

81+
%if large-time
82+
.example.com TRUE / FALSE 17545593600 test7value test7
83+
.example.com TRUE / FALSE 17545593600 test4value test4
84+
.example.com TRUE / FALSE 17545593600 test2value test2
85+
%else
7186
.example.com TRUE / FALSE 2145830400 test7value test7
7287
.example.com TRUE / FALSE 2145830400 test4value test4
7388
.example.com TRUE / FALSE 2145830400 test2value test2
89+
%endif
7490
.example.com TRUE / FALSE 0 test1value test1
7591
</file>
7692
</verify>

tests/data/test172

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -b %LOGDIR/jar%TESTNUMBER.txt -b "t
3636

3737
.%HOSTIP TRUE /silly/ FALSE 0 ismatch this
3838
.%HOSTIP TRUE / FALSE 0 partmatch present
39-
%HOSTIP FALSE /we/want/ FALSE 2139150993 nodomain value
39+
%HOSTIP FALSE /we/want/ FALSE 22139150993 nodomain value
4040
</file>
4141
<features>
4242
cookies

tests/data/test179

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ HTTP using proxy and cookies with path checks
3434
http://supertrooper.fake/c/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -x %HOSTIP:%HTTPPORT
3535
</command>
3636
<file name="%LOGDIR/injar%TESTNUMBER">
37-
supertrooper.fake FALSE /a FALSE 2139150993 mooo indeed
37+
supertrooper.fake FALSE /a FALSE 22139150993 mooo indeed
3838
supertrooper.fake FALSE /b FALSE 0 moo1 indeed
39-
supertrooper.fake FALSE /c FALSE 2139150993 moo2 indeed
39+
supertrooper.fake FALSE /c FALSE 22139150993 moo2 indeed
4040
</file>
4141
<features>
4242
cookies

tests/data/test1915

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ http://%HOSTIP:%NOLISTENPORT/not-there/%TESTNUMBER
4242
42
4343
</errorcode>
4444
<stdout>
45+
%if large-time
46+
[0/4] 1.example.com 25250320 01:02:03
47+
[1/4] 2.example.com 25250320 03:02:01
48+
[2/4] 3.example.com 25250319 01:02:03
49+
%else
4550
[0/4] 1.example.com 20370320 01:02:03
4651
[1/4] 2.example.com 20370320 03:02:01
4752
[2/4] 3.example.com 20370319 01:02:03
53+
%endif
4854
[3/4] 4.example.com unlimited
4955
First request returned 7
5056
Second request returned 42

tests/data/test31

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@ Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
5454
Set-Cookie:eat=this; domain=moo.foo.moo;
5555
Set-Cookie: eat=this-too; domain=.foo.moo;
5656
Set-Cookie: nodomainnovalue
57+
%if large-time
58+
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525
59+
Set-Cookie: novalue; domain=reallysilly
60+
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525
61+
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525
62+
%else
5763
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
5864
Set-Cookie: novalue; domain=reallysilly
5965
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
6066
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
67+
%endif
6168
Set-Cookie: magic=yessir; path=/silly/; HttpOnly
6269
Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
6370
Set-Cookie: partialip=nono; domain=.0.0.1;
@@ -96,10 +103,17 @@ Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
96103
Set-Cookie: eat=this; domain=moo.foo.moo;
97104
Set-Cookie: eat=this-too; domain=.foo.moo;
98105
Set-Cookie: nodomainnovalue
106+
%if large-time
107+
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525
108+
Set-Cookie: novalue; domain=reallysilly
109+
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525
110+
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525
111+
%else
99112
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
100113
Set-Cookie: novalue; domain=reallysilly
101114
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
102115
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
116+
%endif
103117
Set-Cookie: magic=yessir; path=/silly/; HttpOnly
104118
Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
105119
Set-Cookie: partialip=nono; domain=.0.0.1;
@@ -157,7 +171,11 @@ test31.curl FALSE /we/want/ FALSE 0 withspaces2 before equals
157171
test31.curl FALSE /we/want/ FALSE 0 withspaces yes within and around
158172
.test31.curl TRUE /we/want/ FALSE 0 blexp yesyes
159173
#HttpOnly_test31.curl FALSE /silly/ FALSE 0 magic yessir
174+
%if large-time
175+
test31.curl FALSE /we/want/ FALSE 17517902187 nodomain value
176+
%else
160177
test31.curl FALSE /we/want/ FALSE 2118138987 nodomain value
178+
%endif
161179
.test31.curl TRUE / FALSE 0 partmatch present
162180
#HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httponly myvalue1
163181
#HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httpo4 value4

tests/data/test327

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT
2020
Server: test-server/fake
2121
Content-Type: text/html
2222
Funny-head: yesyes swsclose
23-
Set-Cookie: foobar=name; expires=Thu, 22 Nov 2037 10:54:11 GMT;
23+
Set-Cookie: foobar=name; expires=Thu, 22 Nov 2525 10:54:11 GMT;
2424

2525
</data>
2626
<data2>

tests/data/test329

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ moo
3232
# Client-side
3333
<client>
3434
<file name="%LOGDIR/jar%TESTNUMBER.txt" mode="text">
35-
.host.foo.com TRUE /we/want/ FALSE 2147483647 test no
35+
.host.foo.com TRUE /we/want/ FALSE 22147483647 test no
3636
</file>
3737
<file name="%LOGDIR/jar%TESTNUMBER-2.txt" mode="text">
38-
.host.foo.com TRUE /we/want/ FALSE 2147483647 tester yes
38+
.host.foo.com TRUE /we/want/ FALSE 22147483647 tester yes
3939
</file>
4040
<server>
4141
http

tests/data/test420

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ Setting cookies set with expired dates that were loaded from jar
4040
http://%HOSTIP:%HTTPPORT/func_test/del_cookie -b %LOGDIR/cookie%TESTNUMBER -c %LOGDIR/save%TESTNUMBER
4141
</command>
4242
<file name="%LOGDIR/cookie%TESTNUMBER" mode="text">
43-
%HOSTIP FALSE /func_test FALSE 1709598616 mycookie6 991
44-
#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie5 990
45-
#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie4 950
46-
#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie3 900
47-
#HttpOnly_%HOSTIP FALSE /func_test/ FALSE 1709598616 mycookie2 5900
48-
#HttpOnly_%HOSTIP FALSE / FALSE 1709598616 mycookie1 4900
43+
%HOSTIP FALSE /func_test FALSE 21709598616 mycookie6 991
44+
#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie5 990
45+
#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie4 950
46+
#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie3 900
47+
#HttpOnly_%HOSTIP FALSE /func_test/ FALSE 21709598616 mycookie2 5900
48+
#HttpOnly_%HOSTIP FALSE / FALSE 21709598616 mycookie1 4900
4949
#HttpOnly_%HOSTIP FALSE /func_test/ FALSE 0 mycookie 1200
5050
</file>
5151
<features>
@@ -69,7 +69,7 @@ Cookie: mycookie2=5900; mycookie=1200; mycookie3=900; mycookie4=950; mycookie5=9
6969
# https://curl.se/docs/http-cookies.html
7070
# This file was generated by libcurl! Edit at your own risk.
7171

72-
#HttpOnly_127.0.0.1 FALSE /func_test/ FALSE 1709598616 mycookie2 5900
72+
#HttpOnly_127.0.0.1 FALSE /func_test/ FALSE 21709598616 mycookie2 5900
7373
</file>
7474
</verify>
7575
</testcase>

tests/data/test46

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ HTTP/1.1 200 OK
1616
Server: Microsoft-IIS/4.0
1717
Date: Tue, 25 Sep 2001 19:37:44 GMT
1818
Content-Type: text/html
19+
%if large-time
20+
Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2525 11:56:27 GMT; path=/
21+
%else
1922
Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2037 11:56:27 GMT; path=/
23+
%endif
2024
Set-Cookie: ckySession=temporary; path=/
2125
Set-Cookie: ASPSESSIONIDQGGQQSJJ=GKNBDIFAAOFDPDAIEAKDIBKE; path=/
2226
Set-Cookie: justaname=; path=/;
@@ -50,10 +54,17 @@ domain..tld:%HTTPPORT/want/%TESTNUMBER --resolve domain..tld:%HTTPPORT:%HOSTIP -
5054
# https://curl.se/docs/http-cookies.html
5155
# This is generated by libcurl! Do not edit.
5256

57+
%if large-time
58+
www.fake.come FALSE / FALSE 22147483647 cookiecliente si
59+
www.loser.com FALSE / FALSE 22139150993 UID 99
60+
domain..tld FALSE / FALSE 22139150993 mooo indeed
61+
#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2
62+
%else
5363
www.fake.come FALSE / FALSE 2147483647 cookiecliente si
5464
www.loser.com FALSE / FALSE 2139150993 UID 99
5565
domain..tld FALSE / FALSE 2139150993 mooo indeed
5666
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
67+
%endif
5768
domain..tld FALSE /want FALSE 0 empty
5869
</file>
5970
<features>
@@ -80,12 +91,21 @@ domain..tld FALSE /want/ FALSE 0 simplyhuge zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
8091
domain..tld FALSE / FALSE 0 justaname
8192
domain..tld FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE
8293
domain..tld FALSE / FALSE 0 ckySession temporary
94+
%if large-time
95+
domain..tld FALSE / FALSE 17517902187 ckyPersistent permanent
96+
domain..tld FALSE /want FALSE 0 empty
97+
#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2
98+
domain..tld FALSE / FALSE 22139150993 mooo indeed
99+
www.loser.com FALSE / FALSE 22139150993 UID 99
100+
www.fake.come FALSE / FALSE 22147483647 cookiecliente si
101+
%else
83102
domain..tld FALSE / FALSE 2118138987 ckyPersistent permanent
84103
domain..tld FALSE /want FALSE 0 empty
85104
#HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2
86105
domain..tld FALSE / FALSE 2139150993 mooo indeed
87106
www.loser.com FALSE / FALSE 2139150993 UID 99
88107
www.fake.come FALSE / FALSE 2147483647 cookiecliente si
108+
%endif
89109
</file>
90110
</verify>
91111
</testcase>

tests/data/test53

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ HTTP, junk session cookies
3232
%HOSTIP:%HTTPPORT/want/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -j
3333
</command>
3434
<file name="%LOGDIR/injar%TESTNUMBER">
35-
%HOSTIP FALSE / FALSE 2139150993 mooo indeed
35+
%HOSTIP FALSE / FALSE 22139150993 mooo indeed
3636
%HOSTIP FALSE / FALSE 0 moo1 indeed
3737
%HOSTIP FALSE / FALSE 1 moo2 indeed
3838
</file>

tests/data/test61

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT
1717
Server: test-server/fake
1818
Content-Type: text/html
1919
Funny-head: yesyes
20+
%if large-time
21+
Set-Cookie: test=yes; httponly; domain=foo.com; expires=Fri Feb 13 11:56:27 GMT 2525
22+
SET-COOKIE: test2=yes; domain=host.foo.com; expires=Fri Feb 13 11:56:27 GMT 2525
23+
%else
2024
Set-Cookie: test=yes; httponly; domain=foo.com; expires=Fri Feb 13 11:56:27 GMT 2037
2125
SET-COOKIE: test2=yes; domain=host.foo.com; expires=Fri Feb 13 11:56:27 GMT 2037
26+
%endif
2227
Set-Cookie: test3=maybe; domain=foo.com; path=/moo; secure
2328
Set-Cookie: test4=no; domain=nope.foo.com; path=/moo; secure
2429
Set-Cookie: test5=name; domain=anything.com; path=/ ; secure
@@ -66,8 +71,13 @@ Accept: */*
6671
# https://curl.se/docs/http-cookies.html
6772
# This file was generated by libcurl! Edit at your own risk.
6873

74+
%if large-time
75+
.host.foo.com TRUE /we/want/ FALSE 17517902187 test2 yes
76+
#HttpOnly_.foo.com TRUE /we/want/ FALSE 17517902187 test yes
77+
%else
6978
.host.foo.com TRUE /we/want/ FALSE 2118138987 test2 yes
7079
#HttpOnly_.foo.com TRUE /we/want/ FALSE 2118138987 test yes
80+
%endif
7181
</file>
7282
</verify>
7383
</testcase>

tests/data/test62

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER http://%HOSTIP:%HTTPPORT/we/want/%T
3636
# https://curl.se/docs/http-cookies.html
3737
# This file was generated by libcurl! Edit at your own risk.
3838

39-
#HttpOnly_.foo.com TRUE /we/want/ FALSE 2147483647 test yes
40-
.host.foo.com TRUE /we/want/ FALSE 2147483647 test2 yes
41-
.fake.host.foo.com TRUE /we/want/ FALSE 2147483647 test4 yes
39+
#HttpOnly_.foo.com TRUE /we/want/ FALSE 22147483647 test yes
40+
.host.foo.com TRUE /we/want/ FALSE 22147483647 test2 yes
41+
.fake.host.foo.com TRUE /we/want/ FALSE 22147483647 test4 yes
4242

4343
.foo.com TRUE /moo TRUE 0 test3 maybe
4444
</file>

tests/data/test676

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Content-Type: text/html
4545
# Client-side
4646
<client>
4747
<file name="%LOGDIR/cookies%TESTNUMBER">
48-
%HOSTIP TRUE /we/want/ FALSE 2118138987 proven yes
48+
%HOSTIP TRUE /we/want/ FALSE 22118138987 proven yes
4949
</file>
5050
<server>
5151
http

tests/libtest/lib1915.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ struct entry {
3333
};
3434

3535
static const struct entry preload_hosts[] = {
36-
/* curl turns 39 that day just before 31-bit time_t overflow */
36+
#if (SIZEOF_TIME_T < 5)
3737
{ "1.example.com", "20370320 01:02:03" },
3838
{ "2.example.com", "20370320 03:02:01" },
3939
{ "3.example.com", "20370319 01:02:03" },
40+
#else
41+
{ "1.example.com", "25250320 01:02:03" },
42+
{ "2.example.com", "25250320 03:02:01" },
43+
{ "3.example.com", "25250319 01:02:03" },
44+
#endif
4045
{ "4.example.com", "" },
4146
{ NULL, NULL } /* end of list marker */
4247
};

0 commit comments

Comments
 (0)