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.0.6.5-rc1
parent
48720ea7a2
commit
27c8cc5b1f
|
@ -303,6 +303,9 @@ namespace OpenSim.Framework.Servers
|
|||
//m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler");
|
||||
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
|
||||
byte[] buffer;
|
||||
|
||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||
|
||||
if (requestHandler is IStreamedRequestHandler)
|
||||
{
|
||||
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
|
||||
|
@ -371,7 +374,7 @@ namespace OpenSim.Framework.Servers
|
|||
}
|
||||
|
||||
request.InputStream.Close();
|
||||
response.ContentType = requestHandler.ContentType;
|
||||
|
||||
if (!response.SendChunked)
|
||||
response.ContentLength64 = buffer.LongLength;
|
||||
|
||||
|
@ -1620,4 +1623,4 @@ namespace OpenSim.Framework.Servers
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using OpenSim.Data;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using System.Net;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
|
@ -90,20 +91,28 @@ namespace OpenSim.Framework.Servers
|
|||
// {
|
||||
// asset.Data = ProcessOutgoingAssetData(asset.Data);
|
||||
// }
|
||||
if (p.Length > 1 && p[1] == "data")
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
|
||||
result = asset.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, asset);
|
||||
xw.Flush();
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, asset);
|
||||
xw.Flush();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
//StreamReader sr = new StreamReader(ms);
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
//StreamReader sr = new StreamReader(ms);
|
||||
result = ms.GetBuffer();
|
||||
|
||||
result = ms.GetBuffer();
|
||||
|
||||
Array.Resize<byte>(ref result, (int)ms.Length);
|
||||
Array.Resize<byte>(ref result, (int)ms.Length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -160,6 +169,48 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
private string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch (assetType)
|
||||
{
|
||||
case 0:
|
||||
return "image/jp2";
|
||||
case 1:
|
||||
return "application/ogg";
|
||||
case 2:
|
||||
return "application/x-metaverse-callingcard";
|
||||
case 3:
|
||||
return "application/x-metaverse-landmark";
|
||||
case 5:
|
||||
return "application/x-metaverse-clothing";
|
||||
case 6:
|
||||
return "application/x-metaverse-primitive";
|
||||
case 7:
|
||||
return "application/x-metaverse-notecard";
|
||||
case 8:
|
||||
return "application/x-metaverse-folder";
|
||||
case 10:
|
||||
return "application/x-metaverse-lsl";
|
||||
case 11:
|
||||
return "application/x-metaverse-lso";
|
||||
case 12:
|
||||
return "image/tga";
|
||||
case 13:
|
||||
return "application/x-metaverse-bodypart";
|
||||
case 17:
|
||||
return "audio/x-wav";
|
||||
case 19:
|
||||
return "image/jpeg";
|
||||
case 20:
|
||||
return "application/x-metaverse-animation";
|
||||
case 21:
|
||||
return "application/x-metaverse-gesture";
|
||||
case 22:
|
||||
return "application/x-metaverse-simstate";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -58,7 +58,9 @@ namespace OpenSim.Region.CoreModules.Framework.Services
|
|||
m_scene = scene;
|
||||
|
||||
// This module is only on for standalones in hypergrid mode
|
||||
enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
|
||||
enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
|
||||
(config.Configs["Startup"].GetBoolean("hypergrid", true)||
|
||||
config.Configs["MXP"].GetBoolean("Enabled", true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue