Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
How the web works: HTTP and CGI explained
CSC 2720 Building Web Applications Servlet – Getting and Setting HTTP Headers.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/10/10.
Java Technology and Applications
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Application Layer 2 Figures from Kurose and Ross
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
The HyperText Transfer Protocol. History HTTP has been in use since 1990 (HTTP/0.9) HTTP/1.0 was defined in RFC 1945 (May 1996) and included metainformation.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/13/10.
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2010 Martin Klein 8/31/10.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
Web Server Design Assignment #1: Basic Operations Due: 02/03/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
Web Server Design Week 11 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/24/10.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Web Server Design Assignment #2: Conditionals & Persistence Due: 02/24/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010.
Web Server Design Week 2 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/20/10.
Web Server Design Week 7 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/24/10.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Overview of Servlets and JSP
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/17/10.
Web Server Design Assignment #3: Transfer Encoding & Content Negotiation Due: 03/24/2010 Old Dominion University Department of Computer Science CS 495/595.
Web Server Design Week 10 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/17/10.
Web Server Design Week 5 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 02/07/12.
Introduction to Web Science Michael L. Nelson CS 495/595 Old Dominion University This work is licensed under a Creative Commons Attribution-NonCommercial-
Web Programming Week 1 Old Dominion University Department of Computer Science CS 418/518 Fall 2007 Michael L. Nelson 8/27/07.
Web Server Design Week 1 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/09/06.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
Web Server Design Week 3 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/23/06.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/13/06.
What’s Really Happening
HTTP – An overview.
Web Server Design Week 10 Old Dominion University
Web Server Design Week 4 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 7 Old Dominion University
Web Server Design Assignment #5 Extra Credit
Web Server Design Week 4 Old Dominion University
Web Server Design Week 15 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Assignment #2: Conditionals & Persistence
Web Server Design Week 8 Old Dominion University
Web Server Design Week 8 Old Dominion University
Old Dominion University Department of Computer Science
Web Server Design Week 6 Old Dominion University
Web Server Design Week 10 Old Dominion University
Web Server Design Week 8 Old Dominion University
Web Server Design Week 11 Old Dominion University
Web Server Design Week 5 Old Dominion University
Web Server Design Week 3 Old Dominion University
Web Server Design Week 4 Old Dominion University
HTTP Hypertext Transfer Protocol
Web Server Design Week 14 Old Dominion University
Web Server Design Assignment #1: Basic Operations
Web Server Design Week 6 Old Dominion University
Web Server Design Assignment #5 Extra Credit
Old Dominion University Department of Computer Science
Web Server Design Week 7 Old Dominion University
Web Programming Week 1 Old Dominion University
Web Server Design Week 7 Old Dominion University
Presentation transcript:

Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10

Terminology Revisited Resource - A data object / service identified by a URI –not necessarily a file on a file system!!! Variant - A resource with > 1 associated simultaneous entities Representation - a variant subject to content negotiation Content negotiation - choosing the “best” representation to return in a response…

Content Negotiation Server-side –server picks best representation (agent can pass in “hints” via Accept.* headers) section 12.1 see Apache algorithm at: Agent-side –server sends a list to the agent and the agent picks from representation section 12.2 Transparent Negotiation –combination of server-side and agent-side performed by caches, proxies, etc. mentioned in passing in RFC 2616; detailed in RFC-2295 –

Turning on Content Negotiation Tradeoff: flexibility vs. performance –“Cool URI’s don’t change” –Turn off content-negotiation for speed e.g., In Apache, content negotiation is turned via: –Type-map file (*.var) –Options +Multiviews directive in httpd.conf or.htaccess file –in our servers, content negotiation will be on by default

How it Works If a direct match for the requested URI is found, then the entity is returned If a 404 would be the result of the current request, AND content negotiation is available for this resource, then content negotiation begins

Request Headers & Status Codes Request headers –Accept –Accept-Charset –Accept-Encoding –Accept-Language Response headers –Content-Location –Vary tells caches how the response was generated –covered in RFC 2295 TCN, Alternates Status codes –300 Multiple Choices –406 Not Acceptable

Test Directory % cd ~mklein/public_html/teaching/cs595-s10/a3-test % ls fairlane.gif index.html.de index.html.ja.jis type-map.example fairlane.jpeg index.html.en index.html.ko.euc-kr vt-uva.html.gz fairlane.png index.html.es index.html.ru.koi8-r vt-uva.html.Z % % more.htaccess Options All +MultiViews note: no “index.html”

