aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorUbitUmarov2017-05-07 00:47:45 +0100
committerUbitUmarov2017-05-07 00:47:45 +0100
commitd0912b61516914f810ba306641aaaa813134462e (patch)
treefc2592d3f9514badd547ab0bad6cf6c4b6097f05 /OpenSim/Framework/Servers
parent oops closed too soon (diff)
downloadopensim-SC-d0912b61516914f810ba306641aaaa813134462e.zip
opensim-SC-d0912b61516914f810ba306641aaaa813134462e.tar.gz
opensim-SC-d0912b61516914f810ba306641aaaa813134462e.tar.bz2
opensim-SC-d0912b61516914f810ba306641aaaa813134462e.tar.xz
let StreamReader be in using statements
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs42
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs7
2 files changed, 18 insertions, 31 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index fb92b92..c32ee28 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -399,11 +399,10 @@ namespace OpenSim.Framework.Servers.HttpServer
399 399
400 Stream requestStream = req.InputStream; 400 Stream requestStream = req.InputStream;
401 401
402 string requestBody;
402 Encoding encoding = Encoding.UTF8; 403 Encoding encoding = Encoding.UTF8;
403 StreamReader reader = new StreamReader(requestStream, encoding); 404 using(StreamReader reader = new StreamReader(requestStream, encoding))
404 405 requestBody = reader.ReadToEnd();
405 string requestBody = reader.ReadToEnd();
406 reader.Close();
407 406
408 Hashtable keysvals = new Hashtable(); 407 Hashtable keysvals = new Hashtable();
409 Hashtable headervals = new Hashtable(); 408 Hashtable headervals = new Hashtable();
@@ -567,13 +566,10 @@ namespace OpenSim.Framework.Servers.HttpServer
567 IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; 566 IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler;
568 Stream requestStream = request.InputStream; 567 Stream requestStream = request.InputStream;
569 568
569 string requestBody;
570 Encoding encoding = Encoding.UTF8; 570 Encoding encoding = Encoding.UTF8;
571 StreamReader reader = new StreamReader(requestStream, encoding); 571 using(StreamReader reader = new StreamReader(requestStream, encoding))
572 572 requestBody = reader.ReadToEnd();
573 string requestBody = reader.ReadToEnd();
574
575 reader.Close();
576 //requestStream.Close();
577 573
578 Hashtable keysvals = new Hashtable(); 574 Hashtable keysvals = new Hashtable();
579 Hashtable headervals = new Hashtable(); 575 Hashtable headervals = new Hashtable();
@@ -690,7 +686,7 @@ namespace OpenSim.Framework.Servers.HttpServer
690 } 686 }
691 } 687 }
692 688
693 request.InputStream.Close(); 689 request.InputStream.Dispose();
694 690
695 if (buffer != null) 691 if (buffer != null)
696 { 692 {
@@ -998,7 +994,7 @@ namespace OpenSim.Framework.Servers.HttpServer
998 { 994 {
999 String requestBody; 995 String requestBody;
1000 996
1001 Stream requestStream = request.InputStream; 997 Stream requestStream = Util.Copy(request.InputStream);
1002 Stream innerStream = null; 998 Stream innerStream = null;
1003 try 999 try
1004 { 1000 {
@@ -1009,9 +1005,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1009 } 1005 }
1010 1006
1011 using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8)) 1007 using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
1012 {
1013 requestBody = reader.ReadToEnd(); 1008 requestBody = reader.ReadToEnd();
1014 } 1009
1015 } 1010 }
1016 finally 1011 finally
1017 { 1012 {
@@ -1263,12 +1258,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1263 //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); 1258 //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");
1264 Stream requestStream = request.InputStream; 1259 Stream requestStream = request.InputStream;
1265 1260
1261 string requestBody;
1266 Encoding encoding = Encoding.UTF8; 1262 Encoding encoding = Encoding.UTF8;
1267 StreamReader reader = new StreamReader(requestStream, encoding); 1263 using(StreamReader reader = new StreamReader(requestStream, encoding))
1268 1264 requestBody= reader.ReadToEnd();
1269 string requestBody = reader.ReadToEnd();
1270 reader.Close();
1271 requestStream.Close();
1272 1265
1273 //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); 1266 //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody);
1274 response.KeepAlive = true; 1267 response.KeepAlive = true;
@@ -1592,15 +1585,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1592 byte[] buffer; 1585 byte[] buffer;
1593 1586
1594 Stream requestStream = request.InputStream; 1587 Stream requestStream = request.InputStream;
1595 1588 string requestBody;
1596 Encoding encoding = Encoding.UTF8; 1589 Encoding encoding = Encoding.UTF8;
1597 StreamReader reader = new StreamReader(requestStream, encoding); 1590 using(StreamReader reader = new StreamReader(requestStream, encoding))
1598 1591 requestBody = reader.ReadToEnd();
1599 string requestBody = reader.ReadToEnd();
1600 // avoid warning for now
1601 reader.ReadToEnd();
1602 reader.Close();
1603 requestStream.Close();
1604 1592
1605 Hashtable keysvals = new Hashtable(); 1593 Hashtable keysvals = new Hashtable();
1606 Hashtable headervals = new Hashtable(); 1594 Hashtable headervals = new Hashtable();
diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
index 0305dee..dfc2715 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs
@@ -50,11 +50,10 @@ namespace OpenSim.Framework.Servers.HttpServer
50 50
51 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 51 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
52 { 52 {
53 string requestBody;
53 Encoding encoding = Encoding.UTF8; 54 Encoding encoding = Encoding.UTF8;
54 StreamReader streamReader = new StreamReader(request, encoding); 55 using(StreamReader streamReader = new StreamReader(request,encoding))
55 56 requestBody = streamReader.ReadToEnd();
56 string requestBody = streamReader.ReadToEnd();
57 streamReader.Close();
58 57
59 string param = GetParam(path); 58 string param = GetParam(path);
60 string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse); 59 string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse);