char option[32];
unsigned long num;
char *end_ptr;
+ bool quoted = FALSE;
semip++; /* pass the semicolon */
result = getalnum(&semip, option, sizeof(option));
if(result)
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;
}
}
fail_unless(asi->num == 9, "wrong number of entries");
+ /* quoted 'ma' value */
+ result = Curl_altsvc_parse(curl, asi, "h2=\"example.net:443\"; ma=\"180\";",
+ ALPN_h2, "example.net", 80);
+ if(result) {
+ fprintf(stderr, "Curl_altsvc_parse(4) failed!\n");
+ unitfail++;
+ }
+ fail_unless(asi->num == 10, "wrong number of entries");
+
result = Curl_altsvc_parse(curl, asi,
"h2=\":443\", h3=\":443\"; ma = 120; persist = 1",
ALPN_h1, "curl.haxx.se", 80);
fprintf(stderr, "Curl_altsvc_parse(5) failed!\n");
unitfail++;
}
- fail_unless(asi->num == 11, "wrong number of entries");
+ fail_unless(asi->num == 12, "wrong number of entries");
/* clear that one again and decrease the counter */
result = Curl_altsvc_parse(curl, asi, "clear;",
fprintf(stderr, "Curl_altsvc_parse(6) failed!\n");
unitfail++;
}
- fail_unless(asi->num == 9, "wrong number of entries");
+ fail_unless(asi->num == 10, "wrong number of entries");
Curl_altsvc_save(asi, outname);