Corrected cookies management in XML-RPC authenticated transport
authorThierry Florac <thierry.florac@onf.fr>
Wed, 15 Jul 2015 11:20:55 +0200
changeset 38 60b0a6b21a12
parent 37 95ac8a3c54b3
child 39 d4c28f4078cd
Corrected cookies management in XML-RPC authenticated transport
src/pyams_utils/protocol/xmlrpc.py
--- a/src/pyams_utils/protocol/xmlrpc.py	Wed Jun 17 10:01:35 2015 +0200
+++ b/src/pyams_utils/protocol/xmlrpc.py	Wed Jul 15 11:20:55 2015 +0200
@@ -107,7 +107,10 @@
         if self.cookies is not None:
             crequest = XMLRPCCookieAuthTransport.CookieRequest('http://%s/' % host)
             cresponse = XMLRPCCookieAuthTransport.CookieResponse(response)
-            self.cookies.extract_cookies(cresponse, crequest)
+            for cookie in self.cookies.make_cookies(cresponse, crequest):
+                if cookie.name.startswith('Set-Cookie'):
+                    cookie.name = cookie.name.split(': ', 1)[1]
+                self.cookies.set_cookie(cookie)
         if response.status != 200:
             raise xmlrpc.client.ProtocolError(host + handler, response.status, response.reason, response.getheaders())
         return self.parse_response(response)