Lecture Notes for Client-Server Interfaces

26 March 2002 - The Hypertext Transfer Protocol (HTTP)


  1. what is http

    1. a protocol for requesting and delivering resources

      1. a good example of a protocol hierarchy: http on tcp on ip

      2. http is a good for building more protocols on top

    2. there are two versions of http: 1.0 and 1.1

    3. a request-response, client-server protocol

    4. an rpc protocol (in http 1.0, anyway)

    5. what is a resource

      1. anything that can be identified by a uniform resource locator

      2. anything that can be encoded in a http response

      3. the client and server must agree on what a resource is

  2. http transactions

    1. client connects and requests, server replies and disconnects

      1. in http 1.1, the server can keep-alive the connection

    2. any reliable transport protocol will do

      1. although it should probably look a lot like tcp - addressing, byte streams

    3. http request and response messages

      1. text and byte based

      2. same general format for requests and responses

        1. a single identification text line

        2. zero or more header text lines

        3. an empty line

        4. zero or more bytes of arbitrary other data

      3. text lines end in crlf (ascii 1310, ascii 1010)

      4. identifier lines differ for requests and responses

        1. requests: method uri protocol

          1. methods - get, head, post

          2. uri - uniform resource identifier

          3. protocol http/1.0 or http/1.1

          4. example - HEAD /rclayton/web-pages/me/weather.html HTTP/1.0

        2. responses: protocol status-code description

          1. protocol - as above

          2. status-code - three digit, five families; the dreaded 404, the desirable 200

          3. description - a human readable description of the code

          4. example - HTTP/1.1 200 OK

      5. header lines

        1. have the format tag: rest of line

        2. header lines starting with whitespace are a continuation of the previous header line - the same format as rfc 822.

        3. http 1.0 defines 16 header lines, none required

        4. http 1.1 defines 46 header lines, one required (Host:)

      6. the trailing blank line is required

      7. message body

        1. can be any sequence of 8-bit bytes

        2. described by the Content-Type: and Content-Length: header lines

        3. content description related to mime (rfc 2045)

  3. http methods

    1. get, head, and post

    2. the get method is the simplest form of request response

      1. the requested resource is given by the uri in the get line

      2. the resource is returned in the reply - the header lines contain information describing the content.

    3. head is like get but the resource isn't returned

    4. post is like get except it allows the client to send arbitrary data to the server - forms, file uploading

  4. clients and servers only have to agree to use http

    1. clients don't have to be browsers - spiders

    2. servers don't have to be web servers - proxies

    3. you'll be using servers for convenient access to the cgi

    4. you won't be using browsers

  5. http 1.1

    1. a performance-enhanced http 1.0 (rfc 2616)

    2. persistent connections

    3. cache support

    4. piece-by-piece responses


This page last modified on 21 March 2002.