From 303a0cb452c4d252e0204449dd847dabc210e89b Mon Sep 17 00:00:00 2001 From: drebs Date: Sat, 2 Sep 2017 00:27:58 -0300 Subject: [feat] use cookies in the client syncer --- src/leap/soledad/client/_http.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/leap/soledad/client/_http.py b/src/leap/soledad/client/_http.py index 300dc335..101c61be 100644 --- a/src/leap/soledad/client/_http.py +++ b/src/leap/soledad/client/_http.py @@ -22,10 +22,11 @@ import base64 from twisted.internet import reactor from twisted.web.iweb import IAgent from twisted.web.client import Agent +from twisted.web.client import CookieAgent from twisted.web.http_headers import Headers +from cookielib import CookieJar from treq.client import HTTPClient as _HTTPClient - from zope.interface import implementer from leap.common.http import getPolicyForHTTPS @@ -37,7 +38,9 @@ __all__ = ['HTTPClient', 'PinnedTokenAgent'] class HTTPClient(_HTTPClient): def __init__(self, uuid, token, cert_file): - self._agent = PinnedTokenAgent(uuid, token, cert_file) + agent = PinnedTokenAgent(uuid, token, cert_file) + jar = CookieJar() + self._agent = CookieAgent(agent, jar) super(self.__class__, self).__init__(self._agent) def set_token(self, token): -- cgit v1.2.3