expose uripath

master
UbitUmarov 2020-04-23 18:16:56 +01:00
parent 5a51553e7d
commit e818c570bb
4 changed files with 25 additions and 3 deletions

View File

@ -98,7 +98,8 @@ namespace OpenSim.Framework.Servers.HttpServer
protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>();
protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
protected ConcurrentDictionary<string, IRequestHandler> m_streamHandlers = new ConcurrentDictionary<string, IRequestHandler>();
protected ConcurrentDictionary<string, IRequestHandler> m_streamHandlers = new ConcurrentDictionary<string, IRequestHandler>();
protected ConcurrentDictionary<string, ISimpleStreamHandler> m_simpleStreamHandlers = new ConcurrentDictionary<string, ISimpleStreamHandler>();
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
protected ConcurrentDictionary<string, PollServiceEventArgs> m_pollHandlers =
@ -329,7 +330,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string path = handler.Path;
string handlerKey = GetHandlerKey(httpMethod, path);
// m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
// m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
m_streamHandlers.TryAdd(handlerKey, handler);
}
@ -342,6 +343,12 @@ namespace OpenSim.Framework.Servers.HttpServer
m_streamHandlers.TryAdd(handler.Path, handler);
}
public void AddSimpleStreamHandler(ISimpleStreamHandler handler)
{
// m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
m_simpleStreamHandlers.TryAdd(handler.Path, handler);
}
public void AddWebSocketHandler(string servicepath, WebSocketRequestDelegate handler)
{
lock (m_WebSocketHandlers)
@ -1054,6 +1061,10 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
private bool TryGetSimpleStreamHandler(string uripath, out ISimpleStreamHandler handler)
{
return m_simpleStreamHandlers.TryGetValue(uripath, out handler);
}
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
// {
// agentHandler = null;
@ -2117,6 +2128,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_streamHandlers.TryRemove(path, out IRequestHandler dummy);
}
public void RemoveSimpleStreamHandler(string path)
{
m_simpleStreamHandlers.TryRemove(path, out ISimpleStreamHandler dummy);
}
public void RemoveHTTPHandler(string httpMethod, string path)
{
if (path == null) return; // Caps module isn't loaded, tries to remove handler where path = null

View File

@ -78,7 +78,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </returns>
bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
bool AddPollServiceHTTPHandler(string ulr, PollServiceEventArgs args);
bool AddPollServiceHTTPHandler(string uripath, PollServiceEventArgs args);
bool AddPollServiceHTTPHandler(PollServiceEventArgs args);
void RemovePollServiceHTTPHandler(string url, string path);

View File

@ -58,6 +58,7 @@ namespace OpenSim.Framework.Servers.HttpServer
IPEndPoint RemoteIPEndPoint { get; }
IPEndPoint LocalIPEndPoint { get; }
Uri Url { get; }
string UriPath { get; }
string UserAgent { get; }
}
}

View File

@ -181,6 +181,11 @@ namespace OpenSim.Framework.Servers.HttpServer
get { return m_request.Uri; }
}
public string UriPath
{
get { return m_request.UriPath; }
}
public string UserAgent
{
get { return m_userAgent; }