Account for some component along the way lower-casing the HTTP header keys. (XFF header issue)
parent
0aeb8981b2
commit
479d72ac97
|
@ -215,16 +215,21 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
|
|
||||||
// We're behind a proxy
|
// We're behind a proxy
|
||||||
Hashtable headers = (Hashtable)request["headers"];
|
Hashtable headers = (Hashtable)request["headers"];
|
||||||
if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null)
|
string xff = "X-Forwarded-For";
|
||||||
{
|
if (headers.ContainsKey(xff.ToLower()))
|
||||||
m_log.DebugFormat("[HOME AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]);
|
xff = xff.ToLower();
|
||||||
|
|
||||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]);
|
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||||
|
return Util.GetCallerIP(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||||
|
|
||||||
|
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||||
if (ep != null)
|
if (ep != null)
|
||||||
return ep.Address.ToString();
|
return ep.Address.ToString();
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[HOME AGENT HANDLER]: No XFF header");
|
|
||||||
|
|
||||||
// Oops
|
// Oops
|
||||||
return Util.GetCallerIP(request);
|
return Util.GetCallerIP(request);
|
||||||
|
|
|
@ -200,24 +200,21 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
|
|
||||||
// We're behind a proxy
|
// We're behind a proxy
|
||||||
Hashtable headers = (Hashtable)request["headers"];
|
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.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||||
m_log.DebugFormat("[XXX] {0}", o.ToString());
|
return Util.GetCallerIP(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null)
|
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||||
{
|
|
||||||
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]);
|
|
||||||
|
|
||||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]);
|
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||||
if (ep != null)
|
if (ep != null)
|
||||||
return ep.Address.ToString();
|
return ep.Address.ToString();
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
|
||||||
|
|
||||||
|
|
||||||
// Oops
|
// Oops
|
||||||
return Util.GetCallerIP(request);
|
return Util.GetCallerIP(request);
|
||||||
|
|
Loading…
Reference in New Issue