File 0001-Ensure-that-identity-token-in-header-is-not-an-unico.patch of Package python-glanceclient.2398

From 76a2a9ee979cf56b856b1c45a8c26e37605705ae Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Fri, 24 Apr 2015 13:29:12 +0200
Subject: [PATCH] Ensure that identity token in header is not an unicode string

We need all the headers to be safe strings so they can be joined
together and not become an unicode string in doing so.

This fixes a bug when creating an image with non-ascii characters in the
name.

This is required for python 2.6 compatibility.

Change-Id: I66ebc27edf4ccd8f903399da58705711c372536d
Closes-Bug: 1448080
---
 glanceclient/common/http.py  | 3 ++-
 glanceclient/common/utils.py | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index 0909e95..922187e 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -64,7 +64,8 @@ class HTTPClient(object):
         self.session.headers["User-Agent"] = USER_AGENT
 
         if self.auth_token:
-            self.session.headers["X-Auth-Token"] = self.auth_token
+            self.session.headers["X-Auth-Token"] = strutils.safe_encode(
+                self.auth_token)
 
         self.timeout = float(kwargs.get('timeout', 600))
 
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py
index fe7a51a..fa7a4ac 100644
--- a/glanceclient/common/utils.py
+++ b/glanceclient/common/utils.py
@@ -415,8 +415,7 @@ def memoized_property(fn):
 
 def safe_header(name, value):
     if name in SENSITIVE_HEADERS:
-        v = value.encode('utf-8')
-        h = hashlib.sha1(v)
+        h = hashlib.sha1(value)
         d = h.hexdigest()
         return name, "{SHA1}%s" % d
     else:
-- 
2.6.3

openSUSE Build Service is sponsored by