From c2212c05aa99bb31e4b99b0b66fc1747b7d01be6 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 4 Aug 2023 13:48:12 +0200 Subject: [PATCH] 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 #11576 Closes #11610 --- tests/data/test1104 | 4 ++-- tests/data/test1216 | 6 +++--- tests/data/test1415 | 16 ++++++++++++++++ tests/data/test172 | 2 +- tests/data/test179 | 4 ++-- tests/data/test1915 | 6 ++++++ tests/data/test31 | 18 ++++++++++++++++++ tests/data/test327 | 2 +- tests/data/test329 | 4 ++-- tests/data/test420 | 14 +++++++------- tests/data/test46 | 20 ++++++++++++++++++++ tests/data/test53 | 2 +- tests/data/test61 | 10 ++++++++++ tests/data/test62 | 6 +++--- tests/data/test676 | 2 +- tests/libtest/lib1915.c | 7 ++++++- 16 files changed, 99 insertions(+), 24 deletions(-) diff --git a/tests/data/test1104 b/tests/data/test1104 index 2401be9558..b77c557683 100644 --- a/tests/data/test1104 +++ b/tests/data/test1104 @@ -16,7 +16,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT Location: /want/data/%TESTNUMBER0002 Server: test-server/fake Set-Cookie: test=true; domain=127.0.0.1; path=/; expires=Thu Jan 1 00:00:00 GMT 1970; -Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2037; +Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2525; Connection: close This server reply is for testing a set-cookie @@ -37,7 +37,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT Location: /want/data/%TESTNUMBER0002 Server: test-server/fake Set-Cookie: test=true; domain=127.0.0.1; path=/; expires=Thu Jan 1 00:00:00 GMT 1970; -Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2037; +Set-Cookie: test2=true; domain=127.0.0.1; path=/; expires=Fri Feb 13 11:56:27 GMT 2525; Connection: close HTTP/1.1 200 Followed here fine swsclose diff --git a/tests/data/test1216 b/tests/data/test1216 index b812f8d9bc..768c39e66d 100644 --- a/tests/data/test1216 +++ b/tests/data/test1216 @@ -34,10 +34,10 @@ HTTP cookie domains tailmatching the host name http://example.fake/c/%TESTNUMBER http://bexample.fake/c/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -x %HOSTIP:%HTTPPORT -example.fake FALSE /a FALSE 2139150993 mooo indeed +example.fake FALSE /a FALSE 22139150993 mooo indeed example.fake FALSE /b FALSE 0 moo1 indeed -example.fake FALSE /c FALSE 2139150993 moo2 indeed -example.fake TRUE /c FALSE 2139150993 moo3 indeed +example.fake FALSE /c FALSE 22139150993 moo2 indeed +example.fake TRUE /c FALSE 22139150993 moo3 indeed cookies diff --git a/tests/data/test1415 b/tests/data/test1415 index 82f83790a5..ae07d76f42 100644 --- a/tests/data/test1415 +++ b/tests/data/test1415 @@ -20,6 +20,15 @@ Content-Length: 4 Content-Type: text/html Funny-head: yesyes Set-Cookie: test1value=test1; domain=example.com; path=/; +%if large-time +Set-Cookie: test2value=test2; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/; +Set-Cookie: test3value=test3; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; +Set-Cookie: test4value=test4; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/; +Set-Cookie: test5value=test5; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; +Set-Cookie: test6value=test6; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; +Set-Cookie: test7value=test7; expires=Thursday, 31-Dec-2525 00:00:00 GMT; domain=example.com; path=/; +Set-Cookie: test8value=test8; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; +%else Set-Cookie: test2value=test2; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/; Set-Cookie: test3value=test3; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; Set-Cookie: test4value=test4; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/; @@ -27,6 +36,7 @@ Set-Cookie: test5value=test5; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=e Set-Cookie: test6value=test6; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; Set-Cookie: test7value=test7; expires=Thursday, 31-Dec-2037 00:00:00 GMT; domain=example.com; path=/; Set-Cookie: test8value=test8; expires=Monday, 13-Jun-1988 03:04:55 GMT; domain=example.com; path=/; +%endif boo @@ -68,9 +78,15 @@ Proxy-Connection: Keep-Alive # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. +%if large-time +.example.com TRUE / FALSE 17545593600 test7value test7 +.example.com TRUE / FALSE 17545593600 test4value test4 +.example.com TRUE / FALSE 17545593600 test2value test2 +%else .example.com TRUE / FALSE 2145830400 test7value test7 .example.com TRUE / FALSE 2145830400 test4value test4 .example.com TRUE / FALSE 2145830400 test2value test2 +%endif .example.com TRUE / FALSE 0 test1value test1 diff --git a/tests/data/test172 b/tests/data/test172 index bf4871931d..e638fc42e0 100644 --- a/tests/data/test172 +++ b/tests/data/test172 @@ -36,7 +36,7 @@ http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -b %LOGDIR/jar%TESTNUMBER.txt -b "t .%HOSTIP TRUE /silly/ FALSE 0 ismatch this .%HOSTIP TRUE / FALSE 0 partmatch present -%HOSTIP FALSE /we/want/ FALSE 2139150993 nodomain value +%HOSTIP FALSE /we/want/ FALSE 22139150993 nodomain value cookies diff --git a/tests/data/test179 b/tests/data/test179 index 4bfceb1ac4..62a8d8c651 100644 --- a/tests/data/test179 +++ b/tests/data/test179 @@ -34,9 +34,9 @@ HTTP using proxy and cookies with path checks http://supertrooper.fake/c/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -x %HOSTIP:%HTTPPORT -supertrooper.fake FALSE /a FALSE 2139150993 mooo indeed +supertrooper.fake FALSE /a FALSE 22139150993 mooo indeed supertrooper.fake FALSE /b FALSE 0 moo1 indeed -supertrooper.fake FALSE /c FALSE 2139150993 moo2 indeed +supertrooper.fake FALSE /c FALSE 22139150993 moo2 indeed cookies diff --git a/tests/data/test1915 b/tests/data/test1915 index 544dd4f41d..0af5421145 100644 --- a/tests/data/test1915 +++ b/tests/data/test1915 @@ -42,9 +42,15 @@ http://%HOSTIP:%NOLISTENPORT/not-there/%TESTNUMBER 42 +%if large-time +[0/4] 1.example.com 25250320 01:02:03 +[1/4] 2.example.com 25250320 03:02:01 +[2/4] 3.example.com 25250319 01:02:03 +%else [0/4] 1.example.com 20370320 01:02:03 [1/4] 2.example.com 20370320 03:02:01 [2/4] 3.example.com 20370319 01:02:03 +%endif [3/4] 4.example.com unlimited First request returned 7 Second request returned 42 diff --git a/tests/data/test31 b/tests/data/test31 index 821fed9fb2..d661f64e13 100644 --- a/tests/data/test31 +++ b/tests/data/test31 @@ -54,10 +54,17 @@ Set-Cookie: partmatch=present; domain=test31.curl ; path=/; Set-Cookie:eat=this; domain=moo.foo.moo; Set-Cookie: eat=this-too; domain=.foo.moo; Set-Cookie: nodomainnovalue +%if large-time +Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525 +Set-Cookie: novalue; domain=reallysilly +Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525 +Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525 +%else Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037 Set-Cookie: novalue; domain=reallysilly Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030 Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030 +%endif Set-Cookie: magic=yessir; path=/silly/; HttpOnly Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad; Set-Cookie: partialip=nono; domain=.0.0.1; @@ -96,10 +103,17 @@ Set-Cookie: partmatch=present; domain=test31.curl ; path=/; Set-Cookie: eat=this; domain=moo.foo.moo; Set-Cookie: eat=this-too; domain=.foo.moo; Set-Cookie: nodomainnovalue +%if large-time +Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525 +Set-Cookie: novalue; domain=reallysilly +Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525 +Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525 +%else Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037 Set-Cookie: novalue; domain=reallysilly Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030 Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030 +%endif Set-Cookie: magic=yessir; path=/silly/; HttpOnly Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad; Set-Cookie: partialip=nono; domain=.0.0.1; @@ -157,7 +171,11 @@ test31.curl FALSE /we/want/ FALSE 0 withspaces2 before equals test31.curl FALSE /we/want/ FALSE 0 withspaces yes within and around .test31.curl TRUE /we/want/ FALSE 0 blexp yesyes #HttpOnly_test31.curl FALSE /silly/ FALSE 0 magic yessir +%if large-time +test31.curl FALSE /we/want/ FALSE 17517902187 nodomain value +%else test31.curl FALSE /we/want/ FALSE 2118138987 nodomain value +%endif .test31.curl TRUE / FALSE 0 partmatch present #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httponly myvalue1 #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httpo4 value4 diff --git a/tests/data/test327 b/tests/data/test327 index 19d7c0fb23..c4a3bc5119 100644 --- a/tests/data/test327 +++ b/tests/data/test327 @@ -20,7 +20,7 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT Server: test-server/fake Content-Type: text/html Funny-head: yesyes swsclose -Set-Cookie: foobar=name; expires=Thu, 22 Nov 2037 10:54:11 GMT; +Set-Cookie: foobar=name; expires=Thu, 22 Nov 2525 10:54:11 GMT; diff --git a/tests/data/test329 b/tests/data/test329 index 1f03d3ce5f..35892a8564 100644 --- a/tests/data/test329 +++ b/tests/data/test329 @@ -32,10 +32,10 @@ moo # Client-side -.host.foo.com TRUE /we/want/ FALSE 2147483647 test no +.host.foo.com TRUE /we/want/ FALSE 22147483647 test no -.host.foo.com TRUE /we/want/ FALSE 2147483647 tester yes +.host.foo.com TRUE /we/want/ FALSE 22147483647 tester yes http diff --git a/tests/data/test420 b/tests/data/test420 index 3d6b624c6e..7b7ecb437e 100644 --- a/tests/data/test420 +++ b/tests/data/test420 @@ -40,12 +40,12 @@ Setting cookies set with expired dates that were loaded from jar http://%HOSTIP:%HTTPPORT/func_test/del_cookie -b %LOGDIR/cookie%TESTNUMBER -c %LOGDIR/save%TESTNUMBER -%HOSTIP FALSE /func_test FALSE 1709598616 mycookie6 991 -#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie5 990 -#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie4 950 -#HttpOnly_%HOSTIP FALSE /func_test FALSE 1709598616 mycookie3 900 -#HttpOnly_%HOSTIP FALSE /func_test/ FALSE 1709598616 mycookie2 5900 -#HttpOnly_%HOSTIP FALSE / FALSE 1709598616 mycookie1 4900 +%HOSTIP FALSE /func_test FALSE 21709598616 mycookie6 991 +#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie5 990 +#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie4 950 +#HttpOnly_%HOSTIP FALSE /func_test FALSE 21709598616 mycookie3 900 +#HttpOnly_%HOSTIP FALSE /func_test/ FALSE 21709598616 mycookie2 5900 +#HttpOnly_%HOSTIP FALSE / FALSE 21709598616 mycookie1 4900 #HttpOnly_%HOSTIP FALSE /func_test/ FALSE 0 mycookie 1200 @@ -69,7 +69,7 @@ Cookie: mycookie2=5900; mycookie=1200; mycookie3=900; mycookie4=950; mycookie5=9 # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. -#HttpOnly_127.0.0.1 FALSE /func_test/ FALSE 1709598616 mycookie2 5900 +#HttpOnly_127.0.0.1 FALSE /func_test/ FALSE 21709598616 mycookie2 5900 diff --git a/tests/data/test46 b/tests/data/test46 index d36787d544..9f9e881cbd 100644 --- a/tests/data/test46 +++ b/tests/data/test46 @@ -16,7 +16,11 @@ HTTP/1.1 200 OK Server: Microsoft-IIS/4.0 Date: Tue, 25 Sep 2001 19:37:44 GMT Content-Type: text/html +%if large-time +Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2525 11:56:27 GMT; path=/ +%else Set-Cookie: ckyPersistent=permanent; expires=Fri, 13-Feb-2037 11:56:27 GMT; path=/ +%endif Set-Cookie: ckySession=temporary; path=/ Set-Cookie: ASPSESSIONIDQGGQQSJJ=GKNBDIFAAOFDPDAIEAKDIBKE; path=/ Set-Cookie: justaname=; path=/; @@ -50,10 +54,17 @@ domain..tld:%HTTPPORT/want/%TESTNUMBER --resolve domain..tld:%HTTPPORT:%HOSTIP - # https://curl.se/docs/http-cookies.html # This is generated by libcurl! Do not edit. +%if large-time +www.fake.come FALSE / FALSE 22147483647 cookiecliente si +www.loser.com FALSE / FALSE 22139150993 UID 99 +domain..tld FALSE / FALSE 22139150993 mooo indeed +#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2 +%else www.fake.come FALSE / FALSE 2147483647 cookiecliente si www.loser.com FALSE / FALSE 2139150993 UID 99 domain..tld FALSE / FALSE 2139150993 mooo indeed #HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2 +%endif domain..tld FALSE /want FALSE 0 empty @@ -80,12 +91,21 @@ domain..tld FALSE /want/ FALSE 0 simplyhuge zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz domain..tld FALSE / FALSE 0 justaname domain..tld FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE domain..tld FALSE / FALSE 0 ckySession temporary +%if large-time +domain..tld FALSE / FALSE 17517902187 ckyPersistent permanent +domain..tld FALSE /want FALSE 0 empty +#HttpOnly_domain..tld FALSE /want FALSE 22139150993 mooo2 indeed2 +domain..tld FALSE / FALSE 22139150993 mooo indeed +www.loser.com FALSE / FALSE 22139150993 UID 99 +www.fake.come FALSE / FALSE 22147483647 cookiecliente si +%else domain..tld FALSE / FALSE 2118138987 ckyPersistent permanent domain..tld FALSE /want FALSE 0 empty #HttpOnly_domain..tld FALSE /want FALSE 2139150993 mooo2 indeed2 domain..tld FALSE / FALSE 2139150993 mooo indeed www.loser.com FALSE / FALSE 2139150993 UID 99 www.fake.come FALSE / FALSE 2147483647 cookiecliente si +%endif diff --git a/tests/data/test53 b/tests/data/test53 index d5997f5a8e..86dfe9af4f 100644 --- a/tests/data/test53 +++ b/tests/data/test53 @@ -32,7 +32,7 @@ HTTP, junk session cookies %HOSTIP:%HTTPPORT/want/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -j -%HOSTIP FALSE / FALSE 2139150993 mooo indeed +%HOSTIP FALSE / FALSE 22139150993 mooo indeed %HOSTIP FALSE / FALSE 0 moo1 indeed %HOSTIP FALSE / FALSE 1 moo2 indeed diff --git a/tests/data/test61 b/tests/data/test61 index b1f53b1e30..18e02eb54b 100644 --- a/tests/data/test61 +++ b/tests/data/test61 @@ -17,8 +17,13 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT Server: test-server/fake Content-Type: text/html Funny-head: yesyes +%if large-time +Set-Cookie: test=yes; httponly; domain=foo.com; expires=Fri Feb 13 11:56:27 GMT 2525 +SET-COOKIE: test2=yes; domain=host.foo.com; expires=Fri Feb 13 11:56:27 GMT 2525 +%else Set-Cookie: test=yes; httponly; domain=foo.com; expires=Fri Feb 13 11:56:27 GMT 2037 SET-COOKIE: test2=yes; domain=host.foo.com; expires=Fri Feb 13 11:56:27 GMT 2037 +%endif Set-Cookie: test3=maybe; domain=foo.com; path=/moo; secure Set-Cookie: test4=no; domain=nope.foo.com; path=/moo; secure Set-Cookie: test5=name; domain=anything.com; path=/ ; secure @@ -66,8 +71,13 @@ Accept: */* # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. +%if large-time +.host.foo.com TRUE /we/want/ FALSE 17517902187 test2 yes +#HttpOnly_.foo.com TRUE /we/want/ FALSE 17517902187 test yes +%else .host.foo.com TRUE /we/want/ FALSE 2118138987 test2 yes #HttpOnly_.foo.com TRUE /we/want/ FALSE 2118138987 test yes +%endif diff --git a/tests/data/test62 b/tests/data/test62 index 0484e8c855..4f3fa2383a 100644 --- a/tests/data/test62 +++ b/tests/data/test62 @@ -36,9 +36,9 @@ http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER http://%HOSTIP:%HTTPPORT/we/want/%T # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. -#HttpOnly_.foo.com TRUE /we/want/ FALSE 2147483647 test yes -.host.foo.com TRUE /we/want/ FALSE 2147483647 test2 yes -.fake.host.foo.com TRUE /we/want/ FALSE 2147483647 test4 yes +#HttpOnly_.foo.com TRUE /we/want/ FALSE 22147483647 test yes +.host.foo.com TRUE /we/want/ FALSE 22147483647 test2 yes +.fake.host.foo.com TRUE /we/want/ FALSE 22147483647 test4 yes .foo.com TRUE /moo TRUE 0 test3 maybe diff --git a/tests/data/test676 b/tests/data/test676 index 6e1fd193f4..601184fe95 100644 --- a/tests/data/test676 +++ b/tests/data/test676 @@ -45,7 +45,7 @@ Content-Type: text/html # Client-side -%HOSTIP TRUE /we/want/ FALSE 2118138987 proven yes +%HOSTIP TRUE /we/want/ FALSE 22118138987 proven yes http diff --git a/tests/libtest/lib1915.c b/tests/libtest/lib1915.c index 1776b261f4..290212fdcc 100644 --- a/tests/libtest/lib1915.c +++ b/tests/libtest/lib1915.c @@ -33,10 +33,15 @@ struct entry { }; static const struct entry preload_hosts[] = { - /* curl turns 39 that day just before 31-bit time_t overflow */ +#if (SIZEOF_TIME_T < 5) { "1.example.com", "20370320 01:02:03" }, { "2.example.com", "20370320 03:02:01" }, { "3.example.com", "20370319 01:02:03" }, +#else + { "1.example.com", "25250320 01:02:03" }, + { "2.example.com", "25250320 03:02:01" }, + { "3.example.com", "25250319 01:02:03" }, +#endif { "4.example.com", "" }, { NULL, NULL } /* end of list marker */ };