aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZandra <[email protected]>2015-12-01 16:24:02 +0100
committerZandra <[email protected]>2015-12-01 16:24:02 +0100
commit8f2c74038cfdd10270d349de4898828f915d3a50 (patch)
tree5f122c270c79a5c459c57780f2ebb1d598613ca9
parentc3d8abd51baafd992bddba8988ebb901eba0d072 (diff)
parentb78c67a0e833abb1a43afcc016a2ab0436c08d2d (diff)
downloadotp-8f2c74038cfdd10270d349de4898828f915d3a50.tar.gz
otp-8f2c74038cfdd10270d349de4898828f915d3a50.tar.bz2
otp-8f2c74038cfdd10270d349de4898828f915d3a50.zip
Merge branch 'maint'
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index e6dcfee818..d1c52dcc78 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1827,11 +1827,13 @@ host_header(_, URI) ->
tls_upgrade(#state{status =
{ssl_tunnel,
#request{settings =
- #http_options{ssl = {_, TLSOptions} = SocketType},
- address = Address} = Request},
+ #http_options{ssl = {_, TLSOptions0} = SocketType},
+ address = {Host, _} = Address} = Request},
session = #session{socket = TCPSocket} = Session0,
options = Options} = State) ->
+ TLSOptions = maybe_add_sni(Host, TLSOptions0),
+
case ssl:connect(TCPSocket, TLSOptions) of
{ok, TLSSocket} ->
ClientClose = httpc_request:is_client_closing(Request#request.headers),
@@ -1862,6 +1864,15 @@ tls_upgrade(#state{status =
{stop, normal, State#state{request = Request}}
end.
+maybe_add_sni(Host, Options) ->
+ case http_util:is_hostname(Host) andalso
+ not lists:keymember(server_name_indication, 1, Options) of
+ true ->
+ [{server_name_indication, Host} | Options];
+ false ->
+ Options
+ end.
+
%% ---------------------------------------------------------------------
%% Session wrappers
%% ---------------------------------------------------------------------