Class: WebLoader::Drivers::HttpDriver
Instance Attribute Summary
Attributes inherited from BaseDriver
#binary, #user_agent
Instance Method Summary
collapse
Methods inherited from BaseDriver
#initialize
Instance Method Details
#driver_name ⇒ Object
11
12
13
|
# File 'lib/web_loader/drivers/http_driver.rb', line 11
def driver_name
"http"
end
|
#fetch(url) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/web_loader/drivers/http_driver.rb', line 15
def fetch(url)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
response = http.get(uri.request_uri, 'User-Agent' => @user_agent) create_response(response)
end
|