#4833 Ensure the name of the headers are always of the correct type
Merged 3 years ago by pingou. Opened 3 years ago by pingou.

file modified
+2 -1
@@ -128,6 +128,7 @@ 

              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 @@ 

  

          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)

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 pingou@pingoured.fr

This fixes git clone via http on py3

rebased onto 50e429f

3 years ago

Pull-Request has been merged by pingou

3 years ago