David Watson <bai...@users.sourceforge.net> added the comment:
> Thanks for the patch. Committed as r84261.
>
> I'm not sure what the point is of supporting IDNA in getnameinfo, so I have
> removed that from the patch. If you think it's needed, please elaborate.
I don't see the point of it either, but if it's not supposed to
accept hostnames, it should use AI_NUMERICHOST in the call it
makes to getaddrinfo(). As it is, it does both forward and
reverse lookups when called with a hostname.
Attaching a patch to use AI_NUMERICHOST.
Also, this issue # isn't really resolved yet as Python does not
support IRIs (AFAIK).
----------
Added file: http://bugs.python.org/file18615/getnameinfo-numerichost.diff
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1027206>
_______________________________________
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3969,6 +3969,7 @@ socket_getnameinfo(PyObject *self, PyObj
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM; /* make numeric port happy */
+ hints.ai_flags = AI_NUMERICHOST; /* don't do any name resolution */
Py_BEGIN_ALLOW_THREADS
ACQUIRE_GETADDRINFO_LOCK
error = getaddrinfo(hostp, pbuf, &hints, &res);
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com