Exemple #1
0
    def __init__(self, auth_provider, service, region,
                 endpoint_type='publicURL',
                 build_interval=1, build_timeout=60,
                 disable_ssl_certificate_validation=False, ca_certs=None,
                 trace_requests='', name=None, http_timeout=None,
                 proxy_url=None, follow_redirects=True):
        self.auth_provider = auth_provider
        self.service = service
        self.region = region
        self.name = name
        self.endpoint_type = endpoint_type
        self.build_interval = build_interval
        self.build_timeout = build_timeout
        self.trace_requests = trace_requests

        self._skip_path = False
        self.general_header_lc = set(('cache-control', 'connection',
                                      'date', 'pragma', 'trailer',
                                      'transfer-encoding', 'via',
                                      'warning'))
        self.response_header_lc = set(('accept-ranges', 'age', 'etag',
                                       'location', 'proxy-authenticate',
                                       'retry-after', 'server',
                                       'vary', 'www-authenticate'))
        dscv = disable_ssl_certificate_validation

        if proxy_url:
            self.http_obj = http.ClosingProxyHttp(
                proxy_url,
                disable_ssl_certificate_validation=dscv, ca_certs=ca_certs,
                timeout=http_timeout, follow_redirects=follow_redirects)
        else:
            self.http_obj = http.ClosingHttp(
                disable_ssl_certificate_validation=dscv, ca_certs=ca_certs,
                timeout=http_timeout, follow_redirects=follow_redirects)
Exemple #2
0
 def test_redirect_default(self):
     connection = http.ClosingProxyHttp(proxy_url=PROXY_URL)
     self.assertTrue(connection.follow_redirects)
Exemple #3
0
 def test_redirect_off(self):
     connection = http.ClosingProxyHttp(follow_redirects=False,
                                        proxy_url=PROXY_URL)
     self.assertFalse(connection.follow_redirects)
Exemple #4
0
 def closing_http(self, proxy_url=PROXY_URL, **kwargs):
     connection = http.ClosingProxyHttp(proxy_url=proxy_url, **kwargs)
     self.assertHasProxy(connection, proxy_url)
     return connection