diff options
Diffstat (limited to 'OpenSim/Capabilities/Handlers')
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs | 28 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 23 |
2 files changed, 15 insertions, 36 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index 72769c2..506f9d2 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs | |||
@@ -157,25 +157,14 @@ namespace OpenSim.Capabilities.Handlers | |||
157 | int len = end - start + 1; | 157 | int len = end - start + 1; |
158 | 158 | ||
159 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | 159 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); |
160 | 160 | responsedata["int_response_code"] = | |
161 | if (start == 0 && len == mesh.Data.Length) // well redudante maybe | 161 | (int)System.Net.HttpStatusCode.PartialContent; |
162 | { | 162 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, mesh.Data.Length); |
163 | responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK; | 163 | |
164 | responsedata["bin_response_data"] = mesh.Data; | 164 | byte[] d = new byte[len]; |
165 | responsedata["int_bytes"] = mesh.Data.Length; | 165 | Array.Copy(mesh.Data, start, d, 0, len); |
166 | } | 166 | responsedata["bin_response_data"] = d; |
167 | else | 167 | responsedata["int_bytes"] = len; |
168 | { | ||
169 | responsedata["int_response_code"] = | ||
170 | (int)System.Net.HttpStatusCode.PartialContent; | ||
171 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, | ||
172 | mesh.Data.Length); | ||
173 | |||
174 | byte[] d = new byte[len]; | ||
175 | Array.Copy(mesh.Data, start, d, 0, len); | ||
176 | responsedata["bin_response_data"] = d; | ||
177 | responsedata["int_bytes"] = len; | ||
178 | } | ||
179 | } | 168 | } |
180 | } | 169 | } |
181 | else | 170 | else |
@@ -213,6 +202,7 @@ namespace OpenSim.Capabilities.Handlers | |||
213 | 202 | ||
214 | return responsedata; | 203 | return responsedata; |
215 | } | 204 | } |
205 | |||
216 | private bool TryParseRange(string header, out int start, out int end) | 206 | private bool TryParseRange(string header, out int start, out int end) |
217 | { | 207 | { |
218 | if (header.StartsWith("bytes=")) | 208 | if (header.StartsWith("bytes=")) |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 2499ce4..57ec2f5 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -249,24 +249,13 @@ namespace OpenSim.Capabilities.Handlers | |||
249 | // m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | 249 | // m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); |
250 | 250 | ||
251 | response["content-type"] = texture.Metadata.ContentType; | 251 | response["content-type"] = texture.Metadata.ContentType; |
252 | response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; | ||
253 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); | ||
252 | 254 | ||
253 | if (start == 0 && len == texture.Data.Length) // well redudante maybe | 255 | byte[] d = new byte[len]; |
254 | { | 256 | Array.Copy(texture.Data, start, d, 0, len); |
255 | response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; | 257 | response["bin_response_data"] = d; |
256 | response["bin_response_data"] = texture.Data; | 258 | response["int_bytes"] = len; |
257 | response["int_bytes"] = texture.Data.Length; | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; | ||
262 | headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); | ||
263 | |||
264 | byte[] d = new byte[len]; | ||
265 | Array.Copy(texture.Data, start, d, 0, len); | ||
266 | response["bin_response_data"] = d; | ||
267 | response["int_bytes"] = len; | ||
268 | } | ||
269 | // response.Body.Write(texture.Data, start, len); | ||
270 | } | 259 | } |
271 | } | 260 | } |
272 | else | 261 | else |