Skip to main content

Module context

Module context 

Source
Expand description

HttpContext — runtime implementation of IHttpContext, IHttpRequest, IHttpResponse.

§Request body

The body is not read eagerly. It stays as the live hyper stream until something asks for it:

  • IHttpRequest::body_bytes buffers the whole body, enforcing App.MaxBodySize.
  • IHttpRequest::multipart streams the body through a multipart parser, enforcing Form.MaxRequestSize, Form.MaxFileSize and Form.MaxFieldSize, and spooling large file parts to disk.

Either way the body can only be consumed once; asking for it twice reports a clear error rather than silently returning an empty body.

§Response body

Responses carry either in-memory bytes or a FileBody. File bodies are streamed by the host with Content-Length, ETag, Last-Modified, Accept-Ranges and Content-Disposition, and satisfy Range, If-Range, If-None-Match and If-Modified-Since requests, so downloads can be cached and resumed.

Structs§

BodyLimits
Limits applied while reading a request body.
HttpContext
Concrete implementation of IHttpContext wrapping a hyper request and response.
HttpRequest
Concrete implementation of IHttpRequest.
HttpResponse
Concrete implementation of IHttpResponse.

Type Aliases§

RespBody
Response body produced by the HTTP host.