aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs43
1 files changed, 25 insertions, 18 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
index fd4c295..c022e09 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
@@ -239,14 +239,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
239 Rest.Prefix = Prefix; 239 Rest.Prefix = Prefix;
240 Rest.GodKey = GodKey; 240 Rest.GodKey = GodKey;
241 241
242 Rest.Authenticate = Rest.Config.GetBoolean("authenticate",true); 242 Rest.Authenticate = Rest.Config.GetBoolean("authenticate", Rest.Authenticate);
243 Rest.Secure = Rest.Config.GetBoolean("secured",true); 243 Rest.Scheme = Rest.Config.GetString("auth-scheme", Rest.Scheme);
244 Rest.ExtendedEscape = Rest.Config.GetBoolean("extended-escape",true); 244 Rest.Secure = Rest.Config.GetBoolean("secured", Rest.Secure);
245 Rest.Realm = Rest.Config.GetString("realm","OpenSim REST"); 245 Rest.ExtendedEscape = Rest.Config.GetBoolean("extended-escape", Rest.ExtendedEscape);
246 Rest.DumpAsset = Rest.Config.GetBoolean("dump-asset",false); 246 Rest.Realm = Rest.Config.GetString("realm", Rest.Realm);
247 Rest.Fill = Rest.Config.GetBoolean("path-fill",true); 247 Rest.DumpAsset = Rest.Config.GetBoolean("dump-asset", Rest.DumpAsset);
248 Rest.DumpLineSize = Rest.Config.GetInt("dump-line-size",32); 248 Rest.Fill = Rest.Config.GetBoolean("path-fill", Rest.Fill);
249 Rest.FlushEnabled = Rest.Config.GetBoolean("flush-on-error",true); 249 Rest.DumpLineSize = Rest.Config.GetInt("dump-line-size", Rest.DumpLineSize);
250 Rest.FlushEnabled = Rest.Config.GetBoolean("flush-on-error", Rest.FlushEnabled);
251
252 // Note: Odd spacing is required in the following strings
250 253
251 Rest.Log.InfoFormat("{0} Authentication is {1}required", MsgId, 254 Rest.Log.InfoFormat("{0} Authentication is {1}required", MsgId,
252 (Rest.Authenticate ? "" : "not ")); 255 (Rest.Authenticate ? "" : "not "));
@@ -374,13 +377,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
374 377
375 string path = request.RawUrl.ToLower(); 378 string path = request.RawUrl.ToLower();
376 379
377 Rest.Log.DebugFormat("{0} Match ENTRY", MsgId); 380 // Rest.Log.DebugFormat("{0} Match ENTRY", MsgId);
378 381
379 try 382 try
380 { 383 {
381 foreach (string key in pathHandlers.Keys) 384 foreach (string key in pathHandlers.Keys)
382 { 385 {
383 Rest.Log.DebugFormat("{0} Match testing {1} against agent prefix <{2}>", MsgId, path, key); 386 // Rest.Log.DebugFormat("{0} Match testing {1} against agent prefix <{2}>", MsgId, path, key);
384 387
385 // Note that Match will not necessarily find the handler that will 388 // Note that Match will not necessarily find the handler that will
386 // actually be used - it does no test for the "closest" fit. It 389 // actually be used - it does no test for the "closest" fit. It
@@ -388,7 +391,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
388 391
389 if (path.StartsWith(key)) 392 if (path.StartsWith(key))
390 { 393 {
391 Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key); 394 // Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key);
392 395
393 // This apparently odd evaluation is needed to prevent a match 396 // This apparently odd evaluation is needed to prevent a match
394 // on anything other than a URI token boundary. Otherwise we 397 // on anything other than a URI token boundary. Otherwise we
@@ -404,7 +407,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
404 407
405 foreach (string key in streamHandlers.Keys) 408 foreach (string key in streamHandlers.Keys)
406 { 409 {
407 Rest.Log.DebugFormat("{0} Match testing {1} against stream prefix <{2}>", MsgId, path, key); 410 // Rest.Log.DebugFormat("{0} Match testing {1} against stream prefix <{2}>", MsgId, path, key);
408 411
409 // Note that Match will not necessarily find the handler that will 412 // Note that Match will not necessarily find the handler that will
410 // actually be used - it does no test for the "closest" fit. It 413 // actually be used - it does no test for the "closest" fit. It
@@ -412,7 +415,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
412 415
413 if (path.StartsWith(key)) 416 if (path.StartsWith(key))
414 { 417 {
415 Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key); 418 // Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key);
416 419
417 // This apparently odd evaluation is needed to prevent a match 420 // This apparently odd evaluation is needed to prevent a match
418 // on anything other than a URI token boundary. Otherwise we 421 // on anything other than a URI token boundary. Otherwise we
@@ -434,7 +437,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
434 437
435 /// <summary> 438 /// <summary>
436 /// This is called by the HTTP server once the handler has indicated 439 /// This is called by the HTTP server once the handler has indicated
437 /// that t is able to handle the request. 440 /// that it is able to handle the request.
438 /// Preconditions: 441 /// Preconditions:
439 /// [1] request != null and is a valid request object 442 /// [1] request != null and is a valid request object
440 /// [2] response != null and is a valid response object 443 /// [2] response != null and is a valid response object
@@ -474,7 +477,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
474 { 477 {
475 // A raw exception indicates that something we weren't expecting has 478 // A raw exception indicates that something we weren't expecting has
476 // happened. This should always reflect a shortcoming in the plugin, 479 // happened. This should always reflect a shortcoming in the plugin,
477 // or a failure to satisfy the preconditions. 480 // or a failure to satisfy the preconditions. It should not reflect
481 // an error in the request itself. Under such circumstances the state
482 // of the request cannot be determined and we are obliged to mark it
483 // as 'handled'.
484
478 Rest.Log.ErrorFormat("{0} Plugin error: {1}", MsgId, e.Message); 485 Rest.Log.ErrorFormat("{0} Plugin error: {1}", MsgId, e.Message);
479 handled = true; 486 handled = true;
480 } 487 }
@@ -497,7 +504,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
497 { 504 {
498 RequestData rdata = new RequestData(request, response, String.Empty); 505 RequestData rdata = new RequestData(request, response, String.Empty);
499 506
500 string bestMatch = null; 507 string bestMatch = String.Empty;
501 string path = String.Format("{0}:{1}", rdata.method, rdata.path).ToLower(); 508 string path = String.Format("{0}:{1}", rdata.method, rdata.path).ToLower();
502 509
503 Rest.Log.DebugFormat("{0} Checking for stream handler for <{1}>", MsgId, path); 510 Rest.Log.DebugFormat("{0} Checking for stream handler for <{1}>", MsgId, path);
@@ -511,7 +518,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
511 { 518 {
512 if (path.StartsWith(pattern)) 519 if (path.StartsWith(pattern))
513 { 520 {
514 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) 521 if (pattern.Length > bestMatch.Length)
515 { 522 {
516 bestMatch = pattern; 523 bestMatch = pattern;
517 } 524 }
@@ -520,7 +527,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
520 527
521 // Handle using the best match available 528 // Handle using the best match available
522 529
523 if (!String.IsNullOrEmpty(bestMatch)) 530 if (bestMatch.Length > 0)
524 { 531 {
525 Rest.Log.DebugFormat("{0} Stream-based handler matched with <{1}>", MsgId, bestMatch); 532 Rest.Log.DebugFormat("{0} Stream-based handler matched with <{1}>", MsgId, bestMatch);
526 RestStreamHandler handler = streamHandlers[bestMatch]; 533 RestStreamHandler handler = streamHandlers[bestMatch];