aboutsummaryrefslogtreecommitdiffstats
path: root/lib/altsvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/altsvc.c')
-rw-r--r--lib/altsvc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/altsvc.c b/lib/altsvc.c
index c39d86ea..c2ec489d 100644
--- a/lib/altsvc.c
+++ b/lib/altsvc.c
@@ -50,8 +50,10 @@
#define MAX_ALTSVC_ALPNLENSTR "10"
#define MAX_ALTSVC_ALPNLEN 10
-#if (defined(USE_QUICHE) || defined(USE_NGTCP2)) && !defined(UNITTESTS)
-#define H3VERSION "h3-27"
+#if defined(USE_QUICHE) && !defined(UNITTESTS)
+#define H3VERSION "h3-29"
+#elif defined(USE_NGTCP2) && !defined(UNITTESTS)
+#define H3VERSION "h3-29"
#else
#define H3VERSION "h3"
#endif
@@ -167,7 +169,6 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, char *line)
as->prio = prio;
as->persist = persist ? 1 : 0;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
- asi->num++; /* one more entry */
}
}
@@ -408,7 +409,6 @@ static void altsvc_flush(struct altsvcinfo *asi, enum alpnid srcalpnid,
strcasecompare(srchost, as->src.host)) {
Curl_llist_remove(&asi->list, e, NULL);
altsvc_free(as);
- asi->num--;
}
}
}
@@ -429,6 +429,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.
@@ -474,7 +476,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
dstalpnid = alpn2alpnid(alpnbuf);
p++;
if(*p == '\"') {
- const char *dsthost;
+ const char *dsthost = "";
const char *value_ptr;
char option[32];
unsigned long num;
@@ -518,12 +520,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) {
@@ -573,7 +575,6 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
as->expires = maxage + time(NULL);
as->persist = persist;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
- asi->num++; /* one more entry */
infof(data, "Added alt-svc: %s:%d over %s\n", dsthost, dstport,
Curl_alpnid2str(dstalpnid));
}