Comments
Patch
@@ -14,10 +14,14 @@ except ImportError:
twice = False
if '--twice' in sys.argv:
sys.argv.remove('--twice')
twice = True
+headonly = False
+if '--headeronly' in sys.argv:
+ sys.argv.remove('--headeronly')
+ headonly = True
reasons = {'Not modified': 'Not Modified'} # python 2.4
tag = None
def request(host, path, show):
@@ -32,17 +36,17 @@ def request(host, path, show):
response = conn.getresponse()
print response.status, reasons.get(response.reason, response.reason)
for h in [h.lower() for h in show]:
if response.getheader(h, None) is not None:
print "%s: %s" % (h, response.getheader(h))
+ if not headonly:
+ print
+ data = response.read()
+ sys.stdout.write(data)
- print
- data = response.read()
- sys.stdout.write(data)
-
- if twice and response.getheader('ETag', None):
- tag = response.getheader('ETag')
+ if twice and response.getheader('ETag', None):
+ tag = response.getheader('ETag')
return response.status
status = request(sys.argv[1], sys.argv[2], sys.argv[3:])
if twice: