aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs30
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs14
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs146
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs22
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs6
5 files changed, 112 insertions, 106 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
index cb88695..072bd6f 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
@@ -312,14 +312,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
312 // Now that everything is setup we can proceed to 312 // Now that everything is setup we can proceed to
313 // add THIS agent to the HTTP server's handler list 313 // add THIS agent to the HTTP server's handler list
314 314
315 if (!AddAgentHandler(Rest.Name,this)) 315 // FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
316 { 316 // have to be handled through the AddHttpHandler interface.
317 Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId); 317// if (!AddAgentHandler(Rest.Name,this))
318 foreach (IRest handler in handlers) 318// {
319 { 319// Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
320 handler.Close(); 320// foreach (IRest handler in handlers)
321 } 321// {
322 } 322// handler.Close();
323// }
324// }
323 325
324 } 326 }
325 catch (Exception e) 327 catch (Exception e)
@@ -342,11 +344,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
342 { 344 {
343 Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId); 345 Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
344 346
345 try 347 // FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
346 { 348 // have to be handled through the AddHttpHandler interface.
347 RemoveAgentHandler(Rest.Name, this); 349// try
348 } 350// {
349 catch (KeyNotFoundException){} 351// RemoveAgentHandler(Rest.Name, this);
352// }
353// catch (KeyNotFoundException){}
350 354
351 foreach (IRest handler in handlers) 355 foreach (IRest handler in handlers)
352 { 356 {
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index eb16750..a2425b5 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -297,7 +297,9 @@ namespace OpenSim.ApplicationPlugins.Rest
297 { 297 {
298 if (!IsEnabled) return false; 298 if (!IsEnabled) return false;
299 _agents.Add(agentName, handler); 299 _agents.Add(agentName, handler);
300 return _httpd.AddAgentHandler(agentName, handler); 300// return _httpd.AddAgentHandler(agentName, handler);
301
302 return false;
301 } 303 }
302 304
303 /// <summary> 305 /// <summary>
@@ -316,7 +318,7 @@ namespace OpenSim.ApplicationPlugins.Rest
316 if (_agents[agentName] == handler) 318 if (_agents[agentName] == handler)
317 { 319 {
318 _agents.Remove(agentName); 320 _agents.Remove(agentName);
319 return _httpd.RemoveAgentHandler(agentName, handler); 321// return _httpd.RemoveAgentHandler(agentName, handler);
320 } 322 }
321 return false; 323 return false;
322 } 324 }
@@ -358,10 +360,10 @@ namespace OpenSim.ApplicationPlugins.Rest
358 _httpd.RemoveStreamHandler(h.HttpMethod, h.Path); 360 _httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
359 } 361 }
360 _handlers = null; 362 _handlers = null;
361 foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents) 363// foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
362 { 364// {
363 _httpd.RemoveAgentHandler(h.Key, h.Value); 365// _httpd.RemoveAgentHandler(h.Key, h.Value);
364 } 366// }
365 _agents = null; 367 _agents = null;
366 } 368 }
367 369
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 05c2d53..8c29ad4 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
82 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>(); 82 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
83 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 83 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
84 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); 84 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
85 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); 85// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
86 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = 86 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
87 new Dictionary<string, PollServiceEventArgs>(); 87 new Dictionary<string, PollServiceEventArgs>();
88 88
@@ -260,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
260 return new List<string>(m_pollHandlers.Keys); 260 return new List<string>(m_pollHandlers.Keys);
261 } 261 }
262 262
263 // Note that the agent string is provided simply to differentiate 263// // Note that the agent string is provided simply to differentiate
264 // the handlers - it is NOT required to be an actual agent header 264// // the handlers - it is NOT required to be an actual agent header
265 // value. 265// // value.
266 public bool AddAgentHandler(string agent, IHttpAgentHandler handler) 266// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
267 { 267// {
268 lock (m_agentHandlers) 268// lock (m_agentHandlers)
269 { 269// {
270 if (!m_agentHandlers.ContainsKey(agent)) 270// if (!m_agentHandlers.ContainsKey(agent))
271 { 271// {
272 m_agentHandlers.Add(agent, handler); 272// m_agentHandlers.Add(agent, handler);
273 return true; 273// return true;
274 } 274// }
275 } 275// }
276 276//
277 //must already have a handler for that path so return false 277// //must already have a handler for that path so return false
278 return false; 278// return false;
279 } 279// }
280 280//
281 public List<string> GetAgentHandlerKeys() 281// public List<string> GetAgentHandlerKeys()
282 { 282// {
283 lock (m_agentHandlers) 283// lock (m_agentHandlers)
284 return new List<string>(m_agentHandlers.Keys); 284// return new List<string>(m_agentHandlers.Keys);
285 } 285// }
286 286
287 public bool AddLLSDHandler(string path, LLSDMethod handler) 287 public bool AddLLSDHandler(string path, LLSDMethod handler)
288 { 288 {
@@ -438,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer
438 438
439 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 439 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
440 440
441 // This is the REST agent interface. We require an agent to properly identify 441// // This is the REST agent interface. We require an agent to properly identify
442 // itself. If the REST handler recognizes the prefix it will attempt to 442// // itself. If the REST handler recognizes the prefix it will attempt to
443 // satisfy the request. If it is not recognizable, and no damage has occurred 443// // satisfy the request. If it is not recognizable, and no damage has occurred
444 // the request can be passed through to the other handlers. This is a low 444// // the request can be passed through to the other handlers. This is a low
445 // probability event; if a request is matched it is normally expected to be 445// // probability event; if a request is matched it is normally expected to be
446 // handled 446// // handled
447 IHttpAgentHandler agentHandler; 447// IHttpAgentHandler agentHandler;
448 448//
449 if (TryGetAgentHandler(request, response, out agentHandler)) 449// if (TryGetAgentHandler(request, response, out agentHandler))
450 { 450// {
451 if (HandleAgentRequest(agentHandler, request, response)) 451// if (HandleAgentRequest(agentHandler, request, response))
452 { 452// {
453 requestEndTick = Environment.TickCount; 453// requestEndTick = Environment.TickCount;
454 return; 454// return;
455 } 455// }
456 } 456// }
457 457
458 //response.KeepAlive = true; 458 //response.KeepAlive = true;
459 response.SendChunked = false; 459 response.SendChunked = false;
@@ -830,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer
830 } 830 }
831 } 831 }
832 832
833 private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) 833// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
834 { 834// {
835 agentHandler = null; 835// agentHandler = null;
836 836//
837 lock (m_agentHandlers) 837// lock (m_agentHandlers)
838 { 838// {
839 foreach (IHttpAgentHandler handler in m_agentHandlers.Values) 839// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
840 { 840// {
841 if (handler.Match(request, response)) 841// if (handler.Match(request, response))
842 { 842// {
843 agentHandler = handler; 843// agentHandler = handler;
844 return true; 844// return true;
845 } 845// }
846 } 846// }
847 } 847// }
848 848//
849 return false; 849// return false;
850 } 850// }
851 851
852 /// <summary> 852 /// <summary>
853 /// Try all the registered xmlrpc handlers when an xmlrpc request is received. 853 /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
@@ -1772,21 +1772,21 @@ namespace OpenSim.Framework.Servers.HttpServer
1772 m_pollHandlers.Remove(path); 1772 m_pollHandlers.Remove(path);
1773 } 1773 }
1774 1774
1775 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1775// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
1776 { 1776// {
1777 lock (m_agentHandlers) 1777// lock (m_agentHandlers)
1778 { 1778// {
1779 IHttpAgentHandler foundHandler; 1779// IHttpAgentHandler foundHandler;
1780 1780//
1781 if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) 1781// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
1782 { 1782// {
1783 m_agentHandlers.Remove(agent); 1783// m_agentHandlers.Remove(agent);
1784 return true; 1784// return true;
1785 } 1785// }
1786 } 1786// }
1787 1787//
1788 return false; 1788// return false;
1789 } 1789// }
1790 1790
1791 public void RemoveXmlRPCHandler(string method) 1791 public void RemoveXmlRPCHandler(string method)
1792 { 1792 {
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index db58f6f..0bd3aae 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
41 uint Port { get; } 41 uint Port { get; }
42 bool UseSSL { get; } 42 bool UseSSL { get; }
43 43
44 // Note that the agent string is provided simply to differentiate 44// // Note that the agent string is provided simply to differentiate
45 // the handlers - it is NOT required to be an actual agent header 45// // the handlers - it is NOT required to be an actual agent header
46 // value. 46// // value.
47 bool AddAgentHandler(string agent, IHttpAgentHandler handler); 47// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
48 48
49 /// <summary> 49 /// <summary>
50 /// Add a handler for an HTTP request. 50 /// Add a handler for an HTTP request.
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
106 106
107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); 107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
108 108
109 /// <summary> 109// /// <summary>
110 /// Remove the agent if it is registered. 110// /// Remove the agent if it is registered.
111 /// </summary> 111// /// </summary>
112 /// <param name="agent"></param> 112// /// <param name="agent"></param>
113 /// <param name="handler"></param> 113// /// <param name="handler"></param>
114 /// <returns></returns> 114// /// <returns></returns>
115 bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); 115// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
116 116
117 /// <summary> 117 /// <summary>
118 /// Remove an HTTP handler 118 /// Remove an HTTP handler
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index 72f9cce..4b61b18 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -231,9 +231,9 @@ namespace OpenSim.Framework.Servers
231 foreach (String s in httpServer.GetHTTPHandlerKeys()) 231 foreach (String s in httpServer.GetHTTPHandlerKeys())
232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); 232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
233 233
234 handlers.AppendFormat("* Agent:\n"); 234// handlers.AppendFormat("* Agent:\n");
235 foreach (String s in httpServer.GetAgentHandlerKeys()) 235// foreach (String s in httpServer.GetAgentHandlerKeys())
236 handlers.AppendFormat("\t{0}\n", s); 236// handlers.AppendFormat("\t{0}\n", s);
237 237
238 handlers.AppendFormat("* LLSD:\n"); 238 handlers.AppendFormat("* LLSD:\n");
239 foreach (String s in httpServer.GetLLSDHandlerKeys()) 239 foreach (String s in httpServer.GetLLSDHandlerKeys())