Juan Hernandez has uploaded a new change for review.

Change subject: sdk: Decode headers using ASCII
......................................................................

sdk: Decode headers using ASCII

Currently the HTTP response headers are used without decoding them.
This is fine in Python 2 because strins are actually array of bytes, but
in Python 3 strings aren't array of bytes, so before using the headers
then need to be decoded using the right encoding. In this case the right
encoding is ASCII, as it is what is recommended by the HTTP protocol
specification.

Change-Id: Iee51e67addd7ba7a53c726c5ab8d2270cd348392
Related: https://bugzilla.redhat.com/1096137
Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com>
---
M src/ovirtsdk/infrastructure/connectionspool.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/31/41331/1

diff --git a/src/ovirtsdk/infrastructure/connectionspool.py 
b/src/ovirtsdk/infrastructure/connectionspool.py
index fbcc8aa..2c6a1f9 100644
--- a/src/ovirtsdk/infrastructure/connectionspool.py
+++ b/src/ovirtsdk/infrastructure/connectionspool.py
@@ -139,7 +139,8 @@
         # have a method to extract the response message, so we have to
         # parse the first header line to find it:
         response_reason = ""
-        header_lines = headers_buffer.getvalue().split("\n")
+        headers_text = headers_buffer.getvalue().decode("ascii")
+        header_lines = headers_text.split("\n")
         if len(header_lines) >= 1:
             response_line = header_lines[0]
             response_fields = response_line.split()


-- 
To view, visit https://gerrit.ovirt.org/41331
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee51e67addd7ba7a53c726c5ab8d2270cd348392
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to