From: Tom Christie Date: Fri, 18 Sep 2020 11:00:43 +0000 (+0100) Subject: Neater Host header logic on redirects (#1299) X-Git-Tag: 0.15.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8050ed75346b8c709e8b6a21b64765483a3e17b;p=thirdparty%2Fhttpx.git Neater Host header logic on redirects (#1299) --- diff --git a/httpx/_client.py b/httpx/_client.py index 5e2b3c6b..8c5fb5b6 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -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