Пример #1
0
 void RemoveUrl (UrlData data)
 {
     MainServer.Instance.RemovePollServiceHTTPHandler ("", "/lslhttp/" + data.urlcode + "/");
 }
Пример #2
0
        public UUID RequestURL (IScriptModule engine, ISceneChildEntity host, UUID itemID)
        {
            UUID urlcode = UUID.Random ();

            lock (m_UrlMap) {
                if (m_UrlMap.Count >= m_TotalUrls) {
                    engine.PostScriptEvent (itemID, host.UUID, "http_request",
                                           new object [] { urlcode.ToString (), "URL_REQUEST_DENIED", "" });
                    return urlcode;
                }
                string url = MainServer.Instance.ServerURI + "/lslhttp/" + urlcode + "/";

                UrlData urlData = new UrlData {
                    hostID = host.UUID,
                    itemID = itemID,
                    engine = engine,
                    url = url,
                    urlcode = urlcode,
                    requests = new Dictionary<UUID, RequestData> ()
                };


                m_UrlMap [url] = urlData;

                string uri = "/lslhttp/" + urlcode + "/";
                MainServer.Instance.AddPollServiceHTTPHandler (uri, new PollServiceEventArgs (HttpRequestHandler, HasEvents,
                                                                                       GetEvents, NoEvents,
                                                                                       urlcode));

                engine.PostScriptEvent (itemID, host.UUID, "http_request",
                                       new object [] { urlcode.ToString (), "URL_REQUEST_GRANTED", url });
            }

            return urlcode;
        }