public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request); Hashtable hash = new Hashtable(); try { hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); } catch (LLSD.LLSDParseException e) { m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace); m_log.Error("Request: " + request); } ArrayList foldersrequested = (ArrayList)hash["folders"]; List <LLSDFetchInventoryDescendents> folders = new List <LLSDFetchInventoryDescendents>(); for (int i = 0; i < foldersrequested.Count; i++) { Hashtable inventoryhash = (Hashtable)foldersrequested[i]; LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); try { LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); } catch (Exception e) { m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e); continue; } folders.Add(llsdRequest); } if (folders.Count == 0) { return("<llsd><map><key>folders</key><array /></map></llsd>"); } List <UUID> bad_folders = new List <UUID>(); List <InventoryCollectionWithDescendents> invcollSet = Fetch(folders, bad_folders); //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count); if (invcollSet == null) { m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol."); #pragma warning disable 0612 return(FetchInventoryDescendentsRequest(foldersrequested, httpRequest, httpResponse)); #pragma warning restore 0612 } StringBuilder lastresponse = new StringBuilder(1024); lastresponse.Append("<llsd>"); if (invcollSet.Count > 0) { lastresponse.Append("<map><key>folders</key><array>"); foreach (InventoryCollectionWithDescendents icoll in invcollSet) { LLSDInventoryFolderContents thiscontents = contentsToLLSD(icoll.Collection, icoll.Descendents); lastresponse.Append(LLSDHelpers.SerialiseLLSDReplyNoHeader(thiscontents)); } lastresponse.Append("</array></map>"); } else { lastresponse.Append("<map><key>folders</key><array /></map>"); } //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); if (bad_folders.Count > 0) { lastresponse.Append("<map><key>bad_folders</key><array>"); foreach (UUID bad in bad_folders) { lastresponse.Append("<map><key>folder_id</key><uuid>"); lastresponse.Append(bad.ToString()); lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>"); } lastresponse.Append("</array></map>"); } lastresponse.Append("</llsd>"); return(lastresponse.ToString());; }