mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already.
This commit is contained in:
@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
reqStream.Close();
|
||||
}
|
||||
|
||||
HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse();
|
||||
Encoding encoding = Util.UTF8;
|
||||
StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding);
|
||||
fwdresponsestr = fwdresponsestream.ReadToEnd();
|
||||
fwdresponsecontenttype = fwdrsp.ContentType;
|
||||
fwdresponsecode = (int)fwdrsp.StatusCode;
|
||||
fwdresponsestream.Close();
|
||||
using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse())
|
||||
{
|
||||
Encoding encoding = Util.UTF8;
|
||||
|
||||
using (Stream s = fwdrsp.GetResponseStream())
|
||||
{
|
||||
using (StreamReader fwdresponsestream = new StreamReader(s))
|
||||
{
|
||||
fwdresponsestr = fwdresponsestream.ReadToEnd();
|
||||
fwdresponsecontenttype = fwdrsp.ContentType;
|
||||
fwdresponsecode = (int)fwdrsp.StatusCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response["content_type"] = fwdresponsecontenttype;
|
||||
response["str_response_string"] = fwdresponsestr;
|
||||
|
||||
@@ -1116,18 +1116,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
||||
// Otherwise prepare the request
|
||||
m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl);
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
|
||||
HttpWebResponse rsp = null;
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
|
||||
|
||||
// We are sending just parameters, no content
|
||||
req.ContentLength = 0;
|
||||
|
||||
// Send request and retrieve the response
|
||||
rsp = (HttpWebResponse)req.GetResponse();
|
||||
|
||||
XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream());
|
||||
doc.Load(rdr);
|
||||
rdr.Close();
|
||||
using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse())
|
||||
using (Stream s = rsp.GetResponseStream())
|
||||
using (XmlTextReader rdr = new XmlTextReader(s))
|
||||
doc.Load(rdr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user