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

Avoid :verify option to get overridden #266

Closed
guapolo opened this issue Jan 31, 2014 · 3 comments
Closed

Avoid :verify option to get overridden #266

guapolo opened this issue Jan 31, 2014 · 3 comments

Comments

@guapolo
Copy link
Contributor

guapolo commented Jan 31, 2014

Hi
attach_ssl_certificates overrides the :verify option value in this line https://github.com/jnunemaker/httparty/blob/master/lib/httparty/connection_adapter.rb#L147

IMHO this should not be the case, using :pem or pfx, this options should honor the previously set :verify_mode value.

I have a use case where using :pem certificates and :verify set to false (in my case, I'm testing my code against a web service which requieres pem certificates for authentication, but the server doesn't have a signed certificate in it's testing environment).

In other words, here's the code I was using, and expected it to work:

class MyClass
  include HTTParty
  default_params(verify: false, pem: a_certificate_and_key)
 # ...
 post(url, ...) # when posting, verify_mode is set to OpenSSL::SSL::VERIFY_PEER
end

but instead I need to use this declaration for it to work OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE, which is pretty ugly.

I'll submit a pull request if you agree on this behavior.

Thanks,

@jnunemaker
Copy link
Owner

Honestly, I didn't add most of the ssl/certificate related code and I'm not sure what makes sense. A pull would definitely help to start the discussion and provide concrete examples of how/if it will break backwards compat.

@kurenn
Copy link
Contributor

kurenn commented Oct 30, 2015

I just placed the pull request #441

Had some issues with this, when working with a client, it is working now!

jnunemaker pushed a commit that referenced this issue Nov 20, 2015
Solves #266 - Honors the verify option to avoid overrides
@kurenn
Copy link
Contributor

kurenn commented Nov 21, 2015

Solution has been merged with #441

@jnunemaker I think you can close this issue

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

3 participants