receivers can't tell if there where proxies on path unless they look

0.9.0-post-fixes
UbitUmarov 2017-05-22 21:22:04 +01:00
parent ea88927a65
commit 4da5d249d8
2 changed files with 23 additions and 25 deletions

View File

@ -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)

View File

@ -517,10 +517,8 @@ 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"]; Hashtable headers = (Hashtable)request["headers"];
//// DEBUG //// DEBUG
@ -528,7 +526,7 @@ namespace OpenSim.Server.Handlers.Simulation
// m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
string xff = "X-Forwarded-For"; string xff = "X-Forwarded-For";
if (headers.ContainsKey(xff.ToLower())) if (!headers.ContainsKey(xff))
xff = xff.ToLower(); xff = xff.ToLower();
if (!headers.ContainsKey(xff) || headers[xff] == null) if (!headers.ContainsKey(xff) || headers[xff] == null)
@ -542,7 +540,7 @@ namespace OpenSim.Server.Handlers.Simulation
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
if (ep != null) if (ep != null)
return ep.Address.ToString(); return ep.Address.ToString();
}
// Oops // Oops
return Util.GetCallerIP(request); return Util.GetCallerIP(request);
} }