From 6848465ae24f2069c2cc3e67ff317ad2d085f5cb Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 24 Jun 2010 13:43:38 -0700 Subject: * SimianAssetServiceConnector Delete() was expecting the wrong type of response, reporting false errors * Fixed a typo in a WebUtil error message --- OpenSim/Framework/WebUtil.cs | 2 +- .../SimianGrid/SimianAssetServiceConnector.cs | 29 ++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 94862a6..e20866e 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -114,7 +114,7 @@ namespace OpenSim.Framework } catch (Exception ex) { - m_log.Warn("GET from URL " + url + " failed: " + ex.Message); + m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message); errorMessage = ex.Message; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 3fdee9c..34bb8b3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -371,18 +371,33 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public bool Delete(string id) { + string errorMessage = String.Empty; + string url = m_serverUrl + id; + if (m_cache != null) m_cache.Expire(id); - string url = m_serverUrl + id; + try + { + HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); + request.Method = "DELETE"; - OSDMap response = WebUtil.ServiceRequest(url, "DELETE"); - if (response["Success"].AsBoolean()) - return true; - else - m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service"); + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) + { + if (response.StatusCode != HttpStatusCode.NoContent) + { + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Unexpected response when deleting asset " + url + ": " + + response.StatusCode + " (" + response.StatusDescription + ")"); + } + } - return false; + return true; + } + catch (Exception ex) + { + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service: " + ex.Message); + return false; + } } #endregion IAssetService -- cgit v1.1