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

Safe HaskellNone
LanguageHaskell98

Network.Wai.Middleware.Push.Referer

Contents

Description

Middleware for server push learning dependency based on Referer:.

Synopsis

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 AND the Referer: ends with "/" or ".html" or ".htm".

Settings

data Settings Source #

Settings for server push based on Referer:.

defaultSettings :: Settings Source #

Default settings.

duration :: Settings -> Int Source #

Duration (in micro seconds) to keep the learning information. The information completely cleared every this duration. Default: 30000000

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