summaryrefslogtreecommitdiff
path: root/src/SocketCore.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-15 01:14:21 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-15 01:14:21 +0900
commit0030025bb6989b130c7f609819669e0619519d64 (patch)
treee2d2c255486f28e9f7f9a37d02041cb56d58ef46 /src/SocketCore.cc
parent393d0d9fbc64ec3345fddae12f2c295473dba78a (diff)
Don't set SNI hostname if it does not include "." for GNUTLS
Diffstat (limited to 'src/SocketCore.cc')
-rw-r--r--src/SocketCore.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/SocketCore.cc b/src/SocketCore.cc
index a625b019..969e15b3 100644
--- a/src/SocketCore.cc
+++ b/src/SocketCore.cc
@@ -986,7 +986,10 @@ bool SocketCore::initiateSecureConnection(const std::string& hostname)
switch(secure_) {
case A2_TLS_INITIALIZED:
secure_ = A2_TLS_HANDSHAKING;
- if(!util::isNumericHost(hostname)) {
+ // Check hostname is not numeric and it includes ".". Setting
+ // "localhost" will produce TLS alert.
+ if(!util::isNumericHost(hostname) &&
+ hostname.find(".") != std::string::npos) {
// TLS extensions: SNI
int ret = gnutls_server_name_set(sslSession_, GNUTLS_NAME_DNS,
hostname.c_str(), hostname.size());