| Hypertext Transfer Protocol |
| The protocol that drives the World Wide Web |
|
The Hypertext Transfer Protocol, better known as HTTP, is the protocol that drives the World Wide Web and therefore the one that underlies all Web applications. Invented by Tim Berners-Lee ("father of the Web") and documented in RFC 2068, which is available online at www.w3.org/Protocols/rfc2068/rfc2068, HTTP is arguably the most important network protocol ever invented, with the notable exception of TCP/IP. HTTP defines how Web browsers and Web servers communicate with each other. It's entirely text based, and it's typically transmitted over TCP connections linking Web browsers to Web servers. Suppose the following HTML file is deployed on a Web server, that its name is Simple.html, and that its URL is www.wintellect.com/simple.html: <html> <body> Hello, world </body> </html> If a user types http://www.wintellect.com/simple.html into Internet Explorer's address bar, Internet Explorer (IE) uses the Internet's Domain Name System (DNS) to convert www.wintellect.com into an IP address (for example, 66.45.26.25). Then IE opens a socket connection to the server at that address using a well-known port number (port 80) and transmits an HTTP request similar to this one: GET /simple.html HTTP/1.1 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate If-Modified-Since: Wed, 24 Oct 2001 14:12:36 GMT If-None-Match: "50b0d3ee955cc11:a78" User-Agent: Mozilla/4.0.(compatible; MSIE.6.0; Windows NT 5.1) Host: www.wintellect.com Connection: Keep-Alive [blank line] The first line of the request is called the start line. It consists of a method name (GET), the name of the resource being requested (/simple.html), and an HTTP version number (1.1). GET is one of seven methods defined in HTTP 1.1; it requests a resource from a Web server. The next eight lines make up the message header. Each line, or header, contains additional information about the request, including information about the browser that originated the request (User-Agent). A blank line (a simple carriage return/line feed pair) marks the end of the message header and also the end of the request. How does the Web server respond to the GET command? Assuming /simple.html is a valid resource identifier and security settings don't prevent the file from being returned, the server transmits an HTTP response like this one: HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Wed, 24 Oct 2001 14:12:37 GMT Content-Type: text/html Accept-Ranges: bytes Last-Modified: Wed, 24 Oct 2001 14:00:53 GMT ETag: "d02acf81975cc11:a78" Content-Length: 46 <html> <body> Hello, world </body> </html> Upon receiving the response, the browser parses the HTML returned by the Web server and displays the resulting Web page. The Content-Type header identifies the returned data as HTML, while Content-Length tells the browser how much HTML was returned. The "200" in the first line of the response is an HTTP status code signifying that the server fulfilled the browser's request. The HTTP specification defines about 40 different status codes, including the infamous 401 ("Unauthorized") code indicating that the user isn't authorized to view this resource. Conversations such as these form the backbone for communications over the Web. As you surf the Web by typing URLs and clicking hyperlinks, your browser issues one GET command after another. Tools such as NetMon-the network packet-sniffing utility that comes with server editions of Windows-let you spy on the HTTP traffic flying back and forth. You don't have to be an HTTP guru to write ASP.NET applications, but a knowledge of basic HTTP semantics and a familiarity with commonly used request and response headers are a big help in understanding the ASP.NET object model. |
(Source: Jeff Prosise, Earthweb Web Development - Feb 26, 2002) |