From 50e429fb5cb9b51a9963bc454dc3586d2bc6b2b0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 28 2020 06:43:18 +0000 Subject: Ensure the name of the headers are always of the correct type This comes with one twist, in python3 the lines we get from subprocess are bytes but we don't want to convert them entirely to unicode, we only want to convert the header's name, and there using `str()` won't work, we need a full `.decode()`. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/ui/clone.py b/pagure/ui/clone.py index 0caffbc..e04e137 100644 --- a/pagure/ui/clone.py +++ b/pagure/ui/clone.py @@ -128,6 +128,7 @@ def proxy_raw_git(): if not line: break header = line.split(b": ", 1) + header[0] = header[0].decode("utf-8") headers[header[0].lower()] = header[1] if len(headers) == 0: @@ -135,7 +136,7 @@ def proxy_raw_git(): if "status" not in headers: # If no status provided, assume 200 OK as per RFC3875 - headers["status"] = "200 OK" + headers[str("status")] = "200 OK" respcode, respmsg = headers.pop("status").split(" ", 1) wrapout = werkzeug.wsgi.wrap_file(flask.request.environ, out)