Ticket #276 (new defect)

Opened 4 years ago

Last modified 22 months ago

ipv6 host support

Reported by: ghazel Owned by: ianb
Priority: normal Milestone: 1.4.1
Component: paste Version: released-version
Severity: normal Keywords:
Cc: felix.schwarz@…

Description

Currently, if you try to use a server config like:

[server:main]
use = egg:Paste#http
host = ::
port = 80

you get:

Traceback (most recent call last):
  File "c:\python25\scripts\paster-script.py", line 8, in <module>
    load_entry_point('pastescript==1.3.6', 'console_scripts', 'paster')()
  File "c:\python25\lib\site-packages\pastescript-1.3.6-py2.5.egg\paste\script\command.py", line 78, in run
    invoke(command, command_name, options, args[1:])
  File "c:\python25\lib\site-packages\pastescript-1.3.6-py2.5.egg\paste\script\command.py", line 117, in invoke
    exit_code = runner.run(args)
  File "c:\python25\lib\site-packages\pastescript-1.3.6-py2.5.egg\paste\script\command.py", line 212, in run
    result = self.command()
  File "c:\python25\lib\site-packages\pastescript-1.3.6-py2.5.egg\paste\script\serve.py", line 232, in command
    server(app)
  File "c:\python25\lib\site-packages\pastedeploy-1.3.1-py2.5.egg\paste\deploy\loadwsgi.py", line 140, in server_wrapper
    **context.local_conf)
  File "c:\python25\lib\site-packages\pastedeploy-1.3.1-py2.5.egg\paste\deploy\util\fixtypeerror.py", line 57, in fix_call
    val = callable(*args, **kw)
  File "c:\python25\lib\site-packages\paste-1.4.2-py2.5.egg\paste\httpserver.py"
, line 1307, in server_runner
    serve(wsgi_app, **kwargs)
  File "c:\python25\lib\site-packages\paste-1.4.2-py2.5.egg\paste\httpserver.py"
, line 1257, in serve
    threadpool_options=threadpool_options)
  File "c:\python25\lib\site-packages\paste-1.4.2-py2.5.egg\paste\httpserver.py"
, line 1107, in __init__
    RequestHandlerClass, ssl_context)
  File "c:\python25\lib\site-packages\paste-1.4.2-py2.5.egg\paste\httpserver.py"
, line 1087, in __init__
    RequestHandlerClass, ssl_context)
  File "c:\python25\lib\site-packages\paste-1.4.2-py2.5.egg\paste\httpserver.py"
, line 358, in __init__
    HTTPServer.__init__(self, server_address, RequestHandlerClass)
  File "c:\python25\lib\SocketServer.py", line 330, in __init__
    self.server_bind()
  File "c:\python25\lib\BaseHTTPServer.py", line 101, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "c:\python25\lib\SocketServer.py", line 341, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.gaierror: (11001, 'getaddrinfo failed')

There are a few ways to add support for this. Here's one example:

in paste.httpserver.SecureHTTPServer.init:

def __init__(self, server_address, RequestHandlerClass,
             ssl_context=None):
    # This overrides the implementation of __init__ in python's
    # SocketServer.TCPServer (which BaseHTTPServer.HTTPServer
    # does not override, thankfully).
    if ':' in server_address[0]:
        self.address_family = socket.AF_INET6
    HTTPServer.__init__(self, server_address, RequestHandlerClass)

Once that's fixed you run in to #275, and once that's fixed ipv6 support works!

Attachments

httpserver.py.patch Download (2.0 KB) - added by n.vandamme 2 years ago.
diff for ipv6 support
httpserver.py.2.patch Download (2.8 KB) - added by n.vandamme 2 years ago.
IPV6 support for paste serve

Change History

Changed 2 years ago by n.vandamme

diff for ipv6 support

follow-up: ↓ 2   Changed 2 years ago by n.vandamme

I've made a patch to allow ipv6 based on the last report (see diff httpserver.py.patch Download). It seems to works on my side, can anyone test it?

Changed 2 years ago by n.vandamme

IPV6 support for paste serve

in reply to: ↑ 1   Changed 2 years ago by n.vandamme

Replying to n.vandamme:

I've made a patch to allow ipv6 based on the last report (see diff httpserver.py.patch Download). It seems to works on my side, can anyone test it?

I've tested it further and it seems to block using ipv4 addresses with the last patch. Here is another that force socket.AF_INET in case of an ipv4 address. (httpserver.py.2.patch Download)

  Changed 22 months ago by Felix Schwarz <felix.schwarz@…>

  • cc felix.schwarz@… added
Note: See TracTickets for help on using tickets.