Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
0fcd55aff3
|
@ -51,11 +51,10 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// supplied BaseHttpServer.
|
/// supplied BaseHttpServer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="httpListener">base HTTP server</param>
|
/// <param name="httpListener">base HTTP server</param>
|
||||||
/// <param name="httpListenerHostname">host name of the HTTP
|
/// <param name="httpListenerHostname">host name of the HTTP server</param>
|
||||||
/// server</param>
|
|
||||||
/// <param name="httpListenerPort">HTTP port</param>
|
/// <param name="httpListenerPort">HTTP port</param>
|
||||||
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
|
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
|
||||||
: this (httpListener,httpListenerHostname,httpListenerPort, false)
|
: this(httpListener,httpListenerHostname,httpListenerPort, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,44 +87,52 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// handler to be removed</param>
|
/// handler to be removed</param>
|
||||||
public void Remove(string capsName)
|
public void Remove(string capsName)
|
||||||
{
|
{
|
||||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
|
lock (m_capsHandlers)
|
||||||
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
|
{
|
||||||
m_capsHandlers.Remove(capsName);
|
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
|
||||||
|
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
|
||||||
|
m_capsHandlers.Remove(capsName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsCap(string cap)
|
public bool ContainsCap(string cap)
|
||||||
{
|
{
|
||||||
return m_capsHandlers.ContainsKey(cap);
|
lock (m_capsHandlers)
|
||||||
|
return m_capsHandlers.ContainsKey(cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The indexer allows us to treat the CapsHandlers object
|
/// The indexer allows us to treat the CapsHandlers object
|
||||||
/// in an intuitive dictionary like way.
|
/// in an intuitive dictionary like way.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <Remarks>
|
/// <remarks>
|
||||||
/// The indexer will throw an exception when you try to
|
/// The indexer will throw an exception when you try to
|
||||||
/// retrieve a cap handler for a cap that is not contained in
|
/// retrieve a cap handler for a cap that is not contained in
|
||||||
/// CapsHandlers.
|
/// CapsHandlers.
|
||||||
/// </Remarks>
|
/// </remarks>
|
||||||
public IRequestHandler this[string idx]
|
public IRequestHandler this[string idx]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_capsHandlers[idx];
|
lock (m_capsHandlers)
|
||||||
|
return m_capsHandlers[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_capsHandlers.ContainsKey(idx))
|
lock (m_capsHandlers)
|
||||||
{
|
{
|
||||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
if (m_capsHandlers.ContainsKey(idx))
|
||||||
m_capsHandlers.Remove(idx);
|
{
|
||||||
|
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
||||||
|
m_capsHandlers.Remove(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == value) return;
|
||||||
|
|
||||||
|
m_capsHandlers[idx] = value;
|
||||||
|
m_httpListener.AddStreamHandler(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == value) return;
|
|
||||||
|
|
||||||
m_capsHandlers[idx] = value;
|
|
||||||
m_httpListener.AddStreamHandler(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +144,12 @@ namespace OpenSim.Framework.Capabilities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string[] __keys = new string[m_capsHandlers.Keys.Count];
|
lock (m_capsHandlers)
|
||||||
m_capsHandlers.Keys.CopyTo(__keys, 0);
|
{
|
||||||
return __keys;
|
string[] __keys = new string[m_capsHandlers.Keys.Count];
|
||||||
|
m_capsHandlers.Keys.CopyTo(__keys, 0);
|
||||||
|
return __keys;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,12 +167,16 @@ namespace OpenSim.Framework.Capabilities
|
||||||
protocol = "https://";
|
protocol = "https://";
|
||||||
|
|
||||||
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
|
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
|
||||||
foreach (string capsName in m_capsHandlers.Keys)
|
|
||||||
{
|
|
||||||
if (excludeSeed && "SEED" == capsName)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
|
lock (m_capsHandlers)
|
||||||
|
{
|
||||||
|
foreach (string capsName in m_capsHandlers.Keys)
|
||||||
|
{
|
||||||
|
if (excludeSeed && "SEED" == capsName)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
|
|
@ -232,9 +232,8 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
||||||
|
|
||||||
m_Server.AddPollServiceHTTPHandler(uri, HandleHttpPoll,
|
m_Server.AddPollServiceHTTPHandler(
|
||||||
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents,
|
uri, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, sessionID));
|
||||||
sessionID));
|
|
||||||
|
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
|
@ -266,11 +265,6 @@ namespace OpenSim.Framework.Console
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable HandleHttpPoll(Hashtable request)
|
|
||||||
{
|
|
||||||
return new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Hashtable HandleHttpCloseSession(Hashtable request)
|
private Hashtable HandleHttpCloseSession(Hashtable request)
|
||||||
{
|
{
|
||||||
DoExpire();
|
DoExpire();
|
||||||
|
|
|
@ -227,21 +227,17 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return new List<string>(m_HTTPHandlers.Keys);
|
return new List<string>(m_HTTPHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
|
public bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args)
|
||||||
{
|
{
|
||||||
bool pollHandlerResult = false;
|
|
||||||
lock (m_pollHandlers)
|
lock (m_pollHandlers)
|
||||||
{
|
{
|
||||||
if (!m_pollHandlers.ContainsKey(methodName))
|
if (!m_pollHandlers.ContainsKey(methodName))
|
||||||
{
|
{
|
||||||
m_pollHandlers.Add(methodName,args);
|
m_pollHandlers.Add(methodName, args);
|
||||||
pollHandlerResult = true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pollHandlerResult)
|
|
||||||
return AddHTTPHandler(methodName, handler);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1848,8 +1844,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
lock (m_pollHandlers)
|
lock (m_pollHandlers)
|
||||||
m_pollHandlers.Remove(path);
|
m_pollHandlers.Remove(path);
|
||||||
|
|
||||||
RemoveHTTPHandler(httpMethod, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
/// </returns>
|
/// </returns>
|
||||||
bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
|
bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
|
||||||
|
|
||||||
bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args);
|
bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a LLSD handler, yay.
|
/// Adds a LLSD handler, yay.
|
||||||
|
|
|
@ -361,7 +361,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// This will persist this beyond the expiry of the caps handlers
|
// This will persist this beyond the expiry of the caps handlers
|
||||||
MainServer.Instance.AddPollServiceHTTPHandler(
|
MainServer.Instance.AddPollServiceHTTPHandler(
|
||||||
capsBase + EventQueueGetUUID.ToString() + "/",
|
capsBase + EventQueueGetUUID.ToString() + "/",
|
||||||
EventQueuePoll,
|
|
||||||
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
|
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
|
||||||
|
|
||||||
Random rnd = new Random(Environment.TickCount);
|
Random rnd = new Random(Environment.TickCount);
|
||||||
|
@ -578,11 +577,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// return responsedata;
|
// return responsedata;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Hashtable EventQueuePoll(Hashtable request)
|
|
||||||
{
|
|
||||||
return new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
// public Hashtable EventQueuePath2(Hashtable request)
|
// public Hashtable EventQueuePath2(Hashtable request)
|
||||||
// {
|
// {
|
||||||
// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
|
// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
|
||||||
|
|
|
@ -90,11 +90,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
get { return null; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable HandleHttpPoll(Hashtable request)
|
|
||||||
{
|
|
||||||
return new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "UrlModule"; }
|
get { return "UrlModule"; }
|
||||||
|
@ -171,9 +166,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
|
|
||||||
string uri = "/lslhttp/" + urlcode.ToString() + "/";
|
string uri = "/lslhttp/" + urlcode.ToString() + "/";
|
||||||
|
|
||||||
m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
|
m_HttpServer.AddPollServiceHTTPHandler(
|
||||||
new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
|
uri,
|
||||||
urlcode));
|
new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode));
|
||||||
|
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
||||||
}
|
}
|
||||||
|
@ -213,9 +208,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
|
|
||||||
string uri = "/lslhttps/" + urlcode.ToString() + "/";
|
string uri = "/lslhttps/" + urlcode.ToString() + "/";
|
||||||
|
|
||||||
m_HttpsServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
|
m_HttpsServer.AddPollServiceHTTPHandler(
|
||||||
new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
|
uri,
|
||||||
urlcode));
|
new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode));
|
||||||
|
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue