|
|
@ -243,7 +243,7 @@ def make_host_url(config, kemal_config)
|
|
|
|
return "#{scheme}#{host}#{port}"
|
|
|
|
return "#{scheme}#{host}#{port}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def get_referer(env, fallback = "/")
|
|
|
|
def get_referer(env, fallback = "/", unroll = true)
|
|
|
|
referer = env.params.query["referer"]?
|
|
|
|
referer = env.params.query["referer"]?
|
|
|
|
referer ||= env.request.headers["referer"]?
|
|
|
|
referer ||= env.request.headers["referer"]?
|
|
|
|
referer ||= fallback
|
|
|
|
referer ||= fallback
|
|
|
@ -251,16 +251,18 @@ def get_referer(env, fallback = "/")
|
|
|
|
referer = URI.parse(referer)
|
|
|
|
referer = URI.parse(referer)
|
|
|
|
|
|
|
|
|
|
|
|
# "Unroll" nested referrers
|
|
|
|
# "Unroll" nested referrers
|
|
|
|
loop do
|
|
|
|
if unroll
|
|
|
|
if referer.query
|
|
|
|
loop do
|
|
|
|
params = HTTP::Params.parse(referer.query.not_nil!)
|
|
|
|
if referer.query
|
|
|
|
if params["referer"]?
|
|
|
|
params = HTTP::Params.parse(referer.query.not_nil!)
|
|
|
|
referer = URI.parse(URI.unescape(params["referer"]))
|
|
|
|
if params["referer"]?
|
|
|
|
|
|
|
|
referer = URI.parse(URI.unescape(params["referer"]))
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
break
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|