]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fixed error in HTTPServer when AI_ADDRCONFIG is not available (as on WinXP)
authorBen Darnell <ben@bendarnell.com>
Sun, 26 Jun 2011 01:36:48 +0000 (18:36 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 26 Jun 2011 01:36:48 +0000 (18:36 -0700)
Closes #287

tornado/httpserver.py
website/sphinx/releases.rst
website/sphinx/releases/next.rst [new file with mode: 0644]

index 922232f6e6481595ed10b4cda62dd17b67e62b4a..7468b8bf987eae704a4875cfc30db71b51894075 100644 (file)
@@ -183,8 +183,15 @@ class HTTPServer(object):
         """
         if address == "":
             address = None
+        flags = socket.AI_PASSIVE
+        if hasattr(socket, "AI_ADDRCONFIG"):
+            # AI_ADDRCONFIG ensures that we only try to bind on ipv6
+            # if the system is configured for it, but the flag doesn't
+            # exist on some platforms (specifically WinXP, although
+            # newer versions of windows have it)
+            flags |= socket.AI_ADDRCONFIG
         for res in socket.getaddrinfo(address, port, family, socket.SOCK_STREAM,
-                                      0, socket.AI_PASSIVE | socket.AI_ADDRCONFIG):
+                                      0, flags):
             af, socktype, proto, canonname, sockaddr = res
             sock = socket.socket(af, socktype, proto)
             flags = fcntl.fcntl(sock.fileno(), fcntl.F_GETFD)
index 69606afc4cef0f1bd939d920bf8ca91e32270c57..6635bf39dc1890bbc2f0c2d632d54aa36c5d5268 100644 (file)
@@ -4,6 +4,7 @@ Release notes
 .. toctree::
    :maxdepth: 2
 
+   releases/next
    releases/v2.0.0
    releases/v1.2.1
    releases/v1.2.0
diff --git a/website/sphinx/releases/next.rst b/website/sphinx/releases/next.rst
new file mode 100644 (file)
index 0000000..13ead38
--- /dev/null
@@ -0,0 +1,11 @@
+What's new in the next release of Tornado
+=========================================
+
+In progress
+-----------
+
+Bug fixes
+~~~~~~~~~
+
+* `HTTPServer`: fixed exception at startup when ``socket.AI_ADDRCONFIG`` is
+  not available, as on Windows XP