on master help sign in
hiding the Timeout module.
commit7a961288b997c2c485957743763d10d7644a61d6 authorKazu Yamamoto <kazu@iij.ad.jp> dateFri 19 Jun 2015, 09:44 (11 years ago) parent84e80b5
4 files changed+24−29
warp/Network/Wai/Handler/Warp.hs+1−2 warp/Network/Wai/Handler/Warp/Internal.hs+17 warp/Network/Wai/Handler/Warp/Timeout.hs+5−26 warp/warp.cabal+1−1
warp/Network/Wai/Handler/Warp.hs+1−2
@@ -118,8 +118,6 @@ module Network.Wai.Handler.Warp (
118118 , HeaderValue
119119 , IndexedHeader
120120 , requestMaxIndex
121− -- ** Time out manager
122− , module Network.Wai.Handler.Warp.Timeout
123121 -- ** File descriptor cache
124122 , module Network.Wai.Handler.Warp.FdCache
125123 -- ** Date
@@ -128,6 +126,7 @@ module Network.Wai.Handler.Warp (
128126 , Source
129127 , recvRequest
130128 , sendResponse
129+ , module Network.Wai.Handler.Warp.Timeout
131130 ) where
132131
133132import Control.Exception (SomeException)
warp/Network/Wai/Handler/Warp/Internal.hs+17
@@ -34,6 +34,23 @@ module Network.Wai.Handler.Warp.Internal (
3434 , IndexedHeader
3535 , requestMaxIndex
3636 -- * Time out manager
37+ -- |
38+ --
39+ -- In order to provide slowloris protection, Warp provides timeout handlers. We
40+ -- follow these rules:
41+ --
42+ -- * A timeout is created when a connection is opened.
43+ --
44+ -- * When all request headers are read, the timeout is tickled.
45+ --
46+ -- * Every time at least 2048 bytes of the request body are read, the timeout
47+ -- is tickled.
48+ --
49+ -- * The timeout is paused while executing user code. This will apply to both
50+ -- the application itself, and a ResponseSource response. The timeout is
51+ -- resumed as soon as we return from user code.
52+ --
53+ -- * Every time data is successfully sent to the client, the timeout is tickled.
3754 , module Network.Wai.Handler.Warp.Timeout
3855 -- * File descriptor cache
3956 , module Network.Wai.Handler.Warp.FdCache
warp/Network/Wai/Handler/Warp/Timeout.hs+5−26
@@ -3,45 +3,24 @@
33{-# LANGUAGE MagicHash #-}
44{-# LANGUAGE UnboxedTuples #-} -- for GHC 7.4 or earlier
55
6−-- |
7−--
8−-- Note that this module will not be exported in Warp 3.2.0.
9−-- Please use Network.Wai.Handler.Warp.Internal instead.
10−--
11−-- In order to provide slowloris protection, Warp provides timeout handlers. We
12−-- follow these rules:
13−--
14−-- * A timeout is created when a connection is opened.
15−--
16−-- * When all request headers are read, the timeout is tickled.
17−--
18−-- * Every time at least 2048 bytes of the request body are read, the timeout
19−-- is tickled.
20−--
21−-- * The timeout is paused while executing user code. This will apply to both
22−-- the application itself, and a ResponseSource response. The timeout is
23−-- resumed as soon as we return from user code.
24−--
25−-- * Every time data is successfully sent to the client, the timeout is tickled.
26−
276module Network.Wai.Handler.Warp.Timeout (
28− -- * Types
7+ -- ** Types
298 Manager
309 , TimeoutAction
3110 , Handle
32− -- * Manager
11+ -- ** Manager
3312 , initialize
3413 , stopManager
3514 , withManager
36− -- * Registration
15+ -- ** Registration
3716 , register
3817 , registerKillThread
39− -- * Control
18+ -- ** Control
4019 , tickle
4120 , cancel
4221 , pause
4322 , resume
44− -- * Exceptions
23+ -- ** Exceptions
4524 , TimeoutThread (..)
4625 ) where
4726
warp/warp.cabal+1−1
@@ -59,7 +59,6 @@ Library
5959 Build-Depends: bytestring >= 0.10.2.0
6060 Exposed-modules: Network.Wai.Handler.Warp
6161 Network.Wai.Handler.Warp.Internal
62− Network.Wai.Handler.Warp.Timeout
6362 Other-modules: Network.Wai.Handler.Warp.Buffer
6463 Network.Wai.Handler.Warp.Conduit
6564 Network.Wai.Handler.Warp.Counter
@@ -77,6 +76,7 @@ Library
7776 Network.Wai.Handler.Warp.Run
7877 Network.Wai.Handler.Warp.SendFile
7978 Network.Wai.Handler.Warp.Settings
79+ Network.Wai.Handler.Warp.Timeout
8080 Network.Wai.Handler.Warp.Types
8181 Network.Wai.Handler.Warp.Windows
8282 Paths_warp