Skip to content
Snippets Groups Projects
Commit 9a294922 authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #592 from sunlightlabs/fix_ssl

Don't throw errors when using SSL
parents b6e11033 b15c86df
No related branches found
No related tags found
No related merge requests found
...@@ -227,15 +227,13 @@ module Geocoder ...@@ -227,15 +227,13 @@ module Geocoder
def make_api_request(query) def make_api_request(query)
timeout(configuration.timeout) do timeout(configuration.timeout) do
uri = URI.parse(query_url(query)) uri = URI.parse(query_url(query))
# client = http_client.new(uri.host, uri.port) args = [uri.host, uri.port]
# client.use_ssl = true if configuration.use_https args = args.push(uri.user, uri.password) unless uri.user.nil? or uri.password.nil?
# client.get(uri.request_uri, configuration.http_headers) opts = {}
opts[:use_ssl] = true if configuration.use_https
http_client.start(uri.host, uri.port) do |client| http_client.start(*args, opts) do |client|
client.use_ssl = true if configuration.use_https client.get(uri.request_uri, configuration.http_headers)
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)
end end
end 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