##// END OF EJS Templates
httpclient: update to c5abd358e543 of httpplus
Augie Fackler -
r16774:69af967b default
parent child Browse files
Show More
@@ -372,6 +372,10 b' class HTTPConnection(object):'
372 372 else:
373 373 sock = socketutil.create_connection((self.host, self.port))
374 374 if self.ssl:
375 # This is the default, but in the case of proxied SSL
376 # requests the proxy logic above will have cleared
377 # blocking mode, so reenable it just to be safe.
378 sock.setblocking(1)
375 379 logger.debug('wrapping socket for ssl with options %r',
376 380 self.ssl_opts)
377 381 sock = socketutil.wrap_socket(sock, **self.ssl_opts)
@@ -58,6 +58,7 b' class MockSocket(object):'
58 58 self.close_on_empty = False
59 59 self.sent = ''
60 60 self.read_wait_sentinel = httpplus._END_HEADERS
61 self.blocking = True
61 62
62 63 def close(self):
63 64 self.closed = True
@@ -66,9 +67,11 b' class MockSocket(object):'
66 67 self.sa = sa
67 68
68 69 def setblocking(self, timeout):
69 assert timeout == 0
70 self.blocking = bool(timeout)
70 71
71 72 def recv(self, amt=-1):
73 # we only properly emulate non-blocking sockets
74 assert not self.blocking
72 75 if self.early_data:
73 76 datalist = self.early_data
74 77 elif not self.data:
@@ -136,6 +139,8 b' def mocksslwrap(sock, keyfile=None, cert'
136 139 ssl_version=None, ca_certs=None,
137 140 do_handshake_on_connect=True,
138 141 suppress_ragged_eofs=True):
142 assert sock.blocking, ('wrapping a socket with ssl requires that '
143 'it be in blocking mode.')
139 144 return MockSSLSocket(sock)
140 145
141 146
General Comments 0
You need to be logged in to leave comments. Login now