CapsHandlers is a cap handler container but also takes care of adding and removing cap handlers to and from the supplied BaseHttpServer.
Exemplo n.º 1
0
        /// <summary>
        /// Return an LLSD-serializable Hashtable describing the
        /// capabilities and their handler details.
        /// </summary>
        /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
        public Hashtable GetCapsDetails(bool excludeSeed, List <string> requestedCaps)
        {
            Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);

            lock (m_pollServiceHandlers)
            {
                foreach (KeyValuePair <string, PollServiceEventArgs> kvp in m_pollServiceHandlers)
                {
                    if (!requestedCaps.Contains(kvp.Key))
                    {
                        continue;
                    }

                    string hostName = m_httpListenerHostName;
                    uint   port     = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
                    string protocol = "http";

                    if (MainServer.Instance.UseSSL)
                    {
                        hostName = MainServer.Instance.SSLCommonName;
                        port     = MainServer.Instance.SSLPort;
                        protocol = "https";
                    }
                    //
                    //            caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));

                    caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
                }
            }

            // Add the external too
            foreach (KeyValuePair <string, string> kvp in ExternalCapsHandlers)
            {
                if (!requestedCaps.Contains(kvp.Key))
                {
                    continue;
                }

                caps[kvp.Key] = kvp.Value;
            }

            Flags |= CapsFlags.SentSeeds;
            return(caps);
        }
Exemplo n.º 2
0
        public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, string regionName)
        {
            m_capsObjectPath       = capsPath;
            m_httpListener         = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen       = httpServer.SSLCommonName;
                httpPort         = httpServer.SSLPort;
            }

            m_agentID      = agent;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
            m_regionName   = regionName;
        }
Exemplo n.º 3
0
        public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, string regionName)
        {
            m_capsObjectPath       = capsPath;
            m_httpListener         = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen       = httpServer.SSLCommonName;
                httpPort         = httpServer.SSLPort;
            }

            m_agentID      = agent;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort);
            m_regionName   = regionName;
            Flags          = CapsFlags.None;
            m_capsActive.Reset();
        }
Exemplo n.º 4
0
        public Caps(IScene scene, IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, UUID agent, bool dumpAssetsToFile, string regionName)
        {
            m_Scene                = scene;
            m_assetCache           = assetCache;
            m_capsObjectPath       = capsPath;
            m_httpListener         = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen       = httpServer.SSLCommonName;
                httpPort         = httpServer.SSLPort;
            }

            m_agentID          = agent;
            m_dumpAssetsToFile = dumpAssetsToFile;
            m_capsHandlers     = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
            m_regionName       = regionName;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Return an LLSD-serializable Hashtable describing the
        /// capabilities and their handler details.
        /// </summary>
        /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
        public Hashtable GetCapsDetails(bool excludeSeed, List <string> requestedCaps)
        {
            Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);

            m_pollServiceHandlers.ForEach(delegate(KeyValuePair <string, PollServiceEventArgs> kvp)
            {
                if (!requestedCaps.Contains(kvp.Key))
                {
                    return;
                }

                string hostName = m_httpListenerHostName;
                uint port       = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
                string protocol = "http";

                if (MainServer.Instance.UseSSL)
                {
                    hostName = MainServer.Instance.SSLCommonName;
                    port     = MainServer.Instance.SSLPort;
                    protocol = "https";
                }

                caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
            });

            // Add the external too
            m_externalCapsHandlers.ForEach(delegate(KeyValuePair <string, string> kvp)
            {
                if (!requestedCaps.Contains(kvp.Key))
                {
                    return;
                }

                caps[kvp.Key] = kvp.Value;
            });

            return(caps);
        }
Exemplo n.º 6
0
        public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, string regionName)
        {
            m_capsObjectPath = capsPath;
            m_httpListener = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen = httpServer.SSLCommonName;
                httpPort = httpServer.SSLPort;
            }

            m_agentID = agent;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
            m_regionName = regionName;
        }
Exemplo n.º 7
0
        public Caps(IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, bool dumpAssetsToFile, string regionName)
        {
            m_assetCache = assetCache;
            m_capsObjectPath = capsPath;
            m_httpListener = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            if (httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen = httpServer.SSLCommonName;
                httpPort = httpServer.SSLPort;
            }

            m_agentID = agent;
            m_dumpAssetsToFile = dumpAssetsToFile;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL);
            m_regionName = regionName;
        }
Exemplo n.º 8
0
        public Caps(IScene scene, IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
                    UUID agent, bool dumpAssetsToFile, string regionName)
        {
            m_Scene = scene;
            m_assetCache = assetCache;
            m_capsObjectPath = capsPath;
            m_httpListener = httpServer;
            m_httpListenerHostName = httpListen;

            m_httpListenPort = httpPort;

            m_persistBakedTextures = false;
            IConfigSource config = m_Scene.Config;
            if (config != null)
            {
                IConfig sconfig = config.Configs["Startup"];
                if (sconfig != null)
                    m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures",m_persistBakedTextures);
            }

            if (httpServer != null && httpServer.UseSSL)
            {
                m_httpListenPort = httpServer.SSLPort;
                httpListen = httpServer.SSLCommonName;
                httpPort = httpServer.SSLPort;
            }

            m_agentID = agent;
            m_dumpAssetsToFile = dumpAssetsToFile;
            m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
            m_regionName = regionName;
        }