From: Robert Pluim Date: Tue, 17 Jul 2018 16:23:34 +0000 (+0200) Subject: Don't check unibyte hostnames for pure-ASCII X-Git-Tag: emacs-27.0.90~1328^2~123^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=742c2344bf076040f9c57f37b2220410f9e27304;p=emacs.git Don't check unibyte hostnames for pure-ASCII * src/process.c (network_lookup_address_info_1): Only check multibyte hostnames for pure-ASCII. * test/src/process-tests.el (unibyte-domain-name): Test unibyte domain names with network-lookup-address-info. --- diff --git a/src/process.c b/src/process.c index 25f02afb297..42909c4ba4f 100644 --- a/src/process.c +++ b/src/process.c @@ -4537,7 +4537,7 @@ network_lookup_address_info_1 (Lisp_Object host, const char *service, Lisp_Object msg = Qt; int ret; - if (SBYTES (host) != SCHARS (host)) + if (STRING_MULTIBYTE (host) && SBYTES (host) != SCHARS (host)) error ("Non-ASCII hostname %s detected, please use puny-encode-domain", SSDATA (host)); ret = getaddrinfo (SSDATA (host), service, hints, res); diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 2cc646e5a6c..ff7404f92bd 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -227,6 +227,10 @@ (should-error (network-lookup-address-info "faß.de")) (should (length (network-lookup-address-info (puny-encode-domain "faß.de"))))) +(ert-deftest unibyte-domain-name () + "Unibyte domain names should work" + (should (length (network-lookup-address-info (string-to-unibyte "google.com"))))) + (ert-deftest lookup-google () "Check that we can look up google IP addresses" (let ((addresses-both (network-lookup-address-info "google.com"))