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