mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -806,7 +806,7 @@ namespace OpenSim.Framework
|
||||
IConfig config = source.Configs[RegionName];
|
||||
|
||||
if (config != null)
|
||||
source.Configs.Remove(RegionName);
|
||||
source.Configs.Remove(config);
|
||||
|
||||
config = source.AddConfig(RegionName);
|
||||
|
||||
@@ -865,10 +865,15 @@ namespace OpenSim.Framework
|
||||
|
||||
return;
|
||||
}
|
||||
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
|
||||
ignoreIncomingConfiguration, false);
|
||||
configMember.performConfigurationRetrieve();
|
||||
RegionFile = filename;
|
||||
else if (filename.ToLower().EndsWith(".xml"))
|
||||
{
|
||||
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
|
||||
ignoreIncomingConfiguration, false);
|
||||
configMember.performConfigurationRetrieve();
|
||||
RegionFile = filename;
|
||||
}
|
||||
else
|
||||
throw new Exception("Invalid file type for region persistence.");
|
||||
}
|
||||
|
||||
public void loadConfigurationOptionsFromMe()
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
@@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (methodWasFound)
|
||||
{
|
||||
xmlRprcRequest.Params.Add(request.Url); // Param[2]
|
||||
xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3]
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1495,5 +1495,49 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client IP address
|
||||
/// </summary>
|
||||
/// <param name="xff"></param>
|
||||
/// <returns></returns>
|
||||
public static IPEndPoint GetClientIPFromXFF(string xff)
|
||||
{
|
||||
if (xff == string.Empty)
|
||||
return null;
|
||||
|
||||
string[] parts = xff.Split(new char[] { ',' });
|
||||
if (parts.Length > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new IPEndPoint(IPAddress.Parse(parts[0]), 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetCallerIP(Hashtable req)
|
||||
{
|
||||
if (req.ContainsKey("headers"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable headers = (Hashtable)req["headers"];
|
||||
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
|
||||
return headers["remote_addr"].ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user