Skip to content

Commit 0c76087

Browse files
committed
Extend net and net_gevent to use the new helper
1 parent 4d51074 commit 0c76087

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

rethinkdb/gevent_net/net_gevent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from rethinkdb import net, ql2_pb2
2727
from rethinkdb.errors import ReqlAuthError, ReqlCursorEmpty, ReqlDriverError, ReqlTimeoutError, RqlDriverError, \
2828
RqlTimeoutError
29+
from rethinkdb.helpers import get_hostname_for_ssl_match
2930
from rethinkdb.logger import default_logger
3031

3132
__all__ = ['Connection']
@@ -103,7 +104,7 @@ def __init__(self, parent):
103104
self._socket.close()
104105
raise ReqlDriverError("SSL handshake failed (see server log for more information): %s" % str(exc))
105106
try:
106-
ssl.match_hostname(self._socket.getpeercert(), hostname=self.host)
107+
ssl.match_hostname(self._socket.getpeercert(), hostname=get_hostname_for_ssl_match(self.host))
107108
except ssl.CertificateError:
108109
self._socket.close()
109110
raise

rethinkdb/net.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
ReqlTimeoutError,
4545
ReqlUserError)
4646
from rethinkdb.handshake import HandshakeV1_0
47+
from rethinkdb.helpers import get_hostname_for_ssl_match
4748
from rethinkdb.logger import default_logger
4849

4950
__all__ = ['Connection', 'Cursor', 'DEFAULT_PORT', 'DefaultConnection', 'make_connection']
@@ -352,7 +353,8 @@ def __init__(self, parent, timeout):
352353
"SSL handshake failed (see server log for more information): %s" %
353354
str(err))
354355
try:
355-
match_hostname(self._socket.getpeercert(), hostname=self.host)
356+
357+
match_hostname(self._socket.getpeercert(), hostname=get_hostname_for_ssl_match(self.host))
356358
except CertificateError:
357359
self._socket.close()
358360
raise

0 commit comments

Comments
 (0)