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.



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

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.



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

def callbacks
  @callbacks
end

#optsObject (readonly)

Returns the value of attribute opts.



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

def opts
  @opts
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#handle_response(response) ⇒ Object



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

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

#methodObject



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

def method
  opts[:method]
end