mirror of
https://github.com/curl/curl.git
synced 2026-07-28 12:43:05 +03:00
altsvc: fix parser for lines ending with CRLF
Fixed the alt-svc parser to treat a newline as end of line. The unit tests in test 1654 were done without CRLF and thus didn't quite match the real world. Now they use CRLF as well. Reported-by: Peter Wu Assisted-by: Peter Wu Assisted-by: Jay Satiro Fixes #5445 Closes #5446
This commit is contained in:
parent
308c243db5
commit
d844f2b9ff
2 changed files with 17 additions and 12 deletions
|
|
@ -431,6 +431,8 @@ static time_t debugtime(void *unused)
|
|||
#define time(x) debugtime(x)
|
||||
#endif
|
||||
|
||||
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
|
||||
|
||||
/*
|
||||
* Curl_altsvc_parse() takes an incoming alt-svc response header and stores
|
||||
* the data correctly in the cache.
|
||||
|
|
@ -520,12 +522,12 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
|
|||
/* Handle the optional 'ma' and 'persist' flags. Unknown flags
|
||||
are skipped. */
|
||||
for(;;) {
|
||||
while(*p && ISBLANK(*p) && *p != ';' && *p != ',')
|
||||
while(ISBLANK(*p))
|
||||
p++;
|
||||
if(!*p || *p == ',')
|
||||
if(*p != ';')
|
||||
break;
|
||||
p++; /* pass the semicolon */
|
||||
if(!*p)
|
||||
if(!*p || ISNEWLINE(*p))
|
||||
break;
|
||||
result = getalnum(&p, option, sizeof(option));
|
||||
if(result) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue