aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
diff options
context:
space:
mode:
authorDiva Canto2010-10-03 20:35:26 -0700
committerDiva Canto2010-10-03 20:35:26 -0700
commit934ae03d44716e7102d4548045a6aed891209603 (patch)
tree1f3f814e2f83797ccb5131bd9df0989bdaf19f3b /OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-934ae03d44716e7102d4548045a6aed891209603.zip
opensim-SC_OLD-934ae03d44716e7102d4548045a6aed891209603.tar.gz
opensim-SC_OLD-934ae03d44716e7102d4548045a6aed891209603.tar.bz2
opensim-SC_OLD-934ae03d44716e7102d4548045a6aed891209603.tar.xz
Made the Gatekeeper proxy-able.
Diffstat (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs')
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 2997430..1f7e502 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private ISimulationService m_SimulationService; 53 private ISimulationService m_SimulationService;
54 54
55 protected bool m_Proxy = false;
56
55 public AgentHandler() { } 57 public AgentHandler() { }
56 58
57 public AgentHandler(ISimulationService sim) 59 public AgentHandler(ISimulationService sim)
@@ -179,13 +181,31 @@ namespace OpenSim.Server.Handlers.Simulation
179 resp["reason"] = OSD.FromString(reason); 181 resp["reason"] = OSD.FromString(reason);
180 resp["success"] = OSD.FromBoolean(result); 182 resp["success"] = OSD.FromBoolean(result);
181 // Let's also send out the IP address of the caller back to the caller (HG 1.5) 183 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
182 resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); 184 resp["your_ip"] = OSD.FromString(GetCallerIP(request));
183 185
184 // TODO: add reason if not String.Empty? 186 // TODO: add reason if not String.Empty?
185 responsedata["int_response_code"] = HttpStatusCode.OK; 187 responsedata["int_response_code"] = HttpStatusCode.OK;
186 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 188 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
187 } 189 }
188 190
191 private string GetCallerIP(Hashtable request)
192 {
193 if (!m_Proxy)
194 return Util.GetCallerIP(request);
195
196 // We're behind a proxy
197 Hashtable headers = (Hashtable)request["headers"];
198 if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null)
199 {
200 IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]);
201 if (ep != null)
202 return ep.Address.ToString();
203 }
204
205 // Oops
206 return Util.GetCallerIP(request);
207 }
208
189 // subclasses can override this 209 // subclasses can override this
190 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 210 protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
191 { 211 {