instance method sanitize_ips

Ruby on Rails 8.1.2

Since v8.1.2 Private

Signature

sanitize_ips(ips)

No documentation comment.

Parameters

ips req
Source
# File actionpack/lib/action_dispatch/middleware/remote_ip.rb, line 185
      def sanitize_ips(ips) # :doc:
        ips.select! do |ip|
          # Only return IPs that are valid according to the IPAddr#new method.
          range = IPAddr.new(ip).to_range
          # We want to make sure nobody is sneaking a netmask in.
          range.begin == range.end
        rescue ArgumentError
          nil
        end
        ips
      end

Defined in actionpack/lib/action_dispatch/middleware/remote_ip.rb line 185 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::RemoteIp::GetIp

Type at least 2 characters to search.

↑↓ navigate · open · esc close