- what is http
- a protocol for requesting and delivering resources
- a good example of a protocol hierarchy: http on tcp on ip
- http is a good for building more protocols on top
- there are two versions of http: 1.0 and 1.1
- 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
- anything that can be encoded in a http response
- the client and server must agree on what a resource is
- http transactions
- client connects and requests, server replies and disconnects
- in http 1.1, the server can keep-alive the connection
- any reliable transport protocol will do
- although it should probably look a lot like tcp - addressing, byte
streams
- http request and response messages
- 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
- methods - get, head, post
- uri - uniform resource identifier
- protocol http/1.0 or http/1.1
- example -
HEAD /rclayton/web-pages/me/weather.html HTTP/1.0
- responses: protocol status-code description
- protocol - as above
- status-code - three digit, five families; the dreaded 404, the
desirable 200
- description - a human readable description of the code
- example -
HTTP/1.1 200 OK
- header lines
- 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
- message body
- 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)
- http methods
- 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
- you'll be using servers for convenient access to the cgi
- you won't be using browsers
- http 1.1
- a performance-enhanced http 1.0 (rfc 2616)
- persistent connections
- cache support
- piece-by-piece responses
This page last modified on 21 March 2002.