Files
danbooru/app/logical/danbooru/http/spoof_referrer.rb
evazion d3bb5c67ee danbooru::http: factor out referrer spoofing.
Factor out referrer spoofing so that it can be used outside of downloading
files. We also need to spoof the referrer when determining the remote
filesize of images on the uploads page.
2020-06-24 21:46:59 -05:00

14 lines
341 B
Ruby

module Danbooru
class Http
class SpoofReferrer < HTTP::Feature
HTTP::Options.register_feature :spoof_referrer, self
def perform(request, &block)
request.headers["Referer"] = request.uri.origin unless request.headers["Referer"].present?
response = yield request
response
end
end
end
end