From b6920267f0e286a78f792c844ff30021044d7e9b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 3 Oct 2009 16:27:55 -0700 Subject: [PATCH] Close was being called to early on the Memory stream. --- .../Servers/HttpServer/AsynchronousRestObjectRequester.cs | 4 +++- OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 3 ++- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs index 6c8d7cf756..a459f1b370 100644 --- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs @@ -82,7 +82,6 @@ namespace OpenSim.Framework.Servers.HttpServer serializer.Serialize(writer, obj); writer.Flush(); } - buffer.Close(); int length = (int) buffer.Length; request.ContentLength = length; @@ -109,13 +108,16 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { + buffer.Close(); respStream.Close(); response.Close(); } action(deserial); + }, null); }, null); + return; } diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 6c0aa46ce8..7ebb462539 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -88,14 +88,15 @@ namespace OpenSim.Framework.Servers.HttpServer serializer.Serialize(writer, sobj); writer.Flush(); } - buffer.Close(); int length = (int)buffer.Length; request.ContentLength = length; Stream requestStream = request.GetRequestStream(); requestStream.Write(buffer.ToArray(), 0, length); + buffer.Close(); requestStream.Close(); + TResponse deserial = default(TResponse); using (WebResponse resp = request.GetResponse()) { diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index e76d80e6c9..11df1039b2 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -62,7 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer writer.Write(obj); writer.Flush(); } - buffer.Close(); length = (int)obj.Length; request.ContentLength = length; @@ -80,6 +79,8 @@ namespace OpenSim.Framework.Servers.HttpServer { if (requestStream != null) requestStream.Close(); + buffer.Close(); + } }