diff options
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 0fb8314..0f6d79b 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -70,13 +70,22 @@ namespace OpenSim.Framework.Servers | |||
70 | m_port = port; | 70 | m_port = port; |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | ||
74 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | ||
75 | /// </summary> | ||
76 | /// <param name="handler"></param> | ||
73 | public void AddStreamHandler(IRequestHandler handler) | 77 | public void AddStreamHandler(IRequestHandler handler) |
74 | { | 78 | { |
75 | string httpMethod = handler.HttpMethod; | 79 | string httpMethod = handler.HttpMethod; |
76 | string path = handler.Path; | 80 | string path = handler.Path; |
77 | 81 | ||
78 | string handlerKey = GetHandlerKey(httpMethod, path); | 82 | string handlerKey = GetHandlerKey(httpMethod, path); |
79 | m_streamHandlers.Add(handlerKey, handler); | 83 | |
84 | if (!m_streamHandlers.ContainsKey(handlerKey)) | ||
85 | { | ||
86 | //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); | ||
87 | m_streamHandlers.Add(handlerKey, handler); | ||
88 | } | ||
80 | } | 89 | } |
81 | 90 | ||
82 | private static string GetHandlerKey(string httpMethod, string path) | 91 | private static string GetHandlerKey(string httpMethod, string path) |
@@ -289,7 +298,7 @@ namespace OpenSim.Framework.Servers | |||
289 | } | 298 | } |
290 | else | 299 | else |
291 | { | 300 | { |
292 | System.Console.WriteLine("Handler not found for http request " + request.RawUrl); | 301 | m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl); |
293 | responseString = "Error"; | 302 | responseString = "Error"; |
294 | } | 303 | } |
295 | } | 304 | } |
@@ -589,7 +598,11 @@ namespace OpenSim.Framework.Servers | |||
589 | 598 | ||
590 | public void RemoveStreamHandler(string httpMethod, string path) | 599 | public void RemoveStreamHandler(string httpMethod, string path) |
591 | { | 600 | { |
592 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); | 601 | string handlerKey = GetHandlerKey(httpMethod, path); |
602 | |||
603 | //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); | ||
604 | |||
605 | m_streamHandlers.Remove(handlerKey); | ||
593 | } | 606 | } |
594 | 607 | ||
595 | public void RemoveHTTPHandler(string httpMethod, string path) | 608 | public void RemoveHTTPHandler(string httpMethod, string path) |