Log message for revision 121227:
  Backport IPv6 changes from trunk
  

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/sources.cfg
  U   Zope/branches/2.13/src/ZServer/datatypes.py
  U   Zope/branches/2.13/src/ZServer/medusa/http_server.py
  U   Zope/branches/2.13/src/ZServer/tests/test_config.py
  U   Zope/branches/2.13/versions.cfg

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst  2011-04-03 16:26:36 UTC (rev 121226)
+++ Zope/branches/2.13/doc/CHANGES.rst  2011-04-03 16:39:36 UTC (rev 121227)
@@ -23,6 +23,8 @@
 Features Added
 ++++++++++++++
 
+- Add preliminary IPv6 support to ZServer.
+
 - Updated to Zope Toolkit 1.0.2.
 
 - Updated distributions:
@@ -31,6 +33,7 @@
   - Products.BTreeFolder2 = 2.13.3
   - Products.ZCatalog = 2.13.8
   - python-gettext = 1.1.1
+  - ZConfig = 2.9.0
 
 2.13.5 (2011-02-23)
 -------------------

Modified: Zope/branches/2.13/sources.cfg
===================================================================
--- Zope/branches/2.13/sources.cfg      2011-04-03 16:26:36 UTC (rev 121226)
+++ Zope/branches/2.13/sources.cfg      2011-04-03 16:39:36 UTC (rev 121227)
@@ -22,3 +22,4 @@
 zExceptions = svn ^/zExceptions/trunk
 ZODB3 = svn ^/ZODB/trunk
 ZopeUndo = svn ^/ZopeUndo/trunk
+ZConfig = svn ^/ZConfig/trunk

Modified: Zope/branches/2.13/src/ZServer/datatypes.py
===================================================================
--- Zope/branches/2.13/src/ZServer/datatypes.py 2011-04-03 16:26:36 UTC (rev 
121226)
+++ Zope/branches/2.13/src/ZServer/datatypes.py 2011-04-03 16:39:36 UTC (rev 
121227)
@@ -35,7 +35,9 @@
             ip = socket.gethostbyname(defaulthost)
             self._set_default_host(defaulthost, ip)
         else:
-            self.ip = socket.gethostbyname(self.host)
+            address_info = socket.getaddrinfo(self.host, self.port)
+            ips = [info[4][0] for info in address_info]
+            self.ip = ips[0]
         self.dnsresolver = dnsresolver
         self.module = module
         self.cgienv = env

Modified: Zope/branches/2.13/src/ZServer/medusa/http_server.py
===================================================================
--- Zope/branches/2.13/src/ZServer/medusa/http_server.py        2011-04-03 
16:26:36 UTC (rev 121226)
+++ Zope/branches/2.13/src/ZServer/medusa/http_server.py        2011-04-03 
16:39:36 UTC (rev 121227)
@@ -542,8 +542,13 @@
         self.ip = ip
         self.port = port
         asyncore.dispatcher.__init__ (self)
-        self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
         
+        if ':' in ip:
+            socket_type = socket.AF_INET6
+        else:
+            socket_type = socket.AF_INET
+        self.create_socket (socket_type, socket.SOCK_STREAM)
+        
         self.handlers = []
         
         if not logger_object:
@@ -555,7 +560,10 @@
         # lower this to 5 if your OS complains
         self.listen (1024)
         
-        host, port = self.socket.getsockname()
+        name = self.socket.getsockname()
+        host = name[0]
+        port = name[1]
+
         if not ip:
             self.log_info('Computing default hostname', 'warning')
             try:

Modified: Zope/branches/2.13/src/ZServer/tests/test_config.py
===================================================================
--- Zope/branches/2.13/src/ZServer/tests/test_config.py 2011-04-03 16:26:36 UTC 
(rev 121226)
+++ Zope/branches/2.13/src/ZServer/tests/test_config.py 2011-04-03 16:39:36 UTC 
(rev 121227)
@@ -134,6 +134,22 @@
         self.assertEqual(server.port, 9381)
         server.close()
 
+    def test_http_over_ipv6(self):
+        factory = self.load_factory("""\
+            <http-server>
+              address [::1]:81
+            </http-server>
+            """)
+        self.assert_(isinstance(factory,
+                                ZServer.datatypes.HTTPServerFactory))
+        self.assertEqual(factory.host, "::1")
+        self.assertEqual(factory.port, 81)
+        self.check_prepare(factory)
+        server = factory.create()
+        self.assertEqual(server.ip, '::1')
+        self.assertEqual(server.port, 9381)
+        server.close()
+    
     def test_http_factory_defaulthost(self):
         factory = self.load_factory("""\
             <http-server>

Modified: Zope/branches/2.13/versions.cfg
===================================================================
--- Zope/branches/2.13/versions.cfg     2011-04-03 16:26:36 UTC (rev 121226)
+++ Zope/branches/2.13/versions.cfg     2011-04-03 16:39:36 UTC (rev 121227)
@@ -35,6 +35,7 @@
 mechanize = 0.2.3
 unittest2 = 0.5.1
 python-gettext = 1.1.1
+ZConfig = 2.9.0
 ZODB3 = 3.10.2
 zope.testing = 3.9.4
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to