Class: Msf::Auxiliary::Web::HTTP::Request
- Inherits:
-
Object
- Object
- Msf::Auxiliary::Web::HTTP::Request
- Defined in:
- lib/msf/core/auxiliary/web/http.rb
Overview
Wraps a queued HTTP request and the callbacks that should process its response.
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#handle_response(response) ⇒ Array<Proc>
Calls each registered callback with the received response.
-
#initialize(url, opts = {}) {|response| ... } ⇒ Request
constructor
A new instance of Request.
-
#method ⇒ Symbol
The HTTP verb used when the request is executed.
Constructor Details
#initialize(url, opts = {}) {|response| ... } ⇒ Request
Returns a new instance of Request.
24 25 26 27 28 29 30 31 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 24 def initialize( url, opts = {}, &callback ) @url = url.to_s.dup @opts = opts.dup @opts[:method] ||= :get @callbacks = [callback].compact end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
18 19 20 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 18 def callbacks @callbacks end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
17 18 19 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 17 def opts @opts end |
#url ⇒ Object
Returns the value of attribute url.
16 17 18 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 16 def url @url end |
Instance Method Details
#handle_response(response) ⇒ Array<Proc>
Calls each registered callback with the received response.
42 43 44 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 42 def handle_response( response ) callbacks.each { |c| c.call response } end |
#method ⇒ Symbol
Returns The HTTP verb used when the request is executed.
34 35 36 |
# File 'lib/msf/core/auxiliary/web/http.rb', line 34 def method opts[:method] end |