Merge pull request #5053 from vszakats/protrelredir
download_strategy: Miscalculated redirect when `Location:` is protocol-relative
This commit is contained in:
commit
8b9c80795d
@ -336,7 +336,10 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
.compact
|
.compact
|
||||||
|
|
||||||
redirect_url = locations.reduce(url) do |current_url, location|
|
redirect_url = locations.reduce(url) do |current_url, location|
|
||||||
if location.start_with?("/")
|
if location.start_with?("//")
|
||||||
|
uri = URI(current_url)
|
||||||
|
"#{uri.scheme}:#{location}"
|
||||||
|
elsif location.start_with?("/")
|
||||||
uri = URI(current_url)
|
uri = URI(current_url)
|
||||||
"#{uri.scheme}://#{uri.host}#{location}"
|
"#{uri.scheme}://#{uri.host}#{location}"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user