Portability | GHC |
---|---|
Stability | experimental |
Maintainer | ameingast@gmail.com |
Safe Haskell | None |
WAI ETag middleware for static files.
- etag :: Bool -> MaxAge -> Middleware
- etag' :: ETagContext -> MaxAge -> Middleware
- respond :: Monad m => MaxAge -> Response -> [Header] -> m Response
- addCacheControl :: MaxAge -> Response -> Response
- modifiedSince :: Request -> Maybe HTTPDate
- hashFileCached :: ETagContext -> FilePath -> IO HashResult
- cacheControl :: MaxAge -> ResponseHeaders -> ResponseHeaders
- hashFile :: FilePath -> IO HashResult
- getModificationTimeIfExists :: FilePath -> IO (Maybe EpochTime)
- data MaxAge
- data HashResult
- = Hash ByteString
- | FileTooBig
- | FileNotFound
- data ETagContext = ETagContext {
- etagCtxUseCache :: !Bool
- etagCtxCache :: !(MVar (HashMap FilePath ByteString))
Documentation
etag :: Bool -> MaxAge -> MiddlewareSource
Attaches the middleware. Enable caching if the first argument is True
.
etag' :: ETagContext -> MaxAge -> MiddlewareSource
Attaches the middleware with a provided context.
respond :: Monad m => MaxAge -> Response -> [Header] -> m ResponseSource
Finalize the response by attaching a cache-control header based on age.
addCacheControl :: MaxAge -> Response -> ResponseSource
Add cache control headers to the response object.
modifiedSince :: Request -> Maybe HTTPDateSource
Determine if-modified-since tag from the http request if present.
hashFileCached :: ETagContext -> FilePath -> IO HashResultSource
Determine the hash of a provided file located at path
.
If caching is enabled, use the cached checksum, otherwise
always re-calculate.
cacheControl :: MaxAge -> ResponseHeaders -> ResponseHeadersSource
Add cache-control to the provided response-headears.
hashFile :: FilePath -> IO HashResultSource
Hash the file with MD5 located at fp
.
getModificationTimeIfExists :: FilePath -> IO (Maybe EpochTime)Source
Determine the file modification time at the location fp
if it exists.
Maximum age that will be attached to all file-resources processed by the middleware.
data HashResult Source
The result of an hash-calculation of a file.
data ETagContext Source
The configuration context of the middleware.
ETagContext | |
|