Module: HTTPX::Plugins::SsrfFilter::ConnectionMethods

Defined in:
lib/httpx/plugins/ssrf_filter.rb

Instance Method Summary collapse

Instance Method Details

#addresses=(addrs) ⇒ Object



133
134
135
136
137
138
139
# File 'lib/httpx/plugins/ssrf_filter.rb', line 133

def addresses=(addrs)
  addrs.reject!(&SsrfFilter.method(:unsafe_ip_address?))

  raise ServerSideRequestForgeryError, "#{@origin.host} has no public IP addresses" if addrs.empty?

  super
end

#initializeObject



124
125
126
127
128
129
130
131
# File 'lib/httpx/plugins/ssrf_filter.rb', line 124

def initialize(*)
  begin
    super
  rescue ServerSideRequestForgeryError => e
    # may raise when IPs are passed as options via :addresses
    throw(:resolve_error, e)
  end
end