HTTP Server
-----------
- .. autoclass:: HTTPServer
+ .. autoclass:: HTTPServer(request_callback: Union[httputil.HTTPServerConnectionDelegate, Callable[[httputil.HTTPServerRequest], None]], no_keep_alive: bool = False, xheaders: bool = False, ssl_options: Union[Dict[str, Any], ssl.SSLContext] = None, protocol: str = None, decompress_request: bool = False, chunk_size: int = None, max_header_size: int = None, idle_connection_timeout: float = None, body_timeout: float = None, max_body_size: int = None, max_buffer_size: int = None, trusted_downstream: List[str] = None)
:members:
+
+ The public interface of this class is mostly inherited from
+ `.TCPServer` and is documented under that class.
max_buffer_size: int = None,
trusted_downstream: List[str] = None,
) -> None:
+ # This method's signature is not extracted with autodoc
+ # because we want its arguments to appear on the class
+ # constructor. When changing this signature, also update the
+ # copy in httpserver.rst.
self.request_callback = request_callback
self.xheaders = xheaders
self.protocol = protocol
return HTTPServer
async def close_all_connections(self) -> None:
+ """Close all open connections and asynchronously wait for them to finish.
+
+ This method is used in combination with `~.TCPServer.stop` to
+ support clean shutdowns (especially for unittests). Typical
+ usage would call ``stop()`` first to stop accepting new
+ connections, then ``await close_all_connections()`` to wait for
+ existing connections to finish.
+
+ This method does not currently close open websocket connections.
+
+ Note that this method is a coroutine and must be caled with ``await``.
+
+ """
while self._connections:
# Peek at an arbitrary element of the set
conn = next(iter(self._connections))