What Is HTTP, and How Does It Work? Page 2
Put simply, HTTPis the protocol that allows Web browsers and servers to communicate. It forms the basis of what a Web server must do to perform its most basic operations.
When discussing how a Web server works, it is not enough to simply outline a diagram of how low-level network packets go in and out of a Web server.
HTTP started out as a very simple protocol, and even though it has had numerous enhancements, it is still relatively simple. As with other standard Internet protocols, control information is passed as plain text via a TCP connection.
In fact, HTTP connections can actually be made using standard "telnet" commands.
/home/chughes > telnet www.extropia 80 GET /index.html HTTP/1.0 <- Extra char return needed
Note that port 80 is the default port a Web server "listens" on for connections.
In response to this HTTP GET command, the Web server returns to us the page "index.html" across the telnet session, and then closes the connection to signify the end of the document.
The following is part of the sample response:
<HTML> <HEAD> <TITLE>eXtropia Homepage</TITLE> [...] </HEAD> </HTML>
But this simple request/response protocol was quickly outgrown, and it wasn't long before HTTP was refined into a more complex protocol (currently version 1.1). Perhaps the greatest change in HTTP/1.1 is its support for persistent connections.
In HTTP/1.0, a connection must to be made to the Web server for each object the browser wishes to download. Many Web pages are very graphic intensive, which means that in addition to downloading the base HTML page (or frames), the browser must also retrieve a number of images. Many of them may actually be quite small and merely sliced up to provide some hard-coded formatting framework to the rest of the HTML page.
Establishing a connection for each one is wasteful, as several network packets have to be exchanged between the Web browser and Web server before the image data can ever start transmitting. In contrast, opening a single TCP connection that transmits the HTML document and then each image one-by-one is more efficient, as the negotiation of starting new TCP connections is eliminated.