Mercurial > hg > mercurial-crew-with-dirclash
comparison tests/get-with-headers.py @ 2539:8a8d9ada4528
Merged WSGI fixes from http://hg.omnifarious.org/~hopper/webmerc/
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 30 Jun 2006 21:36:45 +0200 |
parents | 84655f721f39 |
children |
comparison
equal
deleted
inserted
replaced
2531:7a90e0c77f43 | 2539:8a8d9ada4528 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 __doc__ = """This does HTTP get requests given a host:port and path and returns | |
4 a subset of the headers plus the body of the result.""" | |
5 | |
6 import httplib, sys | |
7 headers = [h.lower() for h in sys.argv[3:]] | |
8 conn = httplib.HTTPConnection(sys.argv[1]) | |
9 conn.request("GET", sys.argv[2]) | |
10 response = conn.getresponse() | |
11 print response.status, response.reason | |
12 for h in headers: | |
13 if response.getheader(h, None) is not None: | |
14 print "%s: %s" % (h, response.getheader(h)) | |
15 print | |
16 sys.stdout.write(response.read()) |