The primary purpose of a Web server is to deliver a document on request to a client. The document may be text, an image file, or other type of file. The document is identified by a name called a URL (Uniform Resource Locator). If the server stores that particular URL (or can generate content for that URL), then it returns the document as the message reply.
http://pandonia/OS.html ftp://services.canberra.edu.au/bin/ls
A trivial document looks like
<html> <head> <title> Title of document </title> </head> <body> <h1> Header level 1 </h1> Some text in here </body>
HTTP/1.1If this is not present, version 0.9 is assumed.
HTTP/1.0 servers must handle different versions of request as follows:
HTTP/1.0 clients must
Request = Simple-Request | Full-Request Simple-Request = "GET" SP Request-URI CRLF Full-Request = Request-Line *(General-Header | Request-Header | Entity-Header) CRLF [Entity-Body]A Simple-Request is an HTTP/0.9 request and must be replied to by a Simple-Response.
A Request-Line has format
Request-Line = Method SP Request-URI SP HTTP-Version CRLFwhere
Method = "GET" | "HEAD" | POST | extension-methode.g.
GET http://jan.newmarch.name/index.html HTTP/1.0
Response = Simple-Response | Full-Response Simple-Response = [Entity-Body] Full-Response = Status-Line *(General-Header | Response-Header | Entity-Header) CRLF [Entity-Body]
The Status-Line gives information about the fate of the request:
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLFe.g.
HTTP/1.0 200 OKThe codes are
Status-Code = "200" ; OK | "201" ; Created | "202" ; Accepted | "204" ; No Content | "301" ; Moved permanently | "302" ; Moved temporarily | "304" ; Not modified | "400" ; Bad request | "401" ; Unauthorised | "403" ; Forbidden | "404" ; Not found | "500" ; Internal server error | "501" ; Not implemented | "502" ; Bad gateway | "503" | Service unavailable | extension-code
The Entity-Header contains useful information about the Entity-Body to follow
Entity-Header = Allow | Content-Encoding | Content-Length | Content-Type | Expires | Last-Modified | extension-header
This is not a very secure scheme. All the HTTP messages are sent in plain text format. The user-id and password are not encrypted in any way.
Helpers handle documents on the client browser side that the browser cannot. It does so by calling another process and passing the document to it. There is little communication between browser and handler.
Plugins also handle documents that the browser cannot. However, plugins run wothin the browser address space as DLLs.
JavaScript and VBScript are run by interpreters within the browser. Typically they are used for field validation.
Java applets are run by an interpreter within the browser. They can accomplish far more than JavaScript or VBScript.
ActiveX controls are DLLs that run within the browser address space. They are built from native code and can do anything.
CGI scripts fatten the server. JavaScript and VBScript really add to the presentation layer. Java and ActiveX can carry application as well as presentation logic.