diff options
author | Latif Khalifa | 2010-10-09 18:01:11 +0200 |
---|---|---|
committer | Latif Khalifa | 2010-10-09 18:01:11 +0200 |
commit | 5e381ec67c1a8d108fced63b76ae44eeb70aa38e (patch) | |
tree | 039b0f397dbc768e40ef3433e6baba850f4d0259 /OpenSim/Region | |
parent | In case when 1 single byte is requested (yes viewer does this) (diff) | |
download | opensim-SC_OLD-5e381ec67c1a8d108fced63b76ae44eeb70aa38e.zip opensim-SC_OLD-5e381ec67c1a8d108fced63b76ae44eeb70aa38e.tar.gz opensim-SC_OLD-5e381ec67c1a8d108fced63b76ae44eeb70aa38e.tar.bz2 opensim-SC_OLD-5e381ec67c1a8d108fced63b76ae44eeb70aa38e.tar.xz |
Return error code instead of the last byte of the file if range is not satisfiable
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index d564ee6..6545be7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | |||
@@ -186,7 +186,15 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
186 | // Range request | 186 | // Range request |
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 | // Before clamping end make sure we can satisfy it in order to avoid | ||
191 | // sending back the last byte instead of an error status | ||
192 | if (end >= texture.Data.Length) | ||
193 | { | ||
194 | response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; | ||
195 | return; | ||
196 | } | ||
197 | |||
190 | end = Utils.Clamp(end, 0, texture.Data.Length - 1); | 198 | end = Utils.Clamp(end, 0, texture.Data.Length - 1); |
191 | start = Utils.Clamp(start, 0, end); | 199 | start = Utils.Clamp(start, 0, end); |
192 | int len = end - start + 1; | 200 | int len = end - start + 1; |