diff options
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 0df16d6..b3a4d61 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -217,17 +217,22 @@ namespace OpenSim.Capabilities.Handlers | |||
217 | 217 | ||
218 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | 218 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); |
219 | 219 | ||
220 | // Always return PartialContent, even if the range covered the entire data length | ||
221 | // We were accidentally sending back 404 before in this situation | ||
222 | // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the | ||
223 | // entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this. | ||
224 | response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; | ||
225 | response["content-type"] = texture.Metadata.ContentType; | 220 | response["content-type"] = texture.Metadata.ContentType; |
226 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); | 221 | |
227 | 222 | if (start == 0 && len == texture.Data.Length) // well redudante maybe | |
228 | byte[] d = new byte[len]; | 223 | { |
229 | Array.Copy(texture.Data, start, d, 0, len); | 224 | response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; |
230 | response["bin_response_data"] = d; | 225 | response["bin_response_data"] = texture.Data; |
226 | } | ||
227 | else | ||
228 | { | ||
229 | response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; | ||
230 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); | ||
231 | |||
232 | byte[] d = new byte[len]; | ||
233 | Array.Copy(texture.Data, start, d, 0, len); | ||
234 | response["bin_response_data"] = d; | ||
235 | } | ||
231 | // response.Body.Write(texture.Data, start, len); | 236 | // response.Body.Write(texture.Data, start, len); |
232 | } | 237 | } |
233 | } | 238 | } |