| [main] [misc] [graphics] [page design] [site design] [xhtml] [css] [xml] [xsl] [schema] [javascript] [php] [mysql] | |
Note that all external links will open up in a separate window. This is a stripped down version of these pages for older browsers. These pages are really meant to be viewed in a standards compliant browser. |
HTTP BasicsThese tutorials are about general networking protocols on the Internet. HTTP BasicsHTTP: the HyperText Transfer Protocol is the transmission protocol used to transmit Web pages on the Internet HTTP, or Hypertext Transfer Protocol is the network protocol used to transmit Web content over the Internet. It works with TCP/IP to transmit information. IP stands for Internet Protocol and handles packaging information for delivery. TCP is the Transmission Control Protocol and it handles packaging information for delivery. HTTP handles addressing the package and providing information that allows the client and server to effectively communicate over the Web. Yes that's way too many acronyms. Anyway, any online application has numerous layers that it is working in or through. Each layer handles a specific aspect of the task at hand. For instance, when you open a Web browser, you have your operating system, your user account and preferences, the application, and the actual display of the page you are viewing all working together on the screen. On the Internet you have separate layers handling the transmission of data, the packaging of data, and the addressing of data. One way to grasp it is to imagine you work for a large wholesale company that delivers its own goods. The Transmission Control Protocol is like the delivery fleet that ships the goods. The Internet Protocol is the shipping room at the front of the warehouse, where things are pulled out of the warehouse (the server) and packaged for delivery to the client. Hypertext Transfer Protocol is the sales department that writes up the invoices and, more importantly, the shipping labels for the packers and drivers to use to figure out what to pack and where it goes. Most of what we talk about when we talk about HTTP is the information it adds to the data package being shipped in order to increase the efficiency of delivery and the usability of the information on both sides of the transaction. In its simplest form, we can think of HTTP as nothing more than a header, or shipping label, and the protocols for processing the data in this header. If you have ever sent a package by UPS, then you know there is more to a shipping label than just the address it is being sent to. The HTTP header is a protocol that tries to pass all the information an application on the client or server may need from the other end of the transaction. An HTTP message can be broken into three parts.
The body of the message is either the content being sent from the server to the client, or form data or an uploaded file being sent from the client to the server. In other words, it is the thing we think of as being the document we sent or received. Not much more needs to be said about that here. However, the other two sections can use some explanation. Request and ResponseIf the request line can be seen as a specification of what to order from whom, the response line can be seen as the receipt confirming that the transaction took place. There can only be one of the two in any message. URI: the Uniform Resource Indicator, a superset of the URL, is a protocol for uniquely identifying every document accessible on the Internet The request contains three critical pieces of information. The first is the method of request, which is to say, how the server is supposed to process it. The second is the path to the resource being requested. The third is the version number of HTTP being used.
The method tells the server how to handle the request. The three most common are
A typical request header might look something like this: GET /index.php HTTP/1.1 The reply line indicates whether the request was successful. It includes the protocol being used, a numeric status code, and a short description of the status code. HTTP/1.1 200 OK The numeric status codes fall into the following ranges:
The most common status message people get to see is The HTTP Header
People who know just enough HTML to be dangerous encounter the term HTTP header and may think that is corresponds in some way to the document header in an HTML document. This is not the case. The HTML document header is something you have coded into the document between If you need a concrete example, think of the HTML header as the date and address written at the top of a business letter, while the HTTP header is the address written on the outside of the envelope. They may both be addresses, but they are physically different things in physically different locations. The HTTP header contains details about the transaction between the client and server, with slight variations depending on whether it is a request or a response. The header information can be grouped into three different categories. These are:
Each header field is delimited by a line break at the end. In other words, each data field is written on its own line. The end of the header section is delimited by one or more blank lines. In computer terms, a blank line is nothing but some form of newline character. So the end of the header section is actually delimited by a sequence of line break characters with nothing between them. A sample request header might look as follows: GET /tutorials/utils/servervars.php HTTP/1.1 Accept: text/html, image/png, image/jpeg, image/gif, */* Accept-Language: en Accept-Encoding: deflate, gzip, x-gzip, identity, * Connection: Keep-Alive Host: localhost Referer: http://localhost/tutorials/utils/ User-Agent: Opera/6.05 (Windows XP; U) [en] A sample response header might look as follows: HTTP/1.1 200 OK Date: Wed, 22nd Jan 2003 11:15:15 GMT Server: Apache/2.0.43 (Win32) PHP/4.3.0 Last-modified: Wed, 22nd Jan 2003 11:10:47 GMT
These pages can be found at:
[http://academ.hvcc.edu/~kantopet/]
|