aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-05-09 16:50:11 +0200
committerJay Satiro <raysatiro@yahoo.com>2016-05-09 15:30:25 -0400
commitf6767f5435f4c8230b382f18d4a2917ae37641d5 (patch)
tree40839e6a1367ede5506d77484a7b30e818d4709c /lib/url.c
parent5bf5f6ebfcede78ef7c2b16daa41c4b7ba266087 (diff)
TLS: move the ALPN/NPN enable bits to the connection
Only protocols that actually have a protocol registered for ALPN and NPN should try to get that negotiated in the TLS handshake. That is only HTTPS (well, http/1.1 and http/2) right now. Previously ALPN and NPN would wrongly be used in all handshakes if libcurl was built with it enabled. Reported-by: Jay Satiro Fixes #789
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 70ccd0f82..605212ee6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -6167,6 +6167,15 @@ static CURLcode create_conn(struct SessionHandle *data,
connections we are allowed to open. */
struct connectbundle *bundle = NULL;
+ if(conn->handler->flags & PROTOPT_ALPN_NPN) {
+ /* The protocol wants it, so set the bits if enabled in the easy handle
+ (default) */
+ if(data->set.ssl_enable_alpn)
+ conn->bits.tls_enable_alpn = TRUE;
+ if(data->set.ssl_enable_npn)
+ conn->bits.tls_enable_npn = TRUE;
+ }
+
if(waitpipe)
/* There is a connection that *might* become usable for pipelining
"soon", and we wait for that */