diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/RestSessionService.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 3f72c31..6c0aa46 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
88 | serializer.Serialize(writer, sobj); | 88 | serializer.Serialize(writer, sobj); |
89 | writer.Flush(); | 89 | writer.Flush(); |
90 | } | 90 | } |
91 | buffer.Close(); | ||
91 | 92 | ||
92 | int length = (int)buffer.Length; | 93 | int length = (int)buffer.Length; |
93 | request.ContentLength = length; | 94 | request.ContentLength = length; |
@@ -99,8 +100,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
99 | using (WebResponse resp = request.GetResponse()) | 100 | using (WebResponse resp = request.GetResponse()) |
100 | { | 101 | { |
101 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 102 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
102 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | 103 | Stream respStream = null; |
103 | resp.Close(); | 104 | try |
105 | { | ||
106 | respStream = resp.GetResponseStream(); | ||
107 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
108 | } | ||
109 | catch { } | ||
110 | finally | ||
111 | { | ||
112 | if (respStream != null) | ||
113 | respStream.Close(); | ||
114 | resp.Close(); | ||
115 | } | ||
104 | } | 116 | } |
105 | return deserial; | 117 | return deserial; |
106 | } | 118 | } |
@@ -140,6 +152,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
140 | serializer.Serialize(writer, sobj); | 152 | serializer.Serialize(writer, sobj); |
141 | writer.Flush(); | 153 | writer.Flush(); |
142 | } | 154 | } |
155 | buffer.Close(); | ||
143 | 156 | ||
144 | int length = (int)buffer.Length; | 157 | int length = (int)buffer.Length; |
145 | request.ContentLength = length; | 158 | request.ContentLength = length; |
@@ -165,6 +178,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
165 | // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); | 178 | // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); |
166 | 179 | ||
167 | deserial = (TResponse)deserializer.Deserialize(stream); | 180 | deserial = (TResponse)deserializer.Deserialize(stream); |
181 | if (stream != null) | ||
182 | stream.Close(); | ||
168 | 183 | ||
169 | if (deserial != null && ResponseCallback != null) | 184 | if (deserial != null && ResponseCallback != null) |
170 | { | 185 | { |