aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2009-04-21 19:42:36 +0000
committerCharles Krinke2009-04-21 19:42:36 +0000
commit27c8cc5b1fc78bad6a8286f4236e4ac094b32e52 (patch)
tree36fecde27c8a877ba74952d2203eb10b92b46e35
parent* extend user cache update test to check data backend (diff)
downloadopensim-SC_OLD-27c8cc5b1fc78bad6a8286f4236e4ac094b32e52.zip
opensim-SC_OLD-27c8cc5b1fc78bad6a8286f4236e4ac094b32e52.tar.gz
opensim-SC_OLD-27c8cc5b1fc78bad6a8286f4236e4ac094b32e52.tar.bz2
opensim-SC_OLD-27c8cc5b1fc78bad6a8286f4236e4ac094b32e52.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs7
-rw-r--r--OpenSim/Framework/Servers/GetAssetStreamHandler.cs83
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs31
-rw-r--r--OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs4
4 files changed, 95 insertions, 30 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index fc2d36a..121b8a8 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -303,6 +303,9 @@ namespace OpenSim.Framework.Servers
303 //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); 303 //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler");
304 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 304 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
305 byte[] buffer; 305 byte[] buffer;
306
307 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
308
306 if (requestHandler is IStreamedRequestHandler) 309 if (requestHandler is IStreamedRequestHandler)
307 { 310 {
308 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; 311 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
@@ -371,7 +374,7 @@ namespace OpenSim.Framework.Servers
371 } 374 }
372 375
373 request.InputStream.Close(); 376 request.InputStream.Close();
374 response.ContentType = requestHandler.ContentType; 377
375 if (!response.SendChunked) 378 if (!response.SendChunked)
376 response.ContentLength64 = buffer.LongLength; 379 response.ContentLength64 = buffer.LongLength;
377 380
@@ -1620,4 +1623,4 @@ namespace OpenSim.Framework.Servers
1620 return; 1623 return;
1621 } 1624 }
1622 } 1625 }
1623} \ No newline at end of file 1626}
diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
index d7fb72b..33b9e6e 100644
--- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
+++ b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs
@@ -38,6 +38,7 @@ using OpenSim.Data;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Statistics; 40using OpenSim.Framework.Statistics;
41using System.Net;
41 42
42namespace OpenSim.Framework.Servers 43namespace OpenSim.Framework.Servers
43{ 44{
@@ -90,20 +91,28 @@ namespace OpenSim.Framework.Servers
90// { 91// {
91// asset.Data = ProcessOutgoingAssetData(asset.Data); 92// asset.Data = ProcessOutgoingAssetData(asset.Data);
92// } 93// }
93 94 if (p.Length > 1 && p[1] == "data")
94 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 95 {
95 MemoryStream ms = new MemoryStream(); 96 httpResponse.StatusCode = (int)HttpStatusCode.OK;
96 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); 97 httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
97 xw.Formatting = Formatting.Indented; 98 result = asset.Data;
98 xs.Serialize(xw, asset); 99 }
99 xw.Flush(); 100 else
100 101 {
101 ms.Seek(0, SeekOrigin.Begin); 102 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
102 //StreamReader sr = new StreamReader(ms); 103 MemoryStream ms = new MemoryStream();
103 104 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
104 result = ms.GetBuffer(); 105 xw.Formatting = Formatting.Indented;
105 106 xs.Serialize(xw, asset);
106 Array.Resize<byte>(ref result, (int)ms.Length); 107 xw.Flush();
108
109 ms.Seek(0, SeekOrigin.Begin);
110 //StreamReader sr = new StreamReader(ms);
111
112 result = ms.GetBuffer();
113
114 Array.Resize<byte>(ref result, (int)ms.Length);
115 }
107 } 116 }
108 else 117 else
109 { 118 {
@@ -160,6 +169,48 @@ namespace OpenSim.Framework.Servers
160 169
161 return data; 170 return data;
162 } 171 }
163 172
173 private string SLAssetTypeToContentType(int assetType)
174 {
175 switch (assetType)
176 {
177 case 0:
178 return "image/jp2";
179 case 1:
180 return "application/ogg";
181 case 2:
182 return "application/x-metaverse-callingcard";
183 case 3:
184 return "application/x-metaverse-landmark";
185 case 5:
186 return "application/x-metaverse-clothing";
187 case 6:
188 return "application/x-metaverse-primitive";
189 case 7:
190 return "application/x-metaverse-notecard";
191 case 8:
192 return "application/x-metaverse-folder";
193 case 10:
194 return "application/x-metaverse-lsl";
195 case 11:
196 return "application/x-metaverse-lso";
197 case 12:
198 return "image/tga";
199 case 13:
200 return "application/x-metaverse-bodypart";
201 case 17:
202 return "audio/x-wav";
203 case 19:
204 return "image/jpeg";
205 case 20:
206 return "application/x-metaverse-animation";
207 case 21:
208 return "application/x-metaverse-gesture";
209 case 22:
210 return "application/x-metaverse-simstate";
211 default:
212 return "application/octet-stream";
213 }
214 }
164 } 215 }
165} \ No newline at end of file 216}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
index ee35ae2..bacfe57 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
@@ -113,17 +113,26 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
113 AssetBase asset = new AssetBase(); 113 AssetBase asset = new AssetBase();
114 if ((dataResponse = m_server.StorageProvider.TryFetchDataMetadata(assetID, out asset)) == BackendResponse.Success) 114 if ((dataResponse = m_server.StorageProvider.TryFetchDataMetadata(assetID, out asset)) == BackendResponse.Success)
115 { 115 {
116 XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); 116 if (rawUrl.Length >= 4 && rawUrl[3] == "data")
117 MemoryStream ms = new MemoryStream(); 117 {
118 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); 118 httpResponse.StatusCode = (int)HttpStatusCode.OK;
119 xs.Serialize(xw, asset); 119 httpResponse.ContentType = Utils.SLAssetTypeToContentType(asset.Type);
120 xw.Flush(); 120 buffer=asset.Data;
121 121 }
122 ms.Seek(0, SeekOrigin.Begin); 122 else
123 buffer = ms.GetBuffer(); 123 {
124 Array.Resize<byte>(ref buffer, (int) ms.Length); 124 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
125 ms.Close(); 125 MemoryStream ms = new MemoryStream();
126 httpResponse.StatusCode = (int) HttpStatusCode.OK; 126 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
127 xs.Serialize(xw, asset);
128 xw.Flush();
129
130 ms.Seek(0, SeekOrigin.Begin);
131 buffer = ms.GetBuffer();
132 Array.Resize<byte>(ref buffer, (int)ms.Length);
133 ms.Close();
134 httpResponse.StatusCode = (int)HttpStatusCode.OK;
135 }
127 } 136 }
128 else 137 else
129 { 138 {
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs
index 37cda17..693217b 100644
--- a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs
+++ b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs
@@ -58,7 +58,9 @@ namespace OpenSim.Region.CoreModules.Framework.Services
58 m_scene = scene; 58 m_scene = scene;
59 59
60 // This module is only on for standalones in hypergrid mode 60 // This module is only on for standalones in hypergrid mode
61 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); 61 enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
62 (config.Configs["Startup"].GetBoolean("hypergrid", true)||
63 config.Configs["MXP"].GetBoolean("Enabled", true));
62 } 64 }
63 } 65 }
64 66