wai-http2-extra-0.1.3: WAI utilities for HTTP/2

Safe Haskell | None
Language | Haskell2010

Network.Wai.Middleware.Push.Referer

Contents

- Middleware
- Making push promise
- Settings

Description

Middleware for server push learning dependency based on Referer:.

Synopsis

- pushOnReferer :: Settings -> Middleware
- type URLPath = ByteString
- type MakePushPromise = URLPath -> URLPath -> FilePath -> IO (Maybe PushPromise)
- defaultMakePushPromise :: MakePushPromise
- data Settings
- defaultSettings :: Settings
- makePushPromise :: Settings -> MakePushPromise
- duration :: Settings -> Int
- keyLimit :: Settings -> Int
- valueLimit :: Settings -> Int

# Middleware

pushOnReferer :: Settings -> Middleware Source #

The middleware to push files based on Referer:. Learning strategy is implemented in the first argument.

# Making push promise

type URLPath = ByteString Source #

Type for URL path.

type MakePushPromise Source #

Arguments

= URLPath | path in referer (key: /index.html)
-> URLPath | path to be pushed (value: /style.css)
-> FilePath | file to be pushed (file_path/style.css)
-> IO (Maybe PushPromise) |

Making a push promise based on Referer:, path to be pushed and file to be pushed. If the middleware should push this file in the next time when the page of Referer: is accessed, this function should return `Just`. If `Nothing` is returned, the middleware learns nothing.

defaultMakePushPromise :: MakePushPromise Source #

Learn if the file to be pushed is CSS (.css) or JavaScript (.js) file.

# Settings

data Settings Source #

Settings for server push based on Referer:.

defaultSettings :: Settings Source #

Default settings.

makePushPromise :: Settings -> MakePushPromise Source #

Default: `defaultMakePushPromise`

duration :: Settings -> Int Source #

Deprecated

keyLimit :: Settings -> Int Source #

Max number of keys (e.g. index.html) in the learning information. Default: 20

valueLimit :: Settings -> Int Source #

Max number of values (e.g. style.css) in the learning information. Default: 20