Class: Arachni::HTTP::Message
- Defined in:
- lib/arachni/http/message.rb,
lib/arachni/http/message/scope.rb
Overview
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
- #body ⇒ String
-
#headers ⇒ Headers<String, String>
HTTP headers as a Hash-like object.
-
#url ⇒ String
Resource location.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Message
constructor
A new instance of Message.
- #parsed_url ⇒ Object
- #scope ⇒ Scope
- #update(options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Message
Note:
All options will be sent through the class setters whenever possible to allow for normalization.
Returns a new instance of Message.
39 40 41 42 43 |
# File 'lib/arachni/http/message.rb', line 39 def initialize( = {} ) update( ) fail ArgumentError, 'Missing :url.' if url.to_s.empty? end |
Instance Attribute Details
#body ⇒ String
26 27 28 |
# File 'lib/arachni/http/message.rb', line 26 def body @body end |
#headers ⇒ Headers<String, String>
Returns HTTP headers as a Hash-like object.
22 23 24 |
# File 'lib/arachni/http/message.rb', line 22 def headers @headers end |
#url ⇒ String
Returns Resource location.
18 19 20 |
# File 'lib/arachni/http/message.rb', line 18 def url @url end |
Instance Method Details
#parsed_url ⇒ Object
69 70 71 72 |
# File 'lib/arachni/http/message.rb', line 69 def parsed_url # Don't cache this, that's already handled by the URI parser's own cache. Arachni::URI( url ) end |
#scope ⇒ Scope
65 66 67 |
# File 'lib/arachni/http/message.rb', line 65 def scope @scope ||= self.class::Scope.new( self ) end |
#update(options) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/arachni/http/message.rb', line 45 def update( ) @normalize_url = [:normalize_url] # Headers are necessary for subsequent operations to set them first. @headers = Headers.new( [:headers] || {} ) .each do |k, v| begin send( "#{k}=", v ) rescue NoMethodError instance_variable_set( "@#{k}".to_sym, v ) end end end |