From fe1e9ac5c3b860be4b7dcba42b95970ba5dbbe5e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 7 Jul 2009 17:45:02 +0000 Subject: [PATCH] Make the asset IN connector return HTTP 404 if an asset is not found, and also make it return a non-xml content type so a browser can be used for testing it. --- .../Handlers/Asset/AssetServerGetHandler.cs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index 7e650f0634..fe0da0b281 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs @@ -68,10 +68,16 @@ namespace OpenSim.Server.Handlers.Asset { result = m_AssetService.GetData(p[0]); if (result == null) + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + httpResponse.ContentType = "text/plain"; result = new byte[0]; - - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = "application/octet-stream"; + } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = "application/octet-stream"; + } } else if (p.Length > 1 && p[1] == "metadata") { @@ -87,6 +93,12 @@ namespace OpenSim.Server.Handlers.Asset httpResponse.ContentType = ServerUtils.SLAssetTypeToContentType(metadata.Type); } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + httpResponse.ContentType = "text/plain"; + result = new byte[0]; + } } else { @@ -101,6 +113,12 @@ namespace OpenSim.Server.Handlers.Asset httpResponse.ContentType = ServerUtils.SLAssetTypeToContentType(asset.Type); } + else + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + httpResponse.ContentType = "text/plain"; + result = new byte[0]; + } } return result; }