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. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 17 ++- bin/HttpServer_OpenSim.dll | Bin 116224 -> 119808 bytes bin/HttpServer_OpenSim.pdb | Bin 343552 -> 355840 bytes bin/HttpServer_OpenSim.xml | 121 +++++++++++++++++++++ 4 files changed, 135 insertions(+), 3 deletions(-) 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; } diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll index 36c0892..e15493d 100755 Binary files a/bin/HttpServer_OpenSim.dll and b/bin/HttpServer_OpenSim.dll differ diff --git a/bin/HttpServer_OpenSim.pdb b/bin/HttpServer_OpenSim.pdb index a69e420..cfff9a7 100644 Binary files a/bin/HttpServer_OpenSim.pdb and b/bin/HttpServer_OpenSim.pdb differ diff --git a/bin/HttpServer_OpenSim.xml b/bin/HttpServer_OpenSim.xml index fa88fc7..61c3ad8 100644 --- a/bin/HttpServer_OpenSim.xml +++ b/bin/HttpServer_OpenSim.xml @@ -1669,6 +1669,65 @@ A header have been received. + + + A thread-safe lockless queue that supports multiple readers and + multiple writers + + + + Queue head + + + Queue tail + + + Queue item count + + + + Constructor + + + + + Enqueue an item + + Item to enqeue + + + + Try to dequeue an item + + Dequeued item if the dequeue was successful + True if an item was successfully deqeued, otherwise false + + + Gets the current number of items in the queue. Since this + is a lockless collection this value should be treated as a close + estimate + + + + Provides a node container for data in a singly linked list + + + + Pointer to the next node in list + + + The data contained by the node + + + + Constructor + + + + + Constructor + + Contains server side HTTP request information. @@ -2825,6 +2884,11 @@ Kind of HTTPS protocol. Usually TLS or SSL. A created . + + + Server is shutting down so shut down the factory + + A request have been received from one of the contexts. @@ -2876,6 +2940,11 @@ A creates . + + + Server is shutting down so shut down the factory + + True if detailed trace logs should be written. @@ -4315,6 +4384,58 @@ message describing the error + + + Timeout Manager. Checks for dead clients. Clients with open connections that are not doing anything. Closes sessions opened with keepalive. + + + + + Causes the watcher to immediately check the connections. + + + + + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. This trims down TickCount so it doesn't wrap + for the callers. + This trims it to a 12 day interval so don't let your frame time get too long. + + + + + + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. + + + + subtraction of passed prevValue from current Environment.TickCount + + + + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. + + + + subtraction of passed prevValue from current Environment.TickCount + + + + Environment.TickCount is an int but it counts all 32 bits so it goes positive + and negative every 24.9 days. Subtracts the passed value (previously fetched by + 'EnvironmentTickCount()') and accounts for any wrapping. + + subtraction of passed prevValue from current Environment.TickCount + + + + Use a Thread or a Timer to monitor the ugly + + Session store using memory for each session. -- cgit v1.1