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

Implemented #2770 #6306

Merged
merged 4 commits into from
Jul 3, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/openssl/ssl/context.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "uri/punycode"

abstract class OpenSSL::SSL::Context
# :nodoc:
def self.default_method
Expand Down Expand Up @@ -95,6 +97,9 @@ abstract class OpenSSL::SSL::Context
#
# Required for OpenSSL <= 1.0.1 only.
protected def set_cert_verify_callback(hostname : String)
# Sanitize the hostname with PunyCode
hostname = URI::Punycode.to_ascii hostname

# Keep a reference so the GC doesn't collect it after sending it to C land
@hostname = hostname
LibSSL.ssl_ctx_set_cert_verify_callback(@handle, ->(x509_ctx, arg) {
Expand Down