class Arachni::Element::Header

Represents an auditable request header element

@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Constants

DECODE_CACHE
ENCODE_CACHE
ENCODE_CHARACTERS
ENCODE_CHARACTERS_LIST

Private Class Methods

decode( header ) click to toggle source
# File lib/arachni/element/header.rb, line 77
def decode( header )
    header = header.to_s

    DECODE_CACHE.fetch( header ) do
        ::URI.decode( header )
    end
end
encode( str ) click to toggle source
# File lib/arachni/element/header.rb, line 65
def encode( str )
    str = str.to_s

    ENCODE_CACHE.fetch( str ) do
        if !ENCODE_CHARACTERS.find { |c| str.include? c }
            str
        else
            ::URI.encode( str, ENCODE_CHARACTERS_LIST )
        end
    end
end
new( options ) click to toggle source
# File lib/arachni/element/header.rb, line 40
def initialize( options )
    super( options )

    self.inputs = options[:inputs]

    @default_inputs = self.inputs.dup.freeze
end

Private Instance Methods

decode( header ) click to toggle source
# File lib/arachni/element/header.rb, line 90
def decode( header )
    self.class.decode( header )
end
encode( header ) click to toggle source
# File lib/arachni/element/header.rb, line 86
def encode( header )
    self.class.encode( header )
end
http_request( opts, &block ) click to toggle source
# File lib/arachni/element/header.rb, line 96
def http_request( opts, &block )
    http.header( @action, opts, &block )
end
name() click to toggle source

@return [String]

Header name.
# File lib/arachni/element/header.rb, line 54
def name
    @inputs.first.first
end
simple() click to toggle source
# File lib/arachni/element/header.rb, line 48
def simple
    @inputs.dup
end
value() click to toggle source

@return [String]

Header value.
# File lib/arachni/element/header.rb, line 60
def value
    @inputs.first.last
end