diff options
author | Julien Barbot <[email protected]> | 2013-11-03 21:30:03 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-11-06 11:13:59 +0100 |
commit | d370fe05f5884691a89784aa73bfb4eb2176edab (patch) | |
tree | e7f1fcff06fa24a17a904159def346506765822e /lib/ssl/src/ssl_handshake.erl | |
parent | bc8b6bf58c96f8d5a07146ddea145f71fe8c8956 (diff) | |
download | otp-d370fe05f5884691a89784aa73bfb4eb2176edab.tar.gz otp-d370fe05f5884691a89784aa73bfb4eb2176edab.tar.bz2 otp-d370fe05f5884691a89784aa73bfb4eb2176edab.zip |
Add a new server_name_indication option to ssl:connect
- Set to disable to explicitly disable SNI support.
- Set to a hostname when upgrading from TCP to TLS.
Diffstat (limited to 'lib/ssl/src/ssl_handshake.erl')
-rw-r--r-- | lib/ssl/src/ssl_handshake.erl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index e1fd6970cc..9142a260b1 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -105,7 +105,7 @@ client_hello_extensions(Host, Version, CipherSuites, SslOpts, ConnectionStates, next_protocol_negotiation = encode_client_protocol_negotiation(SslOpts#ssl_options.next_protocol_selector, Renegotiation), - sni = sni(Host)}. + sni = sni(Host, SslOpts#ssl_options.server_name_indication)}. %%-------------------------------------------------------------------- -spec certificate(der_cert(), db_handle(), certdb_ref(), client | server) -> #certificate{} | #alert{}. @@ -1159,13 +1159,19 @@ select_curve(Curves, [Curve| Rest]) -> false -> select_curve(Curves, Rest) end. +%% RFC 6066, Section 3: Currently, the only server names supported are +%% DNS hostnames +sni(_, disable) -> + undefined; +sni(Host, undefined) -> + sni1(Host); +sni(_Host, SNIOption) -> + sni1(SNIOption). -sni(Host) -> - %% RFC 6066, Section 3: Currently, the only server names supported are - %% DNS hostnames - case inet_parse:domain(Host) of +sni1(Hostname) -> + case inet_parse:domain(Hostname) of false -> undefined; - true -> #sni{hostname = Host} + true -> #sni{hostname = Hostname} end. %%-------------------------------------------------------------------- %%% Internal functions |