aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
authorJeff Ames2008-08-19 02:59:27 +0000
committerJeff Ames2008-08-19 02:59:27 +0000
commitbea7d4d81ad7a75706305be6c8ca06f8dc6e6eca (patch)
tree6350036021802eadb2540d14461eb545afd7dea6 /OpenSim/ApplicationPlugins
parentAttachment persistence!!! Patch #9169 (Mantis #1171) (diff)
downloadopensim-SC_OLD-bea7d4d81ad7a75706305be6c8ca06f8dc6e6eca.zip
opensim-SC_OLD-bea7d4d81ad7a75706305be6c8ca06f8dc6e6eca.tar.gz
opensim-SC_OLD-bea7d4d81ad7a75706305be6c8ca06f8dc6e6eca.tar.bz2
opensim-SC_OLD-bea7d4d81ad7a75706305be6c8ca06f8dc6e6eca.tar.xz
Update svn properties, formatting cleanup.
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs36
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs3
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs59
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs9
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs1
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs4
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs6
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs13
8 files changed, 30 insertions, 101 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 44c12a2..535a5ea 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -49,8 +49,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
49 public string Version { get { return m_version; } } 49 public string Version { get { return m_version; } }
50 public string Name { get { return m_name; } } 50 public string Name { get { return m_name; } }
51 51
52 public void Initialise() 52 public void Initialise()
53 { 53 {
54 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); 54 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
55 throw new PluginNotInitialisedException (Name); 55 throw new PluginNotInitialisedException (Name);
56 } 56 }
@@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
75 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 75 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
76 76
77 openSim.ModuleLoader.LoadDefaultSharedModules(); 77 openSim.ModuleLoader.LoadDefaultSharedModules();
78 78
79 if (!CheckRegionsForSanity(regionsToLoad)) 79 if (!CheckRegionsForSanity(regionsToLoad))
80 { 80 {
81 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); 81 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
@@ -95,10 +95,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
95 95
96 public void Dispose() 96 public void Dispose()
97 { 97 {
98 } 98 }
99 99
100 #endregion 100 #endregion
101 101
102 /// <summary> 102 /// <summary>
103 /// Check that region configuration information makes sense. 103 /// Check that region configuration information makes sense.
104 /// </summary> 104 /// </summary>
@@ -108,43 +108,43 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
108 { 108 {
109 if (regions.Length <= 0) 109 if (regions.Length <= 0)
110 return true; 110 return true;
111 111
112 List<RegionInfo> checkedRegions = new List<RegionInfo>(); 112 List<RegionInfo> checkedRegions = new List<RegionInfo>();
113 checkedRegions.Add(regions[0]); 113 checkedRegions.Add(regions[0]);
114 114
115 for (int i = 1; i < regions.Length; i++) 115 for (int i = 1; i < regions.Length; i++)
116 { 116 {
117 RegionInfo region = regions[i]; 117 RegionInfo region = regions[i];
118 118
119 foreach (RegionInfo checkedRegion in checkedRegions) 119 foreach (RegionInfo checkedRegion in checkedRegions)
120 { 120 {
121 if (region.RegionID == checkedRegion.RegionID) 121 if (region.RegionID == checkedRegion.RegionID)
122 { 122 {
123 m_log.ErrorFormat( 123 m_log.ErrorFormat(
124 "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", 124 "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
125 region.RegionName, checkedRegion.RegionName, region.RegionID); 125 region.RegionName, checkedRegion.RegionName, region.RegionID);
126 return false; 126 return false;
127 } 127 }
128 else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY) 128 else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY)
129 { 129 {
130 m_log.ErrorFormat( 130 m_log.ErrorFormat(
131 "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}", 131 "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}",
132 region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY); 132 region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY);
133 return false; 133 return false;
134 } 134 }
135 else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port) 135 else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port)
136 { 136 {
137 m_log.ErrorFormat( 137 m_log.ErrorFormat(
138 "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", 138 "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
139 region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port); 139 region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port);
140 return false; 140 return false;
141 } 141 }
142 } 142 }
143 } 143 }
144 144
145 return true; 145 return true;
146 } 146 }
147 147
148 public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle) 148 public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
149 { 149 {
150 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); 150 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs
index 5fd0219..f593349 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/IRest.cs
@@ -23,14 +23,12 @@
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
29using System; 28using System;
30 29
31namespace OpenSim.ApplicationPlugins.Rest.Inventory 30namespace OpenSim.ApplicationPlugins.Rest.Inventory
32{ 31{
33
34 /// <summary> 32 /// <summary>
35 /// This interface represents the boundary between the general purpose 33 /// This interface represents the boundary between the general purpose
36 /// REST plugin handling, and the functionally specific handlers. The 34 /// REST plugin handling, and the functionally specific handlers. The
@@ -44,5 +42,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
44 void Initialize(); 42 void Initialize();
45 void Close(); 43 void Close();
46 } 44 }
47
48} 45}
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
index 6fc3ea3..d08f830 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
@@ -40,7 +40,6 @@ using System.Xml;
40 40
41namespace OpenSim.ApplicationPlugins.Rest.Inventory 41namespace OpenSim.ApplicationPlugins.Rest.Inventory
42{ 42{
43
44 /// <summary> 43 /// <summary>
45 /// This class represents the current REST request. It 44 /// This class represents the current REST request. It
46 /// encapsulates the request/response state and takes care 45 /// encapsulates the request/response state and takes care
@@ -66,7 +65,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
66 65
67 internal class RequestData 66 internal class RequestData
68 { 67 {
69
70 // HTTP Server interface data 68 // HTTP Server interface data
71 69
72 internal OSHttpRequest request = null; 70 internal OSHttpRequest request = null;
@@ -170,7 +168,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
170 168
171 internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) 169 internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix)
172 { 170 {
173
174 request = p_request; 171 request = p_request;
175 response = p_response; 172 response = p_response;
176 qprefix = p_qprefix; 173 qprefix = p_qprefix;
@@ -187,7 +184,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
187 initUrl(); 184 initUrl();
188 185
189 initParameters(p_qprefix.Length); 186 initParameters(p_qprefix.Length);
190
191 } 187 }
192 188
193 // Just for convenience... 189 // Just for convenience...
@@ -212,7 +208,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
212 208
213 return authenticated; 209 return authenticated;
214 } 210 }
215 else return true; 211 else
212 return true;
216 } 213 }
217 } 214 }
218 215
@@ -229,7 +226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
229 226
230 private void authenticate() 227 private void authenticate()
231 { 228 {
232
233 string authdata = request.Headers.Get("Authorization"); 229 string authdata = request.Headers.Get("Authorization");
234 string reqscheme = String.Empty; 230 string reqscheme = String.Empty;
235 231
@@ -291,7 +287,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
291 Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId); 287 Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId);
292 DoChallenge(); 288 DoChallenge();
293 } 289 }
294
295 } 290 }
296 291
297 /// <summary> 292 /// <summary>
@@ -315,7 +310,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
315 310
316 private void DoBasic(string authdata) 311 private void DoBasic(string authdata)
317 { 312 {
318
319 string response = null; 313 string response = null;
320 314
321 MatchCollection matches = basicParms.Matches(authdata); 315 MatchCollection matches = basicParms.Matches(authdata);
@@ -346,7 +340,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
346 // Validate against user database 340 // Validate against user database
347 authenticated = Validate(userName,userPass); 341 authenticated = Validate(userName,userPass);
348 } 342 }
349
350 } 343 }
351 344
352 /// <summary> 345 /// <summary>
@@ -357,7 +350,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
357 350
358 private void DoDigest(string authdata) 351 private void DoDigest(string authdata)
359 { 352 {
360
361 string response = null; 353 string response = null;
362 354
363 MatchCollection matches = digestParm1.Matches(authdata); 355 MatchCollection matches = digestParm1.Matches(authdata);
@@ -390,12 +382,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
390 382
391 if (authparms.TryGetValue("response", out response)) 383 if (authparms.TryGetValue("response", out response))
392 { 384 {
393
394 string temp = null; 385 string temp = null;
395 386
396 do 387 do
397 { 388 {
398
399 string nck = null; 389 string nck = null;
400 string ncl = null; 390 string ncl = null;
401 391
@@ -448,7 +438,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
448 438
449 if (authparms.TryGetValue("qop", out temp)) 439 if (authparms.TryGetValue("qop", out temp))
450 { 440 {
451
452 qop = temp.ToLower(); // replace with actual value used 441 qop = temp.ToLower(); // replace with actual value used
453 442
454 // if QOP was specified then 443 // if QOP was specified then
@@ -485,11 +474,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
485 { 474 {
486 lock (cntable) cntable.Add(nonce, nck); 475 lock (cntable) cntable.Add(nonce, nck);
487 } 476 }
488
489 } 477 }
490 else 478 else
491 { 479 {
492
493 qop = String.Empty; 480 qop = String.Empty;
494 481
495 // if QOP was not specified then 482 // if QOP was not specified then
@@ -509,12 +496,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
509 // Validate the supplied userid/password info 496 // Validate the supplied userid/password info
510 497
511 authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); 498 authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response);
512
513 } 499 }
514 while (false); 500 while (false);
515
516 } 501 }
517
518 } 502 }
519 503
520 // Indicate that authentication is required 504 // Indicate that authentication is required
@@ -523,7 +507,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
523 string opaque, string stale, string alg, 507 string opaque, string stale, string alg,
524 string qop, string auth) 508 string qop, string auth)
525 { 509 {
526
527 sbuilder.Length = 0; 510 sbuilder.Length = 0;
528 511
529 if (scheme == null || scheme == Rest.AS_BASIC) 512 if (scheme == null || scheme == Rest.AS_BASIC)
@@ -544,7 +527,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
544 527
545 if (scheme == null || scheme == Rest.AS_DIGEST) 528 if (scheme == null || scheme == Rest.AS_DIGEST)
546 { 529 {
547
548 sbuilder.Append(Rest.AS_DIGEST); 530 sbuilder.Append(Rest.AS_DIGEST);
549 sbuilder.Append(" "); 531 sbuilder.Append(" ");
550 532
@@ -617,9 +599,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
617 sbuilder.Append(Rest.CS_DQUOTE); 599 sbuilder.Append(Rest.CS_DQUOTE);
618 600
619 AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString()); 601 AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString());
620
621 } 602 }
622
623 } 603 }
624 604
625 /// <summary> 605 /// <summary>
@@ -631,7 +611,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
631 611
632 private bool Validate(string user, string pass) 612 private bool Validate(string user, string pass)
633 { 613 {
634
635 Rest.Log.DebugFormat("{0} Simple User Validation", MsgId); 614 Rest.Log.DebugFormat("{0} Simple User Validation", MsgId);
636 615
637 // Both values are required 616 // Both values are required
@@ -643,7 +622,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
643 user = user.Trim(); 622 user = user.Trim();
644 623
645 return vetPassword(user, pass); 624 return vetPassword(user, pass);
646
647 } 625 }
648 626
649 /// <summary> 627 /// <summary>
@@ -658,7 +636,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
658 636
659 private string getPassword(string user) 637 private string getPassword(string user)
660 { 638 {
661
662 int x; 639 int x;
663 string first; 640 string first;
664 string last; 641 string last;
@@ -690,7 +667,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
690 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); 667 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
691 return udata.PasswordHash; 668 return udata.PasswordHash;
692 } 669 }
693
694 } 670 }
695 671
696 /// <summary> 672 /// <summary>
@@ -704,7 +680,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
704 680
705 private bool vetPassword(string user, string pass) 681 private bool vetPassword(string user, string pass)
706 { 682 {
707
708 int x; 683 int x;
709 string HA1; 684 string HA1;
710 string first; 685 string first;
@@ -734,13 +709,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
734 HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); 709 HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
735 710
736 return (0 == sc.Compare(HA1, udata.PasswordHash)); 711 return (0 == sc.Compare(HA1, udata.PasswordHash));
737
738 } 712 }
739 713
740 // Validate the request-digest 714 // Validate the request-digest
741 private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response) 715 private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response)
742 { 716 {
743
744 string patt = null; 717 string patt = null;
745 string payl = String.Empty; 718 string payl = String.Empty;
746 string KDS = null; 719 string KDS = null;
@@ -798,12 +771,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
798 // Compare the generated sequence with the original 771 // Compare the generated sequence with the original
799 772
800 return (0 == sc.Compare(KDS, response)); 773 return (0 == sc.Compare(KDS, response));
801
802 } 774 }
803 775
804 private string HashToString(string pattern) 776 private string HashToString(string pattern)
805 { 777 {
806
807 Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern); 778 Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern);
808 779
809 byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern)); 780 byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern));
@@ -818,7 +789,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
818 Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString()); 789 Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString());
819 790
820 return sbuilder.ToString(); 791 return sbuilder.ToString();
821
822 } 792 }
823 793
824 internal void Complete() 794 internal void Complete()
@@ -829,7 +799,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
829 799
830 internal void Redirect(string Url, bool temp) 800 internal void Redirect(string Url, bool temp)
831 { 801 {
832
833 redirectLocation = Url; 802 redirectLocation = Url;
834 803
835 if (temp) 804 if (temp)
@@ -844,7 +813,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
844 } 813 }
845 814
846 Fail(statusCode, statusDescription, true); 815 Fail(statusCode, statusDescription, true);
847
848 } 816 }
849 817
850 // Fail for an arbitrary reason. Just a failure with 818 // Fail for an arbitrary reason. Just a failure with
@@ -867,7 +835,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
867 835
868 internal void Fail(int code, string message, bool reset) 836 internal void Fail(int code, string message, bool reset)
869 { 837 {
870
871 statusCode = code; 838 statusCode = code;
872 statusDescription = message; 839 statusDescription = message;
873 840
@@ -907,7 +874,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
907 re.httppath = path; 874 re.httppath = path;
908 875
909 throw re; 876 throw re;
910
911 } 877 }
912 878
913 // Reject this request 879 // Reject this request
@@ -924,19 +890,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
924 890
925 internal virtual bool Respond(string reason) 891 internal virtual bool Respond(string reason)
926 { 892 {
927
928 Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason); 893 Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason);
929 894
930 if (!handled) 895 if (!handled)
931 { 896 {
932
933 Rest.Log.DebugFormat("{0} Generating Response", MsgId); 897 Rest.Log.DebugFormat("{0} Generating Response", MsgId);
934 Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method); 898 Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method);
935 899
936 // A Head request can NOT have a body! 900 // A Head request can NOT have a body!
937 if (method != Rest.HEAD) 901 if (method != Rest.HEAD)
938 { 902 {
939
940 Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId); 903 Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId);
941 904
942 // If the writer is non-null then we know that an XML 905 // If the writer is non-null then we know that an XML
@@ -993,7 +956,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
993 956
994 response.SendChunked = chunked; 957 response.SendChunked = chunked;
995 response.KeepAlive = keepAlive; 958 response.KeepAlive = keepAlive;
996
997 } 959 }
998 960
999 // Set the status code & description. If nothing has been stored, 961 // Set the status code & description. If nothing has been stored,
@@ -1054,13 +1016,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1054 1016
1055 Rest.Log.DebugFormat("{0} Closing output stream", MsgId); 1017 Rest.Log.DebugFormat("{0} Closing output stream", MsgId);
1056 response.OutputStream.Close(); 1018 response.OutputStream.Close();
1057
1058 } 1019 }
1059 1020
1060 Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason); 1021 Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason);
1061 1022
1062 return handled; 1023 return handled;
1063
1064 } 1024 }
1065 1025
1066 // Add a header to the table. We need to allow 1026 // Add a header to the table. We need to allow
@@ -1122,7 +1082,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1122 1082
1123 private void initUrl() 1083 private void initUrl()
1124 { 1084 {
1125
1126 uri = request.Url; 1085 uri = request.Url;
1127 1086
1128 if (query == null) 1087 if (query == null)
@@ -1137,7 +1096,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1137 { 1096 {
1138 path = uri.AbsolutePath; 1097 path = uri.AbsolutePath;
1139 if (path.EndsWith(Rest.UrlPathSeparator)) 1098 if (path.EndsWith(Rest.UrlPathSeparator))
1140 path = path.Substring(0,path.Length-1); 1099 path = path.Substring(0, path.Length-1);
1141 } 1100 }
1142 1101
1143 // If we succeeded in getting a path, perform any 1102 // If we succeeded in getting a path, perform any
@@ -1149,7 +1108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1149 { 1108 {
1150 // Handle "+". Not a standard substitution, but 1109 // Handle "+". Not a standard substitution, but
1151 // common enough... 1110 // common enough...
1152 path = path.Replace(Rest.C_PLUS,Rest.C_SPACE); 1111 path = path.Replace(Rest.C_PLUS, Rest.C_SPACE);
1153 } 1112 }
1154 pathNodes = path.Split(Rest.CA_PATHSEP); 1113 pathNodes = path.Split(Rest.CA_PATHSEP);
1155 } 1114 }
@@ -1167,12 +1126,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1167 1126
1168 hostname = uri.Host; 1127 hostname = uri.Host;
1169 port = uri.Port; 1128 port = uri.Port;
1170
1171 } 1129 }
1172 1130
1173 internal int initParameters(int prfxlen) 1131 internal int initParameters(int prfxlen)
1174 { 1132 {
1175
1176 if (prfxlen < path.Length-1) 1133 if (prfxlen < path.Length-1)
1177 { 1134 {
1178 parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP); 1135 parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP);
@@ -1194,7 +1151,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1194 } 1151 }
1195 1152
1196 return parameters.Length; 1153 return parameters.Length;
1197
1198 } 1154 }
1199 1155
1200 internal string[] PathNodes 1156 internal string[] PathNodes
@@ -1211,7 +1167,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1211 1167
1212 internal string BuildUrl(int first, int last) 1168 internal string BuildUrl(int first, int last)
1213 { 1169 {
1214
1215 if (pathNodes == null) 1170 if (pathNodes == null)
1216 { 1171 {
1217 initUrl(); 1172 initUrl();
@@ -1252,7 +1207,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1252 } 1207 }
1253 1208
1254 return sbuilder.ToString(); 1209 return sbuilder.ToString();
1255
1256 } 1210 }
1257 1211
1258 // Setup the XML writer for output 1212 // Setup the XML writer for output
@@ -1272,7 +1226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1272 1226
1273 internal void initXmlReader() 1227 internal void initXmlReader()
1274 { 1228 {
1275
1276 XmlReaderSettings settings = new XmlReaderSettings(); 1229 XmlReaderSettings settings = new XmlReaderSettings();
1277 1230
1278 settings.ConformanceLevel = ConformanceLevel.Fragment; 1231 settings.ConformanceLevel = ConformanceLevel.Fragment;
@@ -1282,14 +1235,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1282 settings.ValidationType = ValidationType.None; 1235 settings.ValidationType = ValidationType.None;
1283 1236
1284 reader = XmlReader.Create(request.InputStream,settings); 1237 reader = XmlReader.Create(request.InputStream,settings);
1285
1286 } 1238 }
1287 1239
1288 private void Flush() 1240 private void Flush()
1289 { 1241 {
1290 byte[] dbuffer = new byte[8192]; 1242 byte[] dbuffer = new byte[8192];
1291 while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0); 1243 while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0);
1292 return;
1293 } 1244 }
1294 1245
1295 // This allows us to make errors a bit more apparent in REST 1246 // This allows us to make errors a bit more apparent in REST
@@ -1301,7 +1252,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1301 1252
1302 internal void SendHtml(string title, string text) 1253 internal void SendHtml(string title, string text)
1303 { 1254 {
1304
1305 AddHeader(Rest.HttpHeaderContentType, "text/html"); 1255 AddHeader(Rest.HttpHeaderContentType, "text/html");
1306 sbuilder.Length = 0; 1256 sbuilder.Length = 0;
1307 1257
@@ -1321,7 +1271,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1321 sbuilder.Append("</html>"); 1271 sbuilder.Append("</html>");
1322 1272
1323 html = sbuilder.ToString(); 1273 html = sbuilder.ToString();
1324
1325 } 1274 }
1326 } 1275 }
1327} 1276}
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
index 2bb91a4..e8c0ee8 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
@@ -38,10 +38,8 @@ 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
45 internal static readonly log4net.ILog Log = 43 internal static readonly log4net.ILog Log =
46 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 45
@@ -374,7 +372,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
374 } 372 }
375 373
376 return sum; 374 return sum;
377
378 } 375 }
379 376
380 public static string Int2Hex8(int val) 377 public static string Int2Hex8(int val)
@@ -409,7 +406,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
409 406
410 public static void Dump(byte[] data) 407 public static void Dump(byte[] data)
411 { 408 {
412
413 char[] buffer = new char[Rest.DumpLineSize]; 409 char[] buffer = new char[Rest.DumpLineSize];
414 int cc = 0; 410 int cc = 0;
415 411
@@ -435,7 +431,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
435 Console.Write(" |"+(new String(buffer))+"|"); 431 Console.Write(" |"+(new String(buffer))+"|");
436 cc = 0; 432 cc = 0;
437 } 433 }
438
439 } 434 }
440 435
441 // Finish off any incomplete line 436 // Finish off any incomplete line
@@ -455,16 +450,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
455 { 450 {
456 Console.Write("\n"); 451 Console.Write("\n");
457 } 452 }
458
459 } 453 }
460
461 } 454 }
462 455
463 // Local exception type 456 // Local exception type
464 457
465 public class RestException : Exception 458 public class RestException : Exception
466 { 459 {
467
468 internal int statusCode; 460 internal int statusCode;
469 internal string statusDesc; 461 internal string statusDesc;
470 internal string httpmethod; 462 internal string httpmethod;
@@ -474,5 +466,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
474 { 466 {
475 } 467 }
476 } 468 }
477
478} 469}
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
index 95b0ee3..85748fa 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
@@ -182,7 +182,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
182 } 182 }
183 183
184 Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId); 184 Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId);
185
186 } 185 }
187 186
188 #endregion Interface 187 #endregion Interface
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
index 7f4157c..9853f16 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
@@ -358,8 +358,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
358 { 358 {
359 if (path.StartsWith(key)) 359 if (path.StartsWith(key))
360 { 360 {
361 return ( path.Length == key.Length || 361 return (path.Length == key.Length ||
362 path.Substring(key.Length,1) == Rest.UrlPathSeparator); 362 path.Substring(key.Length, 1) == Rest.UrlPathSeparator);
363 } 363 }
364 } 364 }
365 365
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 0c107d5..8a0eba5 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -257,7 +257,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
257 257
258 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) 258 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
259 { 259 {
260
261 rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid); 260 rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid);
262 261
263 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", 262 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
@@ -646,7 +645,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
646 645
647 // Scan the set of folders in the entity collection for an 646 // Scan the set of folders in the entity collection for an
648 // entry that matches the context folder. It is assumed that 647 // entry that matches the context folder. It is assumed that
649 // the only reliable indicator of this is a zero UUID ( using 648 // the only reliable indicator of this is a zero UUID (using
650 // implicit context), or the parent's UUID matches that of the 649 // implicit context), or the parent's UUID matches that of the
651 // URI designated node (explicit context). We don't allow 650 // URI designated node (explicit context). We don't allow
652 // ambiguity in this case because this is POST and we are 651 // ambiguity in this case because this is POST and we are
@@ -1368,7 +1367,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1368 1367
1369 foreach (InventoryFolderBase parent in ic.rdata.folders) 1368 foreach (InventoryFolderBase parent in ic.rdata.folders)
1370 { 1369 {
1371 if ( parent.ID == result.ParentID ) 1370 if (parent.ID == result.ParentID)
1372 { 1371 {
1373 found = true; 1372 found = true;
1374 break; 1373 break;
@@ -1382,7 +1381,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1382 ic.Fail(Rest.HttpStatusCodeBadRequest, 1381 ic.Fail(Rest.HttpStatusCodeBadRequest,
1383 Rest.HttpStatusDescBadRequest+": invalid parent"); 1382 Rest.HttpStatusDescBadRequest+": invalid parent");
1384 } 1383 }
1385
1386 } 1384 }
1387 1385
1388 // This is a new folder, so no existing UUID is available 1386 // This is a new folder, so no existing UUID is available
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
index 41319ea..a5165d9 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestTestServices.cs
@@ -40,10 +40,8 @@ using OpenSim.Framework.Communications.Cache;
40 40
41namespace OpenSim.ApplicationPlugins.Rest.Inventory 41namespace OpenSim.ApplicationPlugins.Rest.Inventory
42{ 42{
43
44 public class RestTestServices : IRest 43 public class RestTestServices : IRest
45 { 44 {
46
47 private bool enabled = false; 45 private bool enabled = false;
48 private string qPrefix = "test"; 46 private string qPrefix = "test";
49 47
@@ -52,7 +50,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
52 50
53 public RestTestServices() 51 public RestTestServices()
54 { 52 {
55
56 Rest.Log.InfoFormat("{0} Test services initializing", MsgId); 53 Rest.Log.InfoFormat("{0} Test services initializing", MsgId);
57 Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); 54 Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version);
58 55
@@ -67,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
67 // Load test cases 64 // Load test cases
68 65
69 loadTests(); 66 loadTests();
70 foreach ( ITest test in tests ) 67 foreach (ITest test in tests)
71 { 68 {
72 test.Initialize(); 69 test.Initialize();
73 } 70 }
@@ -81,7 +78,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
81 enabled = true; 78 enabled = true;
82 79
83 Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId); 80 Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId);
84
85 } 81 }
86 82
87 // Post-construction, pre-enabled initialization opportunity 83 // Post-construction, pre-enabled initialization opportunity
@@ -98,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
98 public void Close() 94 public void Close()
99 { 95 {
100 enabled = false; 96 enabled = false;
101 foreach ( ITest test in tests ) 97 foreach (ITest test in tests)
102 { 98 {
103 test.Close(); 99 test.Close();
104 } 100 }
@@ -123,8 +119,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
123 119
124 private void DoTests(RequestData rdata) 120 private void DoTests(RequestData rdata)
125 { 121 {
126 122 if (!enabled)
127 if (!enabled) return; 123 return;
128 124
129 // Now that we know this is a serious attempt to 125 // Now that we know this is a serious attempt to
130 // access inventory data, we should find out who 126 // access inventory data, we should find out who
@@ -177,7 +173,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
177 if (!rdata.handled) 173 if (!rdata.handled)
178 test.Execute(rdata); 174 test.Execute(rdata);
179 } 175 }
180
181 } 176 }
182 177
183 #endregion Interface 178 #endregion Interface