From e0a650d9ade2d028b9aaa4f0fb9fb07a371fbdfe Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 4 Sep 2017 20:30:01 -0300 Subject: [feat] toggle http persistence depending on environment variable --- src/leap/soledad/client/_http.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/leap/soledad/client/_http.py b/src/leap/soledad/client/_http.py index f6e2e28e..1a1260b0 100644 --- a/src/leap/soledad/client/_http.py +++ b/src/leap/soledad/client/_http.py @@ -18,6 +18,7 @@ A twisted-based, TLS-pinned, token-authenticated HTTP client. """ import base64 +import os from twisted.internet import reactor from twisted.web.iweb import IAgent @@ -58,7 +59,8 @@ class PinnedTokenAgent(Agent): self.set_token(token) # pin this agent with the platform TLS certificate factory = getPolicyForHTTPS(cert_file) - pool = HTTPConnectionPool(reactor, persistent=True) + persistent = os.environ.get('SOLEDAD_HTTP_PERSIST', None) + pool = HTTPConnectionPool(reactor, persistent=bool(persistent)) Agent.__init__(self, reactor, contextFactory=factory, pool=pool) def set_token(self, token): -- cgit v1.2.3