From 6c3305e7d9760a4bd35c0df5f28cf017bbbb4641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Mon, 19 Sep 2022 13:26:27 +0200 Subject: [PATCH] Replace deprecated `Socket.ip?` with `IPAddress.valid?` (#12489) --- src/openssl/ssl/hostname_validation.cr | 2 +- src/openssl/ssl/socket.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openssl/ssl/hostname_validation.cr b/src/openssl/ssl/hostname_validation.cr index ad77a63d0e20..9f09dfc9d4eb 100644 --- a/src/openssl/ssl/hostname_validation.cr +++ b/src/openssl/ssl/hostname_validation.cr @@ -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 diff --git a/src/openssl/ssl/socket.cr b/src/openssl/ssl/socket.cr index c0a3a6e5597b..742ad8f78eea 100644 --- a/src/openssl/ssl/socket.cr +++ b/src/openssl/ssl/socket.cr @@ -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