]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - qwebirc/root.py
Merge.
[irc/quakenet/qwebirc.git] / qwebirc / root.py
index 0aaa6b154798dd37b036b22753a5064ba405be15..847648fb181c6f09b7e0e10d1584a886e6ba5eb3 100644 (file)
@@ -13,9 +13,6 @@ class RootResource(resource.Resource):
       name = "qui.html"
     return self.primaryChild.getChild(name, request)
 
-class HTTPChannel(http.HTTPChannel, TimeoutMixin):
-  timeOut = 5
-
 class ProxyRequest(server.Request):
   ip_re = re.compile(r"^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})|(::|(([a-fA-F0-9]{1,4}):){7}(([a-fA-F0-9]{1,4}))|(:(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){1,6}:)|((([a-fA-F0-9]{1,4}):)(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){2}(:([a-fA-F0-9]{1,4})){1,5})|((([a-fA-F0-9]{1,4}):){3}(:([a-fA-F0-9]{1,4})){1,4})|((([a-fA-F0-9]{1,4}):){4}(:([a-fA-F0-9]{1,4})){1,3})|((([a-fA-F0-9]{1,4}):){5}(:([a-fA-F0-9]{1,4})){1,2})))$", re.IGNORECASE)
   def validIP(self, ip):
@@ -38,17 +35,21 @@ class ProxyRequest(server.Request):
       return real_ip
       
     return fake_ip
-    
+
+class HTTPChannel(http.HTTPChannel):
+  def timeoutConnection(self):
+    self.transport.abortConnection()
+
 class RootSite(server.Site):
   protocol = HTTPChannel
-  
+
   if hasattr(config, "FORWARDED_FOR_HEADER"):
     requestFactory = ProxyRequest
 
   def __init__(self, path, *args, **kwargs):
     root = RootResource()
+    kwargs["timeout"] = config.HTTP_REQUEST_TIMEOUT
     server.Site.__init__(self, root, *args, **kwargs)
-
     services = {}
     services["StaticEngine"] = root.primaryChild = engines.StaticEngine(path)