337 **self._observeropts) |
337 **self._observeropts) |
338 |
338 |
339 return logginghttpconnection(createconnection, *args, **kwargs) |
339 return logginghttpconnection(createconnection, *args, **kwargs) |
340 |
340 |
341 if has_https: |
341 if has_https: |
342 class httpsconnection(httplib.HTTPConnection): |
342 class httpsconnection(keepalive.HTTPConnection): |
343 response_class = keepalive.HTTPResponse |
343 response_class = keepalive.HTTPResponse |
344 default_port = httplib.HTTPS_PORT |
344 default_port = httplib.HTTPS_PORT |
345 # must be able to send big bundle as stream. |
345 # must be able to send big bundle as stream. |
346 send = _gen_sendfile(keepalive.safesend) |
346 send = _gen_sendfile(keepalive.safesend) |
347 getresponse = keepalive.wrapgetresponse(httplib.HTTPConnection) |
347 getresponse = keepalive.wrapgetresponse(httplib.HTTPConnection) |
348 |
348 |
349 def __init__(self, host, port=None, key_file=None, cert_file=None, |
349 def __init__(self, host, port=None, key_file=None, cert_file=None, |
350 *args, **kwargs): |
350 *args, **kwargs): |
351 httplib.HTTPConnection.__init__(self, host, port, *args, **kwargs) |
351 keepalive.HTTPConnection.__init__(self, host, port, *args, **kwargs) |
352 self.key_file = key_file |
352 self.key_file = key_file |
353 self.cert_file = cert_file |
353 self.cert_file = cert_file |
354 |
354 |
355 def connect(self): |
355 def connect(self): |
356 self.sock = socket.create_connection((self.host, self.port)) |
356 self.sock = socket.create_connection((self.host, self.port)) |