diff options
author | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
commit | 80c19b7cac52a57fd04966169c657400aeee3de8 (patch) | |
tree | 32c48c0d00da28ed091d8c6a671d43d1e9ab8bdb /OpenSim/Framework/Configuration | |
parent | minor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff) | |
download | opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.zip opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.tar.gz opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.tar.bz2 opensim-SC-80c19b7cac52a57fd04966169c657400aeee3de8.tar.xz |
Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already.
Diffstat (limited to 'OpenSim/Framework/Configuration')
-rw-r--r-- | OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578..6681c37 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -65,23 +65,27 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
65 | byte[] buf = new byte[8192]; | 65 | byte[] buf = new byte[8192]; |
66 | HttpWebRequest request = | 66 | HttpWebRequest request = |
67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); | 67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); |
68 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); | 68 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) |
69 | |||
70 | Stream resStream = response.GetResponseStream(); | ||
71 | |||
72 | string tempString = null; | ||
73 | int count = 0; | ||
74 | |||
75 | do | ||
76 | { | 69 | { |
77 | count = resStream.Read(buf, 0, buf.Length); | 70 | using (Stream resStream = response.GetResponseStream()) |
78 | if (count != 0) | ||
79 | { | 71 | { |
80 | tempString = Util.UTF8.GetString(buf, 0, count); | 72 | string tempString = null; |
81 | sb.Append(tempString); | 73 | int count = 0; |
74 | |||
75 | do | ||
76 | { | ||
77 | count = resStream.Read(buf, 0, buf.Length); | ||
78 | if (count != 0) | ||
79 | { | ||
80 | tempString = Util.UTF8.GetString(buf, 0, count); | ||
81 | sb.Append(tempString); | ||
82 | } | ||
83 | } | ||
84 | while (count > 0); | ||
85 | |||
86 | LoadDataFromString(sb.ToString()); | ||
82 | } | 87 | } |
83 | } while (count > 0); | 88 | } |
84 | LoadDataFromString(sb.ToString()); | ||
85 | } | 89 | } |
86 | catch (WebException) | 90 | catch (WebException) |
87 | { | 91 | { |