aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
diff options
context:
space:
mode:
authorJeff Ames2008-08-28 14:41:54 +0000
committerJeff Ames2008-08-28 14:41:54 +0000
commit3bf88587277b83c0b6f058fabba7d46a3b5a6a00 (patch)
treeed4ad9dc27e649a6f52661665fb681984251f480 /OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
parentThannk you, Ralphos, for a patch the corrects an improper cast in (diff)
downloadopensim-SC-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.zip
opensim-SC-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.gz
opensim-SC-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.bz2
opensim-SC-3bf88587277b83c0b6f058fabba7d46a3b5a6a00.tar.xz
Update svn properties, formatting cleanup.
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs40
1 files changed, 15 insertions, 25 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
index fa22481..19bf381 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
@@ -23,7 +23,7 @@
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29using System; 29using System;
@@ -38,11 +38,9 @@ using Nini.Config;
38 38
39namespace OpenSim.ApplicationPlugins.Rest.Inventory 39namespace OpenSim.ApplicationPlugins.Rest.Inventory
40{ 40{
41
42 public class Rest 41 public class Rest
43 { 42 {
44 43 internal static readonly log4net.ILog Log =
45 internal static readonly log4net.ILog Log =
46 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 45
48 internal static bool DEBUG = Log.IsDebugEnabled; 46 internal static bool DEBUG = Log.IsDebugEnabled;
@@ -77,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
77 /// HTTP requires that status information be generated for PUT 75 /// HTTP requires that status information be generated for PUT
78 /// and POST opertaions. This is in support of that. The 76 /// and POST opertaions. This is in support of that. The
79 /// operation verb gets substituted into the first string, 77 /// operation verb gets substituted into the first string,
80 /// and the completion code is inserted into the tail. The 78 /// and the completion code is inserted into the tail. The
81 /// strings are put here to encourage consistency. 79 /// strings are put here to encourage consistency.
82 /// </summary> 80 /// </summary>
83 81
@@ -88,7 +86,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
88 86
89 static Rest() 87 static Rest()
90 { 88 {
91 HttpStatusDesc = new Dictionary<int,string>(); 89 HttpStatusDesc = new Dictionary<int,string>();
92 if (HttpStatusCodeArray.Length != HttpStatusDescArray.Length) 90 if (HttpStatusCodeArray.Length != HttpStatusDescArray.Length)
93 { 91 {
94 Log.ErrorFormat("{0} HTTP Status Code and Description arrays do not match"); 92 Log.ErrorFormat("{0} HTTP Status Code and Description arrays do not match");
@@ -143,7 +141,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
143 /// supported by all servers. See Respond 141 /// supported by all servers. See Respond
144 /// to see how these are handled. 142 /// to see how these are handled.
145 /// </summary> 143 /// </summary>
146 144
147 // REST AGENT 1.0 interpretations 145 // REST AGENT 1.0 interpretations
148 public const string GET = "get"; // information retrieval - server state unchanged 146 public const string GET = "get"; // information retrieval - server state unchanged
149 public const string HEAD = "head"; // same as get except only the headers are returned. 147 public const string HEAD = "head"; // same as get except only the headers are returned.
@@ -175,7 +173,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
175 public static readonly char C_PERIOD = '.'; 173 public static readonly char C_PERIOD = '.';
176 public static readonly char C_COMMA = ','; 174 public static readonly char C_COMMA = ',';
177 public static readonly char C_DQUOTE = '"'; 175 public static readonly char C_DQUOTE = '"';
178 176
179 public static readonly string CS_SPACE = " "; 177 public static readonly string CS_SPACE = " ";
180 public static readonly string CS_SLASH = "/"; 178 public static readonly string CS_SLASH = "/";
181 public static readonly string CS_PATHSEP = "/"; 179 public static readonly string CS_PATHSEP = "/";
@@ -184,7 +182,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
184 public static readonly string CS_PERIOD = "."; 182 public static readonly string CS_PERIOD = ".";
185 public static readonly string CS_COMMA = ","; 183 public static readonly string CS_COMMA = ",";
186 public static readonly string CS_DQUOTE = "\""; 184 public static readonly string CS_DQUOTE = "\"";
187 185
188 public static readonly char[] CA_SPACE = { C_SPACE }; 186 public static readonly char[] CA_SPACE = { C_SPACE };
189 public static readonly char[] CA_SLASH = { C_SLASH }; 187 public static readonly char[] CA_SLASH = { C_SLASH };
190 public static readonly char[] CA_PATHSEP = { C_PATHSEP }; 188 public static readonly char[] CA_PATHSEP = { C_PATHSEP };
@@ -392,7 +390,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
392 public const string AS_DIGEST = "Digest"; 390 public const string AS_DIGEST = "Digest";
393 391
394 /// Supported Digest algorithms 392 /// Supported Digest algorithms
395 393
396 public const string Digest_MD5 = "MD5"; // assumedd efault if omitted 394 public const string Digest_MD5 = "MD5"; // assumedd efault if omitted
397 public const string Digest_MD5Sess = "MD5-sess"; 395 public const string Digest_MD5Sess = "MD5-sess";
398 396
@@ -440,7 +438,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
440 int val = 0; 438 int val = 0;
441 int sum = 0; 439 int sum = 0;
442 string tmp = null; 440 string tmp = null;
443 441
444 if (hex != null) 442 if (hex != null)
445 { 443 {
446 tmp = hex.ToLower(); 444 tmp = hex.ToLower();
@@ -455,7 +453,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
455 } 453 }
456 454
457 return sum; 455 return sum;
458
459 } 456 }
460 457
461 // Nonce management 458 // Nonce management
@@ -465,17 +462,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
465 return StringToBase64(CreationDate + Guid.NewGuid().ToString()); 462 return StringToBase64(CreationDate + Guid.NewGuid().ToString());
466 } 463 }
467 464
468 // Dump he specified data stream; 465 // Dump the specified data stream
469 466
470 public static void Dump(byte[] data) 467 public static void Dump(byte[] data)
471 { 468 {
472
473 char[] buffer = new char[Rest.DumpLineSize]; 469 char[] buffer = new char[Rest.DumpLineSize];
474 int cc = 0; 470 int cc = 0;
475 471
476 for (int i = 0; i < data.Length; i++) 472 for (int i = 0; i < data.Length; i++)
477 { 473 {
478
479 if (i % Rest.DumpLineSize == 0) Console.Write("\n{0}: ",i.ToString("d8")); 474 if (i % Rest.DumpLineSize == 0) Console.Write("\n{0}: ",i.ToString("d8"));
480 475
481 if (i % 4 == 0) Console.Write(" "); 476 if (i % 4 == 0) Console.Write(" ");
@@ -494,7 +489,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
494 Console.Write(" |"+(new String(buffer))+"|"); 489 Console.Write(" |"+(new String(buffer))+"|");
495 cc = 0; 490 cc = 0;
496 } 491 }
497
498 } 492 }
499 493
500 // Finish off any incomplete line 494 // Finish off any incomplete line
@@ -504,33 +498,29 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
504 for (int i = cc ; i < Rest.DumpLineSize; i++) 498 for (int i = cc ; i < Rest.DumpLineSize; i++)
505 { 499 {
506 if (i % 4 == 0) Console.Write(" "); 500 if (i % 4 == 0) Console.Write(" ");
507 Console.Write(" "); 501 Console.Write(" ");
508 buffer[i % Rest.DumpLineSize] = ' '; 502 buffer[i % Rest.DumpLineSize] = ' ';
509 } 503 }
510 Console.WriteLine(" |"+(new String(buffer))+"|"); 504 Console.WriteLine(" |"+(new String(buffer))+"|");
511 } 505 }
512 else 506 else
513 { 507 {
514 Console.Write("\n"); 508 Console.Write("\n");
515 } 509 }
516
517 } 510 }
518
519 } 511 }
520 512
521 // Local exception type 513 // Local exception type
522 514
523 public class RestException : Exception 515 public class RestException : Exception
524 { 516 {
525
526 internal int statusCode; 517 internal int statusCode;
527 internal string statusDesc; 518 internal string statusDesc;
528 internal string httpmethod; 519 internal string httpmethod;
529 internal string httppath; 520 internal string httppath;
530 521
531 public RestException(string msg) : base(msg) 522 public RestException(string msg) : base(msg)
532 { 523 {
533 } 524 }
534 } 525 }
535
536} 526}