aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-03-03 11:17:52 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-03-03 11:17:52 +0100
commite1be8254534898fccafc5d6cd04f6235f283cfbd (patch)
treed48bbbf5cb59d93e82fc14f13f1b0c7a7e5044d3 /lib/http.c
parent4331a3b8fa40cc8d71b7abb36b096dccdc11e3cb (diff)
alt-svc: the libcurl bits
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c
index d0a01979d..f5709b68b 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -77,6 +77,7 @@
#include "http2.h"
#include "connect.h"
#include "strdup.h"
+#include "altsvc.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -3978,6 +3979,20 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
}
+#ifdef USE_ALTSVC
+ /* If enabled, the header is incoming and this is over HTTPS */
+ else if(data->asi && checkprefix("Alt-Svc:", k->p) &&
+ (conn->handler->flags & PROTOPT_SSL)) {
+ /* the ALPN of the current request */
+ enum alpnid id = (conn->httpversion == 20) ? ALPN_h2 : ALPN_h1;
+ result = Curl_altsvc_parse(data, data->asi,
+ &k->p[ strlen("Alt-Svc:") ],
+ id, conn->host.name,
+ curlx_uitous(conn->remote_port));
+ if(result)
+ return result;
+ }
+#endif
else if(conn->handler->protocol & CURLPROTO_RTSP) {
result = Curl_rtsp_parseheader(conn, k->p);
if(result)