Structure of HTTP Transactions
To generalize, all client requests and server responses follow the same general structure shown in Figure 1.1.
Figure 1.2 shows the structure of a client request.
![]() |
HTTP transactions do not need to use
all the headers. As a matter of fact, it is possible to perform some
HTTP requests without supplying any header information at all. For
example, in the most simple case, a request of GET /
HTTP/1.0 without any headers is sufficient for most servers
to understand the client.[2]
HTTP requests have the following general components:
The first line tells the client which method to use, which entity (document) to apply it to, and which version of HTTP the client is using. Possible HTTP 1.1 methods are GET, POST, HEAD, PUT, LINK, UNLINK, DELETE, OPTIONS, and TRACE. HTTP 1.0 does not support the OPTIONS or TRACE method. Not all methods need be supported by a server.
The URL specifies the location of a document to apply the method to. Each server may have its own way of translating the URL string into some form of usable resource. For example, the URL may represent a document to transmit to the client. Or the URL may actually map to a program, the output of which is sent to the client.
Finally, the last entry on the first line specifies the version of HTTP the client is using.
General message headers are optional headers used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
