diff options
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 8aa87fd..a3238df 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | |||
@@ -187,18 +187,20 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
187 | int start, end; | 187 | int start, end; |
188 | if (TryParseRange(range, out start, out end)) | 188 | if (TryParseRange(range, out start, out end)) |
189 | { | 189 | { |
190 | end = Utils.Clamp(end, 1, texture.Data.Length); | 190 | end = Utils.Clamp(end, 1, texture.Data.Length - 1); |
191 | start = Utils.Clamp(start, 0, end - 1); | 191 | start = Utils.Clamp(start, 0, end - 1); |
192 | int len = end - start + 1; | ||
192 | 193 | ||
193 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | 194 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); |
194 | 195 | ||
195 | if (end - start < texture.Data.Length) | 196 | if (len < texture.Data.Length) |
196 | response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; | 197 | response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; |
197 | 198 | ||
198 | response.ContentLength = end - start; | 199 | response.ContentLength = len; |
199 | response.ContentType = texture.Metadata.ContentType; | 200 | response.ContentType = texture.Metadata.ContentType; |
201 | response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); | ||
200 | 202 | ||
201 | response.Body.Write(texture.Data, start, end - start); | 203 | response.Body.Write(texture.Data, start, len); |
202 | } | 204 | } |
203 | else | 205 | else |
204 | { | 206 | { |