receivers can't tell if there where proxies on path unless they look
parent
ea88927a65
commit
4da5d249d8
|
@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Login
|
||||||
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
|
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
if (m_Proxy && request.Params[3] != null)
|
if (request.Params[3] != null)
|
||||||
{
|
{
|
||||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
|
IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
|
||||||
if (ep != null)
|
if (ep != null)
|
||||||
|
|
|
@ -517,32 +517,30 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
|
|
||||||
protected string GetCallerIP(Hashtable request)
|
protected string GetCallerIP(Hashtable request)
|
||||||
{
|
{
|
||||||
if (!m_Proxy)
|
if (request.ContainsKey("headers"))
|
||||||
return Util.GetCallerIP(request);
|
|
||||||
|
|
||||||
// We're behind a proxy
|
|
||||||
Hashtable headers = (Hashtable)request["headers"];
|
|
||||||
|
|
||||||
//// DEBUG
|
|
||||||
//foreach (object o in headers.Keys)
|
|
||||||
// m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
|
|
||||||
|
|
||||||
string xff = "X-Forwarded-For";
|
|
||||||
if (headers.ContainsKey(xff.ToLower()))
|
|
||||||
xff = xff.ToLower();
|
|
||||||
|
|
||||||
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
Hashtable headers = (Hashtable)request["headers"];
|
||||||
return Util.GetCallerIP(request);
|
|
||||||
|
//// DEBUG
|
||||||
|
//foreach (object o in headers.Keys)
|
||||||
|
// m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
|
||||||
|
|
||||||
|
string xff = "X-Forwarded-For";
|
||||||
|
if (!headers.ContainsKey(xff))
|
||||||
|
xff = xff.ToLower();
|
||||||
|
|
||||||
|
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)
|
||||||
|
return ep.Address.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// Oops
|
||||||
return Util.GetCallerIP(request);
|
return Util.GetCallerIP(request);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue