diff options
author | teravus | 2013-03-16 03:14:11 -0400 |
---|---|---|
committer | teravus | 2013-03-16 03:14:11 -0400 |
commit | 6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d (patch) | |
tree | 7dd6383368b33d8e2c2f10ab13d00570eef7922a | |
parent | Finally remove the 'REST' ApplicationPlugins code which has been non-function... (diff) | |
download | opensim-SC_OLD-6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d.zip opensim-SC_OLD-6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d.tar.gz opensim-SC_OLD-6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d.tar.bz2 opensim-SC_OLD-6e1b3f9951b5ae9fbc0dc65e8404cb878206c68d.tar.xz |
*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.
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 17 | ||||
-rwxr-xr-x | bin/HttpServer_OpenSim.dll | bin | 116224 -> 119808 bytes | |||
-rw-r--r-- | bin/HttpServer_OpenSim.pdb | bin | 343552 -> 355840 bytes | |||
-rw-r--r-- | 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 | |||
486 | { | 486 | { |
487 | try | 487 | try |
488 | { | 488 | { |
489 | SendHTML500(response); | 489 | byte[] buffer500 = SendHTML500(response); |
490 | response.Body.Write(buffer500,0,buffer500.Length); | ||
491 | response.Body.Close(); | ||
490 | } | 492 | } |
491 | catch | 493 | catch |
492 | { | 494 | { |
@@ -719,7 +721,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
719 | catch (Exception e) | 721 | catch (Exception e) |
720 | { | 722 | { |
721 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); | 723 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); |
722 | SendHTML500(response); | 724 | try |
725 | { | ||
726 | byte[] buffer500 = SendHTML500(response); | ||
727 | response.Body.Write(buffer500, 0, buffer500.Length); | ||
728 | response.Body.Close(); | ||
729 | } | ||
730 | catch | ||
731 | { | ||
732 | } | ||
723 | } | 733 | } |
724 | finally | 734 | finally |
725 | { | 735 | { |
@@ -1746,7 +1756,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1746 | response.SendChunked = false; | 1756 | response.SendChunked = false; |
1747 | response.ContentLength64 = buffer.Length; | 1757 | response.ContentLength64 = buffer.Length; |
1748 | response.ContentEncoding = Encoding.UTF8; | 1758 | response.ContentEncoding = Encoding.UTF8; |
1749 | 1759 | ||
1760 | |||
1750 | return buffer; | 1761 | return buffer; |
1751 | } | 1762 | } |
1752 | 1763 | ||
diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll index 36c0892..e15493d 100755 --- a/bin/HttpServer_OpenSim.dll +++ b/bin/HttpServer_OpenSim.dll | |||
Binary files differ | |||
diff --git a/bin/HttpServer_OpenSim.pdb b/bin/HttpServer_OpenSim.pdb index a69e420..cfff9a7 100644 --- a/bin/HttpServer_OpenSim.pdb +++ b/bin/HttpServer_OpenSim.pdb | |||
Binary files 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 @@ | |||
1669 | A header have been received. | 1669 | A header have been received. |
1670 | </summary> | 1670 | </summary> |
1671 | </member> | 1671 | </member> |
1672 | <member name="T:HttpServer.LocklessQueue`1"> | ||
1673 | <summary> | ||
1674 | A thread-safe lockless queue that supports multiple readers and | ||
1675 | multiple writers | ||
1676 | </summary> | ||
1677 | </member> | ||
1678 | <member name="F:HttpServer.LocklessQueue`1.head"> | ||
1679 | <summary>Queue head</summary> | ||
1680 | </member> | ||
1681 | <member name="F:HttpServer.LocklessQueue`1.tail"> | ||
1682 | <summary>Queue tail</summary> | ||
1683 | </member> | ||
1684 | <member name="F:HttpServer.LocklessQueue`1.count"> | ||
1685 | <summary>Queue item count</summary> | ||
1686 | </member> | ||
1687 | <member name="M:HttpServer.LocklessQueue`1.#ctor"> | ||
1688 | <summary> | ||
1689 | Constructor | ||
1690 | </summary> | ||
1691 | </member> | ||
1692 | <member name="M:HttpServer.LocklessQueue`1.Enqueue(`0)"> | ||
1693 | <summary> | ||
1694 | Enqueue an item | ||
1695 | </summary> | ||
1696 | <param name="item">Item to enqeue</param> | ||
1697 | </member> | ||
1698 | <member name="M:HttpServer.LocklessQueue`1.TryDequeue(`0@)"> | ||
1699 | <summary> | ||
1700 | Try to dequeue an item | ||
1701 | </summary> | ||
1702 | <param name="item">Dequeued item if the dequeue was successful</param> | ||
1703 | <returns>True if an item was successfully deqeued, otherwise false</returns> | ||
1704 | </member> | ||
1705 | <member name="P:HttpServer.LocklessQueue`1.Count"> | ||
1706 | <summary>Gets the current number of items in the queue. Since this | ||
1707 | is a lockless collection this value should be treated as a close | ||
1708 | estimate</summary> | ||
1709 | </member> | ||
1710 | <member name="T:HttpServer.LocklessQueue`1.SingleLinkNode"> | ||
1711 | <summary> | ||
1712 | Provides a node container for data in a singly linked list | ||
1713 | </summary> | ||
1714 | </member> | ||
1715 | <member name="F:HttpServer.LocklessQueue`1.SingleLinkNode.Next"> | ||
1716 | <summary>Pointer to the next node in list</summary> | ||
1717 | </member> | ||
1718 | <member name="F:HttpServer.LocklessQueue`1.SingleLinkNode.Item"> | ||
1719 | <summary>The data contained by the node</summary> | ||
1720 | </member> | ||
1721 | <member name="M:HttpServer.LocklessQueue`1.SingleLinkNode.#ctor"> | ||
1722 | <summary> | ||
1723 | Constructor | ||
1724 | </summary> | ||
1725 | </member> | ||
1726 | <member name="M:HttpServer.LocklessQueue`1.SingleLinkNode.#ctor(`0)"> | ||
1727 | <summary> | ||
1728 | Constructor | ||
1729 | </summary> | ||
1730 | </member> | ||
1672 | <member name="T:HttpServer.IHttpRequest"> | 1731 | <member name="T:HttpServer.IHttpRequest"> |
1673 | <summary> | 1732 | <summary> |
1674 | Contains server side HTTP request information. | 1733 | Contains server side HTTP request information. |
@@ -2825,6 +2884,11 @@ | |||
2825 | <param name="protocol">Kind of HTTPS protocol. Usually TLS or SSL.</param> | 2884 | <param name="protocol">Kind of HTTPS protocol. Usually TLS or SSL.</param> |
2826 | <returns>A created <see cref="T:HttpServer.IHttpClientContext"/>.</returns> | 2885 | <returns>A created <see cref="T:HttpServer.IHttpClientContext"/>.</returns> |
2827 | </member> | 2886 | </member> |
2887 | <member name="M:HttpServer.IHttpContextFactory.Shutdown"> | ||
2888 | <summary> | ||
2889 | Server is shutting down so shut down the factory | ||
2890 | </summary> | ||
2891 | </member> | ||
2828 | <member name="E:HttpServer.IHttpContextFactory.RequestReceived"> | 2892 | <member name="E:HttpServer.IHttpContextFactory.RequestReceived"> |
2829 | <summary> | 2893 | <summary> |
2830 | A request have been received from one of the contexts. | 2894 | A request have been received from one of the contexts. |
@@ -2876,6 +2940,11 @@ | |||
2876 | A creates <see cref="T:HttpServer.IHttpClientContext"/>. | 2940 | A creates <see cref="T:HttpServer.IHttpClientContext"/>. |
2877 | </returns> | 2941 | </returns> |
2878 | </member> | 2942 | </member> |
2943 | <member name="M:HttpServer.HttpContextFactory.Shutdown"> | ||
2944 | <summary> | ||
2945 | Server is shutting down so shut down the factory | ||
2946 | </summary> | ||
2947 | </member> | ||
2879 | <member name="P:HttpServer.HttpContextFactory.UseTraceLogs"> | 2948 | <member name="P:HttpServer.HttpContextFactory.UseTraceLogs"> |
2880 | <summary> | 2949 | <summary> |
2881 | True if detailed trace logs should be written. | 2950 | True if detailed trace logs should be written. |
@@ -4315,6 +4384,58 @@ | |||
4315 | </summary> | 4384 | </summary> |
4316 | <param name="message">message describing the error</param> | 4385 | <param name="message">message describing the error</param> |
4317 | </member> | 4386 | </member> |
4387 | <member name="T:HttpServer.ContextTimeoutManager"> | ||
4388 | <summary> | ||
4389 | Timeout Manager. Checks for dead clients. Clients with open connections that are not doing anything. Closes sessions opened with keepalive. | ||
4390 | </summary> | ||
4391 | </member> | ||
4392 | <member name="M:HttpServer.ContextTimeoutManager.ProcessContextTimeouts"> | ||
4393 | <summary> | ||
4394 | Causes the watcher to immediately check the connections. | ||
4395 | </summary> | ||
4396 | </member> | ||
4397 | <member name="M:HttpServer.ContextTimeoutManager.EnvironmentTickCount"> | ||
4398 | <summary> | ||
4399 | Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
4400 | and negative every 24.9 days. This trims down TickCount so it doesn't wrap | ||
4401 | for the callers. | ||
4402 | This trims it to a 12 day interval so don't let your frame time get too long. | ||
4403 | </summary> | ||
4404 | <returns></returns> | ||
4405 | </member> | ||
4406 | <member name="M:HttpServer.ContextTimeoutManager.EnvironmentTickCountSubtract(System.Int32,System.Int32)"> | ||
4407 | <summary> | ||
4408 | Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
4409 | and negative every 24.9 days. Subtracts the passed value (previously fetched by | ||
4410 | 'EnvironmentTickCount()') and accounts for any wrapping. | ||
4411 | </summary> | ||
4412 | <param name="newValue"></param> | ||
4413 | <param name="prevValue"></param> | ||
4414 | <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | ||
4415 | </member> | ||
4416 | <member name="M:HttpServer.ContextTimeoutManager.EnvironmentTickCountAdd(System.Int32,System.Int32)"> | ||
4417 | <summary> | ||
4418 | Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
4419 | and negative every 24.9 days. Subtracts the passed value (previously fetched by | ||
4420 | 'EnvironmentTickCount()') and accounts for any wrapping. | ||
4421 | </summary> | ||
4422 | <param name="newValue"></param> | ||
4423 | <param name="prevValue"></param> | ||
4424 | <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | ||
4425 | </member> | ||
4426 | <member name="M:HttpServer.ContextTimeoutManager.EnvironmentTickCountSubtract(System.Int32)"> | ||
4427 | <summary> | ||
4428 | Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
4429 | and negative every 24.9 days. Subtracts the passed value (previously fetched by | ||
4430 | 'EnvironmentTickCount()') and accounts for any wrapping. | ||
4431 | </summary> | ||
4432 | <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | ||
4433 | </member> | ||
4434 | <member name="T:HttpServer.ContextTimeoutManager.MonitorType"> | ||
4435 | <summary> | ||
4436 | Use a Thread or a Timer to monitor the ugly | ||
4437 | </summary> | ||
4438 | </member> | ||
4318 | <member name="T:HttpServer.Sessions.MemorySessionStore"> | 4439 | <member name="T:HttpServer.Sessions.MemorySessionStore"> |
4319 | <summary> | 4440 | <summary> |
4320 | Session store using memory for each session. | 4441 | Session store using memory for each session. |