diff mercurial/hgweb/server.py @ 4130:178007785be8

web/server: disable address reuse option for BaseHTTPServer on windows On windows, a socket with the SO_REUSEADDR option set is able to bind to any port, even if there's already an active socket listening on it. test-http: check server address cannot be reused.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 19 Feb 2007 10:08:59 +0100
parents 3d7480ada3e5
children 9dc64c8414ca bd46b83b9692
line wrap: on
line diff
--- a/mercurial/hgweb/server.py	Mon Feb 19 10:32:46 2007 +0100
+++ b/mercurial/hgweb/server.py	Mon Feb 19 10:08:59 2007 +0100
@@ -197,6 +197,11 @@
                 pass
 
     class MercurialHTTPServer(object, _mixin, BaseHTTPServer.HTTPServer):
+        
+        # SO_REUSEADDR has broken semantics on windows
+        if os.name == 'nt':
+            allow_reuse_address = 0
+    
         def __init__(self, *args, **kargs):
             BaseHTTPServer.HTTPServer.__init__(self, *args, **kargs)
             self.accesslog = accesslog