Documentation

Std.Http.Protocol.H1.Parser

This module defines parsers for HTTP/1.1 request and response lines, headers, and body framing. The reference used is https://httpwg.org/specs/rfc9112.html.

Parses a request line and returns a fully-typed Request.Head. A higher minor version of HTTP/1 is read as HTTP/1.1 (RFC 9110 §6.2). request-line = method SP request-target SP HTTP-version

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Parses a request line and returns the recognized HTTP method and version when available. A higher minor version of HTTP/1 is read as HTTP/1.1 (RFC 9110 §6.2).

    request-line = method SP request-target SP HTTP-version

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Parses a single header field line, or returns none when it sees the blank line that terminates the header section.

      field-line = field-name ":" OWS field-value OWS CRLF
      
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Parses the line that continues a field value after an obsolete line folding (obs-fold = OWS CRLF RWS, RFC 9112 §5.2): the leading whitespace, the field content and the terminating CRLF. Returns the content without the whitespace around it.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Parses the size and extensions of a chunk.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Result of parsing partial or complete information.

            Instances For

              Parses a single chunk in chunked transfer encoding.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Parses fixed-size data that can be incomplete.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Parses fixed-size chunk data that can be incomplete.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Parses a trailer header (used after a chunked body). Framing and routing fields (isFramingTrailerField) are always rejected, to prevent trailer injection attacks where a downstream proxy might re-interpret them. With strict, every field forbidden in trailers is rejected; without it, the others are parsed and left for the caller to drop, since RFC 9110 §6.5.1 asks recipients not to merge them rather than to reject a message that is otherwise complete.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Parses trailer headers after a chunked body and returns them as an array of name-value pairs.

                      This is exposed for callers that need the trailer values directly (e.g. clients). The internal protocol machine parses the section one field at a time with parseTrailerHeader, and discards trailer values.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Parses a status line and returns a fully-typed Response.Head. status-line = HTTP-version SP status-code SP [ reason-phrase ] Accepts only HTTP/1.x, read as HTTP/1.1 for any minor version above 1. For parsing where the version may be unrecognized and must be mapped to an error event, use parseStatusLineRawVersion.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Parses a status line and returns the status code plus recognized HTTP version when available. Consumes and discards the reason phrase.

                          RFC 9110 §2.5: a response with a higher minor version than HTTP/1.1 (HTTP/1.2) is processed as HTTP/1.1, the highest minor version this client implements.

                          status-line = HTTP-version SP status-code SP [ reason-phrase ] CRLF

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For