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

Safe HaskellNone
LanguageHaskell98

Network.Wai.Middleware.Push.Referer

Description

Middleware for server push learning dependency based on Referer:.

Synopsis

Documentation

pushOnReferer :: MakePushPromise -> Middleware Source #

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

Cache of learning information is kept for 30 seconds and cleared completely. Max number of keys (e.g. index.html) is 20. Max number of values (e.g. style.css) for each key is 20. These numbers are hard-coded at this moment.

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".

type URLPath = ByteString Source #

Type for URL path.