http server useless changes
parent
0d940df4e2
commit
7ce9f890b1
|
@ -47,30 +47,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
byte[] data = ReadFully(request);
|
byte[] data;
|
||||||
string param = GetParam(path);
|
if (request is MemoryStream)
|
||||||
string responseString = m_method(data, path, param);
|
data = ((MemoryStream)request).ToArray();
|
||||||
|
else
|
||||||
return Encoding.UTF8.GetBytes(responseString);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] ReadFully(Stream stream)
|
|
||||||
{
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
using (MemoryStream ms = new MemoryStream(1024*256))
|
|
||||||
{
|
{
|
||||||
while (true)
|
request.Seek(0, SeekOrigin.Begin);
|
||||||
|
using (MemoryStream ms = new MemoryStream((int)request.Length))
|
||||||
{
|
{
|
||||||
int read = stream.Read(buffer, 0, buffer.Length);
|
request.CopyTo(ms);
|
||||||
|
data = ms.ToArray();
|
||||||
if (read <= 0)
|
|
||||||
{
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
ms.Write(buffer, 0, read);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
request.Dispose();
|
||||||
|
|
||||||
|
string param = GetParam(path);
|
||||||
|
string responseString = m_method(data, path, param);
|
||||||
|
return Encoding.UTF8.GetBytes(responseString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue