OpenQuizz
Une application de gestion des contenus pédagogiques
HTTPConnection Class Reference
Inheritance diagram for HTTPConnection:
Collaboration diagram for HTTPConnection:

Public Member Functions

def __init__ (self, *args, **kw)
 
def host (self)
 
def host (self, value)
 
def connect (self)
 
def putrequest (self, method, url, *args, **kwargs)
 
def putheader (self, header, *values)
 
def request (self, method, url, body=None, headers=None)
 
def request_chunked (self, method, url, body=None, headers=None)
 

Data Fields

 source_address
 
 socket_options
 
 proxy
 
 proxy_config
 
 sock
 
 auto_open
 

Static Public Attributes

 default_port
 
 default_socket_options
 
 is_verified
 

Detailed Description

Based on :class:`http.client.HTTPConnection` but provides an extra constructor
backwards-compatibility layer between older and newer Pythons.

Additional keyword parameters are used to configure attributes of the connection.
Accepted parameters include:

- ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
- ``source_address``: Set the source address for the current connection.
- ``socket_options``: Set specific options on the underlying socket. If not specified, then
  defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
  Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.

  For example, if you wish to enable TCP Keep Alive in addition to the defaults,
  you might pass:

  .. code-block:: python

     HTTPConnection.default_socket_options + [
         (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
     ]

  Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
args,
**  kw 
)

Reimplemented in SOCKSConnection.

Member Function Documentation

◆ connect()

def connect (   self)

Reimplemented in HTTPSConnection.

◆ host() [1/2]

def host (   self)
Getter method to remove any trailing dots that indicate the hostname is an FQDN.

In general, SSL certificates don't include the trailing dot indicating a
fully-qualified domain name, and thus, they don't validate properly when
checked against a domain name that includes the dot. In addition, some
servers may not expect to receive the trailing dot when provided.

However, the hostname with trailing dot is critical to DNS resolution; doing a
lookup with the trailing dot will properly only resolve the appropriate FQDN,
whereas a lookup without a trailing dot will search the system's search domain
list. Thus, it's important to keep the original host around for use only in
those cases where it's appropriate (i.e., when doing DNS lookup to establish the
actual TCP connection across which we're going to send HTTP requests).

◆ host() [2/2]

def host (   self,
  value 
)
Setter for the `host` property.

We assume that only urllib3 uses the _dns_host attribute; httplib itself
only uses `host`, and it seems reasonable that other libraries follow suit.

◆ putheader()

def putheader (   self,
  header,
values 
)
 

◆ putrequest()

def putrequest (   self,
  method,
  url,
args,
**  kwargs 
)
 

◆ request()

def request (   self,
  method,
  url,
  body = None,
  headers = None 
)

◆ request_chunked()

def request_chunked (   self,
  method,
  url,
  body = None,
  headers = None 
)
Alternative to the common request method, which sends the
body with chunked encoding and not as one block

Field Documentation

◆ auto_open

auto_open

◆ default_port

default_port
static

◆ default_socket_options

default_socket_options
static

◆ is_verified

is_verified
static

◆ proxy

proxy

◆ proxy_config

proxy_config

◆ sock

sock

◆ socket_options

socket_options

◆ source_address

source_address

The documentation for this class was generated from the following file: