Module: HTTPX::Plugins::SsrfFilter::ConnectionMethods
- Defined in:
- lib/httpx/plugins/ssrf_filter.rb
Instance Method Summary collapse
Instance Method Details
#addresses=(addrs) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 128 def addresses=(addrs) addrs = addrs.map { |addr| addr.is_a?(IPAddr) ? addr : IPAddr.new(addr) } addrs.reject!(&SsrfFilter.method(:unsafe_ip_address?)) raise ServerSideRequestForgeryError, "#{@origin.host} has no public IP addresses" if addrs.empty? super end |
#initialize ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 119 def initialize(*) begin super rescue ServerSideRequestForgeryError => e # may raise when IPs are passed as options via :addresses throw(:resolve_error, e) end end |