adding get-with-headers.py
% hg serve
% hgweb filerevision
200 Script output follows
test:get-with-headers.py
get-with-headers.py
changeset 0: |
79ee608ca36d |
author: |
test |
date: |
Thu Jan 01 00:00:00 1970 +0000 (long ago) |
permissions: |
-rwxr-xr-x |
description: |
a |
3__doc__ = """This does HTTP get requests given a host:port and path and returns 4a subset of the headers plus the body of the result.""" 7headers = [h.lower() for h in sys.argv[3:]] 8conn = httplib.HTTPConnection(sys.argv[1]) 9conn.request("GET", sys.argv[2]) 10response = conn.getresponse() 11print response.status, response.reason 13 if response.getheader(h, None) is not None: 14 print "%s: %s" % (h, response.getheader(h)) 16sys.stdout.write(response.read()) 18if 200 <= response.status <= 299:
% hgweb fileannotate
200 Script output follows
test: get-with-headers.py annotate
Annotate get-with-headers.py
changeset 0: |
79ee608ca36d |
author: |
test |
date: |
Thu Jan 01 00:00:00 1970 +0000 (long ago) |
permissions: |
-rwxr-xr-x |
description: |
a |
% errors encountered