A Closer Look at HTTP
In publishing a site,
we’ve been focusing on only one method of the HTTP
protocol, GET. Apache’s basic
handling of GET is more than adequate for sites
that just need to publish information from files, but HTTP (and
Apache) can support a much wider range of options. Developers who
want to create interactive sites will have to write some programs to
supply the basic logic. However, many useful tasks are simple to
create, and Apache is quite capable of supporting much more complex
applications, including applications that connect to databases or
other information sources.
Every HTTP request must specify a method. This tells the server how to handle the incoming data. For a complete account, see the HTTP 1.1 specification (http://www.w3.org/Protocols/rfc2616/rfc2616.html). Briefly, however, the methods are as follows:
-
GET Returns the data asked for. To save network traffic, a “conditional
GET" only generates a return if the condition is satisfied. For instance, a page that alters frequently may be transmitted. The client asks for it again: if it hasn’t changed since last time, the conditionalGETgenerates a response telling the client to get it from its local cache. (GETmay also include extra path information, as well as a query string with information an application needs to process.)-
HEAD Returns the headers that a
GETwould have included, but without data. They can be used to test the freshness of the client’s cache without the bandwidth expense of retrieving ...
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