O slideshow foi denunciado.

Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP

5.724 visualizações

Publicada em

Suporte para cache no protocolo HTTP

Publicada em: Educação, Tecnologia
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Metodologias de Programação IV - Aula 4, Secção 1 - Suporte para cache no protocolo HTTP

  1. 1. Suporte para cache no protocolo HTTP<br />2011-2012<br />Metodologias de Programação IV<br />
  2. 2. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Content-Type: text/html<br />…<br />…<br />…<br />
  3. 3. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Content-Type: text/html<br />…<br />…<br />…<br />+ 40.318 bytes<br />
  4. 4. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Content-Type: text/html<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />…<br />+ 40.318 bytes<br />
  5. 5. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Content-Type: text/html<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />…<br />+ 40.318 bytes<br />
  6. 6. Last-Modified: Wed, 29 Sep 2010 16:33:13 GMT<br />Last-Modified: Thu, 02 Jul 2009 02:19:00 GMT<br />Last-Modified: Sat, 06 Feb 2010 19:47:46 GMT<br />Last-Modified: Wed, 17 Sep 2003 14:46:36 GMT<br />//v1.7<br />// Flash Player Version Detection<br />// Detect Client Browser type<br />Last-Modified: Thu, 29 Jan 2009 02:09:59 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:26 GMT<br />
  7. 7. Cliente<br />Servidor<br />
  8. 8. Cliente<br />Servidor<br />Proxies<br />...<br />
  9. 9. HEAD /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Content-Type: text/html<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />…<br />+ 0 bytes<br />
  10. 10. HEAD /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Connection: Keep-Alive<br />Client-response-num: 1<br />Keep-Alive: timeout=15, max=100<br />Set-Cookie: AF_SID=b672a03f4a0338f035131f6b8034ff33; path=/<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />Client-peer: 65.98.99.99.166:80<br />Client-date: Sun, 16 Oct 2011 16:20:34 GMT<br />Content-Type: text/html<br />Server: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e<br />420 bytes<br />
  11. 11. HEAD /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />...<br />HTTP/1.1 200 OK<br />Connection: Keep-Alive<br />Client-response-num: 1<br />Keep-Alive: timeout=15, max=100<br />Set-Cookie: AF_SID=b672a03f4a0338f035131f6b8034ff33; path=/<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />Client-peer: 65.98.99.99.166:80<br />Client-date: Sun, 16 Oct 2011 16:20:34 GMT<br />Content-Type: text/html<br />Server: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e<br />420 bytes<br />Mas se setiveralteradoemrelação à cópiaem cache…<br />GET /tc/home.html...<br />
  12. 12. Cliente<br />Servidor<br />HEAD ...<br />HTTP/1.1 200 OK<br />
  13. 13. Cliente<br />Servidor<br />HEAD ...<br />HTTP/1.1 200 OK<br />GET ...<br />HTTP/1.1 200 OK<br />
  14. 14. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />If-Modified-Since: Fri, 14 Oct 2011 19:08:24 GMT<br />...<br />HTTP/1.1 200 OK<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />Server: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e<br />Set-Cookie: AF_SID=7896d3ac9d40552973a20a4e6cd7ceac; path=/<br />Keep-Alive: timeout=15, max=100<br />Connection: Keep-Alive<br />Transfer-Encoding: chunked<br />Content-Type: text/html<br />+ 40.318 bytes<br />
  15. 15. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />If-Modified-Since: Fri, 14 Oct 2011 19:08:24 GMT<br />...<br />HTTP/1.1 200 OK<br />Date: Sun, 16 Oct 2011 16:20:34 GMT<br />Last-Modified: Sun, 16 Oct 2011 07:49:25 GMT<br />Server: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e<br />Set-Cookie: AF_SID=7896d3ac9d40552973a20a4e6cd7ceac; path=/<br />Keep-Alive: timeout=15, max=100<br />Connection: Keep-Alive<br />Transfer-Encoding: chunked<br />Content-Type: text/html<br />+ 40.318 bytes<br />
  16. 16. GET /tc/home.html HTTP/1.1<br />Host: www.tribunalconstitucional.pt<br />If-Modified-Since: Sun, 16 Oct 2011 07:49:25 GMT<br />...<br />299 bytes<br />HTTP/1.1 304 Notmodified<br />Connection: Keep-Alive<br />Keep-Alive: timeout=15, max=99<br />Date: Sun, 16 Oct 2011 18:26:07 GMT<br />Client-peer: 65.98.99.166:80<br />Etag: "e05af-19db-4a4beb1b“<br />Client-date: Sun, 16 Oct 2011 18:26:06 GMT<br />Server: Apache/1.3.41 (Unix) mod_perl/1.31 mod_ssl/2.8.31 OpenSSL/0.9.8e<br />
  17. 17. Cliente<br />Servidor<br />GET ...<br />HTTP/1.1 200 OK<br />HTTP/1.1 304 Notmodified<br />
  18. 18. HEAD<br />If-Modified-Since<br />
  19. 19. “HTTP/1.1 implements a more efficientapproach to thisproblemusingtwonewheaders: If-Modified-Sinceand(...)” (p. 58)<br />HEAD<br />If-Modified-Since<br />
  20. 20. “HTTP/1.1 implements a more efficientapproach to thisproblemusingtwonewheaders: If-Modified-Sinceand(...)” (p. 58)<br />HEAD<br />If-Modified-Since<br />
  21. 21.
  22. 22. HEAD<br />If-Modified-Since<br />http://bit.ly/oNhktc<br />
  23. 23. HEAD<br />If-Modified-Since<br />Ideal para cache<br />Alternativa p/ cache<br />Recolha de<br />listas de recursos<br />
  24. 24. HEAD<br />If-Modified-Since<br />Ideal para cache<br />Alternativa p/ cache<br />Recolha de<br />listas de recursos<br />
  25. 25. Leituras associadas<br />Web ApplicationArchitecture, Second Edition<br />Cap. 3: “Birth of the Web: HTTP”, pp. 49-51 e 58-59.<br />Krishnamurthy, B.; Mogul, J.; Kristol, D. (1999).<br />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á,<br />11 a 14 de Maio, 1999.<br />http://bit.ly/oNhktc<br />

×