Skip to content
WebsiteHosting.com

concept HTTP, TLS & web servers

HTTP request and response

Read the method, target, headers, optional body, status and returned content in a small HTTP exchange.

Sources checked · P0022

What it means

HTTP is a request–response protocol: the client sends a request with a method, target, header fields and possibly content; the server returns a status, fields and possibly representation data. The status alone is not a complete description of what happened, and a successful connection is not an HTTP success. HTTP semantics HTTP/1.1 messaging

A URL identifies where the request is directed, but its fragment (the part after #) is not sent as the HTTP request target. The browser or client first establishes the relevant connection; with HTTPS, TLS protects the HTTP exchange in transit. HTTP alone does not promise encryption.

Try it

Example — assemble an HTTP exchange locally. Choose GET or HEAD, a synthetic path and a supported media type, then run the local exchange. Inspect a message part to connect the request start line, fields and body with the corresponding response elements. Nothing is sent to a server.

Build a local HTTP exchange

Change the method or target and inspect what belongs to the request and the response.

Example
Exchange preview — not sent anywhere

The target selects a route; the method describes the requested action. This fixture chooses a representation from Accept, but a real server controls its own negotiation.

  1. Preview inputs
  2. Route exists
  3. Response 200
Build a local HTTP exchange: current state
ItemState / resultWhy it matters
Selected partstartThe request start line names the method, origin-form target and HTTP/1.1 version.
Request start lineGET /guide HTTP/1.1Method and origin-form target; fragments are not included.
Request fieldsHost: www.example.test; Accept: text/htmlHost identifies the authority in this HTTP/1.1 example.
Request bodyNoneThese GET/HEAD examples do not upload data.
Response status200The response status is not a request method.
Response fieldsContent-Type: text/html; Content-Length: 22Metadata about the selected representation.
Response body<h1>Example guide</h1>HEAD has no response content even when the route exists.
Build a local HTTP exchange: local inputs and actions

An invented HTTP/1.1 text exchange. No fetch, server or actual browser request.

About this model

Only GET/HEAD and two media types are modeled. / and /guide exist; other allowed paths do not. The ASCII representation length is fixed for this fixture. HTTP/2 and HTTP/3 use different framing. GET and HEAD have no request content here.

Read the article’s primary sources for protocol rules and implementation-specific limits. This scene has no network access.

The fixture contains / and /guide; /missing is a valid question for an absent route. Compare GET /guide with HEAD /guide. Both describe the same selected representation, but HEAD has no response content. Its Content-Length can describe the corresponding GET representation; it does not mean that many body bytes were transmitted in the HEAD response. Method semantics

Local requestStatusResponse content
GET /guide, HTML200The fixed guide representation
HEAD /guide, HTML200None; representation metadata remains
GET /missing, HTML404The fixture's error representation
GET /guide, JSON200A different declared representation selected by this fixture

The Accept control demonstrates a server's declared negotiation policy, not a rule that every server must produce JSON. Unknown methods, control characters, arbitrary URLs and unsupported target syntax are rejected. The path field accepts only the displayed bounded characters and never accepts credentials or request headers. Reset restores GET /guide, HTML and the start-line explanation.

The displayed exchange is an HTTP/1.1 teaching representation with ASCII bodies. HTTP/2 and HTTP/3 frame messages differently. GET/HEAD request content, informational responses, streaming, compression and connection reuse are outside this small scene. HTTP/1.1 request target and framing

What happens to a request?

  1. A client derives the origin and request target from the URL. DNS name lookup, connection setup and TLS negotiation (for HTTPS) are separate concerns.
  2. It sends the method and fields. An API might send a JSON body with a POST; a normal GET often has no content. Do not infer that every request has a body.
  3. A server, application or intermediary determines a result: for example 200 OK, a redirect, 404 Not Found, or a server failure.
  4. The client interprets status, response headers and any received content. A 204 No Content response deliberately has no body; a HEAD response also has no message body, even when headers describe the representation. Message framing
PartA useful question
MethodWhat action is being requested?
TargetWhich resource on this origin?
Request headersWhat preferences or conditions are supplied?
Response statusWhat kind of result occurred?
Response headersWhat representation or caching policy applies?
Optional bodyWhat data, if any, accompanies the message?

When it helps

In browser developer tools, select a request and inspect its URL, method, status, request and response headers separately. A successful TLS connection does not imply an HTTP 200; a completed HTTP exchange may legitimately return 404. A response body may be JSON, HTML, an image or nothing. Caches and proxies may participate, so the response did not necessarily originate from the application itself.

Avoid pasting authentication cookies, bearer tokens or customer data into troubleshooting tickets. Share only sanitized headers and the status needed to reproduce a problem.

Same URL, different method and response

A GET /inventory typically asks for a representation; a HEAD /inventory requests the corresponding metadata without response content. A valid 204 No Content reply tells the client there is no response content, while 304 Not Modified can guide cache reuse after a conditional request. Neither should be rendered as an HTML page containing the expected object. An HTTP/1.1 text example is a teaching format; HTTP/2 and HTTP/3 represent request information differently on the wire. Methods and responses HTTP/1.1 format

In practice

When examining an authorized transaction, record the effective request method, target, key headers, status and whether content was actually returned. Check redirects and intermediaries before attributing a response to an origin. Avoid sending state-changing requests merely to “test” availability; begin with read-only requests and understand caching or authentication constraints.

Key takeaways

Interpret an HTTP exchange as a paired request and response with method-specific semantics. A status code is one observation, not proof that the application or all downstream resources behaved correctly.

Frequently asked questions

Editorial questions, answered from the sources listed for this article.

Does a GET request have to return HTML?

No. HTTP can transfer multiple representation types; the response media type and content determine what is returned.

Is HEAD identical to GET?

Its semantics correspond to obtaining metadata without response content, but the server must still handle method-specific requirements. It is not a transport-only ping.

What does a 204 response contain?

A 204 indicates successful processing with no response content. A client should not invent a response body from the status.

Does a timeout produce an HTTP status code?

No. If no HTTP response is received, a transport or connection failure is not itself an HTTP response with a status code.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. RFC 9110 — HTTP Semantics

    Sections 6, 8, 9 and 15. HTTP messages, methods, representations and status codes.

    Checked .

  2. RFC 9112 — HTTP/1.1

    Sections 2–7. Textual HTTP/1.1 message format, framing and message bodies.

    Checked .