mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 19:23:37 +08:00
DEV: Remove unused uri parameter (#16179)
The parameter is not used and it did not work properly anyway because sometimes `@uri` is used instead of `uri`, which can be different.
This commit is contained in:
parent
44c8f4940e
commit
b0f414f7f5
|
@ -133,18 +133,18 @@ class FinalDestination
|
||||||
|
|
||||||
# this is a new interface for simply getting
|
# this is a new interface for simply getting
|
||||||
# N bytes accounting for all internal logic
|
# N bytes accounting for all internal logic
|
||||||
def get(uri = @uri, redirects = @limit, extra_headers: {}, &blk)
|
def get(redirects = @limit, extra_headers: {}, &blk)
|
||||||
raise "Must specify block" unless block_given?
|
raise "Must specify block" unless block_given?
|
||||||
|
|
||||||
if uri && uri.port == 80 && FinalDestination.is_https_domain?(uri.hostname)
|
if @uri && @uri.port == 80 && FinalDestination.is_https_domain?(@uri.hostname)
|
||||||
uri.scheme = "https"
|
@uri.scheme = "https"
|
||||||
uri = URI(uri.to_s)
|
@uri = URI(@uri.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
return if !validate_uri
|
return if !validate_uri
|
||||||
return if @stop_at_blocked_pages && blocked_domain?(uri)
|
return if @stop_at_blocked_pages && blocked_domain?(@uri)
|
||||||
|
|
||||||
result, headers_subset = safe_get(uri, &blk)
|
result, headers_subset = safe_get(@uri, &blk)
|
||||||
cookie = headers_subset.set_cookie
|
cookie = headers_subset.set_cookie
|
||||||
location = headers_subset.location
|
location = headers_subset.location
|
||||||
|
|
||||||
|
@ -153,23 +153,23 @@ class FinalDestination
|
||||||
end
|
end
|
||||||
|
|
||||||
if result == :redirect
|
if result == :redirect
|
||||||
old_port = uri.port
|
old_port = @uri.port
|
||||||
location = "#{uri.scheme}://#{uri.host}#{location}" if location[0] == "/"
|
location = "#{@uri.scheme}://#{@uri.host}#{location}" if location[0] == "/"
|
||||||
uri = uri(location)
|
@uri = uri(location)
|
||||||
|
|
||||||
# https redirect, so just cache that whole new domain is https
|
# https redirect, so just cache that whole new domain is https
|
||||||
if old_port == 80 && uri&.port == 443 && (URI::HTTPS === uri)
|
if old_port == 80 && @uri&.port == 443 && (URI::HTTPS === @uri)
|
||||||
FinalDestination.cache_https_domain(uri.hostname)
|
FinalDestination.cache_https_domain(@uri.hostname)
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil if !uri
|
return nil if !@uri
|
||||||
|
|
||||||
extra = nil
|
extra = nil
|
||||||
extra = { 'Cookie' => cookie } if cookie
|
extra = { 'Cookie' => cookie } if cookie
|
||||||
|
|
||||||
get(uri, redirects - 1, extra_headers: extra, &blk)
|
get(redirects - 1, extra_headers: extra, &blk)
|
||||||
elsif result == :ok
|
elsif result == :ok
|
||||||
uri.to_s
|
@uri.to_s
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user