Accept (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Host: Connection: close HTTP/ OK Date: Wed, 03 Mar :29:23 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Location: fairlane.txt Vary: negotiate,accept TCN: choice Last-Modified: Mon, 13 Mar :00:53 GMT ETag: "67d75d-c1-40ed86390c740;40ed863dd1280" Accept-Ranges: bytes Content-Length: 193 Connection: close Content-Type: text/plain Connection closed by foreign host. note: structured ETag

Accept (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Host: Connection: close Accept: image/*; q=1.0 HTTP/ OK Date: Wed, 03 Mar :30:42 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Location: fairlane.jpeg Vary: negotiate,accept TCN: choice Last-Modified: Sun, 12 Mar :37:16 GMT ETag: "67d75e ecfad56ab00;40ed863dd1280" Accept-Ranges: bytes Content-Length: Connection: close Content-Type: image/jpeg Connection closed by foreign host.

Accept (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Host: Connection: close Accept: image/png; q=1.0, image/gif; q=0.5, image/jpeg; q=0.1 HTTP/ OK Date: Wed, 03 Mar :31:49 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Location: fairlane.png Vary: negotiate,accept TCN: choice Last-Modified: Sun, 12 Mar :37:31 GMT ETag: "67d75c-17f9b-40ecfae3b8cc0;40ed863dd1280" Accept-Ranges: bytes Content-Length: Connection: close Content-Type: image/png Connection closed by foreign host.

Accept (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Host: Connection: close Accept: image/tiff; q=1.0, image/gif; q=0.001 HTTP/ OK Date: Wed, 03 Mar :33:25 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Location: fairlane.gif Vary: negotiate,accept TCN: choice Last-Modified: Sun, 12 Mar :46:10 GMT ETag: "67d75b-c28b-40ed250e5c880;40ed863dd1280" Accept-Ranges: bytes Content-Length: Connection: close Content-Type: image/gif Connection closed by foreign host.

Accept-Encoding (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/vt-uva HTTP/1.1 Host: Connection: close HTTP/ OK Date: Wed, 03 Mar :34:29 GMT Server: Apache/ (Unix) DAV/2 PHP/ Content-Location: vt-uva.html.gz Vary: negotiate,accept TCN: choice Last-Modified: Sun, 12 Mar :52:54 GMT ETag: "67d75a-2c54-40ed268fa5580;40ed863dd1280" Accept-Ranges: bytes Content-Length: Connection: close Content-Type: application/x-gzip Connection closed by foreign host. Content-Type: text/html Content-Encoding: x-gzip

Accept-Encoding dhcp :~/Desktop/cs595-s06 mln$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s06/a3-test/vt-uva HTTP/1.1 Accept-Encoding: compress; q=0.1, gzip; q=0.0 Host: Connection: close HTTP/ OK Date: Mon, 13 Mar :29:54 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Content-Location: vt-uva.html.Z Vary: negotiate,accept-encoding TCN: choice Last-Modified: Sun, 12 Mar :52:41 GMT ETag: "3b64c3-5c0b-44148a19;4414d473" Accept-Ranges: bytes Content-Length: Connection: close Content-Type: text/html Content-Encoding: compress Connection closed by foreign host.

Accept-Language dhcp :~/Desktop/cs595-s06 mln$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s06/a3-test/ HTTP/1.1 Accept-Language: de; q=1.0 Host: Connection: close HTTP/ OK Date: Mon, 13 Mar :32:36 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Content-Location: index.html.de Vary: negotiate,accept-language,accept-charset TCN: choice Last-Modified: Sun, 12 Mar :39:23 GMT ETag: "3b64b7-1c ebb;4414d473" Accept-Ranges: bytes Content-Length: 7316 Connection: close Content-Type: text/html Content-Language: de Connection closed by foreign host.

Accept-Charset dhcp :~/Desktop/cs595-s06 mln$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s06/a3-test/index.html HTTP/1.1 Accept-Language: ja; q=1.0 Accept-Charset: iso-2022-jp; q=1.0 Host: Connection: close HTTP/ OK Date: Mon, 13 Mar :35:17 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Content-Location: index.html.ja.jis Vary: negotiate,accept-language,accept-charset TCN: choice Last-Modified: Sun, 12 Mar :39:23 GMT ETag: "3b64ba-1dd ebb;4414d473" Accept-Ranges: bytes Content-Length: 7635 Connection: close Content-Type: text/html; charset=iso-2022-jp Content-Language: ja Connection closed by foreign host.

Accept-Charset / Status 406 dhcp :~/Desktop/cs595-s06 mln$ telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mln/teaching/cs595-s06/a3-test/index.html HTTP/1.1 Accept-Language: ja; q=1.0 Accept-Charset: euc-jp; q=1.0 Host: Connection: close HTTP/ Not Acceptable Date: Mon, 13 Mar :39:29 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Alternates: {"index.html.de" 1 {type text/html} {language de} {length 7316}}, {"index.html.en" 1 {type text/html} {language en} {length 7233}}, {"index.html.es" 1 {type text/html} {language es} {length 7643}}, {"index.html.ja.jis" 1 {type text/html} {charset iso-2022-jp} {language ja} {length 7635}}, {"index.html.ru.koi8-r" 1 {type text/html} {charset koi8-r} {language ru} {length 7277}} Vary: negotiate,accept-language,accept-charset TCN: list Connection: close Content-Type: text/html; charset=iso Connection closed by foreign host.

406 Not Acceptable (mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Host: Accept: image/tiff; q=1.0, *;q=0.0 Connection: close HTTP/ Not Acceptable Date: Wed, 03 Mar :47:43 GMT Server: Apache/ (Unix) DAV/2 PHP/ Alternates: {"fairlane.gif" 1 {type image/gif} {length 49803}}, {"fairlane.jpeg" 1 {type image/jpeg} {length 38457}}, {"fairlane.png" 1 {type image/png} {length 98203}}, {"fairlane.txt" 1 {type text/plain} {length 193}} Vary: negotiate,accept TCN: list Connection: close Content-Type: text/html; charset=iso Connection closed by foreign host.

406 Not Acceptable dhcp :~/Desktop/cs595-s06 mln$ telnet 80Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a3-test/fairlane HTTP/1.1 Host: Accept: image/tiff; q=1.0, *;q=0.0 Connection: close HTTP/ Not Acceptable Date: Tue, 14 Mar :30:23 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Alternates: {"fairlane.gif" 1 {type image/gif} {length 49803}}, {"fairlane.jpeg" 1 {type image/jpeg} {length 38457}}, {"fairlane.png" 1 {type image/png} {length 98203}}, {"fairlane.txt" 1 {type text/plain} {length 193}} Vary: negotiate,accept TCN: list Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso d 406 Not Acceptable Not Acceptable An appropriate representation of the requested resource /~mln/teaching/cs595-s06/a3-test/fairlane could not be found on this server. Available variants: fairlane.gif, type image/gif fairlane.jpeg, type image/jpeg fairlane.png, type image/png fairlane.txt, type text/plain Apache/ Server at Port 80 0

300 Multiple Choices Multiple Choices The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent- driven negotiation information (section 12) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location. Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content- Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection. If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.

Transparent Content Negotiation Defined in RFC-2295 Client requests CN –“transparent” does not mean “hide from client”, it means “making transparent all available representations for a given URI” Three kinds of responses: –list: “here is a list for the client to choose from” –choice: “the server made this choice for the client” –adhoc: “weird things are happening, so the server made a choice” (a (hopefully) rare situation)

(mln-web:~) mklein% telnet 80 Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mklein/teaching/cs595-s10/a3-test/fairlane HTTP/1.1 Negotiate: 1.0 Host: Connection: close HTTP/ Multiple Choices Date: Wed, 03 Mar :50:07 GMT Server: Apache/ (Unix) DAV/2 PHP/ Alternates: {"fairlane.gif" 1 {type image/gif} {length 49803}}, {"fairlane.jpeg" 1 {type image/jpeg} {length 38457}}, {"fairlane.png" 1 {type image/png} {length 98203}}, {"fairlane.txt" 1 {type text/plain} {length 193}} Vary: negotiate,accept TCN: list Content-Length: 549 Connection: close Content-Type: text/html; charset=iso Multiple Choices Multiple Choices Available variants: fairlane.gif, type image/gif fairlane.jpeg, type image/jpeg fairlane.png, type image/png fairlane.txt, type text/plain Apache/ (Unix) DAV/2 PHP/ Server at Port 80 Connection closed by foreign host.