aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs21
2 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index 2116605..ed4b205 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -42,14 +42,22 @@ using log4net;
42 42
43namespace OpenSim.Region.CoreModules.Avatar.Friends 43namespace OpenSim.Region.CoreModules.Avatar.Friends
44{ 44{
45 public class FriendsRequestHandler : BaseStreamHandler 45 public class FriendsRequestHandler : 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 FriendsModule m_FriendsModule; 49 private FriendsModule m_FriendsModule;
50 50
51 public FriendsRequestHandler(FriendsModule fmodule) 51 public FriendsRequestHandler(FriendsModule fmodule)
52 : base("POST", "/friends") 52 : base("POST", "/friends", new BasicDosProtectorOptions()
53 {
54 AllowXForwardedFor = true,
55 ForgetTimeSpan = TimeSpan.FromMinutes(2),
56 MaxRequestsInTimeframe = 5,
57 ReportingName = "FRIENDSDOSPROTECTOR",
58 RequestTimeSpan = TimeSpan.FromSeconds(5),
59 ThrottledAction = ThrottleAction.DoThrottledMethod
60 })
53 { 61 {
54 m_FriendsModule = fmodule; 62 m_FriendsModule = fmodule;
55 } 63 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index a26a5f0..0f05e07 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -165,7 +165,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
165 regionimage = regionimage.Replace("-", ""); 165 regionimage = regionimage.Replace("-", "");
166 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage); 166 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
167 167
168 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); 168 MainServer.Instance.AddHTTPHandler(regionimage,
169 new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
170 {
171 AllowXForwardedFor = false,
172 ForgetTimeSpan = TimeSpan.FromMinutes(2),
173 MaxRequestsInTimeframe = 4,
174 ReportingName = "MAPDOSPROTECTOR",
175 RequestTimeSpan = TimeSpan.FromSeconds(10),
176 ThrottledAction = ThrottleAction.DoThrottledMethod
177 }).Process);
169 MainServer.Instance.AddLLSDHandler( 178 MainServer.Instance.AddLLSDHandler(
170 "/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest); 179 "/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
171 180
@@ -1081,6 +1090,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1081 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1090 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1082 } 1091 }
1083 1092
1093 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1094 {
1095 Hashtable reply = new Hashtable();
1096 int statuscode = 500;
1097 reply["str_response_string"] = "I blocked you! HAHAHAHAHAHAHHAHAH";
1098 reply["int_response_code"] = statuscode;
1099 reply["content_type"] = "text/plain";
1100 return reply;
1101 }
1102
1084 public Hashtable OnHTTPGetMapImage(Hashtable keysvals) 1103 public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
1085 { 1104 {
1086 m_log.Debug("[WORLD MAP]: Sending map image jpeg"); 1105 m_log.Debug("[WORLD MAP]: Sending map image jpeg");