Senin, 30 Mei 2011

SMW ♥ 303

How do I know? Here's the clue. Have a look at the log generated by Live HTTP headers (a Firefox add-on) below:

01: http://localhost/wiki/index.php/Special:URIResolver/Mr_X
02:
03: GET /wiki/index.php/Special:URIResolver/Mr_X HTTP/1.1
04: Host: localhost
05: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
06: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
07: Accept-Language: en-gb,en;q=0.5
08: Accept-Encoding: gzip,deflate
09: Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
10: Keep-Alive: 65535
11: Connection: keep-alive
12: If-Modified-Since: Mon, 30 May 2011 15:02:24 GMT
13:
14: HTTP/1.1 303 See Other
15: Date: Mon, 30 May 2011 15:08:38 GMT
16: Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
17: X-Powered-By: PHP/5.3.5
18: Vary: Accept-Encoding,Cookie
19: Expires: Thu, 01 Jan 1970 00:00:00 GMT
20: Cache-Control: private, must-revalidate, max-age=0
21: Last-Modified: Mon, 30 May 2011 15:08:38 GMT
22: Location: http://localhost/wiki/index.php/Mr_X
23: Content-Length: 0
24: Keep-Alive: timeout=5, max=100
25: Connection: Keep-Alive
26: Content-Type: text/html; charset=utf-8
27: ----------------------------------------------------------
28: http://localhost/wiki/index.php/Mr_X
29:
30: GET /wiki/index.php/Mr_X HTTP/1.1
31: Host: localhost
32: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
33: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
34: Accept-Language: en-gb,en;q=0.5
35: Accept-Encoding: gzip,deflate
36: Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
37: Keep-Alive: 65535
38: Connection: keep-alive
39:
40: HTTP/1.1 200 OK
41: Date: Mon, 30 May 2011 15:08:38 GMT
42: Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
43: X-Powered-By: PHP/5.3.5
44: Content-Language: en
45: Vary: Accept-Encoding,Cookie
46: Expires: Thu, 01 Jan 1970 00:00:00 GMT
47: Cache-Control: private, must-revalidate, max-age=0
48: Last-Modified: Mon, 30 May 2011 16:30:27 GMT
49: Keep-Alive: timeout=5, max=99
50: Connection: Keep-Alive
51: Transfer-Encoding: chunked
52: Content-Type: text/html; charset=UTF-8
53: ----------------------------------------------------------
view raw 303 @ SMW.txt hosted with ❤ by GitHub

So, what does really happen?
  1. I send a request to dereferencing the resource (any kind of resource) URI  @ line 3. I add a content negoitation stuff on the header like line 6.
  2. The server gives a 303 response (yay!) @ line 14 and because I was asking for text/html content, the server gives a redirection to this location @ line 22.
  3. I send a second request  @ line 30 to get the text/html content (information resource) to the location as specified on the server response.
  4. I got a 200 @ line 40, voila! Now I could read the information describing the resource URI.

Tidak ada komentar:

Posting Komentar