aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2018-11-29 20:21:25 +0000
committerUbitUmarov2018-11-29 20:21:25 +0000
commit98b12278f0582f3915f4ba2d62bd5f8997fb519c (patch)
tree90dd0f3885978496c14778e3b1ffc7ded23c7ced /OpenSim/Region
parentmantis 8414: add cap CreateInventoryCategory handler (diff)
downloadopensim-SC-98b12278f0582f3915f4ba2d62bd5f8997fb519c.zip
opensim-SC-98b12278f0582f3915f4ba2d62bd5f8997fb519c.tar.gz
opensim-SC-98b12278f0582f3915f4ba2d62bd5f8997fb519c.tar.bz2
opensim-SC-98b12278f0582f3915f4ba2d62bd5f8997fb519c.tar.xz
fix CopyInventoryFromNotecard error handling
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs34
1 files changed, 18 insertions, 16 deletions
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
1312 if(folder == null) 1312 if(folder == null)
1313 break; 1313 break;
1314 1314
1315 StringBuilder sb = LLSDxmlEncode.Start(256); 1315 StringBuilder sb = LLSDxmlEncode.Start();
1316 LLSDxmlEncode.AddMap(sb); 1316 LLSDxmlEncode.AddMap(sb);
1317 LLSDxmlEncode.AddElem("folder_id", folder.ID, sb); 1317 LLSDxmlEncode.AddElem("folder_id", folder.ID, sb);
1318 LLSDxmlEncode.AddElem("name", folder.Name, sb); 1318 LLSDxmlEncode.AddElem("name", folder.Name, sb);
@@ -1324,9 +1324,7 @@ namespace OpenSim.Region.ClientStack.Linden
1324 return resp; 1324 return resp;
1325 } 1325 }
1326 1326
1327 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; 1327 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
1328 httpResponse.StatusDescription = "Error";
1329 httpResponse.KeepAlive = false;
1330 return ""; 1328 return "";
1331 } 1329 }
1332 1330
@@ -1376,21 +1374,25 @@ namespace OpenSim.Region.ClientStack.Linden
1376 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 1374 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
1377 } 1375 }
1378 1376
1377
1378 private string CopyInventoryFromNotecardError(IOSHttpResponse response)
1379 {
1380 response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
1381 response.StatusDescription = "";
1382 return "";
1383 }
1384
1379 /// <summary> 1385 /// <summary>
1380 /// Called by the CopyInventoryFromNotecard caps handler. 1386 /// Called by the CopyInventoryFromNotecard caps handler.
1381 /// </summary> 1387 /// </summary>
1382 /// <param name="request"></param> 1388 /// <param name="request"></param>
1383 /// <param name="path"></param> 1389 /// <param name="path"></param>
1384 /// <param name="param"></param> 1390 /// <param name="param"></param>
1391
1385 public string CopyInventoryFromNotecard(string request, string path, string param, 1392 public string CopyInventoryFromNotecard(string request, string path, string param,
1386 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 1393 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
1387 { 1394 {
1388 Hashtable response = new Hashtable(); 1395 InventoryItemBase copyItem = null;
1389 response["int_response_code"] = 404;
1390 response["content_type"] = "text/plain";
1391 response["keepalive"] = false;
1392 response["str_response_string"] = "";
1393
1394 try 1396 try
1395 { 1397 {
1396 OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request); 1398 OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@@ -1408,14 +1410,11 @@ namespace OpenSim.Region.ClientStack.Linden
1408 { 1410 {
1409// TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID); 1411// TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID);
1410 if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID)) 1412 if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID))
1411 { 1413 return CopyInventoryFromNotecardError(httpResponse);
1412 return LLSDHelpers.SerialiseLLSDReply(response);
1413 }
1414 } 1414 }
1415 } 1415 }
1416 1416
1417 InventoryItemBase item = null; 1417 InventoryItemBase item = null;
1418 InventoryItemBase copyItem = null;
1419 IClientAPI client = null; 1418 IClientAPI client = null;
1420 1419
1421 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); 1420 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
@@ -1440,10 +1439,13 @@ namespace OpenSim.Region.ClientStack.Linden
1440 catch (Exception e) 1439 catch (Exception e)
1441 { 1440 {
1442 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString()); 1441 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString());
1442 copyItem = null;
1443 } 1443 }
1444 1444
1445 response["int_response_code"] = 200; 1445 if(copyItem == null)
1446 return LLSDHelpers.SerialiseLLSDReply(response); 1446 return CopyInventoryFromNotecardError(httpResponse);
1447
1448 return "";
1447 } 1449 }
1448 1450
1449 public string GetObjectPhysicsData(string request, string path, 1451 public string GetObjectPhysicsData(string request, string path,