summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-12-16 22:30:45 +0700
committerGitHub <noreply@github.com>2021-12-16 22:30:45 +0700
commit95667607c9b3a1cc8beb8b908fbe538369e8c289 (patch)
treed2c24363d921490bcef5cb3efb70ae794fbe22a5
parent55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa (diff)
parent9737a55f6dde490e7fdf1c9d5c5733e48c94d141 (diff)
downloadvyos-1x-95667607c9b3a1cc8beb8b908fbe538369e8c289.tar.gz
vyos-1x-95667607c9b3a1cc8beb8b908fbe538369e8c289.zip
Merge pull request #1107 from erkin/current
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'])