pi_portal.modules.system.socket.unix_stream_http_connection

UnixStreamHTTPConnection class.

class pi_portal.modules.system.socket.unix_stream_http_connection.UnixStreamHTTPConnection(host, port=None, timeout=<object object>, source_address=None, blocksize=8192)[source]

HTTP connection over a unix socket.

Parameters:

host – Path to the unix socket to open.

close()

Close the connection to the HTTP server.

connect()[source]

Open a unix socket on the specified host.

Return type:

None

endheaders(message_body=None, *, encode_chunked=False)

Indicate that the last header line has been sent to the server.

This method sends the request to the server. The optional message_body argument can be used to pass a message body associated with the request.

getresponse()

Get the response from the server.

If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable.

If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed.

putheader(header, *values)

Send a request header line to the server.

For example: h.putheader(‘Accept’, ‘text/html’)

putrequest(method, url, skip_host=False, skip_accept_encoding=False)

Send a request to the server.

`method’ specifies an HTTP request method, e.g. ‘GET’. `url’ specifies the object being requested, e.g. ‘/index.html’. `skip_host’ if True does not add automatically a ‘Host:’ header `skip_accept_encoding’ if True does not add automatically an

‘Accept-Encoding:’ header

request(method, url, body=None, headers={}, *, encode_chunked=False)

Send a complete request to the server.

response_class

alias of HTTPResponse

send(data)

Send data’ to the server. ``data` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object.

set_tunnel(host, port=None, headers=None)

Set up host and port for HTTP CONNECT tunnelling.

In a connection that uses HTTP CONNECT tunneling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to set_tunnel. This done by sending an HTTP CONNECT request to the proxy server when the connection is established.

This method must be called before the HTTP connection has been established.

The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request.