Skip to content
Snippets Groups Projects
Commit 5d9c2182 authored by Dan Drinkard's avatar Dan Drinkard
Browse files

Don't throw errors when using SSL

parent 8fa9b3ea
No related branches found
No related tags found
No related merge requests found
......@@ -227,15 +227,13 @@ module Geocoder
def make_api_request(query)
timeout(configuration.timeout) do
uri = URI.parse(query_url(query))
# client = http_client.new(uri.host, uri.port)
# client.use_ssl = true if configuration.use_https
# client.get(uri.request_uri, configuration.http_headers)
args = [uri.host, uri.port]
args = args.push(uri.user, uri.password) unless uri.user.nil? or uri.password.nil?
opts = {}
opts[:use_ssl] = true if configuration.use_https
http_client.start(uri.host, uri.port) do |client|
client.use_ssl = true if configuration.use_https
req = Net::HTTP::Get.new(uri.request_uri, configuration.http_headers)
req.basic_auth(uri.user, uri.password) if uri.user and uri.password
client.request(req)
http_client.start(*args, opts) do |client|
resp = client.get(uri.request_uri, configuration.http_headers)
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment