Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add IPv6 support #195

Merged
merged 1 commit into from Dec 13, 2012

Conversation

Projects
None yet
7 participants
Contributor

zamabe commented Dec 12, 2012

Authored by mordervomubel ( https://github.com/mordervomubel )
GitHub issue webpy/webpy #70

@zamabe zamabe Add IPv6 support.
Authored by mordervomubel ( https://github.com/mordervomubel )
GitHub issue webpy/webpy #70
7348edd

@aaronsw aaronsw merged commit 7348edd into webpy:master Dec 13, 2012

eslizn commented on 7348edd Jan 26, 2013

Traceback (most recent call last):
File "boot.py", line 15, in
app.run()
File "D:\PHPnow\htdocs\web\application.py", line 313, in run
return wsgi.runwsgi(self.wsgifunc(*middleware))
File "D:\PHPnow\htdocs\web\wsgi.py", line 55, in runwsgi
server_addr = validip(listget(sys.argv, 1, ''))
File "D:\PHPnow\htdocs\web\net.py", line 108, in validip
if validip6addr(ip): return (ip,port)
File "D:\PHPnow\htdocs\web\net.py", line 33, in validip6addr
socket.inet_pton(socket.AF_INET6, address)
AttributeError: 'module' object has no attribute 'inet_pton'

?

python 2.7.3 web.py 0.35

Any Updates for the issues?

I also met the problem.

Contributor

zamabe commented Mar 20, 2013

inet_pton has not been implemented in python on windows.
See http://bugs.python.org/issue7171 for more information.

TL;DR
Windows recently (months) added support for inet_pton.
Slated for inclusion in Python 3.4, no mention of backport.

I commented 'Matt Boswell's code to check for ipv6 first' portion in net.py (\python27\lib\site-packages\web\net.py) to avoid this issue.

In python 2.7-python3.3 , socket.py does not have 'inet_pton', so, you can change the code like this:

\lib\site-packages\web\net.py about line:33

def validip6addr(address):
    """
    Returns True if `address` is a valid IPv6 address.

        >>> validip6addr('::')
        True
        >>> validip6addr('aaaa:bbbb:cccc:dddd::1')
        True
        >>> validip6addr('1:2:3:4:5:6:7:8:9:10')
        False
        >>> validip6addr('12:10')
        False
    """

    return False

let it return False. and dont support Add IPv6 support

Contributor

zamabe commented May 3, 2013

Perhaps a try/except is more appropriate.

sintrb commented Jun 8, 2013

line 32 to line 35, do change like this:

    try:
        socket.inet_pton(socket.AF_INET6, address)
    except:
        return False

@microacup you should make a new commit and add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment