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

Merge branch 'master' into abravalheri-master

Conflicts:
	lib/geocoder/configuration.rb
parents d58fed7d 9f4cea65
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,7 @@ module Geocoder ...@@ -48,6 +48,7 @@ module Geocoder
:timeout, :timeout,
:lookup, :lookup,
:language, :language,
:request_headers,
:use_https, :use_https,
:http_proxy, :http_proxy,
:https_proxy, :https_proxy,
...@@ -70,6 +71,7 @@ module Geocoder ...@@ -70,6 +71,7 @@ module Geocoder
@timeout = 3 # geocoding service timeout (secs) @timeout = 3 # geocoding service timeout (secs)
@lookup = :google # name of geocoding service (symbol) @lookup = :google # name of geocoding service (symbol)
@language = :en # ISO-639 language code @language = :en # ISO-639 language code
@request_headers = {} # HTTP headers for lookup
@use_https = false # use HTTPS for lookup requests? (if supported) @use_https = false # use HTTPS for lookup requests? (if supported)
@http_proxy = nil # HTTP proxy server (user:pass@host:port) @http_proxy = nil # HTTP proxy server (user:pass@host:port)
@https_proxy = nil # HTTPS proxy server (user:pass@host:port) @https_proxy = nil # HTTPS proxy server (user:pass@host:port)
......
...@@ -149,7 +149,7 @@ module Geocoder ...@@ -149,7 +149,7 @@ module Geocoder
unless cache and body = cache[url] unless cache and body = cache[url]
client = http_client.new(uri.host, uri.port) client = http_client.new(uri.host, uri.port)
client.use_ssl = true if Geocoder::Configuration.use_https client.use_ssl = true if Geocoder::Configuration.use_https
response = client.get(uri.request_uri) response = client.get(uri.request_uri, Geocoder::Configuration.request_headers)
body = response.body body = response.body
if cache and (200..399).include?(response.code.to_i) if cache and (200..399).include?(response.code.to_i)
cache[url] = body cache[url] = body
......
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