ipv6 client causes errors in twisted.web
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
twisted (Ubuntu) |
New
|
Undecided
|
Unassigned |
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,
Traceback (most recent call last):
File "/usr/lib/
File "/usr/lib/
File "/usr/lib/
File "/usr/lib/
--- <exception caught here> ---
File "/usr/lib/
File "/usr/lib/
body = resrc.render(self)
File "/usr/lib/
File "/usr/lib/
File "/usr/lib/
return string.
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
tags: | added: patch |
getRequestHostn ame() has similar problems, which this addresses:
def new_getRequestH ostname( self): b'host' ) (b'['):
return host[:host. rfind(b' :')]
else:
return host host.decode( "idna") )
host = self.getHeader(
if host:
if host.startswith
if host.find(b']') < host.rfind(b':'):
host = self.getHost().host
try:
ip = IPAddress(
except AddrFormatError:
# If we could not convert the hostname to an IPAddress, assume that
# it is a hostname.
return networkString(host)
if ip.version == 4:
return networkString(host)
else:
return networkString(b'[' + host + b']')