diff options
Diffstat (limited to '')
-rw-r--r-- | Servers/BaseHttpServer.cs | 20 | ||||
-rw-r--r-- | Servers/IRestHandler.cs | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/Servers/BaseHttpServer.cs b/Servers/BaseHttpServer.cs index 7c2a195..174402a 100644 --- a/Servers/BaseHttpServer.cs +++ b/Servers/BaseHttpServer.cs | |||
@@ -76,11 +76,23 @@ namespace OpenSim.Servers | |||
76 | string response; | 76 | string response; |
77 | RestMethod handler; | 77 | RestMethod handler; |
78 | 78 | ||
79 | string methodKey = String.Format("{0}: {1}", method, path); | 79 | string requestKey = String.Format("{0}: {1}", method, path); |
80 | 80 | ||
81 | if (m_restHandlers.TryGetValue(methodKey, out handler)) | 81 | string bestMatch = String.Empty; |
82 | foreach( string currentKey in m_restHandlers.Keys ) | ||
83 | { | ||
84 | if( requestKey.StartsWith( currentKey )) | ||
85 | { | ||
86 | if(currentKey.Length > bestMatch.Length ) | ||
87 | { | ||
88 | bestMatch = currentKey; | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | |||
93 | if (m_restHandlers.TryGetValue(bestMatch, out handler)) | ||
82 | { | 94 | { |
83 | response = handler(request); | 95 | response = handler(request, path); |
84 | 96 | ||
85 | } | 97 | } |
86 | else | 98 | else |
diff --git a/Servers/IRestHandler.cs b/Servers/IRestHandler.cs index deb77d8..46459ff 100644 --- a/Servers/IRestHandler.cs +++ b/Servers/IRestHandler.cs | |||
@@ -4,5 +4,5 @@ using System.Text; | |||
4 | 4 | ||
5 | namespace OpenSim.CAPS | 5 | namespace OpenSim.CAPS |
6 | { | 6 | { |
7 | public delegate string RestMethod( string request ); | 7 | public delegate string RestMethod( string request, string path ); |
8 | } | 8 | } |