aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-25 23:43:57 +0000
committerJustin Clark-Casey (justincc)2011-11-25 23:43:57 +0000
commit5b4fe23f7f1877a150ed50dd63beaac762fe8674 (patch)
tree1f8a9a9c9acfd04dd76c02c61c4eb370a9be5d17 /OpenSim
parentImplement the FetchInventoryDescendents2 capability using the same code as We... (diff)
downloadopensim-SC-5b4fe23f7f1877a150ed50dd63beaac762fe8674.zip
opensim-SC-5b4fe23f7f1877a150ed50dd63beaac762fe8674.tar.gz
opensim-SC-5b4fe23f7f1877a150ed50dd63beaac762fe8674.tar.bz2
opensim-SC-5b4fe23f7f1877a150ed50dd63beaac762fe8674.tar.xz
Resolve error where an unknown asset type would cause the fetch inventory descendents cap to fail.
Introduced just a few commits ago in 0688861
Diffstat (limited to '')
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs83
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs5
2 files changed, 44 insertions, 44 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index 04fa55c..08570bc 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -42,7 +42,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
42 42
43namespace OpenSim.Capabilities.Handlers 43namespace OpenSim.Capabilities.Handlers
44{ 44{
45
46 public class WebFetchInvDescHandler 45 public class WebFetchInvDescHandler
47 { 46 {
48 private static readonly ILog m_log = 47 private static readonly ILog m_log =
@@ -60,39 +59,40 @@ namespace OpenSim.Capabilities.Handlers
60 59
61 public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 60 public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
62 { 61 {
63// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request");
64
65 // nasty temporary hack here, the linden client falsely
66 // identifies the uuid 00000000-0000-0000-0000-000000000000
67 // as a string which breaks us
68 //
69 // correctly mark it as a uuid
70 //
71 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
72
73 // another hack <integer>1</integer> results in a
74 // System.ArgumentException: Object type System.Int32 cannot
75 // be converted to target type: System.Boolean
76 //
77 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
78 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
79
80 Hashtable hash = new Hashtable();
81 try
82 {
83 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
84 }
85 catch (LLSD.LLSDParseException pe)
86 {
87 m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
88 m_log.Error("Request: " + request.ToString());
89 }
90
91 ArrayList foldersrequested = (ArrayList)hash["folders"];
92
93 string response = "";
94 lock (m_fetchLock) 62 lock (m_fetchLock)
95 { 63 {
64// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request);
65
66 // nasty temporary hack here, the linden client falsely
67 // identifies the uuid 00000000-0000-0000-0000-000000000000
68 // as a string which breaks us
69 //
70 // correctly mark it as a uuid
71 //
72 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
73
74 // another hack <integer>1</integer> results in a
75 // System.ArgumentException: Object type System.Int32 cannot
76 // be converted to target type: System.Boolean
77 //
78 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
79 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
80
81 Hashtable hash = new Hashtable();
82 try
83 {
84 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
85 }
86 catch (LLSD.LLSDParseException e)
87 {
88 m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
89 m_log.Error("Request: " + request);
90 }
91
92 ArrayList foldersrequested = (ArrayList)hash["folders"];
93
94 string response = "";
95
96 for (int i = 0; i < foldersrequested.Count; i++) 96 for (int i = 0; i < foldersrequested.Count; i++)
97 { 97 {
98 string inventoryitemstr = ""; 98 string inventoryitemstr = "";
@@ -106,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers
106 } 106 }
107 catch (Exception e) 107 catch (Exception e)
108 { 108 {
109 m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); 109 m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
110 } 110 }
111 LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); 111 LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
112 112
@@ -130,12 +130,12 @@ namespace OpenSim.Capabilities.Handlers
130 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; 130 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
131 } 131 }
132 132
133 //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); 133// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
134 //m_log.Debug("[CAPS] "+response); 134 //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
135
136 return response;
135 137
136 } 138 }
137
138 return response;
139 } 139 }
140 140
141 /// <summary> 141 /// <summary>
@@ -184,8 +184,9 @@ namespace OpenSim.Capabilities.Handlers
184 return reply; 184 return reply;
185 } 185 }
186 186
187 public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID, 187 public InventoryCollection Fetch(
188 bool fetchFolders, bool fetchItems, int sortOrder, out int version) 188 UUID agentID, UUID folderID, UUID ownerID,
189 bool fetchFolders, bool fetchItems, int sortOrder, out int version)
189 { 190 {
190 m_log.DebugFormat( 191 m_log.DebugFormat(
191 "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", 192 "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
@@ -194,6 +195,7 @@ namespace OpenSim.Capabilities.Handlers
194 version = 0; 195 version = 0;
195 InventoryFolderImpl fold; 196 InventoryFolderImpl fold;
196 if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) 197 if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
198 {
197 if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) 199 if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
198 { 200 {
199 InventoryCollection ret = new InventoryCollection(); 201 InventoryCollection ret = new InventoryCollection();
@@ -202,6 +204,7 @@ namespace OpenSim.Capabilities.Handlers
202 204
203 return ret; 205 return ret;
204 } 206 }
207 }
205 208
206 InventoryCollection contents = new InventoryCollection(); 209 InventoryCollection contents = new InventoryCollection();
207 210
@@ -236,7 +239,7 @@ namespace OpenSim.Capabilities.Handlers
236 llsdFolder.parent_id = invFolder.ParentID; 239 llsdFolder.parent_id = invFolder.ParentID;
237 llsdFolder.name = invFolder.Name; 240 llsdFolder.name = invFolder.Name;
238 241
239 if (!Enum.IsDefined(typeof(AssetType), invFolder.Type)) 242 if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
240 llsdFolder.type = "-1"; 243 llsdFolder.type = "-1";
241 else 244 else
242 llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type); 245 llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 2a41b87..a49d619 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -48,8 +48,7 @@ namespace OpenSim.Region.ClientStack.Linden
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
49 public class WebFetchInvDescModule : INonSharedRegionModule 49 public class WebFetchInvDescModule : INonSharedRegionModule
50 { 50 {
51 private static readonly ILog m_log = 51// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 52
54 private Scene m_scene; 53 private Scene m_scene;
55 54
@@ -120,8 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden
120 119
121 private void RegisterCaps(UUID agentID, Caps caps) 120 private void RegisterCaps(UUID agentID, Caps caps)
122 { 121 {
123 UUID capID = UUID.Random();
124
125 if (m_webFetchInventoryDescendentsUrl != "") 122 if (m_webFetchInventoryDescendentsUrl != "")
126 RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl); 123 RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
127 else if (m_fetchInventoryDescendents2Url != "") 124 else if (m_fetchInventoryDescendents2Url != "")