Class: Msf::Auxiliary::Web::HTTP::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/auxiliary/web/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}, &callback) ⇒ Request

Returns a new instance of Request


18
19
20
21
22
23
24
25
# File 'lib/msf/core/auxiliary/web/http.rb', line 18

def initialize( url, opts = {}, &callback )
  @url  = url.to_s.dup
  @opts = opts.dup

  @opts[:method] ||= :get

  @callbacks = [callback].compact
end

Instance Attribute Details

#callbacksObject (readonly)

Returns the value of attribute callbacks


16
17
18
# File 'lib/msf/core/auxiliary/web/http.rb', line 16

def callbacks
  @callbacks
end

#optsObject (readonly)

Returns the value of attribute opts


15
16
17
# File 'lib/msf/core/auxiliary/web/http.rb', line 15

def opts
  @opts
end

#urlObject

Returns the value of attribute url


14
15
16
# File 'lib/msf/core/auxiliary/web/http.rb', line 14

def url
  @url
end

Instance Method Details

#handle_response(response) ⇒ Object


31
32
33
# File 'lib/msf/core/auxiliary/web/http.rb', line 31

def handle_response( response )
  callbacks.each { |c| c.call response }
end

#methodObject


27
28
29
# File 'lib/msf/core/auxiliary/web/http.rb', line 27

def method
  opts[:method]
end