diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6d3a3a7..da2bfeb 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -250,14 +250,30 @@ namespace OpenSim.Server.Handlers.Simulation | |||
250 | return encoding.GetBytes("false"); | 250 | return encoding.GetBytes("false"); |
251 | } | 251 | } |
252 | 252 | ||
253 | string requestBody; | ||
254 | |||
253 | Stream inputStream = request; | 255 | Stream inputStream = request; |
254 | if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) | 256 | Stream innerStream = null; |
255 | inputStream = new GZipStream(inputStream, CompressionMode.Decompress); | 257 | try |
258 | { | ||
259 | if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) | ||
260 | { | ||
261 | innerStream = inputStream; | ||
262 | inputStream = new GZipStream(innerStream, CompressionMode.Decompress); | ||
263 | } | ||
256 | 264 | ||
257 | StreamReader reader = new StreamReader(inputStream, encoding); | 265 | using (StreamReader reader = new StreamReader(inputStream, encoding)) |
266 | { | ||
267 | requestBody = reader.ReadToEnd(); | ||
268 | } | ||
269 | } | ||
270 | finally | ||
271 | { | ||
272 | if (innerStream != null) | ||
273 | innerStream.Dispose(); | ||
274 | inputStream.Dispose(); | ||
275 | } | ||
258 | 276 | ||
259 | string requestBody = reader.ReadToEnd(); | ||
260 | reader.Close(); | ||
261 | keysvals.Add("body", requestBody); | 277 | keysvals.Add("body", requestBody); |
262 | 278 | ||
263 | Hashtable responsedata = new Hashtable(); | 279 | Hashtable responsedata = new Hashtable(); |
@@ -461,15 +477,31 @@ namespace OpenSim.Server.Handlers.Simulation | |||
461 | keysvals.Add("headers", headervals); | 477 | keysvals.Add("headers", headervals); |
462 | keysvals.Add("querystringkeys", querystringkeys); | 478 | keysvals.Add("querystringkeys", querystringkeys); |
463 | 479 | ||
480 | String requestBody; | ||
481 | Encoding encoding = Encoding.UTF8; | ||
482 | |||
464 | Stream inputStream = request; | 483 | Stream inputStream = request; |
465 | if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) | 484 | Stream innerStream = null; |
466 | inputStream = new GZipStream(inputStream, CompressionMode.Decompress); | 485 | try |
486 | { | ||
487 | if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) | ||
488 | { | ||
489 | innerStream = inputStream; | ||
490 | inputStream = new GZipStream(innerStream, CompressionMode.Decompress); | ||
491 | } | ||
467 | 492 | ||
468 | Encoding encoding = Encoding.UTF8; | 493 | using (StreamReader reader = new StreamReader(inputStream, encoding)) |
469 | StreamReader reader = new StreamReader(inputStream, encoding); | 494 | { |
495 | requestBody = reader.ReadToEnd(); | ||
496 | } | ||
497 | } | ||
498 | finally | ||
499 | { | ||
500 | if (innerStream != null) | ||
501 | innerStream.Dispose(); | ||
502 | inputStream.Dispose(); | ||
503 | } | ||
470 | 504 | ||
471 | string requestBody = reader.ReadToEnd(); | ||
472 | reader.Close(); | ||
473 | keysvals.Add("body", requestBody); | 505 | keysvals.Add("body", requestBody); |
474 | 506 | ||
475 | httpResponse.StatusCode = 200; | 507 | httpResponse.StatusCode = 200; |