summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-09-29 14:08:10 +0200
committerKali Kaneko <kali@leap.se>2017-09-29 14:19:43 +0200
commit0ab1783859b3ba0a33f2db861ecb6e494d792a66 (patch)
treec4f1c3cee4772a9d4eda84cc911cae1f9f51ed70
parent61ff02efc093fedb59df9d1a97eca907e113c69b (diff)
[bug] _HTTP11ClientFactory constructor has changed in twisted
-rw-r--r--src/leap/common/http.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/leap/common/http.py b/src/leap/common/http.py
index 1f30903..6550302 100644
--- a/src/leap/common/http.py
+++ b/src/leap/common/http.py
@@ -109,7 +109,7 @@ class _HTTP11ClientFactory(HTTP11ClientFactory):
A timeout-able HTTP 1.1 client protocol factory.
"""
- def __init__(self, quiescentCallback, timeout):
+ def __init__(self, quiescentCallback, metadata, timeout):
"""
:param quiescentCallback: The quiescent callback to be passed to
protocol instances, used to return them to
@@ -119,7 +119,11 @@ class _HTTP11ClientFactory(HTTP11ClientFactory):
protocols created by this factory.
:type timeout: float
"""
- HTTP11ClientFactory.__init__(self, quiescentCallback)
+ try:
+ HTTP11ClientFactory.__init__(self, quiescentCallback)
+ except TypeError:
+ # Twisted >= 17.9 added an extra param
+ HTTP11ClientFactory.__init__(self, quiescentCallback, metadata)
self._timeout = timeout
def buildProtocol(self, _):
@@ -144,7 +148,8 @@ class _HTTPConnectionPool(HTTPConnectionPool):
def _newConnection(self, key, endpoint):
def quiescentCallback(protocol):
self._putConnection(key, protocol)
- factory = self._factory(quiescentCallback, timeout=self._timeout)
+ factory = self._factory(quiescentCallback, repr(endpoint),
+ timeout=self._timeout)
return endpoint.connect(factory)