on master help sign in
doc update.
commitb6b9f3e7748872ee3079bcd1e1dfa48825481604 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 30 Jun 2016, 15:40 (10 years ago) parent85a2581
2 files changed+41
warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+8 warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+33
warp/Network/Wai/Handler/Warp/HTTP2/Request.hs+8
@@ -89,6 +89,10 @@ getHTTP2DataKey :: Vault.Key (IO (Maybe HTTP2Data))
8989getHTTP2DataKey = unsafePerformIO Vault.newKey
9090{-# NOINLINE getHTTP2Data #-}
9191
92+-- | Getting 'HTTP2Data' through vault of the request.
93+-- Warp uses this to receive 'HTTP2Data' from 'Middleware'.
94+--
95+-- Since: 3.2.7
9296getHTTP2Data :: Request -> IO (Maybe HTTP2Data)
9397getHTTP2Data req = case Vault.lookup getHTTP2DataKey (vault req) of
9498 Nothing -> return Nothing
@@ -98,6 +102,10 @@ setHTTP2DataKey :: Vault.Key (Maybe HTTP2Data -> IO ())
98102setHTTP2DataKey = unsafePerformIO Vault.newKey
99103{-# NOINLINE setHTTP2Data #-}
100104
105+-- | Setting 'HTTP2Data' through vault of the request.
106+-- 'Middleware' should use this.
107+--
108+-- Since: 3.2.7
101109setHTTP2Data :: Request -> Maybe HTTP2Data -> IO ()
102110setHTTP2Data req mh2d = case Vault.lookup setHTTP2DataKey (vault req) of
103111 Nothing -> return ()
warp/Network/Wai/Handler/Warp/HTTP2/Types.hs+33
@@ -283,19 +283,52 @@ enqueueControl ctlQ ctl = atomically $ writeTQueue ctlQ ctl
283283
284284----------------------------------------------------------------
285285
286+-- | HTTP/2 specific data.
287+--
288+-- Since: 3.2.7
286289newtype HTTP2Data = HTTP2Data {
290+ -- | Accessor for 'PushPromise' in 'HTTP2Data'.
291+ --
292+ -- Since: 3.2.7
287293 http2dataPushPromise :: [PushPromise]
288294 }
289295
296+-- | Default HTTP/2 specific data.
297+--
298+-- Since: 3.2.7
290299defaultHTTP2Data :: HTTP2Data
291300defaultHTTP2Data = HTTP2Data []
292301
302+-- | HTTP/2 push promise or sever push.
303+--
304+-- Since: 3.2.7
293305data PushPromise = PushPromise {
306+ -- | Accessor for a URL path in 'PushPromise'.
307+ -- E.g. \"\/style\/default.css\".
308+ --
309+ -- Since: 3.2.7
294310 promisedPath :: ByteString
311+ -- | Accessor for 'FilePath' in 'PushPromise'.
312+ -- E.g. \"FILE_PATH/default.css\".
313+ --
314+ -- Since: 3.2.7
295315 , promisedFile :: FilePath
316+ -- | Accessor for 'H.ResponseHeaders' in 'PushPromise'
317+ -- \"content-type\" must be specified.
318+ -- Default value: [].
319+ --
320+ --
321+ -- Since: 3.2.7
296322 , promisedResponseHeaders :: H.ResponseHeaders
323+ -- | Accessor for 'Weight' in 'PushPromise'.
324+ -- Default value: 16.
325+ --
326+ -- Since: 3.2.7
297327 , promisedWeight :: Weight
298328 }
299329
330+-- | Default push promise.
331+--
332+-- Since: 3.2.7
300333defaultPushPromise :: PushPromise
301334defaultPushPromise = PushPromise "" "" [] 16