Fix referer spoofing not working for certain fc2.com image URLs. Spoofing the referer like this redirects to an HTML error page: * curl -H "Referer: http://wwwew.web.fc2.com" http://wwwew.web.fc2.com/e/405.jpg Spoofing it like this works: * curl -H "Referer: http://wwwew.web.fc2.com/e/405.jpg" http://wwwew.web.fc2.com/e/405.jpg
16 lines
365 B
Ruby
16 lines
365 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Danbooru
|
|
class Http
|
|
class SpoofReferrer < HTTP::Feature
|
|
HTTP::Options.register_feature :spoof_referrer, self
|
|
|
|
def perform(request, &block)
|
|
request.headers["Referer"] = request.uri unless request.headers["Referer"].present?
|
|
response = yield request
|
|
response
|
|
end
|
|
end
|
|
end
|
|
end
|