January 2011
Intermediate to advanced
224 pages
5h 43m
English
As mentioned in Chapter 9, communication on the World Wide Web happens over the HTTP protocol. This chapter describes how to use this protocol to make your client-side program talk to your web server.
A simple HTTP request might look like this:
GET /files/data.txt HTTP/1.1 Host: eloquentjavascript.net User-Agent: My Imaginary Browser
This asks for the file files/data.txt from the server at eloquentjavascript.net. In addition, it specifies that this request uses
version 1.1 of the HTTP protocol—version 1.0 is also still in use and works slightly
differently. The Host and User-Agent lines are called
headers. These follow a pattern: They start with a word that identifies the information they contain, followed ...