Method: UnXF#initialize
- Defined in:
- lib/unxf.rb
#initialize(app, trusted = [:RFC_1918, :LOCALHOST, :LOCALHOST6]) ⇒ UnXF
In your Rack config.ru:
use UnXF
If you do not want to trust any hosts other than “0.6.6.6”, you may only specify one host to trust:
use UnXF, "0.6.6.6"
If you want to trust “0.6.6.6” in addition to the default set of hosts:
use UnXF, [ :RFC_1918, :LOCALHOST, "0.6.6.6" ]
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/unxf.rb', line 40 def initialize(app, trusted = [:RFC_1918, :LOCALHOST, :LOCALHOST6]) @app = app @trusted = Patricia.new @trusted6 = Patricia.new(:AF_INET6) Array(trusted).each do |mask| mask = UnXF.const_get(mask) if Symbol === mask Array(mask).each do |prefix| (/:/ =~ prefix ? @trusted6 : @trusted).add(prefix, true) end end end |