When sending http requests, close the response stream instead of waiting

for the finalizer to do it, if it ever does.
avinationmerge
Melanie Thielker 2014-09-20 20:42:07 +02:00
parent 9c552212a9
commit 4002cd96a5
1 changed files with 4 additions and 1 deletions

View File

@ -465,6 +465,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public void SendRequest() public void SendRequest()
{ {
HttpWebResponse response = null; HttpWebResponse response = null;
Stream resStream = null;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
string tempString = null; string tempString = null;
@ -547,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Status = (int)response.StatusCode; Status = (int)response.StatusCode;
Stream resStream = response.GetResponseStream(); resStream = response.GetResponseStream();
do do
{ {
@ -605,6 +606,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
} }
finally finally
{ {
if (resStream != null)
resStream.Close();
if (response != null) if (response != null)
response.Close(); response.Close();
} }