diff options
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 17 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 17 |
2 files changed, 26 insertions, 8 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a5ec4f2..968c1e6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | |||
@@ -215,13 +215,22 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
215 | 215 | ||
216 | // We're behind a proxy | 216 | // We're behind a proxy |
217 | Hashtable headers = (Hashtable)request["headers"]; | 217 | Hashtable headers = (Hashtable)request["headers"]; |
218 | if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) | 218 | string xff = "X-Forwarded-For"; |
219 | if (headers.ContainsKey(xff.ToLower())) | ||
220 | xff = xff.ToLower(); | ||
221 | |||
222 | if (!headers.ContainsKey(xff) || headers[xff] == null) | ||
219 | { | 223 | { |
220 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | 224 | m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); |
221 | if (ep != null) | 225 | return Util.GetCallerIP(request); |
222 | return ep.Address.ToString(); | ||
223 | } | 226 | } |
224 | 227 | ||
228 | m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); | ||
229 | |||
230 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); | ||
231 | if (ep != null) | ||
232 | return ep.Address.ToString(); | ||
233 | |||
225 | // Oops | 234 | // Oops |
226 | return Util.GetCallerIP(request); | 235 | return Util.GetCallerIP(request); |
227 | } | 236 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8aa410b..6d01f80 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -205,13 +205,22 @@ namespace OpenSim.Server.Handlers.Simulation | |||
205 | 205 | ||
206 | // We're behind a proxy | 206 | // We're behind a proxy |
207 | Hashtable headers = (Hashtable)request["headers"]; | 207 | Hashtable headers = (Hashtable)request["headers"]; |
208 | if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) | 208 | string xff = "X-Forwarded-For"; |
209 | if (headers.ContainsKey(xff.ToLower())) | ||
210 | xff = xff.ToLower(); | ||
211 | |||
212 | if (!headers.ContainsKey(xff) || headers[xff] == null) | ||
209 | { | 213 | { |
210 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | 214 | m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); |
211 | if (ep != null) | 215 | return Util.GetCallerIP(request); |
212 | return ep.Address.ToString(); | ||
213 | } | 216 | } |
214 | 217 | ||
218 | m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); | ||
219 | |||
220 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); | ||
221 | if (ep != null) | ||
222 | return ep.Address.ToString(); | ||
223 | |||
215 | // Oops | 224 | // Oops |
216 | return Util.GetCallerIP(request); | 225 | return Util.GetCallerIP(request); |
217 | } | 226 | } |