Commit b463bf13 authored by Jason Madden's avatar Jason Madden

Fix ssl tests under 3.3 by creating the check_hostname attribute. Bump tested...

Fix ssl tests under 3.3 by creating the check_hostname attribute. Bump tested 3.4 to 3.4.4 due to test errors seen under 3.4.3.
parent 49528457
...@@ -59,6 +59,9 @@ class SSLContext(orig_SSLContext): ...@@ -59,6 +59,9 @@ class SSLContext(orig_SSLContext):
server_hostname=server_hostname, server_hostname=server_hostname,
_context=self) _context=self)
if not hasattr(orig_SSLContext, 'check_hostname'):
# Python 3.3 lacks this
check_hostname = False
class _contextawaresock(socket._gevent_sock_class): class _contextawaresock(socket._gevent_sock_class):
# We have to pass the raw stdlib socket to SSLContext.wrap_socket. # We have to pass the raw stdlib socket to SSLContext.wrap_socket.
...@@ -68,7 +71,10 @@ class _contextawaresock(socket._gevent_sock_class): ...@@ -68,7 +71,10 @@ class _contextawaresock(socket._gevent_sock_class):
# solution is to keep a weak reference to the SSLSocket on the raw # solution is to keep a weak reference to the SSLSocket on the raw
# socket and delegate. # socket and delegate.
_sslsock = None # We keep it in a slot to avoid having the ability to set any attributes
# we're not prepared for (because we don't know what to delegate.)
__slots__ = ('_sslsock',)
@property @property
def context(self): def context(self):
...@@ -79,7 +85,12 @@ class _contextawaresock(socket._gevent_sock_class): ...@@ -79,7 +85,12 @@ class _contextawaresock(socket._gevent_sock_class):
self._sslsock().context = ctx self._sslsock().context = ctx
def __getattr__(self, name): def __getattr__(self, name):
return getattr(self._sslsock(), name) try:
return getattr(self._sslsock(), name)
except RuntimeError:
# XXX: If the attribute doesn't exist,
# we infinitely recurse
raise AttributeError(name)
class SSLSocket(socket): class SSLSocket(socket):
......
...@@ -94,7 +94,7 @@ for var in "$@"; do ...@@ -94,7 +94,7 @@ for var in "$@"; do
install 3.3.6 python3.3 install 3.3.6 python3.3
;; ;;
3.4) 3.4)
install 3.4.3 python3.4 install 3.4.4 python3.4
;; ;;
3.5) 3.5)
install 3.5.1 python3.5 install 3.5.1 python3.5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment