curl/tests/data/test1660
Daniel Stenberg 54f6d836d8
hsts: handle unlimited expiry
When setting a blank expire string, meaning unlimited, curl would pass
TIME_T_MAX to getime_r() when creating the output, while on 64 bit
systems such a large value cannot be convetered to a tm struct making
curl to exit the loop with an error instead. It can't be converted
because the year it would represent doesn't fit in the 'int tm_year'
field!

Starting now, unlimited expiry is instead handled differently by using a
human readable expiry date spelled out as "unlimited" instead of trying
to use a distant actual date.

Test 1660 and 1915 have been updated to help verify this change.

Reported-by: Jonathan Cardoso
Fixes #7720
Closes #7721
2021-09-15 14:37:36 +02:00

84 lines
2.0 KiB
Plaintext

<testcase>
<info>
<keywords>
unittest
HSTS
</keywords>
</info>
<client>
<server>
none
</server>
<features>
unittest
HSTS
</features>
<file name="log/input%TESTNUMBER">
# Your HSTS cache. https://curl.se/docs/hsts.html
# This file was generated by libcurl! Edit at your own risk.
.readfrom.example "20211001 04:47:41"
.old.example "20161001 04:47:41"
.new.example "unlimited"
</file>
# This date is exactly "20190124 22:34:21" UTC
<setenv>
CURL_TIME=1548369261
</setenv>
<name>
HSTS
</name>
<command>
-
</command>
</client>
<verify>
<stdout>
readfrom.example [readfrom.example]: 1633063661 includeSubDomains
'old.example' is not HSTS
'readfrom.example' is not HSTS
example.com [example.com]: 1579905261
example.com [example.com]: 1569905261
example.com [example.com]: 1569905261
example.com [example.com]: 1569905261 includeSubDomains
example.org [example.org]: 1579905261
Input 8: error 43
Input 9: error 43
this.example [this.example]: 1548400797
'this.example' is not HSTS
Input 12: error 43
Input 13: error 43
Input 14: error 43
3.example.com [example.com]: 1569905261 includeSubDomains
3.example.com [example.com]: 1569905261 includeSubDomains
foo.example.com [example.com]: 1569905261 includeSubDomains
'foo.xample.com' is not HSTS
'forexample.net' is not HSTS
'forexample.net' is not HSTS
'example.net' is not HSTS
expire.example [expire.example]: 1548369268
Number of entries: 4
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
expire.example [expire.example]: 1548369268
'expire.example' is not HSTS
'expire.example' is not HSTS
'expire.example' is not HSTS
</stdout>
<file name="log/hsts%TESTNUMBER" mode="text">
# Your HSTS cache. https://curl.se/docs/hsts.html
# This file was generated by libcurl! Edit at your own risk.
.new.example "unlimited"
.example.com "20191001 04:47:41"
example.org "20200124 22:34:21"
</file>
</verify>
</testcase>