From 387e9f7a7faeb412054383080afc3507a1522746 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 2 Oct 2009 18:31:08 -0700 Subject: * Creates Util.UTF8 and switches some references of Encoding.UTF8 to Util.UTF8 (not all references were switched since not all OpenSim libraries reference OpenSim.Framework) * Shrinks the largest in-memory object, the LLRAW.HeightmapLookupValue struct (only used for exporting to LLRAW terrain files), to the minimum possible size. This seems to have the odd side effect of cutting the size of the two double[256,256] terrain objects in half. Possibly an alignment optimization? --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 771ae05..f314d64 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -965,7 +965,7 @@ namespace OpenSim.Framework.Servers.HttpServer } // response.ContentType = "application/llsd+json"; - // return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); + // return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); response.ContentType = "application/llsd+xml"; return OSDParser.SerializeLLSDXmlBytes(llsdResponse); } -- cgit v1.1 From 006dfd6d9a31127b5aad55b16b7f85f29faff620 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 2 Oct 2009 20:35:15 -0700 Subject: Closing another stream. --- .../HttpServer/SynchronousRestObjectRequester.cs | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index ec9bd4f..eab463c 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs @@ -58,6 +58,7 @@ namespace OpenSim.Framework.Servers.HttpServer public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { Type type = typeof (TRequest); + TResponse deserial = default(TResponse); WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; @@ -81,19 +82,33 @@ namespace OpenSim.Framework.Servers.HttpServer int length = (int) buffer.Length; request.ContentLength = length; - Stream requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception) + { + return deserial; + } + finally + { + if (requestStream != null) + requestStream.Close(); + } } - TResponse deserial = default(TResponse); try { using (WebResponse resp = request.GetResponse()) { if (resp.ContentLength > 0) { + Stream respStream = resp.GetResponseStream(); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); + deserial = (TResponse)deserializer.Deserialize(respStream); + respStream.Close(); } } } -- cgit v1.1