Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
cleaner enabling of etag caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Newson committed Oct 9, 2009
1 parent efc4e38 commit 13b325b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion couchdb-external-hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ def respond(req):
urllib.urlencode(req["query"])))
if "If-None-Match" in req["headers"]:
hreq.add_header("If-None-Match", req["headers"]["If-None-Match"])

try:
f = urlopen(hreq)
body = f.read()
headers = f.info().dict
headers = {"Content-Type":f.info().getheader("Content-Type"), "ETag":f.info().getheader("ETag")}
#headers = f.info().dict
sys.stdout.write("%s\n" % json.dumps({"code":f.getcode(),"headers":headers,"body":body}))
except HTTPError, e:
sys.stdout.write("%s\n" % json.dumps({"code":e.code}))
Expand Down

0 comments on commit 13b325b

Please sign in to comment.