mirror of
https://github.com/curl/curl.git
synced 2026-08-26 04:23:33 +03:00
altsvc: accept quoted ma and persist values
As mandated by the spec. Test 1654 is extended to verify. Closes #4443
This commit is contained in:
parent
666a22675d
commit
c24cf6c64c
3 changed files with 23 additions and 3 deletions
12
lib/altsvc.c
12
lib/altsvc.c
|
|
@ -442,6 +442,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
|
|||
char option[32];
|
||||
unsigned long num;
|
||||
char *end_ptr;
|
||||
bool quoted = FALSE;
|
||||
semip++; /* pass the semicolon */
|
||||
result = getalnum(&semip, option, sizeof(option));
|
||||
if(result)
|
||||
|
|
@ -451,12 +452,21 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
|
|||
if(*semip != '=')
|
||||
continue;
|
||||
semip++;
|
||||
while(*semip && ISBLANK(*semip))
|
||||
semip++;
|
||||
if(*semip == '\"') {
|
||||
/* quoted value */
|
||||
semip++;
|
||||
quoted = TRUE;
|
||||
}
|
||||
num = strtoul(semip, &end_ptr, 10);
|
||||
if(num < ULONG_MAX) {
|
||||
if((end_ptr != semip) && num && (num < ULONG_MAX)) {
|
||||
if(strcasecompare("ma", option))
|
||||
maxage = num;
|
||||
else if(strcasecompare("persist", option) && (num == 1))
|
||||
persist = TRUE;
|
||||
if(quoted && (*end_ptr == '\"'))
|
||||
end_ptr++;
|
||||
}
|
||||
semip = end_ptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue