summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-29 11:19:52 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-29 11:20:17 -0300
commitf56a0435f2008cf88609124a74fcaa71ad8fb2c1 (patch)
tree52888f4b2d6b697e3dfdfdc7eb4fe8467a7dced7
parent119cd5d3ff9fbbafc59db7481c0eee29f43c0c64 (diff)
Turn on SNI in OpenSSL
-rw-r--r--drivers/openssl/stream_peer_openssl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/openssl/stream_peer_openssl.cpp b/drivers/openssl/stream_peer_openssl.cpp
index 67f58b6028..9349df3793 100644
--- a/drivers/openssl/stream_peer_openssl.cpp
+++ b/drivers/openssl/stream_peer_openssl.cpp
@@ -309,6 +309,9 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs,
validate_certs=p_validate_certs;
validate_hostname=p_for_hostname!="";
+
+
+
if (p_validate_certs) {
@@ -380,6 +383,10 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs,
bio->ptr = this;
SSL_set_bio( ssl, bio, bio );
+ if (p_for_hostname!=String()) {
+ SSL_set_tlsext_host_name(ssl,p_for_hostname.utf8().get_data());
+ }
+
use_blocking=true; // let handshake use blocking
// Set the SSL to automatically retry on failure.
SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);