[Zodb-checkins] SVN: ZODB/trunk/src/ Bug fixed

Jim Fulton jim at zope.com
Thu Sep 30 10:26:02 EDT 2010


Log message for revision 117090:
  Bug fixed
  
  - On some systems, using an empty string in a server address of a ZEO
    client led to a socket error. Now, ZEO clients treat '' as an alias
    for 'localhost'.
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZEO/tests/testZEO.py
  U   ZODB/trunk/src/ZEO/zrpc/client.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2010-09-30 13:53:30 UTC (rev 117089)
+++ ZODB/trunk/src/CHANGES.txt	2010-09-30 14:26:02 UTC (rev 117090)
@@ -2,6 +2,17 @@
  Change History
 ================
 
+3.10.0b8 (2010-09-30)
+=====================
+
+Bugs fixed
+----------
+
+- On some systems, using an empty string in a server address of a ZEO
+  client led to a socket error. Now, ZEO clients treat '' as an alias
+  for 'localhost'.
+
+
 3.10.0b7 (2010-09-28)
 =====================
 

Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py	2010-09-30 13:53:30 UTC (rev 117089)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py	2010-09-30 14:26:02 UTC (rev 117090)
@@ -1656,6 +1656,19 @@
     >>> conn.close()
     """
 
+def can_use_empty_string_for_local_host_on_client():
+    """We should be able to spell localhost with ''.
+
+    >>> (_, port), _ = start_server()
+    >>> conn = ZEO.connection(('', port))
+    >>> conn.root()
+    {}
+    >>> conn.root.x = 1
+    >>> transaction.commit()
+
+    >>> conn.close()
+    """
+
 slow_test_classes = [
     BlobAdaptedFileStorageTests, BlobWritableCacheTests,
     MappingStorageTests, DemoStorageTests,

Modified: ZODB/trunk/src/ZEO/zrpc/client.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/client.py	2010-09-30 13:53:30 UTC (rev 117089)
+++ ZODB/trunk/src/ZEO/zrpc/client.py	2010-09-30 14:26:02 UTC (rev 117090)
@@ -444,7 +444,7 @@
             # reconfiguration can affect failover
             if domain == socket.AF_INET:
                 for (family, socktype, proto, cannoname, sockaddr
-                     ) in socket.getaddrinfo(host, port):
+                     ) in socket.getaddrinfo(host or 'localhost', port):
                     # for IPv6, drop flowinfo, and restrict addresses
                     # to [host]:port
                     yield family, sockaddr[:2]



More information about the Zodb-checkins mailing list