module HTTPX::Plugins::SsrfFilter::ConnectionMethods

  1. lib/httpx/plugins/ssrf_filter.rb

Methods

Public Class

  1. new

Public Instance

  1. addresses=

Public Class methods

new(*)
[show source]
    # File lib/httpx/plugins/ssrf_filter.rb
122 def initialize(*)
123   begin
124     super
125   rescue ServerSideRequestForgeryError => e
126     # may raise when IPs are passed as options via :addresses
127     throw(:resolve_error, e)
128   end
129 end

Public Instance methods

addresses=(addrs)
[show source]
    # File lib/httpx/plugins/ssrf_filter.rb
131 def addresses=(addrs)
132   addrs = addrs.map { |addr| addr.is_a?(IPAddr) ? addr : IPAddr.new(addr) }
133 
134   addrs.reject!(&SsrfFilter.method(:unsafe_ip_address?))
135 
136   raise ServerSideRequestForgeryError, "#{@origin.host} has no public IP addresses" if addrs.empty?
137 
138   super
139 end