Skip to content
Snippets Groups Projects
Commit f1118507 authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

get-with-headers: add a --headeronly switch

In some case we do not care about the actual rendering.
parent 66cec3c2
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,10 @@
if '--twice' in sys.argv:
sys.argv.remove('--twice')
twice = True
headeronly = False
if '--headeronly' in sys.argv:
sys.argv.remove('--headeronly')
headeronly = True
reasons = {'Not modified': 'Not Modified'} # python 2.4
......@@ -37,4 +41,8 @@
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 headeronly:
print
data = response.read()
sys.stdout.write(data)
......@@ -40,10 +48,6 @@
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment