Client projection dispatch management.
Provides Contexts for managing a client's sessions.
Engineering
Agents are fairly complicated with respect to preferences. The current implementation presumes HTTP/1.1 in most cases where a protocol priority should be used to select a desired wire protocol.
Navigation and Session are essentially unimplemented. Finding a generic structure that fits all use cases is unlikely; however, the direction of a traditional user agent model should be sufficient in most cases.
typing
weakref
core
flows
io
http
_prepare_http_transports_v0
_prepare_http_transports_v0(ifctx, ports)
_prepare_http_transports_v1
_prepare_http_transports_v1(ifctx, ports)
_prepare_http_transports_v2
_prepare_http_transports_v2(ifctx, ports)
protocols
protocols = {
'http': _prepare_http_transports_v0, # Adjustable.
'http-1': _prepare_http_transports_v1, # Strictly 1.0/1.1 only.
'http-2': _prepare_http_transports_v2, # Not implemented
}
Controller
Request execution controller for HTTP agents.
ControllerProperties
- http_response
The http.Structures instance representing the response status and headers.
Controllerhttp_response
http_response = None
@property
Controllertransportio.Transport
Controller__init__
__init__(self, invocations, channel_id, connect_output)
Controller_correlation
_correlation(self, channel_id, parameters, connect_input)
Controllerhttp_add_header
http_add_header(self, key, value)
Append a single header to the header sequence that will be supplied by the response.
Controlleradd_header
add_header = http_add_header
Controllerhttp_extend_headers
http_extend_headers(self, pairs)
Add a sequence of headers.
Controllerextend_headers
extend_headers = http_extend_headers
Controllerhttp_set_request
http_set_request(self, method, uri, length)
Assign the method and URI of the request and designate the transfer encoding. Excepting length, all parameters must be bytes instances.
If cotype is None, neither Content-Length nor Transfer-Encoding will be appended to the headers.
If cotype is not None and length is None, chunked transfer encoding will be used. If cotype is not None and length is an integer, Content-Length will be provided.
Controllerset_request
set_request = http_set_request
Controllerconnect
connect(self, channel)
Initiate the request causing headers to be sent and connect the channel as the HTTP request's entity body. If channel is None, no entity body will be supplied.
Controlleraccept
accept(self, channel)
Accept the entity-body of the response into channel. If channel is None, any entity body sent will trigger a fault.
Controller_http_content_headers
_http_content_headers(self, cotype, length)
Define the type and length of the entity body to be sent.
Controllerhttp_dispatch_output
http_dispatch_output(self, channel)
Dispatch the given channel using a new fault.kernel.io.Transfer instance into invocations' fault.kernel.io.Transport transaction.
Controllerhttp_iterate_output
http_iterate_output(self, iterator)
Construct a Flow consisting of a single fault.kernel.flows.Iterate instance used to stream output to the connection protocol state.
The fault.kernel.io.Transfer transaction will be dispatched into the fault.kernel.io.Transport supporting the connection to the remote peer.
Controllerhttp_put_data
http_put_data(self, uri, cotype, data)
Send the given data to the remote end with the given content type, cotype. If other headers are desired, they must be configured before running this method.
Controllerhttp_read_input_into_buffer
http_read_input_into_buffer(self, callback, *args)
Connect the input to a buffer that executes the given callback when the entity body has been transferred.
Controllerhttp_read_input_into_file
http_read_input_into_file(self, path)
Connect the input to a buffer that executes the given callback when the entity body has been transferred.
Controllerhttp_ignore_input
http_ignore_input(self)
Connect the given input to a transfer that discards events.
Session
Session dispatching invocation projections for facilitating a request.
Session__init__
__init__(self)
Sessions_correlate
s_correlate(self, inv)
Sessionxact_exit
xact_exit(self, xact)
Sessionactuate
actuate(self)
RInvocation
An HTTP request received by a service and its determined response headers and status.
The parameters should store exact bytes instances that were read by the transport. Higher-level interfaces, http.Structures, should often decode these field accordingly.
RInvocationProperties
RInvocationprojection
projection = True
RInvocationcontext
context = None
@property
RInvocationheadershttp.HeaderSequence
RInvocationmethodstr
Decoded form of the request's method.
RInvocationpathstr
Decoded form of the request URI's path.
RInvocationdeclare_output_length
declare_output_length(self, length)
RInvocationdeclare_output_chunked
declare_output_chunked(self)
RInvocation__init__
__init__(self, exit_method, method, path, headers)
RInvocation__str__
__str__(self)
RInvocationfrom_request
from_request(Class, rline, headers)
Initialize an Invocation using a parsed request line and headers. Primarily, this is used by fork in a server context.