aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs')
-rw-r--r--OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs25
1 files changed, 9 insertions, 16 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
index 92608a6..ef64999 100644
--- a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs
@@ -139,22 +139,21 @@ namespace OpenSim.Capabilities.Handlers
139 // if(type != AssetType.Mesh && type != AssetType.Texture) 139 // if(type != AssetType.Mesh && type != AssetType.Texture)
140 // m_log.Warn("[GETASSETS]: type: " + query); 140 // m_log.Warn("[GETASSETS]: type: " + query);
141 141
142 responsedata["content_type"] = asset.Metadata.ContentType;
143 responsedata["bin_response_data"] = asset.Data;
144 responsedata["int_bytes"] = asset.Data.Length;
145 responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
146
142 string range = String.Empty; 147 string range = String.Empty;
143 if (((Hashtable)request["headers"])["range"] != null) 148 if (((Hashtable)request["headers"])["range"] != null)
144 range = (string)((Hashtable)request["headers"])["range"]; 149 range = (string)((Hashtable)request["headers"])["range"];
145 else if (((Hashtable)request["headers"])["Range"] != null) 150 else if (((Hashtable)request["headers"])["Range"] != null)
146 range = (string)((Hashtable)request["headers"])["Range"]; 151 range = (string)((Hashtable)request["headers"])["Range"];
147 152 else
148 responsedata["content_type"] = asset.Metadata.ContentType; 153 return responsedata; // full asset
149 154
150 if (String.IsNullOrEmpty(range)) 155 if (String.IsNullOrEmpty(range))
151 { 156 return responsedata; // full asset
152 // full asset
153 responsedata["bin_response_data"] = asset.Data;
154 responsedata["int_bytes"] = asset.Data.Length;
155 responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
156 return responsedata;
157 }
158 157
159 // range request 158 // range request
160 int start, end; 159 int start, end;
@@ -181,18 +180,12 @@ namespace OpenSim.Capabilities.Handlers
181 headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length); 180 headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length);
182 responsedata["headers"] = headers; 181 responsedata["headers"] = headers;
183 responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; 182 responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
184 183 responsedata["bin_start"] = start;
185 byte[] d = new byte[len];
186 Array.Copy(asset.Data, start, d, 0, len);
187 responsedata["bin_response_data"] = d;
188 responsedata["int_bytes"] = len; 184 responsedata["int_bytes"] = len;
189 return responsedata; 185 return responsedata;
190 } 186 }
191 187
192 m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr); 188 m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr);
193 responsedata["bin_response_data"] = asset.Data;
194 responsedata["int_bytes"] = asset.Data.Length;
195 responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
196 return responsedata; 189 return responsedata;
197 } 190 }
198 } 191 }