diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid')
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index 0066bd4..968c1e6 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | |||
@@ -215,15 +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 | { | 219 | if (headers.ContainsKey(xff.ToLower())) |
220 | m_log.DebugFormat("[HOME AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); | 220 | xff = xff.ToLower(); |
221 | 221 | ||
222 | IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); | 222 | if (!headers.ContainsKey(xff) || headers[xff] == null) |
223 | if (ep != null) | 223 | { |
224 | return ep.Address.ToString(); | 224 | m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); |
225 | return Util.GetCallerIP(request); | ||
225 | } | 226 | } |
226 | 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 | |||
227 | // Oops | 234 | // Oops |
228 | return Util.GetCallerIP(request); | 235 | return Util.GetCallerIP(request); |
229 | } | 236 | } |