From 0af1d8fe196e403c066f7fc3dbc9f4b897b4da2c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 30 Apr 2013 23:35:59 +0200 Subject: [PATCH] Fix CAPS to work like they should - do not send caps to the viewer if they're not in the requested caps list. The previous wrong behavior caused the debug setting "UseHTTPInventory" to fail on all viewers when turned off. UDB inventory would not be correctly used in that case. --- OpenSim/Capabilities/CapsHandlers.cs | 7 +++++-- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 13 ++++++++++++- .../Framework/Caps/CapabilitiesModule.cs | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs index 1709f46c9c..458272d10c 100644 --- a/OpenSim/Capabilities/CapsHandlers.cs +++ b/OpenSim/Capabilities/CapsHandlers.cs @@ -158,7 +158,7 @@ namespace OpenSim.Framework.Capabilities /// capabilities and their handler details. /// /// If true, then exclude the seed cap. - public Hashtable GetCapsDetails(bool excludeSeed) + public Hashtable GetCapsDetails(bool excludeSeed, List requestedCaps) { Hashtable caps = new Hashtable(); string protocol = "http://"; @@ -175,6 +175,9 @@ namespace OpenSim.Framework.Capabilities if (excludeSeed && "SEED" == capsName) continue; + if (requestedCaps != null && !requestedCaps.Contains(capsName)) + continue; + caps[capsName] = baseUrl + m_capsHandlers[capsName].Path; } } @@ -182,4 +185,4 @@ namespace OpenSim.Framework.Capabilities return caps; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 921d3bfb7d..59b9585946 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -355,11 +355,22 @@ namespace OpenSim.Region.ClientStack.Linden return string.Empty; } - Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true); + OSDArray capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(request); + List validCaps = new List(); + + foreach (OSD c in capsRequested) + validCaps.Add(c.AsString()); + + Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); // Add the external too foreach (KeyValuePair kvp in m_HostCapsObj.ExternalCapsHandlers) + { + if (!validCaps.Contains(kvp.Key)) + continue; + caps[kvp.Key] = kvp.Value; + } string result = LLSDHelpers.SerialiseLLSDReply(caps); diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 2eb9bfb7c1..fff86d5862 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Framework { caps.AppendFormat("** Circuit {0}:\n", kvp.Key); - for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false).GetEnumerator(); kvp2.MoveNext(); ) + for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); ) { Uri uri = new Uri(kvp2.Value.ToString()); caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);