HTTP 1.0 (draft 7)


References:


Introduction

A Web client transfers a URL by opening a connection to the well-known HTTPD port on a Web server (port 80, usually).

Protocol Version Numbers

The old HTTP protocol (Sep. 1996) is HTTP/1.0. Recently the Web switched to  HTTP/1.1. To accommodate use of multiple protocol versions in the Internet, proxies and gateways never send a message with a version number higher than its version number.

HTTP/1.0 Details

Servers just return documents via HTTP, while clients must present documents to users. Thus HTTP servers are simpler than clients (6,500 vs. 80,000 lines of C code for NCSA httpd 1.3 and Mosaic 2.5).

HTTP/1.0 is a very simple-minded protocol. It uses ASCII commands terminated by CR/LF. So you can simulate an HTTP client with a telnet session:

daphne.cs.vt.edu> telnet www 80
Trying 128.173.40.201... Connected to info.cs.vt.edu.
Escape character is '^]'.
GET / HTTP/1.0

<HTML>
<HEAD>
<TITLE>
Virginia Tech Computer Science Department Home Page
</TITLE>
</HEAD>

<BODY>

<CENTER>
<A HREF=/htbin/imagemap/image/maps/vtcs.gif.map>
<IMG BORDER=0 SRC=/image/new_headers/vtcs.gif 
 ALT="Virginia Tech Department of Computer Science" ISMAP></A>
<P>
660 McBryde Hall<BR>
Blacksburg, VA 24061<BR>
Phone: (540)231-6931<BR>
FAX: (540)231-6075<P>
Department Head: Dr. John M. Carroll
</CENTER>

<HR SIZE=4>

<P> Welcome to the Virginia Tech Department of Computer Science Home
Page. 

...

<H6>
Last updated August 28, 1996<BR>
http://www.cs.vt.edu/
</H6>
</BODY>
</HTML>
Connection closed by foreign host.
In the example above, we fetched the home page of host www.cs.vt.edu.

HTTP Message Types

HTTP/1.0 request format:

request-line:  reqest request-URI HTTP-version
headers (0 or more lines)
<blank line>
body (only if a POST command)
Possible requests:
GET
Request a document named by a URI (uniform resource identifier - superclass of URL)
HEAD
Return only header of specified URI (e.g., test link for validity, recent modification)
POST
Post a document: elelctronic mail, form input, news.

HTTP/1.0 response format:

status-lineHTTP-version response-code human-readable-phrase
headers (0 or more)
<blank line>
body

Example: Header in Response

daphne.cs.vt.edu> telnet ei 80
Trying 128.173.40.129... Connected to ei.cs.vt.edu.
Escape character is '^]'.
GET /~wwwbtb/fall.96/ClassNotes/Protocols/MIMEscreen.gif HTTP/1.0

HTTP/1.0 200 Document follows
Date: Tue, 10 Sep 1996 14:34:06 GMT
Server: NCSA/1.4.2
Content-type: image/gif
Last-modified: Tue, 10 Sep 1996 13:25:26 GMT
Content-length: 9755

GIF87<9750 non-ascii characters>Connection closed by foreign host.

Example: If-Modified-Since

A client that has a copy of a document in its cache may send a GET with the If-Modified-Since header to check whether the cached copy is up-to-date.
daphne.cs.vt.edu> telnet ei 80
Trying 128.173.40.129... Connected to ei.cs.vt.edu.
Escape character is '^]'.
GET /~wwwbtb/fall.96/ClassNotes/Protocols/MIMEscreen.gif HTTP/1.0
If-Modified-Since: Saturday, 10-Sep-96 20:20:14

HTTP/1.0 304 Not modified
Date: Tue, 10 Sep 1996 14:40:58 GMT
Server: NCSA/1.4.2

Connection closed by foreign host.

Example: Server Redirect

daphne.cs.vt.edu> telnet ei 80
Trying 128.173.40.129... Connected to ei.cs.vt.edu.
Escape character is '^]'.
GET /~wwwbtb HTTP/1.0

HTTP/1.0 302 Found
Date: Tue, 10 Sep 1996 14:42:49 GMT
Server: NCSA/1.4.2
Location: http://ei.cs.vt.edu/~wwwbtb/
Content-type: text/html

<HEAD><TITLE>Document moved</TITLE></HEAD>
<BODY><H1>Document moved</H1>
This document has moved <A
HREF="http://ei.cs.vt.edu/~wwwbtb/">here</A>.<P>
</BODY>
Connection closed by foreign host.

HTTP Header Fields

From Figure 13.3 in Stevens:
Header Name Meaning Request? Response? Both?
Allow yes
Authorization Send userid/password yes
Content-Encoding yes
Content-Length How many bytes of data? yes
Content-Type MIME-type of data yes
Date Current time/date yes yes
Expires When to discard from cache yes
From yes
If-Modified-Since For conditional GET yes
Last-Modified Date data last modified yes
Location yes
MIME-Version So MIME names can change yes yes
Pragma No-cache, etc. yes yes
Referer URL previously visited yes
Server yes
User-Agent Web browser name yes
WWW Authenticate yes

Return Codes

Classification of return codes
Response Code Meaning
1xx Not used
2xxx Request succeeded
3xxx Client error
4xxx Server error
From Figure 13.4 in Stevens:
Response Meaning
200 OK, request succeeded
202 Request accepted, but processing incomplete
301 Requested URL has been assigned a new, permanent URL
302 Reqeusted URL has been temporarily assigned a new URL 
304 Document not modified (response to conditional GET
400 Bad request
401 Request not accepted because user authentication required
403 Forbidden for unspecified reason
404 Not found
500 Internal server error
501 Not implemented
502 Invalid response from gateway or upstream server
503 Service temporarily unavailable

Last modified on 27 Jan 1998.

Send comments to abrams@vt.edu.
[This is http://ei.cs.vt.edu/~wwwbtb/Notes/Protocols/http1_0.html.]