aboutsummaryrefslogtreecommitdiff
path: root/lib/altsvc.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-09-30 10:29:46 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-09-30 16:35:12 +0200
commitc24cf6c64c9ecff09d86ed2ab334df8c327f07f5 (patch)
tree1ba5bb97e31520ea224b68e018830817ecf38db8 /lib/altsvc.c
parent666a22675d17e46607759a27968eb51a412241e4 (diff)
altsvc: accept quoted ma and persist values
As mandated by the spec. Test 1654 is extended to verify. Closes #4443
Diffstat (limited to 'lib/altsvc.c')
-rw-r--r--lib/altsvc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/altsvc.c b/lib/altsvc.c
index a961e5c05..64971a9f0 100644
--- a/lib/altsvc.c
+++ b/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;
}