*Yet another HTTPServer update code changes in OpenSim Libs. * This fixes a connection close issue by getting rid of the socket references * This adds a connection timeout checker to shutdown poor or evil connections and combats DOS attempts that just connect and make no complete requests and just wait. It also actually implements KeepAlive... instead of just understanding the connection header in the request... you can test by connecting and requesting a keepalive header and sending another request on the same connection. The new timeout checker closes expired keepalive sessions, just make sure you send the request within 70 seconds of connecting or the timeout checker will timeout the connection.

This commit is contained in:
teravus
2013-03-16 03:14:11 -04:00
parent 03075359b5
commit 6e1b3f9951
4 changed files with 135 additions and 3 deletions

View File

@@ -486,7 +486,9 @@ namespace OpenSim.Framework.Servers.HttpServer
{
try
{
SendHTML500(response);
byte[] buffer500 = SendHTML500(response);
response.Body.Write(buffer500,0,buffer500.Length);
response.Body.Close();
}
catch
{
@@ -719,7 +721,15 @@ namespace OpenSim.Framework.Servers.HttpServer
catch (Exception e)
{
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e);
SendHTML500(response);
try
{
byte[] buffer500 = SendHTML500(response);
response.Body.Write(buffer500, 0, buffer500.Length);
response.Body.Close();
}
catch
{
}
}
finally
{
@@ -1746,7 +1756,8 @@ namespace OpenSim.Framework.Servers.HttpServer
response.SendChunked = false;
response.ContentLength64 = buffer.Length;
response.ContentEncoding = Encoding.UTF8;
return buffer;
}