on master help sign in
Move HTTP2 connection handler to Http2Application
commit72684a75c6afecc2edff48943bdcc82aed856746 authorAndrew Pritchard <awpr@google.com> dateWed 29 Jul 2015, 20:21 (11 years ago) parente73cd98
2 files changed+10−6
warp/Network/Wai/Handler/Warp/HTTP2.hs+4−2 warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+6−4
warp/Network/Wai/Handler/Warp/HTTP2.hs+4−2
@@ -7,9 +7,11 @@ import Control.Concurrent (forkIO, killThread)
77import qualified Control.Exception as E
88import Control.Monad (when, unless, replicateM_)
99import Data.ByteString (ByteString)
10+
1011import Network.HTTP2
1112import Network.Socket (SockAddr)
12−import Network.Wai
13+
14+import Network.Wai.HTTP2 (Http2Application)
1315import Network.Wai.Handler.Warp.HTTP2.EncodeFrame
1416import Network.Wai.Handler.Warp.HTTP2.Manager
1517import Network.Wai.Handler.Warp.HTTP2.Receiver
@@ -22,7 +24,7 @@ import Network.Wai.Handler.Warp.Types
2224
2325----------------------------------------------------------------
2426
25−http2 :: Connection -> InternalInfo -> SockAddr -> Transport -> S.Settings -> (BufSize -> IO ByteString) -> Application -> IO ()
27+http2 :: Connection -> InternalInfo -> SockAddr -> Transport -> S.Settings -> (BufSize -> IO ByteString) -> Http2Application -> IO ()
2628http2 conn ii addr transport settings readN app = do
2729 checkTLS
2830 ok <- checkPreface
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+6−4
@@ -22,6 +22,7 @@ import qualified Network.HTTP.Types as H
2222import Network.HTTP2
2323import Network.HTTP2.Priority
2424import Network.Wai
25+import Network.Wai.HTTP2 (Http2Application)
2526import Network.Wai.Handler.Warp.HTTP2.EncodeFrame
2627import Network.Wai.Handler.Warp.HTTP2.Manager
2728import Network.Wai.Handler.Warp.HTTP2.Types
@@ -33,14 +34,14 @@ import Network.Wai.Internal (Response(..), ResponseReceived(..), ResponseReceive
3334
3435----------------------------------------------------------------
3536
36−-- | The wai definition is 'type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived'.
37−-- This type implements the second argument (Response -> IO ResponseReceived)
37+-- | The wai definition is @type Http2Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived@.
38+-- This type implements the second argument @Response -> IO ResponseReceived@
3839-- with extra arguments.
3940type Responder = ThreadContinue -> T.Handle -> Stream -> Request ->
4041 Response -> IO ResponseReceived
4142
4243-- | This function is passed to workers.
43−-- They also pass 'Response's from 'Application's to this function.
44+-- They also pass 'Response's from 'Http2Application's to this function.
4445-- This function enqueues commands for the HTTP/2 sender.
4546response :: Context -> Manager -> Responder
4647response Context{outputQ} mgr tconf th strm req rsp = do
@@ -83,7 +84,8 @@ data Break = Break deriving (Show, Typeable)
8384
8485instance Exception Break
8586
86−worker :: Context -> S.Settings -> T.Manager -> Application -> Responder -> IO ()
87+worker ::
88+ Context -> S.Settings -> T.Manager -> Http2Application -> Responder -> IO ()
8789worker ctx@Context{inputQ,outputQ} set tm app responder = do
8890 tid <- myThreadId
8991 sinfo <- newStreamInfo