[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 120/222: altsvc: accept quoted ma and persist values
From: |
gnunet |
Subject: |
[gnurl] 120/222: altsvc: accept quoted ma and persist values |
Date: |
Thu, 07 Nov 2019 00:10:16 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c24cf6c64c9ecff09d86ed2ab334df8c327f07f5
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon Sep 30 10:29:46 2019 +0200
altsvc: accept quoted ma and persist values
As mandated by the spec. Test 1654 is extended to verify.
Closes #4443
---
lib/altsvc.c | 12 +++++++++++-
tests/data/test1654 | 1 +
tests/unit/unit1654.c | 13 +++++++++++--
3 files changed, 23 insertions(+), 3 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;
}
diff --git a/tests/data/test1654 b/tests/data/test1654
index 5b32cb419..6a82daa08 100644
--- a/tests/data/test1654
+++ b/tests/data/test1654
@@ -53,6 +53,7 @@ h1 2.example.org 8080 h3 2.example.org 8080 "20190125
22:34:21" 0 0
h1 3.example.org 8080 h2 example.com 8080 "20190125 22:34:21" 0 0
h1 3.example.org 8080 h3 yesyes.com 8080 "20190125 22:34:21" 0 0
h2 example.org 80 h2 example.com 443 "20190124 22:36:21" 0 0
+h2 example.net 80 h2 example.net 443 "20190124 22:37:21" 0 0
</file>
</verify>
</testcase>
diff --git a/tests/unit/unit1654.c b/tests/unit/unit1654.c
index 51fc5d16f..a800d9c3a 100644
--- a/tests/unit/unit1654.c
+++ b/tests/unit/unit1654.c
@@ -97,6 +97,15 @@ UNITTEST_START
}
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);
@@ -104,7 +113,7 @@ UNITTEST_START
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;",
@@ -113,7 +122,7 @@ UNITTEST_START
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);
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 101/222: Revert "FTP: url-decode path before evaluation", (continued)
- [gnurl] 101/222: Revert "FTP: url-decode path before evaluation", gnunet, 2019/11/06
- [gnurl] 104/222: HTTP3: fix prefix parameter for ngtcp2 build, gnunet, 2019/11/06
- [gnurl] 96/222: HTTP3: update quic.aiortc.org + add link to server list, gnunet, 2019/11/06
- [gnurl] 107/222: tests: fix narrowing conversion warnings, gnunet, 2019/11/06
- [gnurl] 116/222: BINDINGS: Kapito is an Erlang library, basically a binding, gnunet, 2019/11/06
- [gnurl] 111/222: RELEASE-NOTES: synced, gnunet, 2019/11/06
- [gnurl] 112/222: setopt: handle ALTSVC set to NULL, gnunet, 2019/11/06
- [gnurl] 118/222: quiche: update HTTP/3 config creation to new API, gnunet, 2019/11/06
- [gnurl] 115/222: BINDINGS: added clj-curl, gnunet, 2019/11/06
- [gnurl] 119/222: mailmap: a Lucas fix, gnunet, 2019/11/06
- [gnurl] 120/222: altsvc: accept quoted ma and persist values,
gnunet <=
- [gnurl] 124/222: lib: silence conversion warnings, gnunet, 2019/11/06
- [gnurl] 113/222: cookies: using a share with cookies shouldn't enable the cookie engine, gnunet, 2019/11/06
- [gnurl] 126/222: checksrc: fix uninitialized variable warning, gnunet, 2019/11/06
- [gnurl] 117/222: BINDINGS: PureBasic, Net::Curl for perl and Nim, gnunet, 2019/11/06
- [gnurl] 133/222: RELEASE-NOTES: synced, gnunet, 2019/11/06
- [gnurl] 134/222: ESNI: initial build/setup, gnunet, 2019/11/06
- [gnurl] 135/222: CURLMOPT_MAX_CONCURRENT_STREAMS.3: fix SEE ALSO typo, gnunet, 2019/11/06
- [gnurl] 141/222: ngtcp2: adapt to API change, gnunet, 2019/11/06
- [gnurl] 140/222: cookies: change argument type for Curl_flush_cookies, gnunet, 2019/11/06
- [gnurl] 142/222: winbuild: add ENABLE_UNICODE option, gnunet, 2019/11/06