aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs')
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs31
1 files changed, 20 insertions, 11 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 7b4e957..c275d87 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -187,7 +187,11 @@ namespace OpenSim.Capabilities.Handlers
187 response["headers"] = headers; 187 response["headers"] = headers;
188 188
189 string range = String.Empty; 189 string range = String.Empty;
190 if (((Hashtable)request["headers"])["Range"] != null) 190
191 if (((Hashtable)request["headers"])["range"] != null)
192 range = (string)((Hashtable)request["headers"])["range"];
193
194 else if (((Hashtable)request["headers"])["Range"] != null)
191 range = (string)((Hashtable)request["headers"])["Range"]; 195 range = (string)((Hashtable)request["headers"])["Range"];
192 196
193 if (!String.IsNullOrEmpty(range)) // JP2's only 197 if (!String.IsNullOrEmpty(range)) // JP2's only
@@ -227,17 +231,22 @@ namespace OpenSim.Capabilities.Handlers
227 231
228// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); 232// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
229 233
230 // Always return PartialContent, even if the range covered the entire data length
231 // We were accidentally sending back 404 before in this situation
232 // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
233 // entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
234 response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
235 response["content-type"] = texture.Metadata.ContentType; 234 response["content-type"] = texture.Metadata.ContentType;
236 headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); 235
237 236 if (start == 0 && len == texture.Data.Length) // well redudante maybe
238 byte[] d = new byte[len]; 237 {
239 Array.Copy(texture.Data, start, d, 0, len); 238 response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
240 response["bin_response_data"] = d; 239 response["bin_response_data"] = texture.Data;
240 }
241 else
242 {
243 response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
244 headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length);
245
246 byte[] d = new byte[len];
247 Array.Copy(texture.Data, start, d, 0, len);
248 response["bin_response_data"] = d;
249 }
241// response.Body.Write(texture.Data, start, len); 250// response.Body.Write(texture.Data, start, len);
242 } 251 }
243 } 252 }