@@ -14,7 +14,7 @@ import qualified Data.ByteString.Lazy as L
14import Data.ByteString.Builder (Builder)
14import Data.ByteString.Builder (Builder)
15import qualified Network.HTTP.Types as H
15import qualified Network.HTTP.Types as H
17−import qualified Network.Wai.Internal as H1 (Request)
17+import Network.Wai.Internal (Request)
19-- | Headers sent after the end of a data stream, as defined by section 4.1.2 of
19-- | Headers sent after the end of a data stream, as defined by section 4.1.2 of
20-- the HTTP\/1.1 spec (RFC 7230), and section 8.1 of the HTTP\/2 spec.
20-- the HTTP\/1.1 spec (RFC 7230), and section 8.1 of the HTTP\/2 spec.
@@ -29,12 +29,8 @@ data PushPromise = PushPromise
29 , promisedHeader :: H.RequestHeaders
29 , promisedHeader :: H.RequestHeaders
32−-- | The type of an HTTP\/2 request: a normal HTTP request and an action to
33−-- push streams associated with this request.
34−type Request = (H1.Request, PushPromise -> Responder -> IO Bool)
36-- | The HTTP\/2-aware equivalent of 'Network.Wai.Application'.
32-- | The HTTP\/2-aware equivalent of 'Network.Wai.Application'.
37−type Http2Application = Request -> Responder
33+type Http2Application = Request -> PushFunc -> Responder
39type Body a = (Builder -> IO ()) -> IO () -> IO a
35type Body a = (Builder -> IO ()) -> IO () -> IO a
@@ -42,6 +38,8 @@ type RespondFunc = forall a. H.Status -> H.ResponseHeaders -> Body a -> IO a
43type Responder = RespondFunc -> IO Trailers
39type Responder = RespondFunc -> IO Trailers
41+type PushFunc = PushPromise -> Responder -> IO Bool
45promiseHeaders :: PushPromise -> H.RequestHeaders
43promiseHeaders :: PushPromise -> H.RequestHeaders
46promiseHeaders p =
44promiseHeaders p =
47 [ (":method", promisedMethod p)
45 [ (":method", promisedMethod p)