Module: HTTPX::Plugins::SsrfFilter::ConnectionMethods
- Defined in:
- lib/httpx/plugins/ssrf_filter.rb
Instance Method Summary collapse
Instance Method Details
#addresses=(addrs) ⇒ Object
131 132 133 134 135 136 137 138 139 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 131 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
122 123 124 125 126 127 128 129 |
# File 'lib/httpx/plugins/ssrf_filter.rb', line 122 def initialize(*) begin super rescue ServerSideRequestForgeryError => e # may raise when IPs are passed as options via :addresses throw(:resolve_error, e) end end |