A non-blocking, single-threaded HTTP server.
Typical applications have little direct interaction with the HTTPConnection class, which is the HTTP parser executed on incoming connections.
A single HTTP request.
All attributes are type str unless otherwise noted.
HTTP request method, e.g. “GET” or “POST”
The requested uri.
HTTP version specified in request, e.g. “HTTP/1.1”
HTTPHeader dictionary-like object for request headers. Acts like a case-insensitive dictionary with additional methods for repeated headers.
Request body, if present, as a byte string.
Client’s IP address as a string. If HTTPConnection.xheaders is set, will pass along the real IP address provided by a load balancer in the X-Real-Ip header
The protocol used, either “http” or “https”. If HTTPConnection.xheaders is set, will pass along the protocol used by a load balancer if reported via an X-Scheme header.
The requested hostname, usually taken from the Host header.
GET/POST arguments are available in the arguments property, which maps arguments names to lists of values (to support multiple values for individual names). Names are of type str, while arguments are byte strings. Note that this is different from RequestHandler.get_argument, which returns argument values as unicode strings.
File uploads are available in the files property, which maps file names to lists of HTTPFile.
An HTTP request is attached to a single HTTP connection, which can be accessed through the “connection” attribute. Since connections are typically kept open in HTTP/1.1, multiple requests can be handled sequentially on a single connection.
Returns True if this request supports HTTP/1.1 semantics
A dictionary of Cookie.Morsel objects.
Writes the given chunk to the response stream.
Finishes this HTTP request on the open connection.
Reconstructs the full URL for this request.
Returns the amount of time it took for this request to execute.
Returns a Deferred object, which is fired when the request is finished and the connection is closed.
Handles a connection to an HTTP client, executing HTTP requests.
We parse HTTP headers and bodies, and execute the request callback until the HTTP conection is closed.
If xheaders is True, we support the X-Real-Ip and X-Scheme headers, which override the remote IP and HTTP scheme for all requests. These headers are useful when running Tornado behind a reverse proxy or load balancer.