1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-04 08:47:11 +00:00

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.
This commit is contained in:
Robert Pluim 2018-07-17 18:23:34 +02:00
parent 93638b0677
commit 742c2344bf
2 changed files with 5 additions and 1 deletions

View File

@ -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);

View File

@ -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"))