Presentation is loading. Please wait.

Presentation is loading. Please wait.

What’s Really Happening

Similar presentations


Presentation on theme: "What’s Really Happening"— Presentation transcript:

1 What’s Really Happening
Under the Bonnet What’s Really Happening

2 Clients and Servers Client is what you use web browser
ftp, mail, news client etc Server is what provides the information web page files from ftp, your , news etc Client is on your machine (usually) Server is on a remote machine (usually) February 2013 Web Development Tools

3 The Communication Protocols, low-level 0s and 1s
Clients must understand the bits/bytes the server sends Different protocols for different services Standards exist to define these protocols You don’t need to know how the protocols work in detail! February 2013 Web Development Tools

4 HTTP HTTP is the protocol for the web Need to appreciate it! Client
Server February 2013 Web Development Tools

5 HTTP Hypertext Transfer Protocol Versions
0.9: Just raw data transfer 1.0: Meta-information, modifiers to request/response semantics 1.1: Proxies, caching, persistent connections, virtual hosts Not to be confused with HTML versions!!! February 2013 Web Development Tools

6 The Protocol Request/Response protocol
2nd and 3rd blocks like an message special words followed by a colon body after a blank line February 2013 Web Development Tools

7 Simplest example Request method is GET relative URL is /index.html
protocol is 1.1 We only need one request modifier: the host No body Whole message is therefore GET /index.html HTTP/1.1 Host: dummy.dcs.aber.ac.uk February 2013 Web Development Tools

8 Response HTTP/1.1 200 OK Date: Wed, 06 Feb 2002 23:54:00 GMT
Server: Apache/ (Win32) Content-Location: index.html.en Vary: negotiate,accept-language,accept-charset TCN: choice Last-Modified: Tue, 15 May :20:02 GMT ETag: "0-5d6-3b012d02;3b27a488" Accept-Ranges: bytes Content-Length: 1494 Content-Type: text/html Content-Language: en <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <html xmlns=" <head> <title>Test Page for Apache Installation</title> (etc) </body> </html> February 2013 Web Development Tools

9 To see the headers If you want to see the headers sent by a page, try the UNIX command: $ wget -S That will enable you to see the headers that the browser would normally receive, but not show to you See example on next slide – helps you to see what the server is doing February 2013 Web Development Tools

10 $ wget -S http://www.aber.ac.uk/
:51: Resolving Connecting to connected. HTTP request sent, awaiting response... HTTP/ Moved Temporarily Date: Mon, 12 Mar :51:22 GMT Server: Apache Location: Content-Length: 0 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html Location: [following] :51: Reusing existing connection to HTTP/ OK Connection: close Length: unspecified [text/html] Saving to: `index.html.1' February 2013 Web Development Tools

11 Possible methods OPTIONS GET HEAD POST PUT DELETE TRACE
what communications options are for the URI GET retrieve the information HEAD identical to GET but no body is returned POST some new data is delivered to the server but a page is retrieved as with GET PUT the body is to be stored at the given URI DELETE the URI resource is deleted TRACE the message is looped back to the sender February 2013 Web Development Tools

12 Response codes You’ll see some of these
You’ve almost certainly seen some before If you’re running a web server, they can help you to find out what went wrong What response codes have you seen in your browser when a page has failed to display? February 2013 Web Development Tools

13 Response codes 2xx - Successful 3xx - Redirection 4xx - Client Error
client may handle these silently 4xx - Client Error includes 404 Not Found 5xx - Server Error February 2013 Web Development Tools

14 Content Negotiation Client and Server can negotiate over content
What will client accept What does the client prefer Server can respond to say that it’s not available, or can’t do it February 2013 Web Development Tools

15 Content Negotiation Covers: file formats quality
encodings (compression etc.) character sets language February 2013 Web Development Tools

16 Negotiation example GET /index.html HTTP/1.1 Host: pcnwhp.dcs.aber.ac.uk Accept-Language: cy, de, en "I prefer Welsh, if not I'll have German, failing that English." the server can deliver the first one it finds browsers allow you to set this (mostly) you have to be able to provide alternatives on the server somehow on Apache to put up index.html.de, index.html.en etc. February 2013 Web Development Tools

17 From this, we see: HTTP is stateless
there is no continuity between one request and the next how can a server tell that a request comes from the same user as an earlier one? the client’s user need not identify themselves fields exist for passing this on, but need not be present get and post both retrieve pages but they’re different February 2013 Web Development Tools

18 Reference Long (114 pages) but interesting to scan
Long (114 pages) but interesting to scan You’re not going to be examined on its detailed contents! February 2013 Web Development Tools


Download ppt "What’s Really Happening"

Similar presentations


Ads by Google