mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
parsedate: make Curl_getdate_capped able to return epoch
By returning error separately on parse errors and avoiding magic numbers, this function can now return 0 or -1 as proper dates when such a date string is provided. Closes #18445
This commit is contained in:
parent
4d040c71d7
commit
f8e6e11725
9 changed files with 50 additions and 68 deletions
|
|
@ -187,13 +187,13 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, const char *line)
|
|||
else {
|
||||
struct altsvc *as;
|
||||
char dbuf[MAX_ALTSVC_DATELEN + 1];
|
||||
time_t expires;
|
||||
time_t expires = 0;
|
||||
|
||||
/* The date parser works on a null-terminated string. The maximum length
|
||||
is upheld by curlx_str_quotedword(). */
|
||||
memcpy(dbuf, curlx_str(&date), curlx_strlen(&date));
|
||||
dbuf[curlx_strlen(&date)] = 0;
|
||||
expires = Curl_getdate_capped(dbuf);
|
||||
Curl_getdate_capped(dbuf, &expires);
|
||||
as = altsvc_create(&srchost, &dsthost, &srcalpn, &dstalpn,
|
||||
(size_t)srcport, (size_t)dstport);
|
||||
if(as) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue