summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/bonafide/_http.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/leap/bitmask/bonafide/_http.py b/src/leap/bitmask/bonafide/_http.py
index 94d0bcb9..d4a0112c 100644
--- a/src/leap/bitmask/bonafide/_http.py
+++ b/src/leap/bitmask/bonafide/_http.py
@@ -56,10 +56,11 @@ class Unchanged(Exception):
def httpRequest(agent, url, values={}, headers={}, method='POST', token=None,
saveto=None):
data = ''
+ mtime = None
if values:
data = urllib.urlencode(values)
headers['Content-Type'] = ['application/x-www-form-urlencoded']
- if saveto is not None:
+ if saveto is not None and os.path.isfile(saveto):
# TODO - I think we need a force parameter, because we might have a
# malformed file. Or maybe just remove the file if sanity check does
# not pass.
@@ -74,7 +75,7 @@ def httpRequest(agent, url, values={}, headers={}, method='POST', token=None,
log.debug("RESPONSE %s %s %s" % (method, response.code, url))
if response.code == 204:
d = defer.succeed('')
- if response.code == 304:
+ if saveto and mtime and response.code == 304:
log.debug('304 (Not modified): %s' % url)
raise Unchanged()
else: