From 6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 16 Mar 2013 03:14:11 -0400 Subject: *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. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 58312ab..dfdd566 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -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; } -- cgit v1.1