change GetCapsDetails(..)

master
UbitUmarov 2020-04-23 23:58:06 +01:00
parent ca5756a100
commit 9000240238
1 changed files with 23 additions and 21 deletions

View File

@ -170,37 +170,39 @@ namespace OpenSim.Framework.Capabilities
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps) public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
{ {
Hashtable caps = new Hashtable(); Hashtable caps = new Hashtable();
if(requestedCaps == null)
return caps;
string protocol = "http://";
if (m_useSSL)
protocol = "https://";
string protocol = m_useSSL ? "https://" : "http://";
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
if (requestedCaps == null)
{
lock (m_capsHandlers)
{
foreach (KeyValuePair<string, ISimpleStreamHandler> kvp in m_capsSimpleHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
foreach (KeyValuePair<string, IRequestHandler> kvp in m_capsHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
}
return caps;
}
lock (m_capsHandlers) lock (m_capsHandlers)
{ {
foreach (string capsName in m_capsHandlers.Keys) for(int i = 0; i < requestedCaps.Count; ++i)
{ {
string capsName = requestedCaps[i];
if (excludeSeed && "SEED" == capsName) if (excludeSeed && "SEED" == capsName)
continue; continue;
if (!requestedCaps.Contains(capsName)) if (m_capsSimpleHandlers.TryGetValue(capsName, out ISimpleStreamHandler shdr))
{
caps[capsName] = baseUrl + shdr.Path;
continue; continue;
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
} }
foreach (string capsName in m_capsSimpleHandlers.Keys) if (m_capsHandlers.TryGetValue(capsName, out IRequestHandler chdr))
{ {
if (excludeSeed && "SEED" == capsName) caps[capsName] = baseUrl + chdr.Path;
continue; }
if (!requestedCaps.Contains(capsName))
continue;
caps[capsName] = baseUrl + m_capsSimpleHandlers[capsName].Path;
} }
} }