= HTTP request
{c}
An <HTTP request> is a message asking a server to apply an <HTTP request method> to a target resource. It includes control information and <HTTP header fields>, and can include content according to the applicable method and message rules. Its meaning is distinct from the textual framing used by one protocol version.<HTTP Semantics>[§6, message abstraction; §9, methods]{ref}
For an illustrative <HTTP 1.1> request, the line `GET /color?view=plain HTTP/1.1` selects a method and request target, while `Host: example.org` supplies host information. An empty line ends the header section. These pieces belong to the version's request-line and field syntax.<HTTP 1.1 (RFC 9112)>[§§2.1, 3 and 5, message format, request line and fields]{ref}
Starting from `https://example.org/color?view=plain#legend`, the ordinary origin-form target is `/color?view=plain`. The <query string> participates in that target, while the <fragment identifier> does not: fragment processing is performed on the client side rather than by including the fragment in the target sent to the server.<HTTP Semantics>[§7.1, determining the target resource]{ref}<HTTP 1.1 (RFC 9112)>[§3.2.1, origin-form]{ref}
The method cannot be inferred from a content string alone. Sending the text `blue` to an endpoint stipulated to replace a color and sending it to an endpoint stipulated to append a log entry request different operations. The target, method and application contract supply that distinction.
An <HTTP request> also differs from a returned <HTTP response>. A successfully transmitted request can receive an error status, and a connection can end before a final response is obtained. Reasoning about the requested operation, its eventual outcome and the transport event as separate observations makes failures easier to interpret.
Back to article page