diff options
author | Diva Canto | 2010-09-03 17:18:53 -0700 |
---|---|---|
committer | Diva Canto | 2010-09-03 17:18:53 -0700 |
commit | 8fc68c6d9810a0d229e94a0cefb35086c65dec36 (patch) | |
tree | b327c9b55f7e8fe74ee9f19300a0033a4b2a2b74 /OpenSim/Framework/Util.cs | |
parent | Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) (diff) | |
download | opensim-SC-8fc68c6d9810a0d229e94a0cefb35086c65dec36.zip opensim-SC-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.gz opensim-SC-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.bz2 opensim-SC-8fc68c6d9810a0d229e94a0cefb35086c65dec36.tar.xz |
Added XFF header processing. Untested, for lack of proxy.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 28 |
1 files changed, 28 insertions, 0 deletions
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 | } |