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.trunk
parent
10d874fb27
commit
fe1e9ac5c3
|
@ -68,11 +68,17 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
{
|
{
|
||||||
result = m_AssetService.GetData(p[0]);
|
result = m_AssetService.GetData(p[0]);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
httpResponse.ContentType = "text/plain";
|
||||||
result = new byte[0];
|
result = new byte[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
httpResponse.ContentType = "application/octet-stream";
|
httpResponse.ContentType = "application/octet-stream";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (p.Length > 1 && p[1] == "metadata")
|
else if (p.Length > 1 && p[1] == "metadata")
|
||||||
{
|
{
|
||||||
AssetMetadata metadata = m_AssetService.GetMetadata(p[0]);
|
AssetMetadata metadata = m_AssetService.GetMetadata(p[0]);
|
||||||
|
@ -87,6 +93,12 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
httpResponse.ContentType =
|
httpResponse.ContentType =
|
||||||
ServerUtils.SLAssetTypeToContentType(metadata.Type);
|
ServerUtils.SLAssetTypeToContentType(metadata.Type);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
httpResponse.ContentType = "text/plain";
|
||||||
|
result = new byte[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -101,6 +113,12 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
httpResponse.ContentType =
|
httpResponse.ContentType =
|
||||||
ServerUtils.SLAssetTypeToContentType(asset.Type);
|
ServerUtils.SLAssetTypeToContentType(asset.Type);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
httpResponse.ContentType = "text/plain";
|
||||||
|
result = new byte[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue