packages feed

warp 2.1.1.2 → 2.1.2

raw patch · 5 files changed

+38/−6 lines, 5 files

Files

Network/Wai/Handler/Warp/Internal.hs view
@@ -1,5 +1,21 @@+{-# OPTIONS_GHC -fno-warn-deprecations #-} module Network.Wai.Handler.Warp.Internal     ( Settings (..)+    , getOnOpen+    , getOnClose+    , getOnException     ) where  import Network.Wai.Handler.Warp.Settings (Settings (..))+import Network.Socket (SockAddr)+import Network.Wai (Request)+import Control.Exception (SomeException)++getOnOpen :: Settings -> SockAddr -> IO Bool+getOnOpen = settingsOnOpen++getOnClose :: Settings -> SockAddr -> IO ()+getOnClose = settingsOnClose++getOnException :: Settings -> Maybe Request -> SomeException -> IO ()+getOnException = settingsOnException
Network/Wai/Handler/Warp/RequestHeader.hs view
@@ -48,9 +48,9 @@ -- >>> parseRequestLine "POST /cgi/search.cgi?key=foo HTTP/1.0" -- ("POST","/cgi/search.cgi","?key=foo",HTTP/1.0) -- >>> parseRequestLine "GET "--- *** Exception: BadFirstLine "GET "+-- *** Exception: Warp: Invalid first line of request: "GET " -- >>> parseRequestLine "GET /NotHTTP UNKNOWN/1.1"--- *** Exception: NonHttp+-- *** Exception: Warp: Request line specified a non-HTTP request parseRequestLine :: ByteString                  -> IO (H.Method                        ,ByteString -- Path
Network/Wai/Handler/Warp/Timeout.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE UnboxedTuples, MagicHash #-}  -- |@@ -46,13 +47,14 @@ import GHC.Exts (mkWeak#) import GHC.IO (IO (IO)) #endif-import Control.Concurrent (threadDelay, myThreadId, killThread)+import Control.Concurrent (threadDelay, myThreadId) import qualified Control.Exception as E import GHC.Weak (Weak (..)) import Network.Wai.Handler.Warp.IORef (IORef) import qualified Network.Wai.Handler.Warp.IORef as I import Network.Wai.Handler.Warp.Thread import System.Mem.Weak (deRefWeak)+import Data.Typeable (Typeable)  ---------------------------------------------------------------- @@ -130,7 +132,13 @@ -- deRefWeak checks if ThreadId referenced by the weak reference -- exists. If exists, it means that the thread is alive. killIfExist :: Weak ThreadId -> TimeoutAction-killIfExist wtid = deRefWeak wtid >>= maybe (return ()) killThread+killIfExist wtid = deRefWeak wtid >>= maybe (return ()) (flip E.throwTo TimeoutThread)++data TimeoutThread = TimeoutThread+    deriving Typeable+instance E.Exception TimeoutThread+instance Show TimeoutThread where+    show TimeoutThread = "Thread killed by Warp's timeout reaper"  #if !MIN_VERSION_base(4,6,0) mkWeakThreadId :: ThreadId -> IO (Weak ThreadId)
Network/Wai/Handler/Warp/Types.hs view
@@ -45,7 +45,15 @@                     | IncompleteHeaders                     | ConnectionClosedByPeer                     | OverLargeHeader-                    deriving (Eq, Show, Typeable)+                    deriving (Eq, Typeable)++instance Show InvalidRequest where+    show (NotEnoughLines xs) = "Warp: Incomplete request headers, received: " ++ show xs+    show (BadFirstLine s) = "Warp: Invalid first line of request: " ++ show s+    show NonHttp = "Warp: Request line specified a non-HTTP request"+    show IncompleteHeaders = "Warp: Request headers did not finish transmission"+    show ConnectionClosedByPeer = "Warp: Client closed connection prematurely"+    show OverLargeHeader = "Warp: Request headers too large, possible memory attack detected. Closing connection."  instance Exception InvalidRequest 
warp.cabal view
@@ -1,5 +1,5 @@ Name:                warp-Version:             2.1.1.2+Version:             2.1.2 Synopsis:            A fast, light-weight web server for WAI applications. License:             MIT License-file:        LICENSE