do not trust ms documentation about inner stream dispose
parent
16cfb3deab
commit
34fa6abc00
|
@ -285,14 +285,13 @@ namespace OpenSim.Framework
|
|||
if (tickdiff > LongCallTime)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {7} bytes ({8} uncomp): {9}",
|
||||
"[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4} bytes ({5} uncomp): {6}",
|
||||
reqnum,
|
||||
method,
|
||||
url,
|
||||
tickdiff,
|
||||
compsize,
|
||||
strBuffer != null ? strBuffer.Length : 0,
|
||||
|
||||
strBuffer != null
|
||||
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
|
||||
: "");
|
||||
|
@ -795,19 +794,16 @@ namespace OpenSim.Framework
|
|||
|
||||
request.Method = verb;
|
||||
|
||||
MemoryStream buffer = null;
|
||||
byte[] data = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (verb == "POST")
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
|
@ -948,11 +944,7 @@ namespace OpenSim.Framework
|
|||
reqnum, tickdiff, tickdata);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (buffer != null && buffer.CanRead)
|
||||
buffer.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1003,7 @@ namespace OpenSim.Framework
|
|||
try
|
||||
{
|
||||
using(Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(data,0,length);
|
||||
requestStream.Write(data, 0, length);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1277,8 +1269,8 @@ namespace OpenSim.Framework
|
|||
request.ContentType = "text/xml";
|
||||
|
||||
byte[] data;
|
||||
XmlWriterSettings settings = new XmlWriterSettings(){CloseOutput = true, Encoding = Util.UTF8};
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlWriterSettings settings = new XmlWriterSettings(){Encoding = Util.UTF8};
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
using (XmlWriter writer = XmlWriter.Create(ms, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue