Class: W3map::HttpEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/w3map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bot) ⇒ HttpEngine

Returns a new instance of HttpEngine.



155
156
157
# File 'lib/w3map.rb', line 155

def initialize(bot)
  @bot = bot
end

Instance Attribute Details

#botObject (readonly)

Returns the value of attribute bot.



154
155
156
# File 'lib/w3map.rb', line 154

def bot
  @bot
end

Instance Method Details

#response_for(url) ⇒ Object



158
159
160
161
162
163
164
165
166
167
# File 'lib/w3map.rb', line 158

def response_for(url)
  uri = URI.parse(url)
  http = Net::HTTP.new(uri.host, uri.port)
  if uri.port == 443
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
  get = Net::HTTP::Get.new(uri.request_uri)
  http.request(get)
end