Metodologias de Programação IV - Aula 2, Secção 3 - Terminologia do protocolo HTTP
Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP
-
Upload
leonel-morgado -
Category
Education
-
view
5.420 -
download
1
description
Transcript of Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP
![Page 1: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/1.jpg)
Suporte para cache no protocolo HTTP
2011-2012
Metodologias de Programação IV
![Page 2: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/2.jpg)
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
HTTP/1.1 200 OKContent-Type: text/html………
![Page 3: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/3.jpg)
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
HTTP/1.1 200 OKContent-Type: text/html……… + 40.318 bytes
![Page 4: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/4.jpg)
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
HTTP/1.1 200 OKContent-Type: text/htmlDate: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMT… + 40.318 bytes
![Page 5: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/5.jpg)
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
HTTP/1.1 200 OKContent-Type: text/htmlDate: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMT… + 40.318 bytes
![Page 6: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/6.jpg)
Last-Modified: Sun, 16 Oct 2011 07:49:26 GMT
Last-Modified: Thu, 29 Jan 2009 02:09:59 GMT
Last-Modified: Wed, 17 Sep 2003 14:46:36 GMT
Last-Modified: Sat, 06 Feb 2010 19:47:46 GMT
Last-Modified: Thu, 02 Jul 2009 02:19:00 GMT
Last-Modified: Wed, 29 Sep 2010 16:33:13 GMT
//v1.7// Flash Player Version Detection// Detect Client Browser type
![Page 7: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/7.jpg)
Cliente Servidor
![Page 8: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/8.jpg)
Cliente Servidor
...
Proxies
![Page 9: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/9.jpg)
HEAD /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
HTTP/1.1 200 OKContent-Type: text/htmlDate: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMT… + 0 bytes
![Page 10: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/10.jpg)
HTTP/1.1 200 OKConnection: Keep-AliveClient-response-num: 1Keep-Alive: timeout=15, max=100Set-Cookie: AF_SID=b672a03f4a0338f035131f6b8034ff33; path=/Date: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMTClient-peer: 65.98.99.99.166:80Client-date: Sun, 16 Oct 2011 16:20:34 GMTContent-Type: text/htmlServer: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e
HEAD /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
420 bytes
![Page 11: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/11.jpg)
HTTP/1.1 200 OKConnection: Keep-AliveClient-response-num: 1Keep-Alive: timeout=15, max=100Set-Cookie: AF_SID=b672a03f4a0338f035131f6b8034ff33; path=/Date: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMTClient-peer: 65.98.99.99.166:80Client-date: Sun, 16 Oct 2011 16:20:34 GMTContent-Type: text/htmlServer: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e
HEAD /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.pt...
420 bytes
Mas se se tiver alterado em relação à cópia em cache…
GET /tc/home.html...
![Page 12: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/12.jpg)
Cliente Servidor
HEAD ...
HTTP/1.1 200 OK
![Page 13: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/13.jpg)
Cliente Servidor
HEAD ...
GET ...
HTTP/1.1 200 OK
HTTP/1.1 200 OK
![Page 14: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/14.jpg)
HTTP/1.1 200 OKDate: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMTServer: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8eSet-Cookie: AF_SID=7896d3ac9d40552973a20a4e6cd7ceac; path=/Keep-Alive: timeout=15, max=100Connection: Keep-AliveTransfer-Encoding: chunkedContent-Type: text/html
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.ptIf-Modified-Since: Fri, 14 Oct 2011 19:08:24 GMT...
+ 40.318 bytes
![Page 15: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/15.jpg)
HTTP/1.1 200 OKDate: Sun, 16 Oct 2011 16:20:34 GMTLast-Modified: Sun, 16 Oct 2011 07:49:25 GMTServer: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8eSet-Cookie: AF_SID=7896d3ac9d40552973a20a4e6cd7ceac; path=/Keep-Alive: timeout=15, max=100Connection: Keep-AliveTransfer-Encoding: chunkedContent-Type: text/html
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.ptIf-Modified-Since: Fri, 14 Oct 2011 19:08:24 GMT...
+ 40.318 bytes
![Page 16: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/16.jpg)
HTTP/1.1 304 Not modifiedConnection: Keep-AliveKeep-Alive: timeout=15, max=99Date: Sun, 16 Oct 2011 18:26:07 GMTClient-peer: 65.98.99.166:80Etag: "e05af-19db-4a4beb1b“Client-date: Sun, 16 Oct 2011 18:26:06 GMTServer: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e
GET /tc/home.html HTTP/1.1Host: www.tribunalconstitucional.ptIf-Modified-Since: Sun, 16 Oct 2011 07:49:25 GMT...
299 bytes
![Page 17: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/17.jpg)
Cliente Servidor
GET ...
HTTP/1.1 200 OK
HTTP/1.1 304 Not modified
![Page 18: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/18.jpg)
HEAD If-Modified-Since
![Page 19: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/19.jpg)
HEAD If-Modified-Since
“HTTP/1.1 implements a more efficient approach to this problem using two new headers: If-Modified-Since and (...)” (p. 58)
![Page 20: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/20.jpg)
HEAD If-Modified-Since
“HTTP/1.1 implements a more efficient approach to this problem using two new headers: If-Modified-Since and (...)” (p. 58)
![Page 21: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/21.jpg)
![Page 22: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/22.jpg)
HEAD If-Modified-Since
http://bit.ly/oNhktc
![Page 23: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/23.jpg)
HEAD If-Modified-Since
Ideal para cacheAlternativa p/ cache
Recolha delistas de recursos
![Page 24: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/24.jpg)
HEAD If-Modified-Since
Ideal para cacheAlternativa p/ cache
Recolha delistas de recursos
![Page 25: Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP](https://reader036.fdocument.pub/reader036/viewer/2022062313/5583f443d8b42aa82c8b456b/html5/thumbnails/25.jpg)
Leituras associadas
Web Application Architecture, Second EditionCap. 3: “Birth of the Web: HTTP”, pp. 49-51 e 58-59.
Krishnamurthy, B.; Mogul, J.; Kristol, D. (1999).Key Differences between HTTP/1.0 and HTTP/1.1. In “WWW8 Conference Refereed Papers”, Eighth International World Wide Web Conference, Toronto Convention Centre, Toronto, Canadá,11 a 14 de Maio, 1999.
http://bit.ly/oNhktc