Module Expr Str ImportFrom alias alias alias alias Import alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad NameLoad AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Pass decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword BoolOpOr NameLoad Num keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body While AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Call NameLoad AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Return Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr orelse Assign AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareIn AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num orelse Assign AttributeStore NameLoad attr Str If NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Str orelse Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If CompareIn AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return AttributeLoad NameLoad attr orelse If Call NameLoad AttributeLoad NameLoad attr NameLoad body Return Call NameLoad AttributeLoad NameLoad attr orelse Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num attr Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If Call AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr If CompareIn NameLoad TupleLoad Str Str body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad orelse Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad Str attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr decorator_list decorator_list Assign NameStore AttributeLoad NameLoad attr
N/A N/A A non-blocking, single-threaded HTTP server.

Typical applications have little direct interaction with the `HTTPServer`
class except to start a server at the beginning of the process
(and even that is often done indirectly via `tornado.web.Application.listen`).

.. versionchanged:: 4.0

   The ``HTTPRequest`` class that used to live in this module has been moved
   to `tornado.httputil.HTTPServerRequest`.  The old name remains as an alias.
 __future__ absolute_import division print_function with_statement N/A socket tornado.escape native_str tornado.http1connection HTTP1ServerConnection HTTP1ConnectionParameters tornado gen tornado httputil tornado iostream tornado netutil tornado.tcpserver TCPServer tornado.util Configurable HTTPServer N/A TCPServer Configurable N/A httputil HTTPServerConnectionDelegate N/A N/A A non-blocking, single-threaded HTTP server.

    A server is defined by a subclass of `.HTTPServerConnectionDelegate`,
    or, for backwards compatibility, a callback that takes an
    `.HTTPServerRequest` as an argument. The delegate is usually a
    `tornado.web.Application`.

    `HTTPServer` supports keep-alive connections by default
    (automatically for HTTP/1.1, or for HTTP/1.0 when the client
    requests ``Connection: keep-alive``).

    If ``xheaders`` is ``True``, we support the
    ``X-Real-Ip``/``X-Forwarded-For`` and
    ``X-Scheme``/``X-Forwarded-Proto`` headers, which override the
    remote IP and URI scheme/protocol for all requests.  These headers
    are useful when running Tornado behind a reverse proxy or load
    balancer.  The ``protocol`` argument can also be set to ``https``
    if Tornado is run behind an SSL-decoding proxy that does not set one of
    the supported ``xheaders``.

    To make this server serve SSL traffic, send the ``ssl_options`` keyword
    argument with an `ssl.SSLContext` object. For compatibility with older
    versions of Python ``ssl_options`` may also be a dictionary of keyword
    arguments for the `ssl.wrap_socket` method.::

       ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
       ssl_ctx.load_cert_chain(os.path.join(data_dir, "mydomain.crt"),
                               os.path.join(data_dir, "mydomain.key"))
       HTTPServer(applicaton, ssl_options=ssl_ctx)

    `HTTPServer` initialization follows one of three patterns (the
    initialization methods are defined on `tornado.tcpserver.TCPServer`):

    1. `~tornado.tcpserver.TCPServer.listen`: simple single-process::

            server = HTTPServer(app)
            server.listen(8888)
            IOLoop.current().start()

       In many cases, `tornado.web.Application.listen` can be used to avoid
       the need to explicitly create the `HTTPServer`.

    2. `~tornado.tcpserver.TCPServer.bind`/`~tornado.tcpserver.TCPServer.start`:
       simple multi-process::

            server = HTTPServer(app)
            server.bind(8888)
            server.start(0)  # Forks multiple sub-processes
            IOLoop.current().start()

       When using this interface, an `.IOLoop` must *not* be passed
       to the `HTTPServer` constructor.  `~.TCPServer.start` will always start
       the server on the default singleton `.IOLoop`.

    3. `~tornado.tcpserver.TCPServer.add_sockets`: advanced multi-process::

            sockets = tornado.netutil.bind_sockets(8888)
            tornado.process.fork_processes(0)
            server = HTTPServer(app)
            server.add_sockets(sockets)
            IOLoop.current().start()

       The `~.TCPServer.add_sockets` interface is more complicated,
       but it can be used with `tornado.process.fork_processes` to
       give you more flexibility in when the fork happens.
       `~.TCPServer.add_sockets` can also be used in single-process
       servers if you want to create your listening sockets in some
       way other than `tornado.netutil.bind_sockets`.

    .. versionchanged:: 4.0
       Added ``decompress_request``, ``chunk_size``, ``max_header_size``,
       ``idle_connection_timeout``, ``body_timeout``, ``max_body_size``
       arguments.  Added support for `.HTTPServerConnectionDelegate`
       instances as ``request_callback``.

    .. versionchanged:: 4.1
       `.HTTPServerConnectionDelegate.start_request` is now called with
       two arguments ``(server_conn, request_conn)`` (in accordance with the
       documentation) instead of one ``(request_conn)``.

    .. versionchanged:: 4.2
       `HTTPServer` is now a subclass of `tornado.util.Configurable`.
     __init__ N/A N/A self N/A args kwargs N/A N/A N/A initialize N/A N/A self request_callback no_keep_alive io_loop xheaders ssl_options protocol decompress_request chunk_size max_header_size idle_connection_timeout body_timeout max_body_size max_buffer_size N/A False None False None None False None None None None None None N/A N/A N/A self request_callback request_callback N/A N/A self no_keep_alive no_keep_alive N/A N/A self xheaders xheaders N/A N/A self protocol protocol N/A N/A self conn_params N/A HTTP1ConnectionParameters decompress decompress_request chunk_size chunk_size max_header_size max_header_size header_timeout N/A idle_connection_timeout 3600 max_body_size max_body_size body_timeout body_timeout N/A N/A N/A TCPServer __init__ self io_loop io_loop ssl_options ssl_options max_buffer_size max_buffer_size read_chunk_size chunk_size N/A N/A self _connections N/A set N/A configurable_base N/A N/A cls N/A N/A N/A HTTPServer N/A classmethod configurable_default N/A N/A cls N/A N/A N/A HTTPServer N/A classmethod close_all_connections N/A N/A self N/A N/A N/A N/A self _connections N/A N/A conn N/A next N/A iter N/A self _connections N/A N/A N/A N/A conn close N/A N/A gen coroutine handle_stream N/A N/A self stream address N/A N/A N/A context N/A _HTTPRequestContext stream address N/A self protocol N/A conn N/A HTTP1ServerConnection stream N/A self conn_params context N/A N/A N/A N/A self _connections add conn N/A N/A N/A conn start_serving self N/A start_request N/A N/A self server_conn request_conn N/A N/A N/A N/A _ServerRequestAdapter self server_conn request_conn N/A on_close N/A N/A self server_conn N/A N/A N/A N/A N/A N/A self _connections remove server_conn N/A N/A _HTTPRequestContext N/A object N/A __init__ N/A N/A self stream address protocol N/A N/A N/A N/A self address address N/A N/A N/A stream socket None N/A N/A N/A self address_family N/A N/A stream socket family N/A N/A N/A self address_family None N/A N/A N/A N/A self address_family N/A N/A socket AF_INET N/A socket AF_INET6 N/A address None N/A N/A N/A self remote_ip N/A address N/A 0 N/A N/A N/A self remote_ip 0.0.0.0 N/A protocol N/A N/A N/A self protocol protocol N/A N/A N/A isinstance stream N/A iostream SSLIOStream N/A N/A N/A self protocol https N/A N/A N/A self protocol http N/A N/A self _orig_remote_ip N/A self remote_ip N/A N/A self _orig_protocol N/A self protocol N/A __str__ N/A N/A self N/A N/A N/A N/A N/A self address_family N/A N/A socket AF_INET N/A socket AF_INET6 N/A N/A N/A self remote_ip N/A N/A N/A isinstance N/A self address bytes N/A N/A N/A native_str N/A self address N/A N/A N/A str N/A self address N/A _apply_xheaders N/A N/A self headers N/A N/A N/A Rewrite the ``remote_ip`` and ``protocol`` fields. N/A ip N/A N/A headers get X-Forwarded-For N/A self remote_ip N/A ip N/A N/A N/A N/A N/A ip split , N/A -1 strip N/A ip N/A N/A headers get X-Real-Ip ip N/A N/A N/A netutil is_valid_ip ip N/A N/A N/A self remote_ip ip N/A proto_header N/A N/A headers get X-Scheme N/A N/A headers get X-Forwarded-Proto N/A self protocol N/A N/A proto_header N/A http https N/A N/A N/A self protocol proto_header N/A _unapply_xheaders N/A N/A self N/A N/A N/A Undo changes from `_apply_xheaders`.

        Xheaders are per-request so they should not leak to the next
        request on the same connection.
         N/A N/A self remote_ip N/A self _orig_remote_ip N/A N/A self protocol N/A self _orig_protocol N/A N/A _ServerRequestAdapter N/A N/A httputil HTTPMessageDelegate N/A N/A Adapts the `HTTPMessageDelegate` interface to the interface expected
    by our clients.
     __init__ N/A N/A self server server_conn request_conn N/A N/A N/A N/A self server server N/A N/A self connection request_conn N/A N/A self request None N/A N/A isinstance N/A server request_callback N/A httputil HTTPServerConnectionDelegate N/A N/A N/A self delegate N/A N/A N/A server request_callback start_request server_conn request_conn N/A N/A self _chunks None N/A N/A N/A self delegate None N/A N/A self _chunks N/A N/A headers_received N/A N/A self start_line headers N/A N/A N/A N/A N/A self server xheaders N/A N/A N/A N/A N/A N/A self connection context _apply_xheaders headers N/A N/A N/A self delegate None N/A N/A N/A self request N/A N/A httputil HTTPServerRequest connection N/A self connection start_line start_line headers headers N/A N/A N/A N/A N/A self delegate headers_received start_line headers N/A data_received N/A N/A self chunk N/A N/A N/A N/A N/A self delegate None N/A N/A N/A N/A N/A self _chunks append chunk N/A N/A N/A N/A N/A self delegate data_received chunk N/A finish N/A N/A self N/A N/A N/A N/A N/A self delegate None N/A N/A N/A N/A self request body N/A N/A join N/A self _chunks N/A N/A N/A N/A self request _parse_body N/A N/A N/A N/A self server request_callback N/A self request N/A N/A N/A N/A N/A self delegate finish N/A N/A N/A self _cleanup N/A on_connection_close N/A N/A self N/A N/A N/A N/A N/A self delegate None N/A N/A N/A self _chunks None N/A N/A N/A N/A N/A self delegate on_connection_close N/A N/A N/A self _cleanup N/A _cleanup N/A N/A self N/A N/A N/A N/A N/A self server xheaders N/A N/A N/A N/A N/A N/A self connection context _unapply_xheaders N/A N/A N/A HTTPRequest N/A httputil HTTPServerRequest