From 66f99ae2677c4cfc26d2376c1de9e8e5d7022dfd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 17 Jan 2011 11:03:46 -0800 Subject: More debug messages to help track the XFF header problem. --- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 ++ OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 3 +++ 2 files changed, 5 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 0066bd4..814a8d9 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -223,6 +223,8 @@ namespace OpenSim.Server.Handlers.Hypergrid if (ep != null) return ep.Address.ToString(); } + else + m_log.WarnFormat("[HOME AGENT HANDLER]: No XFF header"); // Oops return Util.GetCallerIP(request); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 9c41bcb..b572cb3 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -208,6 +208,9 @@ namespace OpenSim.Server.Handlers.Simulation if (ep != null) return ep.Address.ToString(); } + else + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + // Oops return Util.GetCallerIP(request); -- cgit v1.1 From 0aeb8981b2b147e2caf2614fbfe59bd7e4340aee Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 17 Jan 2011 11:19:20 -0800 Subject: Brute force debug for XFF issue --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index b572cb3..96821ec 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -200,6 +200,13 @@ namespace OpenSim.Server.Handlers.Simulation // We're behind a proxy Hashtable headers = (Hashtable)request["headers"]; + + foreach (object o in headers.Keys) + { + if (o != null) + m_log.DebugFormat("[XXX] {0}", o.ToString()); + } + if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) { m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); -- cgit v1.1 From 479d72ac975fd34f43d76c0ab20f869cb07fb6fc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 17 Jan 2011 11:37:39 -0800 Subject: Account for some component along the way lower-casing the HTTP header keys. (XFF header issue) --- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 21 ++++++++++++-------- .../Server/Handlers/Simulation/AgentHandlers.cs | 23 ++++++++++------------ 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 814a8d9..968c1e6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -215,16 +215,21 @@ namespace OpenSim.Server.Handlers.Hypergrid // We're behind a proxy Hashtable headers = (Hashtable)request["headers"]; - if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) - { - m_log.DebugFormat("[HOME AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); + string xff = "X-Forwarded-For"; + if (headers.ContainsKey(xff.ToLower())) + xff = xff.ToLower(); - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); - if (ep != null) - return ep.Address.ToString(); + if (!headers.ContainsKey(xff) || headers[xff] == null) + { + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); } - else - m_log.WarnFormat("[HOME AGENT HANDLER]: No XFF header"); + + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); // Oops return Util.GetCallerIP(request); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 96821ec..57672a8 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -200,24 +200,21 @@ namespace OpenSim.Server.Handlers.Simulation // We're behind a proxy Hashtable headers = (Hashtable)request["headers"]; + string xff = "X-Forwarded-For"; + if (headers.ContainsKey(xff.ToLower())) + xff = xff.ToLower(); - foreach (object o in headers.Keys) + if (!headers.ContainsKey(xff) || headers[xff] == null) { - if (o != null) - m_log.DebugFormat("[XXX] {0}", o.ToString()); + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); } - if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) - { - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); - - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); - if (ep != null) - return ep.Address.ToString(); - } - else - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); // Oops return Util.GetCallerIP(request); -- cgit v1.1 From bf5ec8cb88219c8fefd7b396d5bd03110d3fa0e5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 21 Jan 2011 22:51:52 +0000 Subject: remove some mono compiler warnings and unnecessary dictionary instantiations --- OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | 3 ++- OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 9 --------- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 2 -- .../Server/Handlers/Simulation/SimulationServiceInConnector.cs | 2 +- 7 files changed, 10 insertions(+), 20 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs index c9e80d9..8472d34 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs @@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Grid { public class GridInfoServerInConnector : ServiceConnector { - private string m_ConfigName = "GridInfoService"; +// private string m_ConfigName = "GridInfoService"; public GridInfoServerInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs index 31eefb1..f3f81b0 100644 --- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs @@ -51,7 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid { public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IGatekeeperService m_GatekeeperService; public GatekeeperAgentHandler(IGatekeeperService gatekeeper, bool proxy) diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 49de8b1..3d0967f 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs @@ -41,9 +41,9 @@ namespace OpenSim.Server.Handlers.Hypergrid { public class GatekeeperServiceInConnector : ServiceConnector { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger( +// MethodBase.GetCurrentMethod().DeclaringType); private IGatekeeperService m_GatekeeperService; public IGatekeeperService GateKeeper diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index e5f6a5d..0e8ce80 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -47,9 +47,9 @@ namespace OpenSim.Server.Handlers.Hypergrid { public class UserAgentServerConnector : ServiceConnector { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger( +// MethodBase.GetCurrentMethod().DeclaringType); private IUserAgentService m_HomeUsersService; diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 00f035c..899f9c0 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -347,7 +347,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleAddFolder(Dictionary request) { - Dictionary result = new Dictionary(); InventoryFolderBase folder = BuildFolder(request); if (m_InventoryService.AddFolder(folder)) @@ -358,7 +357,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleUpdateFolder(Dictionary request) { - Dictionary result = new Dictionary(); InventoryFolderBase folder = BuildFolder(request); if (m_InventoryService.UpdateFolder(folder)) @@ -369,7 +367,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleMoveFolder(Dictionary request) { - Dictionary result = new Dictionary(); UUID parentID = UUID.Zero; UUID.TryParse(request["ParentID"].ToString(), out parentID); UUID folderID = UUID.Zero; @@ -387,7 +384,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleDeleteFolders(Dictionary request) { - Dictionary result = new Dictionary(); UUID principal = UUID.Zero; UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); List slist = (List)request["FOLDERS"]; @@ -408,7 +404,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandlePurgeFolder(Dictionary request) { - Dictionary result = new Dictionary(); UUID folderID = UUID.Zero; UUID.TryParse(request["ID"].ToString(), out folderID); @@ -421,7 +416,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleAddItem(Dictionary request) { - Dictionary result = new Dictionary(); InventoryItemBase item = BuildItem(request); if (m_InventoryService.AddItem(item)) @@ -432,7 +426,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleUpdateItem(Dictionary request) { - Dictionary result = new Dictionary(); InventoryItemBase item = BuildItem(request); if (m_InventoryService.UpdateItem(item)) @@ -443,7 +436,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleMoveItems(Dictionary request) { - Dictionary result = new Dictionary(); List idlist = (List)request["IDLIST"]; List destlist = (List)request["DESTLIST"]; UUID principal = UUID.Zero; @@ -482,7 +474,6 @@ namespace OpenSim.Server.Handlers.Asset byte[] HandleDeleteItems(Dictionary request) { - Dictionary result = new Dictionary(); UUID principal = UUID.Zero; UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); List slist = (List)request["ITEMS"]; diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 3104917..85bf96e 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -129,8 +129,6 @@ namespace OpenSim.Server.Handlers.Presence byte[] LogoutAgent(Dictionary request) { UUID session = UUID.Zero; - Vector3 position = Vector3.Zero; - Vector3 lookat = Vector3.Zero; if (!request.ContainsKey("SessionID")) return FailureResult(); diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 50d6fb2..f33eda7 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -38,7 +38,7 @@ namespace OpenSim.Server.Handlers.Simulation public class SimulationServiceInConnector : ServiceConnector { private ISimulationService m_LocalSimulationService; - private IAuthenticationService m_AuthenticationService; +// private IAuthenticationService m_AuthenticationService; public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) -- cgit v1.1