Example #1
0
    def __init__(self,
                 host,
                 port=None,
                 key_file=None,
                 cert_file=None,
                 strict=None,
                 timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                 ssl_context=None,
                 server_hostname=None,
                 **kw):

        HTTPConnection.__init__(self,
                                host,
                                port,
                                strict=strict,
                                timeout=timeout,
                                **kw)

        self.key_file = key_file
        self.cert_file = cert_file
        self.ssl_context = ssl_context
        self.server_hostname = server_hostname

        # Required property for Google AppEngine 1.9.0 which otherwise causes
        # HTTPS requests to go out as HTTP. (See Issue #356)
        self._protocol = 'https'
Example #2
0
 def __init__(self, *args, **kwargs):
     HTTPConnection.__init__(self, *args, **kwargs)
     self._original_response_cls = self.response_class
     # We'd ideally hook into httplib's states, but they're all
     # __mangled_vars so we use our own state var.  This variable is set
     # when we receive an early response from the server.  If this value is
     # set to True, any calls to send() are noops.  This value is reset to
     # false every time _send_request is called.  This is to workaround the
     # fact that py2.6 (and only py2.6) has a separate send() call for the
     # body in _send_request, as opposed to endheaders(), which is where the
     # body is sent in all versions > 2.6.
     self._response_received = False
     self._expect_header_set = False