aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs3
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs74
-rw-r--r--OpenSim/Framework/Util.cs51
4 files changed, 121 insertions, 11 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 0b9ea42..6a07bc9 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -38,8 +38,7 @@ namespace OpenSim.Framework
38{ 38{
39 public class AvatarAppearance 39 public class AvatarAppearance
40 { 40 {
41 private static readonly ILog m_log 41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 42
44 // these are guessed at by the list here - 43 // these are guessed at by the list here -
45 // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll 44 // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 4070b49..47e0293 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -90,8 +90,8 @@ namespace OpenSim.Framework.Communications.Tests
90 TestHelper.InMethod(); 90 TestHelper.InMethod();
91 // We want to use our own LoginService for this test, one that 91 // We want to use our own LoginService for this test, one that
92 // doesn't require authentication. 92 // doesn't require authentication.
93 LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(), 93 new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(),
94 m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); 94 m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector);
95 95
96 Hashtable loginParams = new Hashtable(); 96 Hashtable loginParams = new Hashtable();
97 loginParams["first"] = m_firstName; 97 loginParams["first"] = m_firstName;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 98e7f0e..878e2fd 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -457,6 +457,10 @@ namespace OpenSim.Framework.Servers.HttpServer
457 // This has to be here to prevent a Linux/Mono crash 457 // This has to be here to prevent a Linux/Mono crash
458 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 458 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
459 } 459 }
460 catch (IOException e)
461 {
462 m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message);
463 }
460 return; 464 return;
461 } 465 }
462 466
@@ -464,7 +468,8 @@ namespace OpenSim.Framework.Servers.HttpServer
464 { 468 {
465 foreach (string strAccept in request.AcceptTypes) 469 foreach (string strAccept in request.AcceptTypes)
466 { 470 {
467 if (strAccept.Contains("application/llsd+xml")) 471 if (strAccept.Contains("application/llsd+xml") ||
472 strAccept.Contains("application/llsd+json"))
468 { 473 {
469 //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header"); 474 //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header");
470 HandleLLSDRequests(request, response); 475 HandleLLSDRequests(request, response);
@@ -483,12 +488,14 @@ namespace OpenSim.Framework.Servers.HttpServer
483 488
484 case "application/llsd+xml": 489 case "application/llsd+xml":
485 case "application/xml+llsd": 490 case "application/xml+llsd":
491 case "application/llsd+json":
486 //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type"); 492 //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type");
487 HandleLLSDRequests(request, response); 493 HandleLLSDRequests(request, response);
488 return; 494 return;
489 495
490 case "text/xml": 496 case "text/xml":
491 case "application/xml": 497 case "application/xml":
498 case "application/json":
492 default: 499 default:
493 //m_log.Info("[Debug BASE HTTP SERVER]: in default handler"); 500 //m_log.Info("[Debug BASE HTTP SERVER]: in default handler");
494 // Point of note.. the DoWeHaveA methods check for an EXACT path 501 // Point of note.. the DoWeHaveA methods check for an EXACT path
@@ -529,9 +536,9 @@ namespace OpenSim.Framework.Servers.HttpServer
529 // with the minimum first 536 // with the minimum first
530 m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e); 537 m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e);
531 } 538 }
532 catch (EndOfStreamException e) 539 catch (IOException e)
533 { 540 {
534 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); 541 m_log.ErrorFormat("[BASE HTTP SERVER] HandleRequest() threw ", e);
535 } 542 }
536 catch (InvalidOperationException e) 543 catch (InvalidOperationException e)
537 { 544 {
@@ -760,6 +767,10 @@ namespace OpenSim.Framework.Servers.HttpServer
760 // This has to be here to prevent a Linux/Mono crash 767 // This has to be here to prevent a Linux/Mono crash
761 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 768 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
762 } 769 }
770 catch (IOException e)
771 {
772 m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message);
773 }
763 } 774 }
764 return; 775 return;
765 //responseString = "Error"; 776 //responseString = "Error";
@@ -793,6 +804,10 @@ namespace OpenSim.Framework.Servers.HttpServer
793 // This has to be here to prevent a Linux/Mono crash 804 // This has to be here to prevent a Linux/Mono crash
794 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 805 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
795 } 806 }
807 catch (IOException e)
808 {
809 m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message);
810 }
796 } 811 }
797 } 812 }
798 813
@@ -823,7 +838,7 @@ namespace OpenSim.Framework.Servers.HttpServer
823 } 838 }
824 try 839 try
825 { 840 {
826 llsdRequest = OSDParser.DeserializeLLSDXml(requestBody); 841 llsdRequest = OSDParser.Deserialize(requestBody);
827 } 842 }
828 catch (Exception ex) 843 catch (Exception ex)
829 { 844 {
@@ -873,10 +888,10 @@ namespace OpenSim.Framework.Servers.HttpServer
873 } 888 }
874 else 889 else
875 { 890 {
876 response.ContentType = "application/llsd+xml"; 891 // Select an appropriate response format
877 //m_log.Info("[Debug BASE HTTP SERVER]: Response: " + llsdResponse.ToString()); 892 buffer = BuildLLSDResponse(request, response, llsdResponse);
878 buffer = OSDParser.SerializeLLSDXmlBytes(llsdResponse);
879 } 893 }
894
880 response.SendChunked = false; 895 response.SendChunked = false;
881 response.ContentLength64 = buffer.Length; 896 response.ContentLength64 = buffer.Length;
882 response.ContentEncoding = Encoding.UTF8; 897 response.ContentEncoding = Encoding.UTF8;
@@ -912,6 +927,47 @@ namespace OpenSim.Framework.Servers.HttpServer
912 } 927 }
913 } 928 }
914 929
930 private byte[] BuildLLSDResponse(OSHttpRequest request, OSHttpResponse response, OSD llsdResponse)
931 {
932 if (request.AcceptTypes != null && request.AcceptTypes.Length > 0)
933 {
934 foreach (string strAccept in request.AcceptTypes)
935 {
936 switch (strAccept)
937 {
938 case "application/llsd+xml":
939 case "application/xml":
940 case "text/xml":
941 response.ContentType = strAccept;
942 return OSDParser.SerializeLLSDXmlBytes(llsdResponse);
943 case "application/llsd+json":
944 case "application/json":
945 response.ContentType = strAccept;
946 return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
947 }
948 }
949 }
950
951 if (!String.IsNullOrEmpty(request.ContentType))
952 {
953 switch (request.ContentType)
954 {
955 case "application/llsd+xml":
956 case "application/xml":
957 case "text/xml":
958 response.ContentType = request.ContentType;
959 return OSDParser.SerializeLLSDXmlBytes(llsdResponse);
960 case "application/llsd+json":
961 case "application/json":
962 response.ContentType = request.ContentType;
963 return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
964 }
965 }
966
967 response.ContentType = "application/llsd+json";
968 return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
969 }
970
915 /// <summary> 971 /// <summary>
916 /// Checks if we have an Exact path in the LLSD handlers for the path provided 972 /// Checks if we have an Exact path in the LLSD handlers for the path provided
917 /// </summary> 973 /// </summary>
@@ -1404,6 +1460,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1404 // This has to be here to prevent a Linux/Mono crash 1460 // This has to be here to prevent a Linux/Mono crash
1405 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); 1461 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
1406 } 1462 }
1463 catch (IOException e)
1464 {
1465 m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message);
1466 }
1407 } 1467 }
1408 } 1468 }
1409 1469
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0a9b67d..65d4f4d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1111,5 +1111,56 @@ namespace OpenSim.Framework
1111 return null; 1111 return null;
1112 } 1112 }
1113 1113
1114 public static string[] Glob(string path)
1115 {
1116 string vol=String.Empty;
1117
1118 if (Path.VolumeSeparatorChar != Path.DirectorySeparatorChar)
1119 {
1120 string[] vcomps = path.Split(new char[] {Path.VolumeSeparatorChar}, 2, StringSplitOptions.RemoveEmptyEntries);
1121
1122 if (vcomps.Length > 1)
1123 {
1124 path = vcomps[1];
1125 vol = vcomps[0];
1126 }
1127 }
1128
1129 string[] comps = path.Split(new char[] {Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar}, StringSplitOptions.RemoveEmptyEntries);
1130
1131 // Glob
1132
1133 path = vol;
1134 if (vol != String.Empty)
1135 path += new String(new char[] {Path.VolumeSeparatorChar, Path.DirectorySeparatorChar});
1136 else
1137 path = new String(new char[] {Path.DirectorySeparatorChar});
1138
1139 List<string> paths = new List<string>();
1140 List<string> found = new List<string>();
1141 paths.Add(path);
1142
1143 foreach (string c in comps)
1144 {
1145 List<string> addpaths = new List<string>();
1146 foreach (string p in paths)
1147 {
1148 string[] dirs = Directory.GetDirectories(p, c);
1149
1150 if (dirs.Length != 0)
1151 {
1152 foreach (string dir in dirs)
1153 addpaths.Add(Path.Combine(path, dir));
1154 }
1155
1156 string[] files = Directory.GetFiles(p, c);
1157 foreach (string f in files)
1158 found.Add(f);
1159 }
1160 paths = addpaths;
1161 }
1162
1163 return found.ToArray();
1164 }
1114 } 1165 }
1115} 1166}