class Arachni::HTTP::Message
@author Tasos Laskos <tasos.laskos@arachni-scanner.com>
Attributes
body[RW]
@return [String]
{Request}/{Response} body.
headers[RW]
@return [Headers<String, String>]
HTTP headers as a Hash-like object.
url[RW]
@return [String]
Resource location.
Public Class Methods
new( options = {} )
click to toggle source
@note All options will be sent through the class setters whenever
possible to allow for normalization.
@param [Hash] options
Message options.
@option options [String] :url
URL.
@option options [Hash] :headers
HTTP headers.
@option options [String] :body
Body.
# File lib/arachni/http/message.rb, line 39 def initialize( options = {} ) update( options ) fail ArgumentError, 'Missing :url.' if url.to_s.empty? end
Public Instance Methods
headers=( h )
click to toggle source
# File lib/arachni/http/message.rb, line 60 def headers=( h ) @headers = Headers.new( h || {} ) end
parsed_url()
click to toggle source
# 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()
click to toggle source
@return [Scope]
# File lib/arachni/http/message.rb, line 65 def scope @scope ||= self.class::Scope.new( self ) end
update( options )
click to toggle source
# File lib/arachni/http/message.rb, line 45 def update( options ) @normalize_url = options[:normalize_url] # Headers are necessary for subsequent operations to set them first. @headers = Headers.new( options[:headers] || {} ) options.each do |k, v| begin send( "#{k}=", v ) rescue NoMethodError instance_variable_set( "@#{k}".to_sym, v ) end end end
url=( url )
click to toggle source
# File lib/arachni/http/message.rb, line 74 def url=( url ) if @normalize_url || @normalize_url.nil? @url = URI.normalize( url ).to_s.freeze else @url = url.to_s.freeze end end