remove redundant code

master
UbitUmarov 2020-04-23 13:24:08 +01:00
parent 212c25f906
commit 92518129ee
1 changed files with 1 additions and 28 deletions

View File

@ -136,7 +136,7 @@ namespace OpenSim.Server.Handlers.MapImage
if (m_GridService != null)
{
System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
IPAddress ipAddr = httpRequest.RemoteIPEndPoint.Address;
GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y));
if (r != null)
{
@ -145,7 +145,6 @@ namespace OpenSim.Server.Handlers.MapImage
m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
return FailureResult("IP address of caller does not match IP address of registered region");
}
}
else
{
@ -223,31 +222,5 @@ namespace OpenSim.Server.Handlers.MapImage
return Util.DocToBytes(doc);
}
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
{
// if (!m_Proxy)
// return request.RemoteIPEndPoint.Address;
// We're behind a proxy
string xff = "X-Forwarded-For";
string xffValue = request.Headers[xff.ToLower()];
if (xffValue == null || (xffValue != null && xffValue == string.Empty))
xffValue = request.Headers[xff];
if (xffValue == null || (xffValue != null && xffValue == string.Empty))
{
// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
return request.RemoteIPEndPoint.Address;
}
System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
if (ep != null)
return ep.Address;
// Oops
return request.RemoteIPEndPoint.Address;
}
}
}