summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerkin <e.altunbas@vyos.io>2021-12-16 17:31:48 +0300
committererkin <e.altunbas@vyos.io>2021-12-16 17:31:48 +0300
commitdc8c230ad45a10be93fc2cd79c38ebb39fd0a148 (patch)
tree6d8fd4d47c0cda3a80515e21b214ff0f054fe578
parente86edf18c18065b61760743cc4311ac0c75c79ab (diff)
downloadvyos-1x-dc8c230ad45a10be93fc2cd79c38ebb39fd0a148.tar.gz
vyos-1x-dc8c230ad45a10be93fc2cd79c38ebb39fd0a148.zip
remote: T4037: Report the final URL when following redirects
-rw-r--r--python/vyos/remote.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py
index 732ef76b7..694ea62ab 100644
--- a/python/vyos/remote.py
+++ b/python/vyos/remote.py
@@ -241,11 +241,9 @@ class HttpC:
# Abort early if the destination is inaccessible.
r.raise_for_status()
# If the request got redirected, keep the last URL we ended up with.
+ final_urlstring = r.url
if r.history:
- final_urlstring = r.history[-1].url
print_error('Redirecting to ' + final_urlstring)
- else:
- final_urlstring = self.urlstring
# Check for the prospective file size.
try:
size = int(r.headers['Content-Length'])