From 69a4f3bf4206b10cc26a1a1315b61097e420f8e9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 10 Apr 2015 00:15:01 +0900 Subject: [PATCH] nghttp: Consider :authority custom header field for SNI --- src/nghttp.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nghttp.cc b/src/nghttp.cc index fa57a99e..9329d436 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -531,12 +531,13 @@ int HttpClient::initiate_connection() { SSL_set_fd(ssl, fd); SSL_set_connect_state(ssl); - // If the user overrode the host header, use that value for - // the SNI extension + // If the user overrode the :authority or host header, use that + // value for the SNI extension const char *host_string = nullptr; - auto i = - std::find_if(std::begin(config.headers), std::end(config.headers), - [](const Header &nv) { return "host" == nv.name; }); + auto i = std::find_if(std::begin(config.headers), + std::end(config.headers), [](const Header &nv) { + return ":authority" == nv.name || "host" == nv.name; + }); if (i != std::end(config.headers)) { host_string = (*i).value.c_str(); } else {