mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Thank you kindly, TLaukkan for a patch that:
Added support for loading bare asset binaries (as opposed to xml encoded asset base) to both sandbox asset service and cable beach. * Added support for enabling region asset service when mxp is enabled. * Moved base http server content type defaulting before invocation of request handle method to allow for variable content type in the response.
This commit is contained in:
@@ -113,17 +113,26 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||
AssetBase asset = new AssetBase();
|
||||
if ((dataResponse = m_server.StorageProvider.TryFetchDataMetadata(assetID, out asset)) == BackendResponse.Success)
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
xs.Serialize(xw, asset);
|
||||
xw.Flush();
|
||||
if (rawUrl.Length >= 4 && rawUrl[3] == "data")
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
httpResponse.ContentType = Utils.SLAssetTypeToContentType(asset.Type);
|
||||
buffer=asset.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
xs.Serialize(xw, asset);
|
||||
xw.Flush();
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
buffer = ms.GetBuffer();
|
||||
Array.Resize<byte>(ref buffer, (int) ms.Length);
|
||||
ms.Close();
|
||||
httpResponse.StatusCode = (int) HttpStatusCode.OK;
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
buffer = ms.GetBuffer();
|
||||
Array.Resize<byte>(ref buffer, (int)ms.Length);
|
||||
ms.Close();
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user