From 3ae9343ebe4f3b7ddcdafcee22c987e49dead451 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 15 Mar 2017 20:28:23 -0300 Subject: [feature] send tag header from server --- client/src/leap/soledad/client/_blobs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'client/src/leap/soledad') diff --git a/client/src/leap/soledad/client/_blobs.py b/client/src/leap/soledad/client/_blobs.py index 2cc06146..97d4c39c 100644 --- a/client/src/leap/soledad/client/_blobs.py +++ b/client/src/leap/soledad/client/_blobs.py @@ -198,12 +198,17 @@ class BlobManager(object): logger.info("Staring download of blob: %s" % blob_id) # TODO this needs to be connected in a tube uri = self.remote + self.user + '/' + blob_id - buf = DecrypterBuffer(doc_id, rev, self.secret) data = yield treq.get(uri) if data.code == 404: logger.warn("Blob not found in server: %s" % blob_id) defer.returnValue(None) + elif not data.headers.hasHeader('Tag'): + logger.error("Server didn't send a tag header for: %s" % blob_id) + defer.returnValue(None) + tag = data.headers.getRawHeaders('Tag')[0] + tag = base64.urlsafe_b64decode(tag) + buf = DecrypterBuffer(doc_id, rev, self.secret, tag) # incrementally collect the body of the response yield treq.collect(data, buf.write) -- cgit v1.2.3