From 6c79cc652ba481f714ccd728fe1f062fbd69bb83 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 May 2017 00:54:17 +0100 Subject: [PATCH] some conditional dispose on http requests inputstream --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- .../Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ec3805f272..da2b860a62 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -815,7 +815,8 @@ namespace OpenSim.Framework.Servers.HttpServer } } - request.InputStream.Dispose(); + if(request.InputStream.CanRead) + request.InputStream.Dispose(); if (buffer != null) { diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 6537f64871..eb8ca0db6c 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs @@ -86,6 +86,9 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer = server.DoHTTPGruntWork(responsedata, response); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; @@ -111,6 +114,9 @@ namespace OpenSim.Framework.Servers.HttpServer OSHttpResponse response = new OSHttpResponse(new HttpResponse(HttpContext, Request), HttpContext); + if(Request.Body.CanRead) + Request.Body.Dispose(); + response.SendChunked = false; response.ContentLength64 = 0; response.ContentEncoding = Encoding.UTF8;