From c48c57d7cdb50dbd970dc2746ac2b08ec9d95085 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sun, 31 May 2009 22:25:49 -0700 Subject: [PATCH] more HTTP chapter --- http-web-services.html | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/http-web-services.html b/http-web-services.html index 7f2c6ee..b9db5ea 100644 --- a/http-web-services.html +++ b/http-web-services.html @@ -134,7 +134,20 @@ Content-Type: image/jpeg The second time you request the same data, you include the ETag hash in an If-None-Match header of your request. If the data hasn’t changed, the server will send you back a 304 status code. As with the last-modified date checking, the server sends back only the 304 status code; it doesn’t send you the same data a second time. By including the ETag hash in your second request, you’re telling the server that there’s no need to re-send the same data if it still matches this hash, since you still have the data from the last time. -

FIXME add curl example here +

Again with the curl: + +

+you@localhost:~$ curl -I -H "If-None-Match: \"3075-ddc8d800\"" http://wearehugh.com/m.jpg  
+HTTP/1.1 304 Not Modified
+Date: Sun, 31 May 2009 18:04:39 GMT
+Server: Apache
+Connection: close
+ETag: "3075-ddc8d800"
+Expires: Mon, 31 May 2010 18:04:39 GMT
+Cache-Control: max-age=31536000, public
+
    +
  1. ETags are commonly enclosed in quotation marks, but the quotation marks are part of the value. They are not delimiters; the only delimiter in the ETag header is the colon between ETag and "3075-ddc8d800". That means you need to send the quotation marks back to the server in the If-None-Match header. +

Python’s HTTP libraries do not support ETags, but httplib2 does. @@ -296,7 +309,29 @@ Content-Type: application/xml

⁂ -

Beyond GET

+

Introducing httplib2

+ +

FIXME + +

How httplib2 handles caching

+ +

FIXME + +

How httplib2 handles Last-Modified and ETag headers

+ +

FIXME + +

How http2lib handles compression

+ +

FIXME + +

How httplib2 handles redirects

+ +

FIXME + +

⁂ + +

Beyond HTTP GET

FIXME @@ -356,7 +391,7 @@ Content-Type: application/xml

⁂ -

Beyond POST

+

Beyond HTTP POST

FIXME