From 98b12278f0582f3915f4ba2d62bd5f8997fb519c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 29 Nov 2018 20:21:25 +0000
Subject: fix CopyInventoryFromNotecard error handling
---
.../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 34 ++++++++++++----------
1 file changed, 18 insertions(+), 16 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 0289513..f54c5f5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1312,7 +1312,7 @@ namespace OpenSim.Region.ClientStack.Linden
if(folder == null)
break;
- StringBuilder sb = LLSDxmlEncode.Start(256);
+ StringBuilder sb = LLSDxmlEncode.Start();
LLSDxmlEncode.AddMap(sb);
LLSDxmlEncode.AddElem("folder_id", folder.ID, sb);
LLSDxmlEncode.AddElem("name", folder.Name, sb);
@@ -1324,9 +1324,7 @@ namespace OpenSim.Region.ClientStack.Linden
return resp;
}
- httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
- httpResponse.StatusDescription = "Error";
- httpResponse.KeepAlive = false;
+ httpResponse.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
return "";
}
@@ -1376,21 +1374,25 @@ namespace OpenSim.Region.ClientStack.Linden
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
}
+
+ private string CopyInventoryFromNotecardError(IOSHttpResponse response)
+ {
+ response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
+ response.StatusDescription = "";
+ return "";
+ }
+
///
/// Called by the CopyInventoryFromNotecard caps handler.
///
///
///
///
+
public string CopyInventoryFromNotecard(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
- Hashtable response = new Hashtable();
- response["int_response_code"] = 404;
- response["content_type"] = "text/plain";
- response["keepalive"] = false;
- response["str_response_string"] = "";
-
+ InventoryItemBase copyItem = null;
try
{
OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@@ -1408,14 +1410,11 @@ namespace OpenSim.Region.ClientStack.Linden
{
// TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID);
if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID))
- {
- return LLSDHelpers.SerialiseLLSDReply(response);
- }
+ return CopyInventoryFromNotecardError(httpResponse);
}
}
InventoryItemBase item = null;
- InventoryItemBase copyItem = null;
IClientAPI client = null;
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
@@ -1440,10 +1439,13 @@ namespace OpenSim.Region.ClientStack.Linden
catch (Exception e)
{
m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString());
+ copyItem = null;
}
- response["int_response_code"] = 200;
- return LLSDHelpers.SerialiseLLSDReply(response);
+ if(copyItem == null)
+ return CopyInventoryFromNotecardError(httpResponse);
+
+ return "";
}
public string GetObjectPhysicsData(string request, string path,
--
cgit v1.1