Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure_ssl! is called after connecting #1563

Open
bughit opened this issue Jan 20, 2022 · 1 comment
Open

configure_ssl! is called after connecting #1563

bughit opened this issue Jan 20, 2022 · 1 comment

Comments

@bughit
Copy link

bughit commented Jan 20, 2022

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
@bughit
Copy link
Author

bughit commented Jan 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant