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

Allow setting verify_hostname to false #151

Merged

Conversation

stefanmb
Copy link
Contributor

@stefanmb stefanmb commented Sep 9, 2024

Follow-up to #120.

In that PR verify_hostname was added, but it cannot be set to false which its main function as a configurable option as per ruby/ruby#2858.

Add #verify_hostname= and #verify_hostname to skip hostname verification

@@ -1111,7 +1111,7 @@ def verify_mode= verify_mode
end

##
# Sets the HTTPS verify_hostname. Defaults to false.
# Sets the HTTPS verify_hostname.
Copy link
Contributor Author

@stefanmb stefanmb Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per #120

net/http/persistent should be thin wrapper,

This setting actually comes from SSLContext's default and it defaults to true. The old comment is at best misleading.

See also ruby/ruby#2858.

@@ -1001,7 +1001,7 @@ def ssl connection
connection.verify_depth = @verify_depth
connection.verify_mode = @verify_mode
connection.verify_hostname = @verify_hostname if
@verify_hostname && connection.respond_to?(:verify_hostname=)
@verify_hostname != nil && connection.respond_to?(:verify_hostname=)
Copy link
Contributor Author

@stefanmb stefanmb Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nil means we don't set this option and want the default from net/http, whereas false is an explicit choice

@stefanmb stefanmb marked this pull request as ready for review September 9, 2024 19:21
@tenderlove tenderlove merged commit f99bcb2 into drbrain:master Sep 9, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

2 participants