module HTTPX::Plugins::SsrfFilter::IPAddrExtensions

  1. lib/httpx/plugins/ssrf_filter.rb

Methods

Public Instance

  1. prefixlen

Public Instance methods

prefixlen()
[show source]
   # File lib/httpx/plugins/ssrf_filter.rb
15 def prefixlen
16   mask_addr = @mask_addr
17   raise "Invalid mask" if mask_addr.zero?
18 
19   mask_addr >>= 1 while (mask_addr & 0x1).zero?
20 
21   length = 0
22   while mask_addr & 0x1 == 0x1
23     length += 1
24     mask_addr >>= 1
25   end
26 
27   length
28 end