Method: Arachni::HTTP::CookieJar#update

Defined in:
lib/arachni/http/cookie_jar.rb

#update(cookies) ⇒ CookieJar

Updates the jar with ‘cookies`.

Parameters:

Returns:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/arachni/http/cookie_jar.rb', line 81

def update( cookies )
    [cookies].flatten.compact.each do |c|
        self << case c
                    when String
                        begin
                            Cookie.from_string( ::Arachni::Options.url.to_s, c )
                        rescue
                            Cookie.from_set_cookie( ::Arachni::Options.url.to_s, c )
                        end

                    when Hash
                        next if c.empty?

                        if c.size > 1
                            Cookie.new( { url: ::Arachni::Options.url.to_s }.merge( c ) )
                        else
                            Cookie.new( url: ::Arachni::Options.url.to_s, inputs: c )
                        end
                    when Cookie
                        c
                end
    end
    self
end