diff options
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 103 |
1 files changed, 56 insertions, 47 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index efa71f2..1b34209 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -549,26 +549,29 @@ namespace OpenSim.Framework.Servers | |||
549 | 549 | ||
550 | string bestMatch = null; | 550 | string bestMatch = null; |
551 | 551 | ||
552 | foreach (string pattern in m_HTTPHandlers.Keys) | 552 | lock (m_HTTPHandlers) |
553 | { | 553 | { |
554 | if (handlerKey.StartsWith(pattern)) | 554 | foreach (string pattern in m_HTTPHandlers.Keys) |
555 | { | 555 | { |
556 | if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) | 556 | if (handlerKey.StartsWith(pattern)) |
557 | { | 557 | { |
558 | bestMatch = pattern; | 558 | if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) |
559 | { | ||
560 | bestMatch = pattern; | ||
561 | } | ||
559 | } | 562 | } |
560 | } | 563 | } |
561 | } | ||
562 | 564 | ||
563 | if (String.IsNullOrEmpty(bestMatch)) | 565 | if (String.IsNullOrEmpty(bestMatch)) |
564 | { | 566 | { |
565 | HTTPHandler = null; | 567 | HTTPHandler = null; |
566 | return false; | 568 | return false; |
567 | } | 569 | } |
568 | else | 570 | else |
569 | { | 571 | { |
570 | HTTPHandler = m_HTTPHandlers[bestMatch]; | 572 | HTTPHandler = m_HTTPHandlers[bestMatch]; |
571 | return true; | 573 | return true; |
574 | } | ||
572 | } | 575 | } |
573 | } | 576 | } |
574 | 577 | ||
@@ -925,25 +928,28 @@ namespace OpenSim.Framework.Servers | |||
925 | 928 | ||
926 | //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); | 929 | //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); |
927 | 930 | ||
928 | foreach (string pattern in m_HTTPHandlers.Keys) | 931 | lock (m_HTTPHandlers) |
929 | { | 932 | { |
930 | if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) | 933 | foreach (string pattern in m_HTTPHandlers.Keys) |
931 | { | 934 | { |
932 | bestMatch = pattern; | 935 | if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) |
936 | { | ||
937 | bestMatch = pattern; | ||
938 | } | ||
933 | } | 939 | } |
934 | } | ||
935 | 940 | ||
936 | // extra kicker to remove the default XMLRPC login case.. just in case.. | 941 | // extra kicker to remove the default XMLRPC login case.. just in case.. |
937 | if (path == "/") | 942 | if (path == "/") |
938 | return false; | 943 | return false; |
939 | 944 | ||
940 | if (String.IsNullOrEmpty(bestMatch)) | 945 | if (String.IsNullOrEmpty(bestMatch)) |
941 | { | 946 | { |
942 | return false; | 947 | return false; |
943 | } | 948 | } |
944 | else | 949 | else |
945 | { | 950 | { |
946 | return true; | 951 | return true; |
952 | } | ||
947 | } | 953 | } |
948 | } | 954 | } |
949 | 955 | ||
@@ -1214,32 +1220,35 @@ namespace OpenSim.Framework.Servers | |||
1214 | // m_log.DebugFormat( | 1220 | // m_log.DebugFormat( |
1215 | // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); | 1221 | // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); |
1216 | 1222 | ||
1217 | foreach (string pattern in m_HTTPHandlers.Keys) | 1223 | lock (m_HTTPHandlers) |
1218 | { | 1224 | { |
1219 | if (searchquery.ToLower().StartsWith(pattern.ToLower())) | 1225 | foreach (string pattern in m_HTTPHandlers.Keys) |
1220 | { | 1226 | { |
1221 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) | 1227 | if (searchquery.ToLower().StartsWith(pattern.ToLower())) |
1222 | { | 1228 | { |
1223 | // You have to specifically register for '/' and to get it, you must specificaly request it | 1229 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) |
1224 | // | 1230 | { |
1225 | if (pattern == "/" && searchquery == "/" || pattern != "/") | 1231 | // You have to specifically register for '/' and to get it, you must specificaly request it |
1226 | bestMatch = pattern; | 1232 | // |
1233 | if (pattern == "/" && searchquery == "/" || pattern != "/") | ||
1234 | bestMatch = pattern; | ||
1235 | } | ||
1227 | } | 1236 | } |
1228 | } | 1237 | } |
1229 | } | ||
1230 | 1238 | ||
1231 | if (String.IsNullOrEmpty(bestMatch)) | 1239 | if (String.IsNullOrEmpty(bestMatch)) |
1232 | { | 1240 | { |
1233 | httpHandler = null; | 1241 | httpHandler = null; |
1234 | return false; | ||
1235 | } | ||
1236 | else | ||
1237 | { | ||
1238 | if (bestMatch == "/" && searchquery != "/") | ||
1239 | return false; | 1242 | return false; |
1243 | } | ||
1244 | else | ||
1245 | { | ||
1246 | if (bestMatch == "/" && searchquery != "/") | ||
1247 | return false; | ||
1240 | 1248 | ||
1241 | httpHandler = m_HTTPHandlers[bestMatch]; | 1249 | httpHandler = m_HTTPHandlers[bestMatch]; |
1242 | return true; | 1250 | return true; |
1251 | } | ||
1243 | } | 1252 | } |
1244 | } | 1253 | } |
1245 | 1254 | ||