@@ -22,29 +22,28 @@ import Data.Typeable
22import qualified Network.HTTP.Types as H
22import qualified Network.HTTP.Types as H
23import Network.HTTP2
23import Network.HTTP2
24import Network.HTTP2.Priority
24import Network.HTTP2.Priority
25−import Network.Wai.HTTP2 (Http2Application, PushPromise, Responder, Response)
25+import Network.Wai
26−import Network.Wai hiding (Response, responseStatus)
27import Network.Wai.Handler.Warp.HTTP2.EncodeFrame
26import Network.Wai.Handler.Warp.HTTP2.EncodeFrame
28import Network.Wai.Handler.Warp.HTTP2.Manager
27import Network.Wai.Handler.Warp.HTTP2.Manager
29import Network.Wai.Handler.Warp.HTTP2.Types
28import Network.Wai.Handler.Warp.HTTP2.Types
30import Network.Wai.Handler.Warp.IORef
29import Network.Wai.Handler.Warp.IORef
30+import Network.Wai.HTTP2 (Http2Application, PushPromise, Responder, RespondFunc)
31import qualified Network.Wai.Handler.Warp.Settings as S
31import qualified Network.Wai.Handler.Warp.Settings as S
32import qualified Network.Wai.Handler.Warp.Timeout as T
32import qualified Network.Wai.Handler.Warp.Timeout as T
34----------------------------------------------------------------
34----------------------------------------------------------------
36−-- | An 'Http2Application' takes a @forall a. Response a -> IO a@; this type
36+-- | An 'Http2Application' takes a 'RespondFunc'; this type implements that by
37−-- implements that by currying some internal arguments.
37+-- currying some internal arguments.
39-- This is the argument to a 'Responder'.
39-- This is the argument to a 'Responder'.
40−type Respond = IO () -> Stream -> TBQueue Sequence ->
40+type Respond = IO () -> Stream -> TBQueue Sequence -> RespondFunc
41− (forall a. Response a -> IO a)
43-- | This function is passed to workers.
42-- | This function is passed to workers.
44−-- They also pass 'Response's from 'Http2Application's to this function.
43+-- They also pass responses from 'Http2Application's to this function.
45-- This function enqueues commands for the HTTP/2 sender.
44-- This function enqueues commands for the HTTP/2 sender.
46response :: Context -> Manager -> ThreadContinue -> Respond
45response :: Context -> Manager -> ThreadContinue -> Respond
47−response ctx mgr tconf tickle strm sq rsp = do
46+response ctx mgr tconf tickle strm sq s h strmbdy = do
48 -- TODO(awpr) HEAD requests will still stream.
47 -- TODO(awpr) HEAD requests will still stream.
50 -- We must not exit this WAI application.
49 -- We must not exit this WAI application.
@@ -56,12 +55,12 @@ response ctx mgr tconf tickle strm sq rsp = do
56 -- After this work, this thread stops to decrease the number of workers.
55 -- After this work, this thread stops to decrease the number of workers.
57 setThreadContinue tconf False
56 setThreadContinue tconf False
59− runStream ctx OResponse tickle strm sq rsp
58+ runStream ctx OResponse tickle strm sq s h strmbdy
61runStream :: Context
60runStream :: Context
62 -> (Stream -> H.Status -> H.ResponseHeaders -> Aux -> Output)
61 -> (Stream -> H.Status -> H.ResponseHeaders -> Aux -> Output)
63 -> Respond
62 -> Respond
64−runStream Context{outputQ} mkOutput tickle strm sq (s, h, strmbdy) = do
63+runStream Context{outputQ} mkOutput tickle strm sq s h strmbdy = do
65 tvar <- newTVarIO SyncNone
64 tvar <- newTVarIO SyncNone
66 let out = mkOutput strm s h (Persist sq tvar)
65 let out = mkOutput strm s h (Persist sq tvar)
67 -- Since we must not enqueue an empty queue to the priority
66 -- Since we must not enqueue an empty queue to the priority