aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorDiva Canto2010-09-03 17:18:53 -0700
committerDiva Canto2010-09-03 17:18:53 -0700
commit8fc68c6d9810a0d229e94a0cefb35086c65dec36 (patch)
treeb327c9b55f7e8fe74ee9f19300a0033a4b2a2b74 /OpenSim/Framework
parentCreate Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) (diff)
downloadopensim-SC_OLD-8fc68c6d9810a0d229e94a0cefb35086c65dec36.zip
opensim-SC_OLD-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.gz
opensim-SC_OLD-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.bz2
opensim-SC_OLD-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.xz
Added XFF header processing. Untested, for lack of proxy.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Framework/Util.cs28
2 files changed, 30 insertions, 0 deletions
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 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized;
31using System.IO; 32using System.IO;
32using System.Net; 33using System.Net;
33using System.Net.Sockets; 34using 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 b5d025f..2ac4eb1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1495,5 +1495,33 @@ 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
1525
1498 } 1526 }
1499} 1527}