This chapter provides a very quick and informal overview of web technology and introduces the Cows scripting language.
When you visit a web site your browser (client application) sends a request to a remote web server. The server simply sends back a response. It's an oversimplification, but we don't need to know more so it's better keeping things simple.
Of course, two applications need to agree on a set of rules to talk each other; these sets of rules are called `protocols'. The protocol followed by browsers and web servers is called HTTP (HyperText Transfer Protocol).
You won't need to know HTTP to create web sites, but some basic concepts will help you to choose the right tools for your job.
A typical request sent by a browser is:
GET /index.html HTTP/1.1
Host: www.g-cows.org
The server will search the page, check for permissions if requested by site administrator and send a response back:
HTTP/1.1 200 OK
Date: Tue, 07 Jan 2004 13:48:49 GMT
Server: Apache/2.0.47 (Unix) PHP/4.3.3
...
Other information and finally the page index.html follow.
I want to point out your attention on the simplicity of this protocol. When you visit a web site, you see text, images and links to other pages so you could expect a communication like the following.
Browser: Send me index.html
Server: Here index.html, with some images. Now you can jump to docs.html or contact.html: which one do you choose?
Browser: Send me docs.html ...
But that's not what happens: we said that HTTP simply allows a sequence of request-answer: no real dialog takes place. The trick is very simple: page index.html contains all information needed by the browser to ask for images and, once user selects a link, to ask for other pages. The real communication is something like this:
Browser: Send me index.html
Server: Here it is [send page]
[ Now, the browser analyze index.html, see that an image is needed and asks for it. ]
Browser: Send me logo.jpg
Server: Here it is [send the image]
[ The browser also see that there are some links pointing to docs.html and contact.html so, as user select a link, it knows how to ask for that page. ]
Browser: Send me docs.html
Server: Here it is [send page]
As you can see, a very simple protocol based on `Give me a resource' and `Here is the resource' mimics more complex iterations based on multiple choices.
This manual can be downloaded from http://www.g-cows.org/.