Ticket #388 (defect)
Opened 3 years ago
Last modified 3 years ago
Status of CherryPy IPv6 support?
Status: closed (fixed)
| Reported by: | lawouach | Assigned to: | fumanchu |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.2-beta |
| Component: | CherryPy code | Keywords: | IPv6 |
| Cc: | hun@n-dimensional.de |
Was ticket 277 (reported by hun[at]n-dimensional[dot]de)
Is there support for having CherryPy listen on [::]:8080? If there is, it is not documented anywhere and non-trivial to find.
Testing with CherryPy 2.0.0f from the Debian package
By default, CherryPy from the Debian package binds to 0.0.0.0:socketPort (socketPort being the value given to CherryPy in the configMap). Giving the socketHost configMap parameter the value "::" or "[::]" just causes an exception because socketHost is no valid IPv4 address but is treated as such.
What about CherryPy 2.1
The same behaviour can be reproduced with CherryPy 2.1 from SVN r.583.
CherryPy 2.1 is based on Python's BaseHTTPServer, which in turn, according to some Python bug tracker items, has been made IPv6 capable some time in 2003: http://mail.python.org/pipermail/patches/2003-May/012619.html
This suggests that it should be possible to make CherryPy 2.1 listen on IPv6 sockets. At least with a little hacking :-)
Change History
11/25/05 12:24:57: Modified by rdelon
- status changed from new to closed.
- resolution set to invalid.
11/25/05 12:27:03: Modified by fumanchu
- status changed from closed to reopened.
- resolution deleted.
11/25/05 12:27:12: Modified by fumanchu
- owner changed from rdelon to fumanchu.
- status changed from reopened to new.
11/25/05 12:27:18: Modified by fumanchu
- status changed from new to assigned.
11/27/05 21:10:26: Modified by fumanchu
- cc set to hun@n-dimensional.de.
11/27/05 21:10:40: Modified by fumanchu
- status changed from assigned to closed.
- resolution set to fixed.
Fixed in [843]. I don't actually have an IPv6 platform; anyone want to test it for me?
11/28/05 09:32:09: Modified by rdelon
- status changed from closed to reopened.
- resolution deleted.
Hmm ... When I start CP on my linux box I get this now:
28/Nov/2005:08:18:45 CONFIG INFO Server parameters: 28/Nov/2005:08:18:45 CONFIG INFO server.environment: production 28/Nov/2005:08:18:45 CONFIG INFO server.logToScreen: True 28/Nov/2005:08:18:45 CONFIG INFO server.logFile: 28/Nov/2005:08:18:45 CONFIG INFO server.logTracebacks: True 28/Nov/2005:08:18:45 CONFIG INFO server.logRequestHeaders: False 28/Nov/2005:08:18:45 CONFIG INFO server.protocolVersion: HTTP/1.0 28/Nov/2005:08:18:45 CONFIG INFO server.socketHost: 28/Nov/2005:08:18:45 CONFIG INFO server.socketPort: 12312 28/Nov/2005:08:18:45 CONFIG INFO server.socketFile: 28/Nov/2005:08:18:45 CONFIG INFO server.reverseDNS: False 28/Nov/2005:08:18:45 CONFIG INFO server.socketQueueSize: 5 28/Nov/2005:08:18:45 CONFIG INFO server.threadPool: 10 Exception in thread Thread-1: Traceback (most recent call last):
File "/usr/local/lib/python2.4/threading.py", line 442, in bootstrap
self.run()
File "/usr/local/lib/python2.4/threading.py", line 422, in run
self.target(*self.args, **self.kwargs)
File "/home/ph/cherrypy/_cpserver.py", line 140, in _start_http
self.httpserver.start()
File "/home/ph/cherrypy/_cpwsgiserver.py", line 225, in start
socket.SOCK_STREAM): gaierror: (-2, 'Name or service not known')
Any idea ?
11/28/05 09:33:09: Modified by rdelon
Sorry about the formatting ... Here is a better one:
28/Nov/2005:08:18:45 CONFIG INFO Server parameters:
28/Nov/2005:08:18:45 CONFIG INFO server.environment: production
28/Nov/2005:08:18:45 CONFIG INFO server.logToScreen: True
28/Nov/2005:08:18:45 CONFIG INFO server.logFile:
28/Nov/2005:08:18:45 CONFIG INFO server.logTracebacks: True
28/Nov/2005:08:18:45 CONFIG INFO server.logRequestHeaders: False
28/Nov/2005:08:18:45 CONFIG INFO server.protocolVersion: HTTP/1.0
28/Nov/2005:08:18:45 CONFIG INFO server.socketHost:
28/Nov/2005:08:18:45 CONFIG INFO server.socketPort: 12312
28/Nov/2005:08:18:45 CONFIG INFO server.socketFile:
28/Nov/2005:08:18:45 CONFIG INFO server.reverseDNS: False
28/Nov/2005:08:18:45 CONFIG INFO server.socketQueueSize: 5
28/Nov/2005:08:18:45 CONFIG INFO server.threadPool: 10
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/usr/local/lib/python2.4/threading.py", line 422, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/ph/cherrypy/_cpserver.py", line 140, in _start_http
self.httpserver.start()
File "/home/ph/cherrypy/_cpwsgiserver.py", line 225, in start
socket.SOCK_STREAM):
gaierror: (-2, 'Name or service not known')
11/28/05 10:01:47: Modified by fumanchu
It's probably a DNS issue--I guess we should trap gaierrors and try the "old" way of opening the socket if we encounter one. Throw in a try/except and fall back to IPv4 with socket.socket(socket.AF_INET, socket.SOCK_STREAM).
01/01/06 20:51:38: Modified by fumanchu
- status changed from reopened to closed.
- resolution set to fixed.
At least one user reports success now (rev 906).


If you don't specify a socketHost it should listen to all interfaces. Isn't that what you want ?