Presentation is loading. Please wait.

Presentation is loading. Please wait.

How the web works: HTTP and CGI explained

Similar presentations


Presentation on theme: "How the web works: HTTP and CGI explained"— Presentation transcript:

1 How the web works: HTTP and CGI explained
Lars M. Garshol

2 HTTP (HyperText Transfer Protocol)
Web’s application layer protocol. Underlying transport protocol: TCP Client/Server Model: Client: (Browser) requests, receives and displays web objects. Server: (Web server) sends objects in response to requests.

3 What happens when we follow a link?
Step 1: Parsing the URL URLs basic form: "protocol://server/request-URI". Step 2: Sending the request "GET /request-URI  HTTP/version“ Example: GET /  HTTP/1.0 Step 3: The server response HTTP/[VER] [CODE] [TEXT] Field1: Value1 Field2: Value2 Document Content

4 The request sent by the client
[METH] [REQUEST-URI] HTTP/[VER] [fieldname1]: [field-value1] [fieldname2]: [field-value2] [request body, if any] GET /TECH/space/ HTTP/1.0 User-Agent: Mozilla/3.0 Accept: */* Host: birk105.studby.uio.no:81

5 The request sent by the client
Some header fields that can be used with GET: User-Agent If-Modified-Since From Authorization HEAD: checking documents

6 The response returned by the server
Outline HTTP/[VER] [CODE] [TEXT] Field1: Value1 Field2: Value2 ... Document content here Example: HTTP/ OK Server: Netscape-Communications/1.1 Date: Tuesday, 25-Nov-97 01:22:04 GMT Last-modified: Thursday, 20-Nov-97 10:44:53 GMT Content-type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

7 The response returned by the server
The Status Codes 1xx: Informational 2xx: Successful 3xx: Redirection 4xx: Client error 5xx: Server error Some header fields a server can return: Location Server Content-length Content-type Content-encoding Expires Last-modified

8 Caching The browser cache Proxy cache
The browser stores a local copy of the web object. Proxy cache The users share a common cache to reduce the network traffic.

9 Server-side Programming
Server-side programs run on the web server in response to requests from the client. CGI (Common Gateway Interface) is a way for web servers and server-side programs to interact. CGI directories tells the server that all files in a particular top-level directory are CGI scripts Submitting forms Pushing data to the server (POST) Some other techniques: ASP, MetaHTML and PHP3 Technologies such as JavaScript, VBScript and Java applets all run in the client and so are not examples of this

10 Some Details Content Negotiation Cookies Accept: image/*, image/png
Accept-Encoding: compress, gzip Cookies HTTP protocol is stateless (server may want to know what a user has done before) Can be used to track the path of a user through a web site Can be used to give pages a personalized look


Download ppt "How the web works: HTTP and CGI explained"

Similar presentations


Ads by Google