summaryrefslogtreecommitdiff
path: root/src/leap/soledad/client
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-04 20:30:01 -0300
committerdrebs <drebs@riseup.net>2017-09-05 11:17:51 -0300
commite0a650d9ade2d028b9aaa4f0fb9fb07a371fbdfe (patch)
treea73123593cc7748efa1649055441f2df898d5174 /src/leap/soledad/client
parent55c8af06488e7061b5e7a53595258180a78b7ef9 (diff)
[feat] toggle http persistence depending on environment variable
Diffstat (limited to 'src/leap/soledad/client')
-rw-r--r--src/leap/soledad/client/_http.py4
1 files changed, 3 insertions, 1 deletions
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):