diff options
author | Jeff Ames | 2008-08-18 00:39:10 +0000 |
---|---|---|
committer | Jeff Ames | 2008-08-18 00:39:10 +0000 |
commit | 6ef9d4da901a346c232458317cca6268da888e2e (patch) | |
tree | dd1d935b10f34f261839da9f9879c02322e8ede7 /OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs | |
parent | Update svn properties, minor formatting cleanup. (diff) | |
download | opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.zip opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.gz opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.bz2 opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs index 94aecbd..6fc3ea3 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs | |||
@@ -23,7 +23,6 @@ | |||
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 | * | ||
27 | */ | 26 | */ |
28 | 27 | ||
29 | using System; | 28 | using System; |
@@ -44,14 +43,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
44 | 43 | ||
45 | /// <summary> | 44 | /// <summary> |
46 | /// This class represents the current REST request. It | 45 | /// This class represents the current REST request. It |
47 | /// encapsulates the request/response state and takes care | 46 | /// encapsulates the request/response state and takes care |
48 | /// of response generation without exposing the REST handler | 47 | /// of response generation without exposing the REST handler |
49 | /// to the actual mechanisms involved. | 48 | /// to the actual mechanisms involved. |
50 | /// | 49 | /// |
51 | /// This structure is created on entry to the Handler | 50 | /// This structure is created on entry to the Handler |
52 | /// method and is disposed of upon return. It is part of | 51 | /// method and is disposed of upon return. It is part of |
53 | /// the plug-in infrastructure, rather than the functionally | 52 | /// the plug-in infrastructure, rather than the functionally |
54 | /// specific REST handler, and fundamental changes to | 53 | /// specific REST handler, and fundamental changes to |
55 | /// this should be reflected in the Rest HandlerVersion. The | 54 | /// this should be reflected in the Rest HandlerVersion. The |
56 | /// object is instantiated, and may be extended by, any | 55 | /// object is instantiated, and may be extended by, any |
57 | /// given handler. See the inventory handler for an example | 56 | /// given handler. See the inventory handler for an example |
@@ -100,7 +99,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
100 | internal bool chunked = false; | 99 | internal bool chunked = false; |
101 | 100 | ||
102 | // Authentication related state | 101 | // Authentication related state |
103 | 102 | ||
104 | internal bool authenticated = false; | 103 | internal bool authenticated = false; |
105 | // internal string scheme = Rest.AS_DIGEST; | 104 | // internal string scheme = Rest.AS_DIGEST; |
106 | // internal string scheme = Rest.AS_BASIC; | 105 | // internal string scheme = Rest.AS_BASIC; |
@@ -132,7 +131,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
132 | private static readonly string[] EmptyPath = { String.Empty }; | 131 | private static readonly string[] EmptyPath = { String.Empty }; |
133 | 132 | ||
134 | // Session related tables. These are only needed if QOP is set to "auth-sess" | 133 | // Session related tables. These are only needed if QOP is set to "auth-sess" |
135 | // and for now at least, it is not. Session related authentication is of | 134 | // and for now at least, it is not. Session related authentication is of |
136 | // questionable merit in the context of REST anyway, but it is, arguably, more | 135 | // questionable merit in the context of REST anyway, but it is, arguably, more |
137 | // secure. | 136 | // secure. |
138 | 137 | ||
@@ -148,27 +147,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
148 | 147 | ||
149 | private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*", | 148 | private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*", |
150 | RegexOptions.Compiled | RegexOptions.IgnoreCase); | 149 | RegexOptions.Compiled | RegexOptions.IgnoreCase); |
151 | 150 | ||
152 | private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*", | 151 | private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*", |
153 | RegexOptions.Compiled | RegexOptions.IgnoreCase); | 152 | RegexOptions.Compiled | RegexOptions.IgnoreCase); |
154 | 153 | ||
155 | private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"", | 154 | private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"", |
156 | RegexOptions.Compiled | RegexOptions.IgnoreCase); | 155 | RegexOptions.Compiled | RegexOptions.IgnoreCase); |
157 | 156 | ||
158 | private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)", | 157 | private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)", |
159 | RegexOptions.Compiled | RegexOptions.IgnoreCase); | 158 | RegexOptions.Compiled | RegexOptions.IgnoreCase); |
160 | 159 | ||
161 | private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)", | 160 | private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)", |
162 | RegexOptions.Compiled | RegexOptions.IgnoreCase); | 161 | RegexOptions.Compiled | RegexOptions.IgnoreCase); |
163 | 162 | ||
164 | // For efficiency, we create static instances of these objects | 163 | // For efficiency, we create static instances of these objects |
165 | 164 | ||
166 | private static MD5 md5hash = MD5.Create(); | 165 | private static MD5 md5hash = MD5.Create(); |
167 | 166 | ||
168 | private static StringComparer sc = StringComparer.OrdinalIgnoreCase; | 167 | private static StringComparer sc = StringComparer.OrdinalIgnoreCase; |
169 | 168 | ||
170 | // Constructor | 169 | // Constructor |
171 | 170 | ||
172 | internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) | 171 | internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) |
173 | { | 172 | { |
174 | 173 | ||
@@ -203,7 +202,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
203 | internal bool IsAuthenticated | 202 | internal bool IsAuthenticated |
204 | { | 203 | { |
205 | get | 204 | get |
206 | { | 205 | { |
207 | if (Rest.Authenticate) | 206 | if (Rest.Authenticate) |
208 | { | 207 | { |
209 | if (!authenticated) | 208 | if (!authenticated) |
@@ -223,7 +222,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
223 | /// Realm, domain, etc. | 222 | /// Realm, domain, etc. |
224 | /// | 223 | /// |
225 | /// This method checks to see if the current request is already | 224 | /// This method checks to see if the current request is already |
226 | /// authenticated for this domain. If it is, then it returns | 225 | /// authenticated for this domain. If it is, then it returns |
227 | /// true. If it is not, then it issues a challenge to the client | 226 | /// true. If it is not, then it issues a challenge to the client |
228 | /// and responds negatively to the request. | 227 | /// and responds negatively to the request. |
229 | /// </summary> | 228 | /// </summary> |
@@ -243,7 +242,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
243 | Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId); | 242 | Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId); |
244 | DoChallenge(); | 243 | DoChallenge(); |
245 | } | 244 | } |
246 | 245 | ||
247 | // So, we have authentication data, now we have to check to | 246 | // So, we have authentication data, now we have to check to |
248 | // see what we got and whether or not it is valid for the | 247 | // see what we got and whether or not it is valid for the |
249 | // current domain. To do this we need to interpret the data | 248 | // current domain. To do this we need to interpret the data |
@@ -327,7 +326,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
327 | foreach (Match m in matches) | 326 | foreach (Match m in matches) |
328 | { | 327 | { |
329 | authparms.Add("response",m.Groups["pval"].Value); | 328 | authparms.Add("response",m.Groups["pval"].Value); |
330 | Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}", | 329 | Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}", |
331 | MsgId, "response", m.Groups["pval"].Value); | 330 | MsgId, "response", m.Groups["pval"].Value); |
332 | } | 331 | } |
333 | 332 | ||
@@ -369,7 +368,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
369 | foreach (Match m in matches) | 368 | foreach (Match m in matches) |
370 | { | 369 | { |
371 | authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); | 370 | authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); |
372 | Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}", | 371 | Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}", |
373 | MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); | 372 | MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); |
374 | } | 373 | } |
375 | 374 | ||
@@ -380,7 +379,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
380 | foreach (Match m in matches) | 379 | foreach (Match m in matches) |
381 | { | 380 | { |
382 | authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); | 381 | authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); |
383 | Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}", | 382 | Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}", |
384 | MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); | 383 | MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); |
385 | } | 384 | } |
386 | 385 | ||
@@ -417,7 +416,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
417 | 416 | ||
418 | if (!authparms.TryGetValue("nonce", out nonce) || nonce == null) | 417 | if (!authparms.TryGetValue("nonce", out nonce) || nonce == null) |
419 | { | 418 | { |
420 | Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId); | 419 | Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId); |
421 | break; | 420 | break; |
422 | } | 421 | } |
423 | 422 | ||
@@ -428,7 +427,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
428 | { | 427 | { |
429 | if (temp != opaque) | 428 | if (temp != opaque) |
430 | { | 429 | { |
431 | Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId); | 430 | Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId); |
432 | break; | 431 | break; |
433 | } | 432 | } |
434 | } | 433 | } |
@@ -440,7 +439,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
440 | { | 439 | { |
441 | if (temp != algorithm) | 440 | if (temp != algorithm) |
442 | { | 441 | { |
443 | Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId); | 442 | Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId); |
444 | break; | 443 | break; |
445 | } | 444 | } |
446 | } | 445 | } |
@@ -457,7 +456,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
457 | 456 | ||
458 | if (!authparms.ContainsKey("cnonce")) | 457 | if (!authparms.ContainsKey("cnonce")) |
459 | { | 458 | { |
460 | Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId); | 459 | Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId); |
461 | break; | 460 | break; |
462 | } | 461 | } |
463 | 462 | ||
@@ -465,7 +464,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
465 | 464 | ||
466 | if (!authparms.TryGetValue("nc", out nck) || nck == null) | 465 | if (!authparms.TryGetValue("nc", out nck) || nck == null) |
467 | { | 466 | { |
468 | Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId); | 467 | Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId); |
469 | break; | 468 | break; |
470 | } | 469 | } |
471 | 470 | ||
@@ -477,7 +476,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
477 | 476 | ||
478 | if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck)) | 477 | if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck)) |
479 | { | 478 | { |
480 | Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId); | 479 | Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId); |
481 | break; | 480 | break; |
482 | } | 481 | } |
483 | cntable[nonce] = nck; | 482 | cntable[nonce] = nck; |
@@ -497,12 +496,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
497 | // these MUST NOT be present. | 496 | // these MUST NOT be present. |
498 | if (authparms.ContainsKey("cnonce")) | 497 | if (authparms.ContainsKey("cnonce")) |
499 | { | 498 | { |
500 | Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId); | 499 | Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId); |
501 | break; | 500 | break; |
502 | } | 501 | } |
503 | if (authparms.ContainsKey("nc")) | 502 | if (authparms.ContainsKey("nc")) |
504 | { | 503 | { |
505 | Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId); | 504 | Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId); |
506 | break; | 505 | break; |
507 | } | 506 | } |
508 | } | 507 | } |
@@ -511,7 +510,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
511 | 510 | ||
512 | authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); | 511 | authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); |
513 | 512 | ||
514 | } | 513 | } |
515 | while (false); | 514 | while (false); |
516 | 515 | ||
517 | } | 516 | } |
@@ -608,7 +607,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
608 | } | 607 | } |
609 | 608 | ||
610 | // We don;t know the userid that will be used | 609 | // We don;t know the userid that will be used |
611 | // so we cannot make any authentication domain | 610 | // so we cannot make any authentication domain |
612 | // assumptions. So the prefix will determine | 611 | // assumptions. So the prefix will determine |
613 | // this. | 612 | // this. |
614 | 613 | ||
@@ -624,7 +623,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
624 | } | 623 | } |
625 | 624 | ||
626 | /// <summary> | 625 | /// <summary> |
627 | /// This method provides validation in support of the BASIC | 626 | /// This method provides validation in support of the BASIC |
628 | /// authentication method. This is not normaly expected to be | 627 | /// authentication method. This is not normaly expected to be |
629 | /// used, but is included for completeness (and because I tried | 628 | /// used, but is included for completeness (and because I tried |
630 | /// it first). | 629 | /// it first). |
@@ -650,11 +649,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
650 | /// <summary> | 649 | /// <summary> |
651 | /// This mechanism is used by the digest authetnication mechanism | 650 | /// This mechanism is used by the digest authetnication mechanism |
652 | /// to return the user's password. In fact, because the OpenSim | 651 | /// to return the user's password. In fact, because the OpenSim |
653 | /// user's passwords are already hashed, and the HTTP mechanism | 652 | /// user's passwords are already hashed, and the HTTP mechanism |
654 | /// does not supply an open password, the hashed passwords cannot | 653 | /// does not supply an open password, the hashed passwords cannot |
655 | /// be used unless the cliemt has used the same salting mechanism | 654 | /// be used unless the cliemt has used the same salting mechanism |
656 | /// to has the password before using it in the authentication | 655 | /// to has the password before using it in the authentication |
657 | /// algorithn. This is not inconceivable... | 656 | /// algorithm. This is not inconceivable... |
658 | /// </summary> | 657 | /// </summary> |
659 | 658 | ||
660 | private string getPassword(string user) | 659 | private string getPassword(string user) |
@@ -665,12 +664,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
665 | string last; | 664 | string last; |
666 | 665 | ||
667 | // Distinguish the parts, if necessary | 666 | // Distinguish the parts, if necessary |
668 | 667 | ||
669 | if ((x=user.IndexOf(Rest.C_SPACE)) != -1) | 668 | if ((x=user.IndexOf(Rest.C_SPACE)) != -1) |
670 | { | 669 | { |
671 | first = user.Substring(0,x); | 670 | first = user.Substring(0,x); |
672 | last = user.Substring(x+1); | 671 | last = user.Substring(x+1); |
673 | } | 672 | } |
674 | else | 673 | else |
675 | { | 674 | { |
676 | first = user; | 675 | first = user; |
@@ -712,12 +711,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
712 | string last; | 711 | string last; |
713 | 712 | ||
714 | // Distinguish the parts, if necessary | 713 | // Distinguish the parts, if necessary |
715 | 714 | ||
716 | if ((x=user.IndexOf(Rest.C_SPACE)) != -1) | 715 | if ((x=user.IndexOf(Rest.C_SPACE)) != -1) |
717 | { | 716 | { |
718 | first = user.Substring(0,x); | 717 | first = user.Substring(0,x); |
719 | last = user.Substring(x+1); | 718 | last = user.Substring(x+1); |
720 | } | 719 | } |
721 | else | 720 | else |
722 | { | 721 | { |
723 | first = user; | 722 | first = user; |
@@ -733,9 +732,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
733 | 732 | ||
734 | HA1 = HashToString(pass); | 733 | HA1 = HashToString(pass); |
735 | HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); | 734 | HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); |
736 | 735 | ||
737 | return (0 == sc.Compare(HA1, udata.PasswordHash)); | 736 | return (0 == sc.Compare(HA1, udata.PasswordHash)); |
738 | 737 | ||
739 | } | 738 | } |
740 | 739 | ||
741 | // Validate the request-digest | 740 | // Validate the request-digest |
@@ -784,7 +783,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
784 | HA2 = HashToString(patt); | 783 | HA2 = HashToString(patt); |
785 | 784 | ||
786 | // Generate Digest | 785 | // Generate Digest |
787 | 786 | ||
788 | if (qop != String.Empty) | 787 | if (qop != String.Empty) |
789 | { | 788 | { |
790 | patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2); | 789 | patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2); |
@@ -856,7 +855,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
856 | Fail(code, message, true); | 855 | Fail(code, message, true); |
857 | } | 856 | } |
858 | 857 | ||
859 | // More adventurous. This failure also includes a | 858 | // More adventurous. This failure also includes a |
860 | // specified entity. | 859 | // specified entity. |
861 | 860 | ||
862 | internal void Fail(int code, string message, string data) | 861 | internal void Fail(int code, string message, string data) |
@@ -899,7 +898,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
899 | fail = true; | 898 | fail = true; |
900 | 899 | ||
901 | Respond("Failure response"); | 900 | Respond("Failure response"); |
902 | 901 | ||
903 | RestException re = new RestException(message+" <"+code+">"); | 902 | RestException re = new RestException(message+" <"+code+">"); |
904 | 903 | ||
905 | re.statusCode = code; | 904 | re.statusCode = code; |
@@ -918,7 +917,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
918 | Fail(Rest.HttpStatusCodeNotImplemented, Rest.HttpStatusDescNotImplemented); | 917 | Fail(Rest.HttpStatusCodeNotImplemented, Rest.HttpStatusDescNotImplemented); |
919 | } | 918 | } |
920 | 919 | ||
921 | // This MUST be called by an agent handler before it returns | 920 | // This MUST be called by an agent handler before it returns |
922 | // control to Handle, otherwise the request will be ignored. | 921 | // control to Handle, otherwise the request will be ignored. |
923 | // This is called implciitly for the REST stream handlers and | 922 | // This is called implciitly for the REST stream handlers and |
924 | // is harmless if it is called twice. | 923 | // is harmless if it is called twice. |
@@ -962,7 +961,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
962 | Rest.Log.DebugFormat("{0} XML Response handler extension EXIT", MsgId); | 961 | Rest.Log.DebugFormat("{0} XML Response handler extension EXIT", MsgId); |
963 | } | 962 | } |
964 | 963 | ||
965 | // If buffer != null, then we assume that | 964 | // If buffer != null, then we assume that |
966 | // this has already been done some other | 965 | // this has already been done some other |
967 | // way. For example, transfer encoding might | 966 | // way. For example, transfer encoding might |
968 | // have been done. | 967 | // have been done. |
@@ -997,7 +996,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
997 | 996 | ||
998 | } | 997 | } |
999 | 998 | ||
1000 | // Set the status code & description. If nothing has been stored, | 999 | // Set the status code & description. If nothing has been stored, |
1001 | // we consider that a success. | 1000 | // we consider that a success. |
1002 | 1001 | ||
1003 | if (statusCode == 0) | 1002 | if (statusCode == 0) |
@@ -1011,7 +1010,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1011 | 1010 | ||
1012 | // For a redirect we need to set the relocation header accordingly | 1011 | // For a redirect we need to set the relocation header accordingly |
1013 | 1012 | ||
1014 | if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect || | 1013 | if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect || |
1015 | response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect) | 1014 | response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect) |
1016 | { | 1015 | { |
1017 | Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation); | 1016 | Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation); |
@@ -1031,7 +1030,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1031 | // We've left the setting of handled' until the | 1030 | // We've left the setting of handled' until the |
1032 | // last minute because the header settings included | 1031 | // last minute because the header settings included |
1033 | // above are pretty harmless. But everything from | 1032 | // above are pretty harmless. But everything from |
1034 | // here on down probably leaves the response | 1033 | // here on down probably leaves the response |
1035 | // element unusable by anyone else. | 1034 | // element unusable by anyone else. |
1036 | 1035 | ||
1037 | handled = true; | 1036 | handled = true; |
@@ -1046,7 +1045,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1046 | 1045 | ||
1047 | if (buffer != null && buffer.Length != 0) | 1046 | if (buffer != null && buffer.Length != 0) |
1048 | { | 1047 | { |
1049 | Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>", | 1048 | Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>", |
1050 | MsgId, buffer.Length, encoding.GetString(buffer)); | 1049 | MsgId, buffer.Length, encoding.GetString(buffer)); |
1051 | response.OutputStream.Write(buffer, 0, buffer.Length); | 1050 | response.OutputStream.Write(buffer, 0, buffer.Length); |
1052 | } | 1051 | } |
@@ -1066,17 +1065,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1066 | 1065 | ||
1067 | // Add a header to the table. We need to allow | 1066 | // Add a header to the table. We need to allow |
1068 | // multiple instances of many of the headers. | 1067 | // multiple instances of many of the headers. |
1069 | // If the | 1068 | // If the |
1070 | 1069 | ||
1071 | internal void AddHeader(string hdr, string data) | 1070 | internal void AddHeader(string hdr, string data) |
1072 | { | 1071 | { |
1073 | if (Rest.DEBUG) | 1072 | if (Rest.DEBUG) |
1074 | { | 1073 | { |
1075 | Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", | 1074 | Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", |
1076 | MsgId, hdr, data); | 1075 | MsgId, hdr, data); |
1077 | if (response.Headers.Get(hdr) != null) | 1076 | if (response.Headers.Get(hdr) != null) |
1078 | { | 1077 | { |
1079 | Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", | 1078 | Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", |
1080 | MsgId, hdr); | 1079 | MsgId, hdr); |
1081 | } | 1080 | } |
1082 | } | 1081 | } |
@@ -1093,7 +1092,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1093 | Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); | 1092 | Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); |
1094 | if (response.Headers.Get(hdr) == null) | 1093 | if (response.Headers.Get(hdr) == null) |
1095 | { | 1094 | { |
1096 | Rest.Log.DebugFormat("{0} No such header existed", | 1095 | Rest.Log.DebugFormat("{0} No such header existed", |
1097 | MsgId, hdr); | 1096 | MsgId, hdr); |
1098 | } | 1097 | } |
1099 | } | 1098 | } |
@@ -1110,7 +1109,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1110 | { | 1109 | { |
1111 | for (int i=0;i<response.Headers.Count;i++) | 1110 | for (int i=0;i<response.Headers.Count;i++) |
1112 | { | 1111 | { |
1113 | Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, | 1112 | Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, |
1114 | response.Headers.Get(i)); | 1113 | response.Headers.Get(i)); |
1115 | } | 1114 | } |
1116 | } | 1115 | } |
@@ -1144,7 +1143,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1144 | // If we succeeded in getting a path, perform any | 1143 | // If we succeeded in getting a path, perform any |
1145 | // additional pre-processing required. | 1144 | // additional pre-processing required. |
1146 | 1145 | ||
1147 | if (path != null) | 1146 | if (path != null) |
1148 | { | 1147 | { |
1149 | if (Rest.ExtendedEscape) | 1148 | if (Rest.ExtendedEscape) |
1150 | { | 1149 | { |
@@ -1182,14 +1181,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1182 | { | 1181 | { |
1183 | parameters = new string[0]; | 1182 | parameters = new string[0]; |
1184 | } | 1183 | } |
1185 | 1184 | ||
1186 | // Generate a debug list of the decoded parameters | 1185 | // Generate a debug list of the decoded parameters |
1187 | 1186 | ||
1188 | if (Rest.DEBUG && prfxlen < path.Length-1) | 1187 | if (Rest.DEBUG && prfxlen < path.Length-1) |
1189 | { | 1188 | { |
1190 | Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen)); | 1189 | Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen)); |
1191 | for (int i = 0; i < parameters.Length; i++) | 1190 | for (int i = 0; i < parameters.Length; i++) |
1192 | { | 1191 | { |
1193 | Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]); | 1192 | Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]); |
1194 | } | 1193 | } |
1195 | } | 1194 | } |
@@ -1197,11 +1196,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1197 | return parameters.Length; | 1196 | return parameters.Length; |
1198 | 1197 | ||
1199 | } | 1198 | } |
1200 | 1199 | ||
1201 | internal string[] PathNodes | 1200 | internal string[] PathNodes |
1202 | { | 1201 | { |
1203 | get | 1202 | get |
1204 | { | 1203 | { |
1205 | if (pathNodes == null) | 1204 | if (pathNodes == null) |
1206 | { | 1205 | { |
1207 | initUrl(); | 1206 | initUrl(); |
@@ -1209,10 +1208,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1209 | return pathNodes; | 1208 | return pathNodes; |
1210 | } | 1209 | } |
1211 | } | 1210 | } |
1212 | 1211 | ||
1213 | internal string BuildUrl(int first, int last) | 1212 | internal string BuildUrl(int first, int last) |
1214 | { | 1213 | { |
1215 | 1214 | ||
1216 | if (pathNodes == null) | 1215 | if (pathNodes == null) |
1217 | { | 1216 | { |
1218 | initUrl(); | 1217 | initUrl(); |