Better string matching when searching for REST handlers: must match an entire path component (ending with '/' or a similar character).
For example, these should match: "/assets" and "/assets/12345", but these shouldn't match: "/assets" and "/assets_exist".0.8.0.3
parent
bbfda8e19e
commit
aa217cf90f
|
@ -857,6 +857,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
private readonly string HANDLER_SEPARATORS = "/?&#";
|
||||
|
||||
private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler)
|
||||
{
|
||||
string bestMatch = null;
|
||||
|
@ -865,7 +867,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
foreach (string pattern in m_streamHandlers.Keys)
|
||||
{
|
||||
if (handlerKey.StartsWith(pattern))
|
||||
if ((handlerKey == pattern)
|
||||
|| (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0)))
|
||||
{
|
||||
if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
|
||||
{
|
||||
|
@ -895,7 +898,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
foreach (string pattern in m_pollHandlers.Keys)
|
||||
{
|
||||
if (handlerKey.StartsWith(pattern))
|
||||
if ((handlerKey == pattern)
|
||||
|| (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0)))
|
||||
{
|
||||
if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
|
||||
{
|
||||
|
@ -927,7 +931,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
foreach (string pattern in m_HTTPHandlers.Keys)
|
||||
{
|
||||
if (handlerKey.StartsWith(pattern))
|
||||
if ((handlerKey == pattern)
|
||||
|| (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0)))
|
||||
{
|
||||
if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue