References:
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.
Possible requests:request-line: reqest request-URI HTTP-version headers (0 or more lines) <blank line> body (only if a POST command)
status-line: HTTP-version response-code human-readable-phrase headers (0 or more) <blank line> body
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.
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.
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.
| 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 |
| Response Code | Meaning |
|---|---|
| 1xx | Not used |
| 2xxx | Request succeeded |
| 3xxx | Client error |
| 4xxx | Server error |
| 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.]