- The HyperText Transfer Protocol.
- A protocol for requesting and delivering resources.
- A good example of a protocol hierarchy: HTTP on TCP on IP.
- HTTP is also good for building more protocols on top.
- A request-response, client-server protocol.
- An RPC protocol (in HTTP 1.0, anyway).
- What is a resource?
- Anything that can be identified by a uniform resource locator (URI).
- Anything that can be encoded in a HTTP response.
- The client and server must agree on what a resource is.
- The Multipurpose Intermet Mail Extensions (MIME) help them agree.
- Client connects and requests, server replies and disconnects.
- The server can keep-alive the connection in HTTP 1.1.
- HTTP 1.0 is an enormously expensive protocol.
- Every URL requires a separate TCP connection.
- Any reliable transport protocol will do.
- Although it should probably look a lot like TCP.
- Addressing, reliable byte streams.
- The requests sent and the replies returned.
- Text and byte based.
- Same general format for requests and responses.
- A single identification text line.
- Zero or more header text lines.
- An empty line.
- Zero or more bytes of arbitrary other data.
- Text lines end in CRLF (ascii 1310, ascii 1010)
- Identifier lines differ for requests and responses.
- Requests: method uri protocol
- Get, head, post methods.
- The uniform resource identifier (URI).
- The protocol (HTTP/1.0 or HTTP/1.1).
- Example -
HEAD /rclayton/web-pages/me/weather.html HTTP/1.0
- Responses: protocol status-code description
- The protocol (HTTP/1.0 or HTTP/1.1).
- A three digit status code.
- Five families; the dreaded 404, the desirable 200.
- A human readable description of the code.
- Example -
HTTP/1.1 200 OK
- Have the format tag
:
rest of line.
- Header lines starting with whitespace are a continuation of the
previous header line - the same format as rfc 822.
- HTTP 1.0 defines 16 header lines, none required
- HTTP 1.1 defines 46 header lines, one required (
Host:
)
- The trailing blank line is required.
- Can be any sequence of 8-bit bytes.
- Described by the
Content-Type:
and Content-Length:
header
lines.
- Content description related to MIME (rfc 2045).
- Get, head, and post
- The get method is the simplest form of request response.
- the requested resource is given by the uri in the get line
- the resource is returned in the reply - the header lines contain
information describing the content.
- head is like get but the resource isn't returned
- post is like get except it allows the client to send arbitrary data to
the server - forms, file uploading
- Clients and servers only have to agree to use HTTP.
- Clients don't have to be browsers - spiders.
- Servers don't have to be web servers - proxies
- A performance-enhanced HTTP 1.0 (rfc 2616)
- Persistent connections.
- Cache support.
- Piece-by-piece responses.
This page last modified on 5 April 2003.