summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2024-05-01 16:01:47 (GMT)
committerGitHub <noreply@github.com>2024-05-01 16:01:47 (GMT)
commit759e8e7ab83848c527a53d7b2051bc14ac7b7c76 (patch)
treeabf1ce47e94ca537bdb5101ba41acae54721fa97 /Lib/urllib
parent49baa656cb994122869bc807a88ea2f3f0d7751b (diff)
downloadcpython-759e8e7ab83848c527a53d7b2051bc14ac7b7c76.zip
cpython-759e8e7ab83848c527a53d7b2051bc14ac7b7c76.tar.gz
cpython-759e8e7ab83848c527a53d7b2051bc14ac7b7c76.tar.bz2
gh-99730: urllib.request: Keep HEAD method on redirect (GH-99731)
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index d22af66..ac6719c 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -650,6 +650,7 @@ class HTTPRedirectHandler(BaseHandler):
newheaders = {k: v for k, v in req.headers.items()
if k.lower() not in CONTENT_HEADERS}
return Request(newurl,
+ method="HEAD" if m == "HEAD" else "GET",
headers=newheaders,
origin_req_host=req.origin_req_host,
unverifiable=True)