summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-02-04 15:12:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-02-04 15:12:44 +0100
commite5c53e5e2f561bef021c8e65dccc2ec06ae76473 (patch)
tree8f6278fa729e33e1817b367fac235e90a011d5f7
parent9c27386ef0be98237323ae8395deb6e44e78527d (diff)
downloadcurl-bagder/altsvc-h3version.tar.gz
altsvc: set h3 version a common single spotbagder/altsvc-h3version
... and move the #ifdefs out of the functions. Reported-by: Harry Sintonen
-rw-r--r--lib/altsvc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/altsvc.c b/lib/altsvc.c
index 93204e012..bb1969f2f 100644
--- a/lib/altsvc.c
+++ b/lib/altsvc.c
@@ -48,19 +48,20 @@
#define MAX_ALTSVC_ALPNLENSTR "10"
#define MAX_ALTSVC_ALPNLEN 10
+#if (defined(USE_QUICHE) || defined(USE_NGTCP2)) && !defined(UNITTESTS)
+#define H3VERSION "h3-25"
+#else
+#define H3VERSION "h3"
+#endif
+
static enum alpnid alpn2alpnid(char *name)
{
if(strcasecompare(name, "h1"))
return ALPN_h1;
if(strcasecompare(name, "h2"))
return ALPN_h2;
-#if (defined(USE_QUICHE) || defined(USE_NGTCP2)) && !defined(UNITTESTS)
- if(strcasecompare(name, "h3-25"))
+ if(strcasecompare(name, H3VERSION))
return ALPN_h3;
-#else
- if(strcasecompare(name, "h3"))
- return ALPN_h3;
-#endif
return ALPN_none; /* unknown, probably rubbish input */
}
@@ -73,11 +74,7 @@ const char *Curl_alpnid2str(enum alpnid id)
case ALPN_h2:
return "h2";
case ALPN_h3:
-#if (defined(USE_QUICHE) || defined(USE_NGTCP2)) && !defined(UNITTESTS)
- return "h3-24";
-#else
- return "h3";
-#endif
+ return H3VERSION;
default:
return ""; /* bad */
}