aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
diff options
context:
space:
mode:
authorMelanie2009-10-05 10:17:23 +0100
committerMelanie2009-10-05 10:17:23 +0100
commit0744292b479446eb1ebec828afafacc0189709ca (patch)
tree3c43b5f425aff61d3625b75b7aef35ce5062ae56 /OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
parentMerge branch 'master' into vehicles (diff)
parentMake the asset connector async Get overload return false if the asset (diff)
downloadopensim-SC-0744292b479446eb1ebec828afafacc0189709ca.zip
opensim-SC-0744292b479446eb1ebec828afafacc0189709ca.tar.gz
opensim-SC-0744292b479446eb1ebec828afafacc0189709ca.tar.bz2
opensim-SC-0744292b479446eb1ebec828afafacc0189709ca.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/RestSessionService.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestSessionService.cs20
1 files changed, 18 insertions, 2 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
index 3f72c31..7ebb462 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
@@ -94,13 +94,26 @@ namespace OpenSim.Framework.Servers.HttpServer
94 94
95 Stream requestStream = request.GetRequestStream(); 95 Stream requestStream = request.GetRequestStream();
96 requestStream.Write(buffer.ToArray(), 0, length); 96 requestStream.Write(buffer.ToArray(), 0, length);
97 buffer.Close();
97 requestStream.Close(); 98 requestStream.Close();
99
98 TResponse deserial = default(TResponse); 100 TResponse deserial = default(TResponse);
99 using (WebResponse resp = request.GetResponse()) 101 using (WebResponse resp = request.GetResponse())
100 { 102 {
101 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 103 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
102 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 104 Stream respStream = null;
103 resp.Close(); 105 try
106 {
107 respStream = resp.GetResponseStream();
108 deserial = (TResponse)deserializer.Deserialize(respStream);
109 }
110 catch { }
111 finally
112 {
113 if (respStream != null)
114 respStream.Close();
115 resp.Close();
116 }
104 } 117 }
105 return deserial; 118 return deserial;
106 } 119 }
@@ -140,6 +153,7 @@ namespace OpenSim.Framework.Servers.HttpServer
140 serializer.Serialize(writer, sobj); 153 serializer.Serialize(writer, sobj);
141 writer.Flush(); 154 writer.Flush();
142 } 155 }
156 buffer.Close();
143 157
144 int length = (int)buffer.Length; 158 int length = (int)buffer.Length;
145 request.ContentLength = length; 159 request.ContentLength = length;
@@ -165,6 +179,8 @@ namespace OpenSim.Framework.Servers.HttpServer
165 // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); 179 // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
166 180
167 deserial = (TResponse)deserializer.Deserialize(stream); 181 deserial = (TResponse)deserializer.Deserialize(stream);
182 if (stream != null)
183 stream.Close();
168 184
169 if (deserial != null && ResponseCallback != null) 185 if (deserial != null && ResponseCallback != null)
170 { 186 {