hio.core.http.serving
hio.core.http.serving classes
nonblocking http server
Module Contents
Classes
Nonblocking HTTP Server Requestant class |
|
Nonblocking HTTP WSGI Responder class |
|
Server WSGI HTTP Server Class |
|
Nonblocking HTTP Server Response class for non-wsgi applications |
|
Manages the associated requestant and responder for an incoming connection |
|
BareServer class nonblocking Bare (non-WSGI) HTTP server |
|
Class that provides Falcon sink endpoint for serving static files in support |
|
HTTP WSGI Server Doer |
Functions
|
Wrapper to create and open HTTP Server instances |
Attributes
- class hio.core.http.serving.Requestant(remoter=None, **kwa)[source]
Bases:
hio.core.http.httping.ParsentNonblocking HTTP Server Requestant class Parses request msg
- checkPersisted(self)[source]
Checks headers to determine if connection should be kept open until client closes it Sets the .persisted flag
- class hio.core.http.serving.Responder(incomer, app, environ, chunkable=False, delay=None)[source]
Nonblocking HTTP WSGI Responder class
- write(self, msg)[source]
WSGI write callback This writes out the headers the first time its called otherwise writes the msg bytes
- start(self, status, response_headers, exc_info=None)[source]
WSGI application start_response callable
Parameters:
- status is string of status code and status reason ‘200 OK’ or simple
status code int which will be replaced with string
- response_headers is list of tuples of strings of the form (field, value)
one tuple for each header example: [
(‘Content-type’, ‘text/plain’), (‘X-Some-Header’, ‘value’)
]
- exc_info is optional exception info if exception occurred while
processing request in wsgi application If exc_info is supplied, and no HTTP headers have been output yet, start_response should replace the currently-stored HTTP response headers with the newly-supplied ones, thus allowing the application to “change its mind” about the output when an error has occurred.
However, if exc_info is provided, and the HTTP headers have already been sent, start_response must raise an error, and should re-raise using the exc_info tuple. That is:
raise exc_info[1].with_traceback(exc_info[2]) (python3)
- Nonstandard modifiction to allow for iterable/generator of body to change
headers and status before first write to support async processing of responses whose iterator/generator yields empty before first non-empty yield. In .service yielding empty does not cause write so status line and headers are not sent until first non-empty write.
The mode is that the app.headers and app.status are consulted to see if changed from when .start = wsgi start_response was first called.
- hio.core.http.serving.openServer(cls=None, **kwa)[source]
Wrapper to create and open HTTP Server instances When used in with statement block, calls .close() on exit of with block
- Parameters
instance (cls is Class instance of subclass) –
- Usage:
- with openServer() as server0:
server0.
- with openServer(cls=BareServer) as server0:
server0.
- class hio.core.http.serving.Server(name='hio.wsgi.server', app=None, reqs=None, reps=None, servant=None, bufsize=8096, wl=None, ha=None, host='', port=None, eha=None, scheme='', tymeout=None, **kwa)[source]
Server WSGI HTTP Server Class
- wind(self, tymth)[source]
Inject new tymist.tymth as new ._tymth. Changes tymist.tyme base. Updates winds .tymer .tymth
- buildEnviron(self, requestant)[source]
Returns wisgi environment dictionary for supplied requestant
- class hio.core.http.serving.CustomResponder(steward=None, status=200, headers=None, body=b'', data=None)[source]
Nonblocking HTTP Server Response class for non-wsgi applications Used by Steward
HTTP/1.1 200 OK
Content-Length: 122
Content-Type: application/json
Date: Thu, 30 Apr 2015 19:37:17 GMT
Server: IoBook.local
- class hio.core.http.serving.Steward(remoter, requestant=None, responder=None, dictable=False)[source]
Manages the associated requestant and responder for an incoming connection for BareServer (non-wsgi) HTTP server
- class hio.core.http.serving.BareServer(servant=None, stewards=None, name='', bufsize=8096, wl=None, ha=None, host='', port=None, eha=None, scheme='', dictable=False, timeout=None, **kwa)[source]
BareServer class nonblocking Bare (non-WSGI) HTTP server Define CustomResponder subclass to respond to requests as per Steward
- class hio.core.http.serving.StaticSink(staticDirPath=None)[source]
Class that provides Falcon sink endpoint for serving static files in support of a client side web app.
- class hio.core.http.serving.ServerDoer(server, **kwa)[source]
Bases:
hio.base.doing.DoerHTTP WSGI Server Doer
See Doer for inherited attributes, properties, and methods.
- .server is HTTP WSGI Server instance
Properties: