diff options
Diffstat (limited to 'OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 4e755aa..7b4e957 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -196,11 +196,25 @@ namespace OpenSim.Capabilities.Handlers | |||
196 | int start, end; | 196 | int start, end; |
197 | if (TryParseRange(range, out start, out end)) | 197 | if (TryParseRange(range, out start, out end)) |
198 | { | 198 | { |
199 | |||
200 | // Before clamping start make sure we can satisfy it in order to avoid | 199 | // Before clamping start make sure we can satisfy it in order to avoid |
201 | // sending back the last byte instead of an error status | 200 | // sending back the last byte instead of an error status |
202 | if (start >= texture.Data.Length) | 201 | if (start >= texture.Data.Length) |
203 | { | 202 | { |
203 | // m_log.DebugFormat( | ||
204 | // "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}", | ||
205 | // texture.ID, start, texture.Data.Length); | ||
206 | |||
207 | // Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back | ||
208 | // Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations | ||
209 | // of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously | ||
210 | // received a very small texture may attempt to fetch bytes from the server past the | ||
211 | // range of data that it received originally. Whether this happens appears to depend on whether | ||
212 | // the viewer's estimation of how large a request it needs to make for certain discard levels | ||
213 | // (http://wiki.secondlife.com/wiki/Image_System#Discard_Level_and_Mip_Mapping), chiefly discard | ||
214 | // level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable | ||
215 | // here will cause the viewer to treat the texture as bad and never display the full resolution | ||
216 | // However, if we return PartialContent (or OK) instead, the viewer will display that resolution. | ||
217 | |||
204 | // response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; | 218 | // response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; |
205 | // viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters | 219 | // viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters |
206 | response["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; | 220 | response["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound; |
@@ -211,7 +225,7 @@ namespace OpenSim.Capabilities.Handlers | |||
211 | start = Utils.Clamp(start, 0, end); | 225 | start = Utils.Clamp(start, 0, end); |
212 | int len = end - start + 1; | 226 | int len = end - start + 1; |
213 | 227 | ||
214 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | 228 | // m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); |
215 | 229 | ||
216 | // Always return PartialContent, even if the range covered the entire data length | 230 | // Always return PartialContent, even if the range covered the entire data length |
217 | // We were accidentally sending back 404 before in this situation | 231 | // We were accidentally sending back 404 before in this situation |