Moved Permanently

The document has moved 301 Moved Permanently

Moved Permanently

The document has moved

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Server Design Week 5 Old Dominion University

Similar presentations


Presentation on theme: "Web Server Design Week 5 Old Dominion University"— Presentation transcript:

1 Web Server Design Week 5 Old Dominion University
Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 2/06/06

2 Status 301 Moved Permanently
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-13.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2 HTTP/1.1 Host: Connection: close HTTP/ Moved Permanently Date: Sun, 05 Feb :12:03 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Location: Transfer-Encoding: chunked Content-Type: text/html; charset=iso 14b <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>301 Moved Permanently</TITLE> </HEAD><BODY> <H1>Moved Permanently</H1> The document has moved <A HREF=" <P> <HR> <ADDRESS>Apache/ Server at Port 80</ADDRESS> </BODY></HTML> Main use: redirect requests for directories not ending in a “/” Can be configured for other resources Browsers typically handle 301 (and 302, 307) transparently

3 When is it not Permanent?
Moved Permanently The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. % cd $WWW_home % mkdir foo % touch foo/bar % lynx [returns a directory listing] % rm -rf foo % echo “this is not a directory” > foo [returns a file]

4 A Simple Request… If the resource is large, we might not want to grab the whole thing frequently unless it has changed We could combine HEAD & GET, or we can modify our request with additional headers Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HTTP/ OK Date: Sun, 05 Feb :58:27 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 Jan :43:15 GMT ETag: "1f4de dd0cc3" Accept-Ranges: bytes Content-Length: 1936 Connection: close Content-Type: text/html <html> <head> <title> Michael Nelson's 1966 Ford Fairlane </title> </head> <body> […]

5 Status 304 Not Modified section 10.3.5, 14.25, RFC 2616
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-3.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Modified-Since: Sun, 29 Jan :43:14 GMT HTTP/ OK Date: Sun, 05 Feb :58:52 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 Jan :43:15 GMT ETag: "1f4de dd0cc3" Accept-Ranges: bytes Content-Length: 1936 Content-Type: text/html <html> <head> <title> Michael Nelson's 1966 Ford Fairlane </title> </head> <body> AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-2.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Modified-Since: Sun, 29 Jan :43:15 GMT HTTP/ Not Modified Date: Sun, 05 Feb :58:41 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 ETag: "1f4de dd0cc3" section , 14.25, RFC 2616

6 Status 412 Precondition Failed
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-7.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Unmodified-Since: Sun, 29 Jan :43:14 GMT HTTP/ Precondition Failed Date: Sun, 05 Feb :02:22 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Transfer-Encoding: chunked Content-Type: text/html; charset=iso 159 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>412 Precondition Failed</TITLE> </HEAD><BODY> <H1>Precondition Failed</H1> The precondition on the request for the URL /~mln/teaching/cs595-s06/a1-test/2/index.html evaluated to false.<P> <HR> <ADDRESS>Apache/ Server at Port 80</ADDRESS> </BODY></HTML> AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-5.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Unmodified-Since: Sun, 29 Jan :43:15 GMT Connection closed by foreign host. HTTP/ OK Date: Sun, 05 Feb :01:54 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 Jan :43:15 GMT ETag: "1f4de dd0cc3" Accept-Ranges: bytes Content-Length: 1936 Content-Type: text/html <html> <head> <title> Michael Nelson's 1966 Ford Fairlane </title> </head> <body> sections , 14.28, RFC 2616

7 Entity Tags as Conditionals
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-9.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Match: "1f4de dd0cc2" HTTP/ Precondition Failed Date: Sun, 05 Feb :07:21 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Transfer-Encoding: chunked Content-Type: text/html; charset=iso 159 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>412 Precondition Failed</TITLE> </HEAD><BODY> <H1>Precondition Failed</H1> The precondition on the request for the URL /~mln/teaching/cs595-s06/a1-test/2/index.html evaluated to false.<P> <HR> <ADDRESS>Apache/ Server at Port 80</ADDRESS> </BODY></HTML> AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-8.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Match: "1f4de dd0cc3" HTTP/ OK Date: Sun, 05 Feb :07:12 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 Jan :43:15 GMT ETag: "1f4de dd0cc3" Accept-Ranges: bytes Content-Length: 1936 Content-Type: text/html <html> <head> <title> Michael Nelson's 1966 Ford Fairlane </title> </head> <body> section 14.24, RFC 2616

8 Getting Fancy With Etags…
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-11.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-None-Match: "1f4de dd0caa" HTTP/ OK Date: Sun, 05 Feb :10:00 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 Last-Modified: Sun, 29 Jan :43:15 GMT ETag: "1f4de dd0cc3" Accept-Ranges: bytes Content-Length: 1936 Content-Type: text/html <html> <head> <title> Michael Nelson's 1966 Ford Fairlane </title> </head> <body> AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-12.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-None-Match: "1f4de dd0caa", "1f4de dd0cc3" HTTP/ Not Modified Date: Sun, 05 Feb :10:13 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 ETag: "1f4de dd0cc3" Connection closed by foreign host. section 14.26, RFC 2616

9 Combining Conditionals
AIHT.local:/Users/mln/Desktop/cs595-s06 % telnet 80 | tee 5-14.out Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mln/teaching/cs595-s06/a1-test/2/index.html HTTP/1.1 Host: Connection: close If-Modified-Since: Sun, 29 Jan :43:15 GMT If-Match: "1f4de dd0cc3" HTTP/ Not Modified Date: Sun, 05 Feb :02:18 GMT Server: Apache/ (Unix) ApacheJServ/1.1.2 PHP/4.3.4 ETag: "1f4de dd0cc3" Connection closed by foreign host. not true true

10 Combining Conditionals
If-Modified-Since If-Unmodified-Since If-Match If-None-Match --- undefined X If the request normally (i.e., without the *** header) would result in anything other than a 2xx or 412 status, the **** header SHOULD be ignored. X =


Download ppt "Web Server Design Week 5 Old Dominion University"

Similar presentations


Ads by Google