The glanceclient.common.http Module

class glanceclient.common.http.HTTPClient(endpoint, **kwargs)

Bases: object

static encode_headers(headers)

Encodes headers.

Note: This should be used right before sending anything out.

Parameters:headers – Headers to encode
Returns:Dictionary with encoded headers’ names and values
get_connection()
static get_connection_class(scheme)
static get_connection_kwargs(scheme, **kwargs)
json_request(method, url, **kwargs)
log_curl_request(method, url, kwargs)
static log_http_response(resp, body=None)
static parse_endpoint(endpoint)
raw_request(method, url, **kwargs)
class glanceclient.common.http.OpenSSLConnectionDelegator(*args, **kwargs)

Bases: object

An OpenSSL.SSL.Connection delegator.

Supplies an additional ‘makefile’ method which httplib requires and is not present in OpenSSL.SSL.Connection.

Note: Since it is not possible to inherit from OpenSSL.SSL.Connection a delegator must be used.

makefile(*args, **kwargs)
class glanceclient.common.http.ResponseBodyIterator(resp)

Bases: object

A class that acts as an iterator over an HTTP response.

next()
class glanceclient.common.http.VerifiedHTTPSConnection(host, port=None, key_file=None, cert_file=None, cacert=None, timeout=None, insecure=False, ssl_compression=True)

Bases: httplib.HTTPSConnection

Extended HTTPSConnection which uses the OpenSSL library for enhanced SSL support. Note: Much of this functionality can eventually be replaced

with native Python 3.3 code.
connect()

Connect to an SSL port using the OpenSSL library and apply per-connection parameters.

static host_matches_cert(host, x509)

Verify that the the x509 certificate we have received from ‘host’ correctly identifies the server we are connecting to, ie that the certificate’s Common Name or a Subject Alternative Name matches ‘host’.

setcontext()

Set up the OpenSSL context.

verify_callback(connection, x509, errnum, depth, preverify_ok)

This Page