alexreisner/geocoder

configure_ssl! is called after connecting

bughit opened this issue · 1 comments

Expected behavior

def make_api_request(query)
uri = URI.parse(query_url(query))
Geocoder.log(:debug, "Geocoder: HTTP request being made for #{uri.to_s}")
http_client.start(uri.host, uri.port, use_ssl: use_ssl?, open_timeout: configuration.timeout, read_timeout: configuration.timeout) do |client|
configure_ssl!(client) if use_ssl?

Not sure if this post connected ssl config works for some ssl issues but it definitely does not work for bypassing "OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired))"

verify_mode needs to be set (which you would do in configure_ssl!) before connecting

Actual behavior

configure_ssl! is called after the connection attempt and failure

Steps to reproduce

Net::HTTP.start('expired.badssl.com', use_ssl: true){puts 'start block'}

fails before the start block

Environment info

  • Geocoder version: master

What's needed here is the ability to specify additional opts to http_client.start which will be applied to the client instance before connecting.