Bypass proxy caching

Add a HTTP Header that prevents HTTP proxy from caching the download file. Tested with Bluecoat ProxySG in between.
This commit is contained in:
Guillaume Nourry-Marquis 2015-02-09 13:28:18 -05:00
parent 795bc51da4
commit 0449e2679f
1 changed files with 4 additions and 1 deletions

View File

@ -178,7 +178,10 @@ class FileGetter(threading.Thread):
self.result = [0]
try:
if (timeit.default_timer() - self.starttime) <= 10:
f = urlopen(self.url)
#XLASH 2015-02-09 This is to prevent Proxy Caching in the way
req = Request(self.url)
req.add_header('Cache-Control' , 'no-cache')
f = urlopen(req)
while 1 and not shutdown_event.isSet():
self.result.append(len(f.read(10240)))
if self.result[-1] == 0: