Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -1,6 +1,6 @@ OBJOPENSSL_SHARED_LIB = @OBJOPENSSL_SHARED_LIB@ OBJOPENSSL_STATIC_LIB = @OBJOPENSSL_STATIC_LIB@ OBJOPENSSL_FRAMEWORK = @OBJOPENSSL_FRAMEWORK@ -OBJFW_LIBS = @OBJFW_LIBS@ OBJFW_FRAMEWORK_LIBS = @OBJFW_FRAMEWORK_LIBS@ +OBJFW_LIBS = @OBJFW_LIBS@ Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -196,10 +196,21 @@ exceptionWithHost: host port: port socket: self SSLError: error]; } + + if (SSL_set_tlsext_host_name(_SSL, [host UTF8String]) != 1) { + unsigned long error = ERR_get_error(); + + [self close]; + + @throw [SSLConnectionFailedException exceptionWithHost: host + port: port + socket: self + SSLError: error]; + } if (_certificateVerificationEnabled) { X509_VERIFY_PARAM *param = SSL_get0_param(_SSL); X509_VERIFY_PARAM_set_hostflags(param,