]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Neater Host header logic on redirects (#1299)
authorTom Christie <tom@tomchristie.com>
Fri, 18 Sep 2020 11:00:43 +0000 (12:00 +0100)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 11:00:43 +0000 (12:00 +0100)
httpx/_client.py

index 5e2b3c6b681d0991a9c8c34023d59b795bb0ced2..8c5fb5b6844c8a81f466138284ebdb72e47d72bc 100644 (file)
@@ -464,7 +464,10 @@ class BaseClient:
             # Strip Authorization headers when responses are redirected away from
             # the origin.
             headers.pop("Authorization", None)
-            headers["Host"] = url.authority
+
+            # Remove the Host header, so that a new one with be auto-populated on
+            # the request instance.
+            headers.pop("Host", None)
 
         if method != request.method and method == "GET":
             # If we've switch to a 'GET' request, then strip any headers which