Skip to content

Commit

Permalink
Remove ProxyHandler#whitelisted_host? in favor of just using ProxyHan…
Browse files Browse the repository at this point in the history
…dler#whitelisted_url?
  • Loading branch information
tmertens committed Mar 12, 2014
1 parent c41e757 commit 84a682f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/billy/handlers/proxy_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ def cacheable?(url, headers, status)
cacheable_headers?(headers) && cacheable_status?(status) && (!whitelisted_url?(url) || blacklisted_path?(url.path))
end

def whitelisted_host?(host)
Billy.config.whitelist.include?(host)
end

def whitelisted_url?(url)
whitelisted_host?(url.host) || whitelisted_host?("#{url.host}:#{url.port}")
!Billy.config.whitelist.index do |v|
v =~ /^#{url.host}(?::#{url.port})?$/
end.nil?
end

def blacklisted_path?(path)
Expand Down

0 comments on commit 84a682f

Please sign in to comment.