summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/client.rst4
-rw-r--r--docs/environment_variables.rst6
-rw-r--r--src/leap/soledad/client/_http.py4
3 files changed, 13 insertions, 1 deletions
diff --git a/docs/client.rst b/docs/client.rst
index 3befd69c..7efabd6f 100644
--- a/docs/client.rst
+++ b/docs/client.rst
@@ -7,3 +7,7 @@ migrated here in the future.
You can also take a look at :ref:`client-side-code-api` and
:ref:`client-side-attachments-api` for information on the API.
+
+.. toctree::
+
+ environment_variables
diff --git a/docs/environment_variables.rst b/docs/environment_variables.rst
new file mode 100644
index 00000000..bebc11d6
--- /dev/null
+++ b/docs/environment_variables.rst
@@ -0,0 +1,6 @@
+Environment Variables
+=====================
+
+Some environment variables affect the behaviour of Soledad Client:
+
+* ``SOLEDAD_HTTP_PERSIST``: persist HTTP connections.
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):