diff options
author | Melanie | 2010-09-05 15:06:00 +0100 |
---|---|---|
committer | Melanie | 2010-09-05 15:06:00 +0100 |
commit | e4c2b44e5cb756b957a96d13ad9a611dfba12df4 (patch) | |
tree | d7978fc31ce346cae467df7a81737cfa323ae6c1 /OpenSim/Framework | |
parent | Remove "Dwell" support from core and replace it with calls to methods (diff) | |
parent | Remove "Dwell" support from core and replace it with calls to methods (diff) | |
download | opensim-SC_OLD-e4c2b44e5cb756b957a96d13ad9a611dfba12df4.zip opensim-SC_OLD-e4c2b44e5cb756b957a96d13ad9a611dfba12df4.tar.gz opensim-SC_OLD-e4c2b44e5cb756b957a96d13ad9a611dfba12df4.tar.bz2 opensim-SC_OLD-e4c2b44e5cb756b957a96d13ad9a611dfba12df4.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 44 |
3 files changed, 56 insertions, 5 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ec25118..e36a72b 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -806,7 +806,7 @@ namespace OpenSim.Framework | |||
806 | IConfig config = source.Configs[RegionName]; | 806 | IConfig config = source.Configs[RegionName]; |
807 | 807 | ||
808 | if (config != null) | 808 | if (config != null) |
809 | source.Configs.Remove(RegionName); | 809 | source.Configs.Remove(config); |
810 | 810 | ||
811 | config = source.AddConfig(RegionName); | 811 | config = source.AddConfig(RegionName); |
812 | 812 | ||
@@ -865,10 +865,15 @@ namespace OpenSim.Framework | |||
865 | 865 | ||
866 | return; | 866 | return; |
867 | } | 867 | } |
868 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, | 868 | else if (filename.ToLower().EndsWith(".xml")) |
869 | ignoreIncomingConfiguration, false); | 869 | { |
870 | configMember.performConfigurationRetrieve(); | 870 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, |
871 | RegionFile = filename; | 871 | ignoreIncomingConfiguration, false); |
872 | configMember.performConfigurationRetrieve(); | ||
873 | RegionFile = filename; | ||
874 | } | ||
875 | else | ||
876 | throw new Exception("Invalid file type for region persistence."); | ||
872 | } | 877 | } |
873 | 878 | ||
874 | public void loadConfigurationOptionsFromMe() | 879 | public void loadConfigurationOptionsFromMe() |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 95c3e6c..d20f8c9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Collections.Specialized; | ||
31 | using System.IO; | 32 | using System.IO; |
32 | using System.Net; | 33 | using System.Net; |
33 | using System.Net.Sockets; | 34 | using System.Net.Sockets; |
@@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
737 | if (methodWasFound) | 738 | if (methodWasFound) |
738 | { | 739 | { |
739 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 740 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
741 | xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] | ||
740 | 742 | ||
741 | try | 743 | try |
742 | { | 744 | { |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index af5a0ce..b66d826 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1495,5 +1495,49 @@ namespace OpenSim.Framework | |||
1495 | } | 1495 | } |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | /// <summary> | ||
1499 | /// Gets the client IP address | ||
1500 | /// </summary> | ||
1501 | /// <param name="xff"></param> | ||
1502 | /// <returns></returns> | ||
1503 | public static IPEndPoint GetClientIPFromXFF(string xff) | ||
1504 | { | ||
1505 | if (xff == string.Empty) | ||
1506 | return null; | ||
1507 | |||
1508 | string[] parts = xff.Split(new char[] { ',' }); | ||
1509 | if (parts.Length > 0) | ||
1510 | { | ||
1511 | try | ||
1512 | { | ||
1513 | return new IPEndPoint(IPAddress.Parse(parts[0]), 0); | ||
1514 | } | ||
1515 | catch (Exception e) | ||
1516 | { | ||
1517 | m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message); | ||
1518 | } | ||
1519 | } | ||
1520 | |||
1521 | return null; | ||
1522 | } | ||
1523 | |||
1524 | public static string GetCallerIP(Hashtable req) | ||
1525 | { | ||
1526 | if (req.ContainsKey("headers")) | ||
1527 | { | ||
1528 | try | ||
1529 | { | ||
1530 | Hashtable headers = (Hashtable)req["headers"]; | ||
1531 | if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) | ||
1532 | return headers["remote_addr"].ToString(); | ||
1533 | } | ||
1534 | catch (Exception e) | ||
1535 | { | ||
1536 | m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message); | ||
1537 | } | ||
1538 | } | ||
1539 | return string.Empty; | ||
1540 | } | ||
1541 | |||
1498 | } | 1542 | } |
1499 | } | 1543 | } |