##// END OF EJS Templates
get-with-headers: add a --headeronly switch...
Pierre-Yves David -
r18400:f1118507 default
parent child Browse files
Show More
@@ -16,6 +16,10 b' twice = False'
16 if '--twice' in sys.argv:
16 if '--twice' in sys.argv:
17 sys.argv.remove('--twice')
17 sys.argv.remove('--twice')
18 twice = True
18 twice = True
19 headeronly = False
20 if '--headeronly' in sys.argv:
21 sys.argv.remove('--headeronly')
22 headeronly = True
19
23
20 reasons = {'Not modified': 'Not Modified'} # python 2.4
24 reasons = {'Not modified': 'Not Modified'} # python 2.4
21
25
@@ -37,13 +41,13 b' def request(host, path, show):'
37 for h in [h.lower() for h in show]:
41 for h in [h.lower() for h in show]:
38 if response.getheader(h, None) is not None:
42 if response.getheader(h, None) is not None:
39 print "%s: %s" % (h, response.getheader(h))
43 print "%s: %s" % (h, response.getheader(h))
44 if not headeronly:
45 print
46 data = response.read()
47 sys.stdout.write(data)
40
48
41 print
49 if twice and response.getheader('ETag', None):
42 data = response.read()
50 tag = response.getheader('ETag')
43 sys.stdout.write(data)
44
45 if twice and response.getheader('ETag', None):
46 tag = response.getheader('ETag')
47
51
48 return response.status
52 return response.status
49
53
General Comments 0
You need to be logged in to leave comments. Login now