module wsgiex 0.2.1

Description

This package provide extended versions of StreamServer, WSGIRequestHandler and some additions.
It doesn't has any dependences and use some parts of Werkzeug's source.

class WSGIRequestHandlerEx()

Description
Extended implementation of WSGIRequestHandler, that also use some code from Werkzeug.
Return
instance Instance of class WSGIRequestHandlerEx

method_public connection_dropped(self, error, environ=None)

Description
Called if the connection was closed by the client.  By default nothing happens.

method_public handle(self)

Description
Handles a request ignoring dropped connections.

method_public handle_one_request(self)

Description
Handle a single HTTP request.

method_public log_message(self, format, *args)

Description
# def log_error(self, format, *args): pass
# def log_request(self, format, *args): pass

method_public send_response(self, code, message=None)

Description
Send the response header and log the response code.

method_public serve_request(self)

Description
Here we serving request and generate response

method_undoc address_string(self)

method_undoc decoding_dance(self, s, charset="utf-8", errors="replace")

method_undoc encoding_dance(self, s, charset="utf-8", errors="replace")

method_undoc get_environ(self)

method_undoc get_stderr(self)

method_undoc version_string(self)

class ThreadedStreamServerEx(self, bind_addr, RequestHandlerClass=None, bind_and_activate=True, dispatcher=None, socketClass=None, selectClass=None, eventClass=None, ssl_args=None, log=True, request_queue_size=None, spawnThreadFunc=None, killThreadFunc=None, sleepFunc=None)

Description
Multi-threaded version of StreamServerEx, that use pool and allow to kill spawned threads.
It also can be patched for using something, that emulate threads by passing <spawnThreadFunc>, <killThreadFunc> and <sleepFunc>.
Return
instance Instance of class ThreadedStreamServerEx

method_public handle_request(self)

Description
Handle one request, possibly blocking. Respects self.timeout.

method_public process_request(self, request, client_address)

Description
Start a new thread to process the request.

method_public process_request_thread(self, rId, request, client_address)

Description
Same as in BaseServer but as a thread. In addition, exception handling is done here.

method_public serve_forever(self, poll_interval=0.5)

Description
Handle one request at a time until shutdown.

method_public shutdown_request(self, request)

Description
Called to shutdown and close an individual request.

method_private _handle_request_noblock(self)

Description
Handle one request, without blocking.

method_private _server_reuse_address(self)

method_private _spawnThreadDefault(self, target, args=None, kwargs=None, daemon=False)

method_private _wait_for_file_ready(self, *args)

method_special __del__(self)

method_special __init__(self, bind_addr, RequestHandlerClass=None, bind_and_activate=True, dispatcher=None, socketClass=None, selectClass=None, eventClass=None, ssl_args=None, log=True, request_queue_size=None, spawnThreadFunc=None, killThreadFunc=None, sleepFunc=None)

method_undoc handle_error(self, request, client_address)

method_undoc server_bind(self)

method_undoc setup_environ(self)

method_undoc shutdown(self)

method_undoc start(self)

method_undoc stop(self, timeout=1)

class StreamServerEx(self, bind_addr, RequestHandlerClass=None, bind_and_activate=True, dispatcher=None, socketClass=None, selectClass=None, eventClass=None, ssl_args=None, log=True, request_queue_size=None)

Description
Extended impelementation of standart Python BaseHTTPServer.HTTPServer, that supports UnixDomainSockets and passed sockets. It also supports SSL and overloading Socket's class and Select's class (for simple using with gevent, for example) by passing <socketClass>, <selectClass>, <eventClass>.
Return
instance Instance of class StreamServerEx

method_public handle_request(self)

Description
Handle one request, possibly blocking. Respects self.timeout.

method_public serve_forever(self, poll_interval=0.5)

Description
Handle one request at a time until shutdown.

method_public shutdown_request(self, request)

Description
Called to shutdown and close an individual request.

method_private _handle_request_noblock(self)

Description
Handle one request, without blocking.

method_private _server_reuse_address(self)

method_private _spawnThreadDefault(self, target, args=None, kwargs=None, daemon=False)

method_private _wait_for_file_ready(self, *args)

method_special __del__(self)

method_special __init__(self, bind_addr, RequestHandlerClass=None, bind_and_activate=True, dispatcher=None, socketClass=None, selectClass=None, eventClass=None, ssl_args=None, log=True, request_queue_size=None)

method_undoc handle_error(self, request, client_address)

method_undoc server_bind(self)

method_undoc setup_environ(self)

method_undoc shutdown(self)

method_undoc start(self)

method_undoc stop(self, timeout=None)

class _SSLContext(self, protocol=None)

Description
Wrapper that provides SSL-context and ability for patching sockets. Source from Werkzeug
Return
instance Instance of class _SSLContext

method_public is_ssl_error(self, error=None)

Description
Checks if the given error (or the current one) is an SSL error.

method_special __init__(self, protocol=None)

method_undoc load_cert_chain(self, certfile, keyfile=None, password=None)

method_undoc wrap_socket(self, sock, **kwargs)

function_public terminate_thread(thread)

Description
Terminates a python thread from another thread. Source from http://stackoverflow.com/a/15274929
Parametrs
thread a threading.Thread instance