aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETRestRegionPlugin.cs10
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs58
-rw-r--r--OpenSim/Framework/Communications/CAPSService.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs13
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs3
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs2
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs24
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs6
-rw-r--r--OpenSim/Region/DataSnapshot/DataRequestHandler.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs6
11 files changed, 110 insertions, 24 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRestRegionPlugin.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRestRegionPlugin.cs
index 2b006e0..a319a8b 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRestRegionPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRestRegionPlugin.cs
@@ -54,10 +54,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
54 public partial class RestRegionPlugin : RestPlugin 54 public partial class RestRegionPlugin : RestPlugin
55 { 55 {
56 #region GET methods 56 #region GET methods
57 public string GetHandler(string request, string path, string param) 57 public string GetHandler(string request, string path, string param,
58 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
58 { 59 {
60 // foreach (string h in httpRequest.Headers.AllKeys)
61 // foreach (string v in httpRequest.Headers.GetValues(h))
62 // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v);
63
64 MsgID = RequestID;
59 m_log.DebugFormat("{0} GET path {1} param {2}", MsgID, path, param); 65 m_log.DebugFormat("{0} GET path {1} param {2}", MsgID, path, param);
60 66
61 try 67 try
62 { 68 {
63 // param empty: regions list 69 // param empty: regions list
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index 8c370ed..4b8cdc1 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -240,9 +240,15 @@ namespace OpenSim.ApplicationPlugins.Rest
240 } 240 }
241 } 241 }
242 242
243
244 private List<RestStreamHandler> _handlers = new List<RestStreamHandler>(); 243 private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();
245 244
245 /// <summary>
246 /// Add a REST stream handler to the underlying HTTP server.
247 /// </summary>
248 /// <param name="httpMethod">GET/PUT/POST/DELETE or
249 /// similar</param>
250 /// <param name="path">URL prefix</param>
251 /// <param name="method">RestMethod handler doing the actual work</param>
246 public virtual void AddRestStreamHandler(string httpMethod, string path, RestMethod method) 252 public virtual void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
247 { 253 {
248 if (!IsEnabled) return; 254 if (!IsEnabled) return;
@@ -259,20 +265,50 @@ namespace OpenSim.ApplicationPlugins.Rest
259 m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path); 265 m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path);
260 } 266 }
261 267
262 public bool AddAgentHandler(string agentname, IHttpAgentHandler handler) 268 /// <summary>
269 /// Add a powerful Agent handler to the underlying HTTP
270 /// server.
271 /// </summary>
272 /// <param name="agentName">name of agent handler</param>
273 /// <param name="handler">agent handler method</param>
274 /// <returns>true when the plugin is disabled or the agent
275 /// handler could not be added..</returns>
276 public bool AddAgentHandler(string agentName, IHttpAgentHandler handler)
263 { 277 {
264 if (!IsEnabled) return false; 278 if (!IsEnabled) return false;
265 return _httpd.AddAgentHandler(agentname, handler); 279 return _httpd.AddAgentHandler(agentName, handler);
266 } 280 }
267 281
282 /// <summary>
283 /// Check whether the HTTP request came from god; that is, is
284 /// the god_key as configured in the config section supplied
285 /// via X-OpenSim-Godkey?
286 /// </summary>
287 /// <param name="request">HTTP request header</param>
288 /// <returns>true when the HTTP request came from god.</returns>
268 protected bool IsGod(OSHttpRequest request) 289 protected bool IsGod(OSHttpRequest request)
269 { 290 {
270 string[] keys = request.Headers.GetValues("x-opensim-godkey"); 291 string[] keys = request.Headers.GetValues("X-OpenSim-Godkey");
271 if (null == keys) return false; 292 if (null == keys) return false;
293
272 // we take the last key supplied 294 // we take the last key supplied
273 return keys[keys.Length-1] == _godkey; 295 return keys[keys.Length-1] == _godkey;
274 } 296 }
275 297
298 /// <summary>
299 /// Checks wether the X-OpenSim-Password value provided in the
300 /// HTTP header is indeed the password on file for the avatar
301 /// specified by the UUID
302 /// </summary>
303 protected bool IsVerifiedUser(OSHttpRequest request, LLUUID uuid)
304 {
305 // XXX under construction
306 return false;
307 }
308
309 /// <summary>
310 /// Clean up and remove all handlers that were added earlier.
311 /// </summary>
276 public virtual void Close() 312 public virtual void Close()
277 { 313 {
278 foreach (RestStreamHandler h in _handlers) 314 foreach (RestStreamHandler h in _handlers)
@@ -282,12 +318,26 @@ namespace OpenSim.ApplicationPlugins.Rest
282 _handlers = null; 318 _handlers = null;
283 } 319 }
284 320
321 /// <summary>
322 /// Return a failure message.
323 /// </summary>
324 /// <param name="method">origin of the failure message</param>
325 /// <param name="message>failure message</param>
326 /// <remarks>This should probably set a return code as
327 /// well. (?)</remarks>
285 protected string Failure(string method, string message) 328 protected string Failure(string method, string message)
286 { 329 {
287 m_log.ErrorFormat("{0} {1} failed: {2}", MsgID, method, message); 330 m_log.ErrorFormat("{0} {1} failed: {2}", MsgID, method, message);
288 return String.Format("<error>{0}</error>", message); 331 return String.Format("<error>{0}</error>", message);
289 } 332 }
290 333
334 /// <summary>
335 /// Return a failure message.
336 /// </summary>
337 /// <param name="method">origin of the failure message</param>
338 /// <param name="e">exception causing the failure message</param>
339 /// <remarks>This should probably set a return code as
340 /// well. (?)</remarks>
291 public string Failure(string method, Exception e) 341 public string Failure(string method, Exception e)
292 { 342 {
293 m_log.DebugFormat("{0} {1} failed: {2}", MsgID, method, e.ToString()); 343 m_log.DebugFormat("{0} {1} failed: {2}", MsgID, method, e.ToString());
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs
index caf96ff..07bea9d 100644
--- a/OpenSim/Framework/Communications/CAPSService.cs
+++ b/OpenSim/Framework/Communications/CAPSService.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Framework.Communications
45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); 45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
46 } 46 }
47 47
48 public string CapsRequest(string request, string path, string param) 48 public string CapsRequest(string request, string path, string param,
49 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
49 { 50 {
50 System.Console.WriteLine("new caps request " + request + " from path " + path); 51 System.Console.WriteLine("new caps request " + request + " from path " + path);
51 return String.Empty; 52 return String.Empty;
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 9725c94..8d8f945 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -208,8 +208,11 @@ namespace OpenSim.Framework.Communications.Capabilities
208 /// <param name="request"></param> 208 /// <param name="request"></param>
209 /// <param name="path"></param> 209 /// <param name="path"></param>
210 /// <param name="param"></param> 210 /// <param name="param"></param>
211 /// <param name="httpRequest">HTTP request header object</param>
212 /// <param name="httpResponse">HTTP response header object</param>
211 /// <returns></returns> 213 /// <returns></returns>
212 public string CapsRequest(string request, string path, string param) 214 public string CapsRequest(string request, string path, string param,
215 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
213 { 216 {
214 m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); 217 m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
215 //Console.WriteLine("caps request " + request); 218 //Console.WriteLine("caps request " + request);
@@ -503,8 +506,11 @@ namespace OpenSim.Framework.Communications.Capabilities
503 /// <param name="request"></param> 506 /// <param name="request"></param>
504 /// <param name="path"></param> 507 /// <param name="path"></param>
505 /// <param name="param"></param> 508 /// <param name="param"></param>
509 /// <param name="httpRequest">HTTP request header object</param>
510 /// <param name="httpResponse">HTTP response header object</param>
506 /// <returns></returns> 511 /// <returns></returns>
507 public string ScriptTaskInventory(string request, string path, string param) 512 public string ScriptTaskInventory(string request, string path, string param,
513 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
508 { 514 {
509 try 515 try
510 { 516 {
@@ -558,7 +564,8 @@ namespace OpenSim.Framework.Communications.Capabilities
558 /// <param name="path"></param> 564 /// <param name="path"></param>
559 /// <param name="param"></param> 565 /// <param name="param"></param>
560 /// <returns></returns> 566 /// <returns></returns>
561 public string NoteCardAgentInventory(string request, string path, string param) 567 public string NoteCardAgentInventory(string request, string path, string param,
568 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
562 { 569 {
563 m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName); 570 m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName);
564 //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); 571 //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request));
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index 1a31ef1..6bd34f5 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -27,5 +27,6 @@
27 27
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod(string request, string path, string param); 30 public delegate string RestMethod(string request, string path, string param,
31 OSHttpRequest httpRequest, OSHttpResponse httpResponse);
31} 32}
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
index 301b0a9..44c9dfc 100644
--- a/OpenSim/Framework/Servers/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Framework.Servers
49 streamReader.Close(); 49 streamReader.Close();
50 50
51 string param = GetParam(path); 51 string param = GetParam(path);
52 string responseString = m_restMethod(requestBody, path, param); 52 string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse);
53 53
54 return Encoding.UTF8.GetBytes(responseString); 54 return Encoding.UTF8.GetBytes(responseString);
55 } 55 }
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 83b5319..5a6a328 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -877,10 +877,13 @@ namespace OpenSim.Grid.GridServer
877 /// <param name="request"></param> 877 /// <param name="request"></param>
878 /// <param name="path"></param> 878 /// <param name="path"></param>
879 /// <param name="param"></param> 879 /// <param name="param"></param>
880 /// <param name="httpRequest">HTTP request header object</param>
881 /// <param name="httpResponse">HTTP response header object</param>
880 /// <returns></returns> 882 /// <returns></returns>
881 public string RestGetRegionMethod(string request, string path, string param) 883 public string RestGetRegionMethod(string request, string path, string param,
884 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
882 { 885 {
883 return RestGetSimMethod(String.Empty, "/sims/", param); 886 return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse);
884 } 887 }
885 888
886 /// <summary> 889 /// <summary>
@@ -889,10 +892,13 @@ namespace OpenSim.Grid.GridServer
889 /// <param name="request"></param> 892 /// <param name="request"></param>
890 /// <param name="path"></param> 893 /// <param name="path"></param>
891 /// <param name="param"></param> 894 /// <param name="param"></param>
895 /// <param name="httpRequest">HTTP request header object</param>
896 /// <param name="httpResponse">HTTP response header object</param>
892 /// <returns></returns> 897 /// <returns></returns>
893 public string RestSetRegionMethod(string request, string path, string param) 898 public string RestSetRegionMethod(string request, string path, string param,
899 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
894 { 900 {
895 return RestSetSimMethod(String.Empty, "/sims/", param); 901 return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse);
896 } 902 }
897 903
898 /// <summary> 904 /// <summary>
@@ -901,8 +907,11 @@ namespace OpenSim.Grid.GridServer
901 /// <param name="request"></param> 907 /// <param name="request"></param>
902 /// <param name="path"></param> 908 /// <param name="path"></param>
903 /// <param name="param">A string representing the sim's UUID</param> 909 /// <param name="param">A string representing the sim's UUID</param>
910 /// <param name="httpRequest">HTTP request header object</param>
911 /// <param name="httpResponse">HTTP response header object</param>
904 /// <returns>Information about the sim in XML</returns> 912 /// <returns>Information about the sim in XML</returns>
905 public string RestGetSimMethod(string request, string path, string param) 913 public string RestGetSimMethod(string request, string path, string param,
914 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
906 { 915 {
907 string respstring = String.Empty; 916 string respstring = String.Empty;
908 917
@@ -946,8 +955,11 @@ namespace OpenSim.Grid.GridServer
946 /// <param name="request"></param> 955 /// <param name="request"></param>
947 /// <param name="path"></param> 956 /// <param name="path"></param>
948 /// <param name="param"></param> 957 /// <param name="param"></param>
958 /// <param name="httpRequest">HTTP request header object</param>
959 /// <param name="httpResponse">HTTP response header object</param>
949 /// <returns>"OK" or an error</returns> 960 /// <returns>"OK" or an error</returns>
950 public string RestSetSimMethod(string request, string path, string param) 961 public string RestSetSimMethod(string request, string path, string param,
962 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
951 { 963 {
952 Console.WriteLine("Processing region update via REST method"); 964 Console.WriteLine("Processing region update via REST method");
953 RegionProfileData theSim; 965 RegionProfileData theSim;
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 1cf2a48..706f461 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -35,6 +35,7 @@ using log4net;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Servers;
38 39
39namespace OpenSim.Grid.UserServer 40namespace OpenSim.Grid.UserServer
40{ 41{
@@ -53,8 +54,11 @@ namespace OpenSim.Grid.UserServer
53 /// <param name="request">The request</param> 54 /// <param name="request">The request</param>
54 /// <param name="path">The path (eg /bork/narf/test)</param> 55 /// <param name="path">The path (eg /bork/narf/test)</param>
55 /// <param name="param">Parameters sent</param> 56 /// <param name="param">Parameters sent</param>
57 /// <param name="httpRequest">HTTP request header object</param>
58 /// <param name="httpResponse">HTTP response header object</param>
56 /// <returns>Success "OK" else error</returns> 59 /// <returns>Success "OK" else error</returns>
57 public string RestDeleteUserSessionMethod(string request, string path, string param) 60 public string RestDeleteUserSessionMethod(string request, string path, string param,
61 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
58 { 62 {
59 // TODO! Important! 63 // TODO! Important!
60 64
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
index abf2c1a..6ecae06 100644
--- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
@@ -72,7 +72,8 @@ namespace OpenSim.Region.DataSnapshot
72 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt)); 72 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
73 } 73 }
74 74
75 public string OnDiscoveryAttempt(string request, string path, string param) 75 public string OnDiscoveryAttempt(string request, string path, string param,
76 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
76 { 77 {
77 //Very static for now, flexible enough to add new formats 78 //Very static for now, flexible enough to add new formats
78 LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse(); 79 LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
index f8651a3..2e8a8da 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
@@ -131,14 +131,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice
131 string capsBase = "/CAPS/" + caps.CapsObjectPath; 131 string capsBase = "/CAPS/" + caps.CapsObjectPath;
132 caps.RegisterHandler("ParcelVoiceInfoRequest", 132 caps.RegisterHandler("ParcelVoiceInfoRequest",
133 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, 133 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
134 delegate(string request, string path, string param) 134 delegate(string request, string path, string param,
135 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
135 { 136 {
136 return ParcelVoiceInfoRequest(request, path, param, 137 return ParcelVoiceInfoRequest(request, path, param,
137 agentID, caps); 138 agentID, caps);
138 })); 139 }));
139 caps.RegisterHandler("ProvisionVoiceAccountRequest", 140 caps.RegisterHandler("ProvisionVoiceAccountRequest",
140 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, 141 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
141 delegate(string request, string path, string param) 142 delegate(string request, string path, string param,
143 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
142 { 144 {
143 return ProvisionVoiceAccountRequest(request, path, param, 145 return ProvisionVoiceAccountRequest(request, path, param,
144 agentID, caps); 146 agentID, caps);
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
index feb716e..77f761f 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
@@ -104,14 +104,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
104 string capsBase = "/CAPS/" + caps.CapsObjectPath; 104 string capsBase = "/CAPS/" + caps.CapsObjectPath;
105 caps.RegisterHandler("ParcelVoiceInfoRequest", 105 caps.RegisterHandler("ParcelVoiceInfoRequest",
106 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, 106 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
107 delegate(string request, string path, string param) 107 delegate(string request, string path, string param,
108 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
108 { 109 {
109 return ParcelVoiceInfoRequest(request, path, param, 110 return ParcelVoiceInfoRequest(request, path, param,
110 agentID, caps); 111 agentID, caps);
111 })); 112 }));
112 caps.RegisterHandler("ProvisionVoiceAccountRequest", 113 caps.RegisterHandler("ProvisionVoiceAccountRequest",
113 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, 114 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
114 delegate(string request, string path, string param) 115 delegate(string request, string path, string param,
116 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
115 { 117 {
116 return ProvisionVoiceAccountRequest(request, path, param, 118 return ProvisionVoiceAccountRequest(request, path, param,
117 agentID, caps); 119 agentID, caps);