aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs11
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs19
-rw-r--r--OpenSim/Framework/Util.cs22
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs100
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs11
9 files changed, 114 insertions, 76 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 878b0cc..fad4741 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -62,7 +62,12 @@ namespace OpenSim.Region.Capabilities
62 private string m_httpListenerHostName; 62 private string m_httpListenerHostName;
63 private uint m_httpListenPort; 63 private uint m_httpListenPort;
64 64
65 private string m_capsObjectPath = "00001-"; 65 /// <summary>
66 /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
67 /// </summary>
68 private string m_capsObjectPath;
69 public string CapsObjectPath { get { return m_capsObjectPath; } }
70
66 private string m_requestPath = "0000/"; 71 private string m_requestPath = "0000/";
67 private string m_mapLayerPath = "0001/"; 72 private string m_mapLayerPath = "0001/";
68 private string m_newInventory = "0002/"; 73 private string m_newInventory = "0002/";
@@ -109,9 +114,12 @@ namespace OpenSim.Region.Capabilities
109 114
110 try 115 try
111 { 116 {
117 m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath);
112 m_httpListener.AddStreamHandler( 118 m_httpListener.AddStreamHandler(
113 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, 119 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
114 GetMapLayer)); 120 GetMapLayer));
121
122 m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory);
115 m_httpListener.AddStreamHandler( 123 m_httpListener.AddStreamHandler(
116 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", 124 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
117 capsBase + m_newInventory, 125 capsBase + m_newInventory,
@@ -142,6 +150,7 @@ namespace OpenSim.Region.Capabilities
142 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) 150 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
143 { 151 {
144 string capsBase = "/CAPS/" + m_capsObjectPath; 152 string capsBase = "/CAPS/" + m_capsObjectPath;
153 httpListener.RemoveStreamHandler("POST", capsBase + path);
145 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 154 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
146 } 155 }
147 156
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 869ca60..cdf6257 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -63,5 +63,7 @@ namespace OpenSim.Framework
63 RegionStatus Region_Status { get; set; } 63 RegionStatus Region_Status { get; set; }
64 64
65 ClientManager ClientManager { get; } 65 ClientManager ClientManager { get; }
66
67 string GetCapsPath(LLUUID agentId);
66 } 68 }
67} 69}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 0fb8314..0f6d79b 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -70,13 +70,22 @@ namespace OpenSim.Framework.Servers
70 m_port = port; 70 m_port = port;
71 } 71 }
72 72
73 /// <summary>
74 /// Add a stream handler to the http server. If the handler already exists, then nothing happens.
75 /// </summary>
76 /// <param name="handler"></param>
73 public void AddStreamHandler(IRequestHandler handler) 77 public void AddStreamHandler(IRequestHandler handler)
74 { 78 {
75 string httpMethod = handler.HttpMethod; 79 string httpMethod = handler.HttpMethod;
76 string path = handler.Path; 80 string path = handler.Path;
77 81
78 string handlerKey = GetHandlerKey(httpMethod, path); 82 string handlerKey = GetHandlerKey(httpMethod, path);
79 m_streamHandlers.Add(handlerKey, handler); 83
84 if (!m_streamHandlers.ContainsKey(handlerKey))
85 {
86 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
87 m_streamHandlers.Add(handlerKey, handler);
88 }
80 } 89 }
81 90
82 private static string GetHandlerKey(string httpMethod, string path) 91 private static string GetHandlerKey(string httpMethod, string path)
@@ -289,7 +298,7 @@ namespace OpenSim.Framework.Servers
289 } 298 }
290 else 299 else
291 { 300 {
292 System.Console.WriteLine("Handler not found for http request " + request.RawUrl); 301 m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl);
293 responseString = "Error"; 302 responseString = "Error";
294 } 303 }
295 } 304 }
@@ -589,7 +598,11 @@ namespace OpenSim.Framework.Servers
589 598
590 public void RemoveStreamHandler(string httpMethod, string path) 599 public void RemoveStreamHandler(string httpMethod, string path)
591 { 600 {
592 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 601 string handlerKey = GetHandlerKey(httpMethod, path);
602
603 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
604
605 m_streamHandlers.Remove(handlerKey);
593 } 606 }
594 607
595 public void RemoveHTTPHandler(string httpMethod, string path) 608 public void RemoveHTTPHandler(string httpMethod, string path)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e16d15e..6c95c88 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,7 +45,6 @@ namespace OpenSim.Framework
45 private static Random randomClass = new Random(); 45 private static Random randomClass = new Random();
46 private static uint nextXferID = 5000; 46 private static uint nextXferID = 5000;
47 private static object XferLock = new object(); 47 private static object XferLock = new object();
48 private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
49 48
50 // Get a list of invalid path characters (OS dependent) 49 // Get a list of invalid path characters (OS dependent)
51 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; 50 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
@@ -422,27 +421,6 @@ namespace OpenSim.Framework
422 return "."; 421 return ".";
423 } 422 }
424 423
425 public static string GetCapsURL(LLUUID userID)
426 {
427 if (capsURLS.ContainsKey(userID))
428 {
429 return capsURLS[userID];
430 }
431 return String.Empty;
432 }
433
434 public static void SetCapsURL(LLUUID userID, string url)
435 {
436 if (capsURLS.ContainsKey(userID))
437 {
438 capsURLS[userID] = url;
439 }
440 else
441 {
442 capsURLS.Add(userID, url);
443 }
444 }
445
446 // Nini (config) related Methods 424 // Nini (config) related Methods
447 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) 425 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
448 { 426 {
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 3a763c8..f1ecc8a 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -984,7 +984,7 @@ namespace OpenSim.Region.ClientStack
984 agentData.child = false; 984 agentData.child = false;
985 agentData.firstname = m_firstName; 985 agentData.firstname = m_firstName;
986 agentData.lastname = m_lastName; 986 agentData.lastname = m_lastName;
987 agentData.CapsPath = String.Empty; 987 agentData.CapsPath = m_scene.GetCapsPath(m_agentId);
988 return agentData; 988 return agentData;
989 } 989 }
990 990
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e036a3a..7948a6f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1649,53 +1649,11 @@ namespace OpenSim.Region.Environment.Scenes
1649 { 1649 {
1650 if (regionHandle == m_regInfo.RegionHandle) 1650 if (regionHandle == m_regInfo.RegionHandle)
1651 { 1651 {
1652 if (agent.CapsPath != String.Empty) 1652 capsPaths[agent.AgentID] = agent.CapsPath;
1653 {
1654 m_log.DebugFormat(
1655 "[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}",
1656 agent.AgentID, agent.CapsPath, RegionInfo.RegionName);
1657 1653
1658 Caps cap = 1654 if (!agent.child)
1659 new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, 1655 {
1660 agent.CapsPath, agent.AgentID, m_dumpAssetsToFile); 1656 AddCapsHandler(agent.AgentID);
1661
1662 Util.SetCapsURL(agent.AgentID,
1663 "http://" + m_regInfo.ExternalHostName + ":" + m_httpListener.Port.ToString() +
1664 "/CAPS/" + agent.CapsPath + "0000/");
1665 cap.RegisterHandlers();
1666 if (agent.child)
1667 {
1668
1669 }
1670 cap.AddNewInventoryItem = AddInventoryItem;
1671 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
1672 cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
1673 cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
1674
1675 if (m_capsHandlers.ContainsKey(agent.AgentID))
1676 {
1677 m_log.DebugFormat(
1678 "[CONNECTION DEBUGGING]: Caps path already in use for avatar {0} in region {1}",
1679 agent.AgentID, RegionInfo.RegionName);
1680
1681 try
1682 {
1683 m_capsHandlers[agent.AgentID] = cap;
1684 }
1685 catch (KeyNotFoundException)
1686 {
1687 m_log.DebugFormat(
1688 "[CONNECTION DEBUGGING]: Caught exception adding handler for avatar {0} at {1}",
1689 agent.AgentID, RegionInfo.RegionName);
1690
1691 // Fix for a potential race condition.
1692 m_capsHandlers.Add(agent.AgentID, cap);
1693 }
1694 }
1695 else
1696 {
1697 m_capsHandlers.Add(agent.AgentID, cap);
1698 }
1699 } 1657 }
1700 else 1658 else
1701 { 1659 {
@@ -1716,6 +1674,56 @@ namespace OpenSim.Region.Environment.Scenes
1716 "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}", 1674 "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}",
1717 agent.AgentID, regionHandle, RegionInfo.RegionName); 1675 agent.AgentID, regionHandle, RegionInfo.RegionName);
1718 } 1676 }
1677 }
1678
1679 /// <summary>
1680 /// Add a caps handler for the given agent.
1681 /// </summary>
1682 /// <param name="agentId"></param>
1683 /// <param name="capsObjectPath"></param>
1684 public void AddCapsHandler(LLUUID agentId)
1685 {
1686 String capsObjectPath = GetCapsPath(agentId);
1687
1688 m_log.DebugFormat(
1689 "[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}",
1690 agentId, capsObjectPath, RegionInfo.RegionName);
1691
1692 Caps cap =
1693 new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
1694 capsObjectPath, agentId, m_dumpAssetsToFile);
1695
1696 cap.RegisterHandlers();
1697
1698 cap.AddNewInventoryItem = AddInventoryItem;
1699 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
1700 cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
1701 cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
1702
1703 if (m_capsHandlers.ContainsKey(agentId))
1704 {
1705 m_log.DebugFormat(
1706 "[CONNECTION DEBUGGING]: Caps path already in use for avatar {0} in region {1}",
1707 agentId, RegionInfo.RegionName);
1708
1709 try
1710 {
1711 m_capsHandlers[agentId] = cap;
1712 }
1713 catch (KeyNotFoundException)
1714 {
1715 m_log.DebugFormat(
1716 "[CONNECTION DEBUGGING]: Caught exception adding handler for avatar {0} at {1}",
1717 agentId, RegionInfo.RegionName);
1718
1719 // Fix for a potential race condition.
1720 m_capsHandlers.Add(agentId, cap);
1721 }
1722 }
1723 else
1724 {
1725 m_capsHandlers.Add(agentId, cap);
1726 }
1719 } 1727 }
1720 1728
1721 /// <summary> 1729 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 2cc5c4f..4002aaf 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
@@ -196,5 +197,19 @@ namespace OpenSim.Region.Environment.Scenes
196 } 197 }
197 198
198 #endregion 199 #endregion
200
201 /// <summary>
202 /// XXX These two methods are very temporary
203 /// </summary>
204 protected Dictionary<LLUUID, String> capsPaths = new Dictionary<LLUUID, String>();
205 public string GetCapsPath(LLUUID agentId)
206 {
207 if (capsPaths.ContainsKey(agentId))
208 {
209 return capsPaths[agentId];
210 }
211
212 return null;
213 }
199 } 214 }
200} 215}
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index e51c58d..d9c34e4 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes
483 } 483 }
484 484
485 /// <summary> 485 /// <summary>
486 /// 486 /// Try to teleport an agent to a new region.
487 /// </summary> 487 /// </summary>
488 /// <param name="remoteClient"></param> 488 /// <param name="remoteClient"></param>
489 /// <param name="RegionHandle"></param> 489 /// <param name="RegionHandle"></param>
@@ -530,7 +530,11 @@ namespace OpenSim.Region.Environment.Scenes
530 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, 530 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
531 position, false); 531 position, false);
532 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); 532 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
533 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); 533
534 // TODO Should construct this behind a method
535 string capsPath =
536 "http://" + reg.ExternalHostName + ":" + 9000 + "/CAPS/" + circuitdata.CapsPath + "0000/";
537
534 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), 538 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
535 capsPath); 539 capsPath);
536 avatar.MakeChildAgent(); 540 avatar.MakeChildAgent();
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 050bf95..67a4b97 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -545,6 +545,7 @@ namespace OpenSim.Region.Environment.Scenes
545 545
546 m_scene.SwapRootAgentCount(false); 546 m_scene.SwapRootAgentCount(false);
547 m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); 547 m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid);
548 m_scene.AddCapsHandler(m_uuid);
548 //if (!m_gotAllObjectsInScene) 549 //if (!m_gotAllObjectsInScene)
549 //{ 550 //{
550 m_scene.SendAllSceneObjectsToClient(this); 551 m_scene.SendAllSceneObjectsToClient(this);
@@ -1616,7 +1617,15 @@ namespace OpenSim.Region.Environment.Scenes
1616 if (res) 1617 if (res)
1617 { 1618 {
1618 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 1619 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
1619 string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); 1620
1621 // TODO Should construct this behind a method
1622 string capsPath =
1623 "http://" + neighbourRegion.ExternalHostName + ":" + 9000
1624 + "/CAPS/" + circuitdata.CapsPath + "0000/";
1625
1626 m_log.DebugFormat(
1627 "[CONNECTION DEBUGGING]: Sending new CAPS seed url {0} to avatar {1}", capsPath, m_uuid);
1628
1620 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, 1629 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
1621 capsPath); 1630 capsPath);
1622 MakeChildAgent(); 1631 MakeChildAgent();