diff options
* Added a Basic DOS protection container/base object for the most common HTTP Server handlers. XMLRPC Handler, GenericHttpHandler and <Various>StreamHandler
* Applied the XmlRpcBasicDOSProtector.cs to the login service as both an example, and good practice.
* Applied the BaseStreamHandlerBasicDOSProtector.cs to the friends service as an example of the DOS Protector on StreamHandlers
* Added CircularBuffer, used for CPU and Memory friendly rate monitoring.
* DosProtector has 2 states, 1. Just Check for blocked users and check general velocity, 2. Track velocity per user, It only jumps to 2 if it's getting a lot of requests, and state 1 is about as resource friendly as if it wasn't even there.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 8b23a83..0bd0235 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | |||
@@ -42,14 +42,22 @@ using OpenSim.Framework.Servers.HttpServer; | |||
42 | 42 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 43 | namespace OpenSim.Server.Handlers.Asset |
44 | { | 44 | { |
45 | public class AssetServerGetHandler : BaseStreamHandler | 45 | public class AssetServerGetHandler : BaseStreamHandlerBasicDOSProtector |
46 | { | 46 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private IAssetService m_AssetService; | 49 | private IAssetService m_AssetService; |
50 | 50 | ||
51 | public AssetServerGetHandler(IAssetService service) : | 51 | public AssetServerGetHandler(IAssetService service) : |
52 | base("GET", "/assets") | 52 | base("GET", "/assets",new BasicDosProtectorOptions() |
53 | { | ||
54 | AllowXForwardedFor = true, | ||
55 | ForgetTimeSpan = TimeSpan.FromSeconds(2), | ||
56 | MaxRequestsInTimeframe = 5, | ||
57 | ReportingName = "ASSETGETDOSPROTECTOR", | ||
58 | RequestTimeSpan = TimeSpan.FromSeconds(5), | ||
59 | ThrottledAction = ThrottleAction.DoThrottledMethod | ||
60 | }) | ||
53 | { | 61 | { |
54 | m_AssetService = service; | 62 | m_AssetService = service; |
55 | } | 63 | } |