[Bug 1604608] Re: ipv6 client causes errors in twisted.web
LaMont Jones
lamont.jones at canonical.com
Sat Jul 30 02:07:07 UTC 2016
What is not addressed by this patch is that twisted assumes that if it is given a hostname, then the user clearly means IPv4. The web client setup is not in the correct order, it should be:
1) resolve the hostname
2) iterate through the available IP addresses (probably preferring ipv6, like the rest of linux), trying each one until success, or end-of-list
2a) create the AF_INET/AF_INET6 socket based on the address family of the current trial IP.
2b) connect.
Today, it creates the socket based on the name it's given (ipv4 address,
ipv6 address, or "huh... hostname, let's try ipv4") and then resolves
it.
The other option would be to create an AF_INET6 socket, and if it turns
out that it's an IPv4 address, change it to the compatible ipv6 address
of "::ffff:192.168.1.1" or such. Note that if the app then calls
getsockname() on the socket, it will see the ipv6-form, and may be
confused.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to twisted in Ubuntu.
https://bugs.launchpad.net/bugs/1604608
Title:
ipv6 client causes errors in twisted.web
Status in twisted package in Ubuntu:
New
Bug description:
If the client connecting to the twisted (16.0.0-1, still present in upstream 16.3.0), then twisted dies as follows:
2016-07-18 15:40:21 [HTTPChannel,468,::ffff:127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1657, in lineReceived
self.allContentReceived()
File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1736, in allContentReceived
req.requestReceived(command, path, version)
File "/usr/lib/python3/dist-packages/maasserver/webapp.py", line 80, in requestReceived
command, path, version)
File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 762, in requestReceived
self.process()
--- <exception caught here> ---
File "/usr/lib/python3/dist-packages/twisted/web/server.py", line 183, in process
self.render(resrc)
File "/usr/lib/python3/dist-packages/twisted/web/server.py", line 234, in render
body = resrc.render(self)
File "/usr/lib/python3/dist-packages/twisted/web/wsgi.py", line 561, in render
self._reactor, self._threadpool, self._application, request)
File "/usr/lib/python3/dist-packages/twisted/web/wsgi.py", line 293, in __init__
'REMOTE_ADDR': _wsgiString(request.getClientIP()),
File "/usr/lib/python3/dist-packages/twisted/web/wsgi.py", line 85, in _wsgiString
return string.decode("iso-8859-1")
builtins.AttributeError: 'NoneType' object has no attribute 'decode'
In the attached patch, the middle block addresses the above immediate
issue, and the other two blocks are my best guess at what the code
_should_ read for completeness.
We'll want to get this SRUed into xenial, once it's fixed in wily, as
it's required for MAAS 2.1 (which runs on "latest LTS release" ==
xenial.)
thanks
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/twisted/+bug/1604608/+subscriptions
More information about the foundations-bugs
mailing list