mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:53:34 +03:00
hsts: skip expired HSTS entries read from file
Extend test 780 to verify Closes #21186
This commit is contained in:
parent
8e8bdd3604
commit
4478a10f0d
2 changed files with 6 additions and 0 deletions
|
|
@ -408,6 +408,7 @@ static CURLcode hsts_add(struct hsts *h, const char *line)
|
|||
time_t expires = 0;
|
||||
const char *hp = curlx_str(&host);
|
||||
size_t hlen;
|
||||
time_t now = time(NULL);
|
||||
|
||||
/* The date parser works on a null-terminated string. The maximum length
|
||||
is upheld by curlx_str_quotedword(). */
|
||||
|
|
@ -419,6 +420,10 @@ static CURLcode hsts_add(struct hsts *h, const char *line)
|
|||
else
|
||||
Curl_getdate_capped(dbuf, &expires);
|
||||
|
||||
if(expires <= now)
|
||||
/* this entry already expired */
|
||||
return CURLE_OK;
|
||||
|
||||
if(hp[0] == '.') {
|
||||
curlx_str_nudge(&host, 1);
|
||||
hp = curlx_str(&host);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue