URL: https://github.com/freeipa/freeipa/pull/335
Author: simo5
 Title: #335: Add compatibility code to retrieve headers
Action: opened

PR body:
The recent fixes for getting cookies from headers broken python3.

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/335/head:pr335
git checkout pr335
From a118d6f3dcd31102e0f5e5b6a0c962b811290bfb Mon Sep 17 00:00:00 2001
From: Simo Sorce <s...@redhat.com>
Date: Wed, 14 Dec 2016 06:20:15 -0500
Subject: [PATCH] Add compatibility code to retrieve headers

Python3 removed the getheaders() function and replaced it with a
get_all() one. Add compat code.


Signed-off-by: Simo Sorce <s...@redhat.com>
 ipalib/rpc.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index bd25e6f..921f5cb 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -729,7 +729,11 @@ def store_session_cookie(self, cookie_header):
     def parse_response(self, response):
-        self.store_session_cookie(response.msg.getheaders('Set-Cookie'))
+        if six.PY2:
+            header = response.msg.getheaders('Set-Cookie')
+        else:
+            header = response.msg.get_all('Set-Cookie')
+        self.store_session_cookie(header)
         return SSLTransport.parse_response(self, response)
Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to