changeset 440:0f07dcad6614

reorderer 1. bot 2. surge protection, add sleep time for forbidden requests, add surge prot. value for recall action imported from: moin--main--1.5--patch-444
author Thomas Waldmann <tw@waldmann-edv.de>
date Tue, 14 Feb 2006 06:38:53 +0000
parents 05175e00f75a
children a858267f7dea
files ChangeLog MoinMoin/multiconfig.py MoinMoin/request.py
diffstat 3 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 13 16:14:03 2006 +0000
+++ b/ChangeLog	Tue Feb 14 06:38:53 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-02-14 07:38:53 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-444
+
+    Summary:
+      reorderer 1. bot 2. surge protection, add sleep time for forbidden requests, add surge prot. value for recall action
+    Revision:
+      moin--main--1.5--patch-444
+
+    reorderer 1. bot 2. surge protection, add sleep time for forbidden requests, add surge prot. value for recall action
+    
+
+    modified files:
+     ChangeLog MoinMoin/multiconfig.py MoinMoin/request.py
+
+
 2006-02-13 17:14:03 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-443
 
     Summary:
--- a/MoinMoin/multiconfig.py	Mon Feb 13 16:14:03 2006 +0000
+++ b/MoinMoin/multiconfig.py	Tue Feb 14 06:38:53 2006 +0000
@@ -300,6 +300,7 @@
     surge_action_limits = { # allow max. <count> <action> requests per <dt> secs
         # action: (count, dt)
         'show': (20, 60),
+        'recall': (5, 60),
         'raw': (20, 40),  # some people use this for css
         'AttachFile': (60, 60),
         'diff': (30, 60),
--- a/MoinMoin/request.py	Mon Feb 13 16:14:03 2006 +0000
+++ b/MoinMoin/request.py	Tue Feb 14 06:38:53 2006 +0000
@@ -145,8 +145,14 @@
             self.user = self.get_user()
             
             if not self.query_string.startswith('action=xmlrpc'):
-                if self.surge_protect():
+                self.clock.start('botprot')
+                if not self.forbidden and self.isForbidden():
+                    self.makeForbidden403()
+                self.clock.stop('botprot')
+                self.clock.start('surgeprot')
+                if not self.forbidden and self.surge_protect():
                     self.makeUnavailable503()
+                self.clock.stop('surgeprot')
 
             from MoinMoin import i18n
 
@@ -978,11 +984,9 @@
     def run(self):
         # Exit now if __init__ failed or request is forbidden
         if self.failed or self.forbidden:
+            if self.forbidden:
+                time.sleep(10) # let the sucker wait!
             return self.finish()
-        if self.isForbidden():
-            self.makeForbidden403()
-            if self.forbidden:
-                return self.finish()
 
         self.open_logs()
         _ = self.getText