Skip to content

Commit

Permalink
Replace deprecated Socket.ip? with IPAddress.valid? (#12489)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Sep 19, 2022
1 parent fe69351 commit 6c3305e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/openssl/ssl/hostname_validation.cr
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module OpenSSL::SSL::HostnameValidation
end

# fail match when hostname is an IP address
if ::Socket.ip?(hostname)
if ::Socket::IPAddress.valid?(hostname)
return false
end

Expand Down
2 changes: 1 addition & 1 deletion src/openssl/ssl/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class OpenSSL::SSL::Socket < IO
{% if LibSSL.has_method?(:ssl_get0_param) %}
param = LibSSL.ssl_get0_param(@ssl)

if ::Socket.ip?(hostname)
if ::Socket::IPAddress.valid?(hostname)
unless LibCrypto.x509_verify_param_set1_ip_asc(param, hostname) == 1
raise OpenSSL::Error.new("X509_VERIFY_PARAM_set1_ip_asc")
end
Expand Down

0 comments on commit 6c3305e

Please sign in to comment.