[issue8857] socket.getaddrinfo needs tests

Giampaolo Rodola' report at bugs.python.org
Thu Jun 17 02:16:12 CEST 2010


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

> FreeBSD/Qemu: ipv6 is ok, but this fails:
[...]

That failure refers to this test:

        # by specifying "http" we expect all returned sockets have
        # STREAM type
        infos = socket.getaddrinfo(HOST, "http")
        for _, socktype, _, _, _ in infos:
             self.assertEqual(socktype, socket.SOCK_STREAM)

...and means that getaddrinfo() consider UDP (socket.SOCK_DGRAM == 1) a valid transfer protocol for HTTP.
By googling around it seems this might actually be true:
http://stackoverflow.com/questions/323351/does-http-use-udp

Changing the string to "ftp" should solve the problem.
As for the IPv6 failure I added some extra code which executes the test only after verifying that binding an IPv6 socket is actually possible.

Btw, socket.has_ipv6 documentation should be more clear about the fact that having it == True doesn't necessarily mean IPv6 is actually supported.

----------
Added file: http://bugs.python.org/file17691/getaddrinfotest.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8857>
_______________________________________


More information about the Python-bugs-list mailing list