What could be simpler?

 
Gadgets

Authentication
Crypto
ENV
HTTP
Regex
Regex 2
Robots
Snarfs
SSL
Stepper

It's this simple: telnet to www.yahoo.com on port 80:

telnet www.yahoo.com 80
Trying 204.71.200.68...
Connected to www.yahoo.com.
Escape character is '^]'.

Yahoo has acknowledged you. This connection will remain open only a limited time, so go ahead and request Yahoo's root page:

GET / HTTP/1.0

The line you just typed is called the "request line" and it's part of the "request header." The request line has three tokens, separated by white space. The first describes the method of the protocol. We're going to talk mostly about the GET, POST and HEAD methods, though there are others, including HEAD, PUT and DELETE.

The second token states the path to the file or the URI for the resource we're requesting. In this caes, "/" signifies the index file at the document root (be it named index.html, home.html, default.htm, etc.)

The third token notifies the server that the browser is using the HTTP 1.0 version of the protocol. (Other possibilities at the current time are HTTP 0.9 and HTTP 1.1.) The protocol string is optional in a GET, but still a good idea to state.

The meat of the HTTP protocol is made of two actions: The client's (or browser's) request and the server's response. Now, press the return key again, adding an empty line to the request line you just typed.

The server should respond with a cascade of HTML-formatted text. The empty line you just typed is used by the server and the browser as code for "this part's finished." In the case of a "GET" there's only one part -- the request header, which contains the request line and possibly others. So, as soon as the server saw that empty line, it responded.

If you saved Yahoo's HTML response in a scroll-back buffer, scroll the page up to where the server response started.

HTTP/1.0 200 OK
Content-length: 10307
Content-Type: text/html

The first three lines, separated from the remainder of the response by a blank line, comprise the header. Yahoo is telling you that it is using version 1.0 of HTTP, that your request was satisfactory and can be fulfilled. (For possible server response codes, see W3's list.)

Yahoo is also telling you the length, in bytes, of what's in the body of the response. And it's telling you the mime type, in this case HTML-formatted text.

<< Back  Next >>






Home | Gadgets | Code | Links | Reads | Contact

Copyright © 1999, 2001, 2002 by John H. Byrd
All rights reserved.