Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions related to parsing Cache-Control
header as defined in
https://tools.ietf.org/html/rfc7234#section-5.2
To get max-age
/s-maxage
from Cache-Control
header, use parseMaxAge
. If you need to check
other directives use parseCacheControl
.
Rules which starts with obs-
is not required to implement because they are maked as "obsolete" as
per https://tools.ietf.org/html/rfc7230#section-1.2
Synopsis
- type CacheControl = [CacheControlDirective]
- data CacheControlDirective
- = CCDOnlyToken !Text
- | CCDTokenWithVal !Text !Text
- parseMaxAge :: Integral a => Text -> Either String a
- findMaxAge :: Integral a => CacheControl -> Either String (Maybe a)
- noCacheExists :: CacheControl -> Bool
- noStoreExists :: CacheControl -> Bool
- mustRevalidateExists :: CacheControl -> Bool
- findCCDOnlyToken :: (Text -> Bool) -> CacheControl -> Maybe Text
- findCCDTokenWithVal :: (Text -> Bool) -> CacheControl -> Maybe (Text, Text)
- parseCacheControl :: Text -> Either String CacheControl
- cacheControlParser :: Parser CacheControl
- optionalWhitespaceParser :: Parser (Maybe Char)
- cacheDirectiveParser :: Parser CacheControlDirective
- tokenParser :: Parser Text
- tcharParser :: Parser Char
- dquoteParser :: Parser Char
- vcharParser :: Parser Char
- quotedStringParser :: Parser Text
- quotedPairParser :: Parser Char
- qdTextParser :: Parser Char
Documentation
type CacheControl = [CacheControlDirective] Source #
data CacheControlDirective Source #
CCDOnlyToken !Text | |
CCDTokenWithVal !Text !Text |
Instances
Eq CacheControlDirective Source # | |
Defined in Data.Parser.CacheControl (==) :: CacheControlDirective -> CacheControlDirective -> Bool # (/=) :: CacheControlDirective -> CacheControlDirective -> Bool # | |
Show CacheControlDirective Source # | |
Defined in Data.Parser.CacheControl showsPrec :: Int -> CacheControlDirective -> ShowS # show :: CacheControlDirective -> String # showList :: [CacheControlDirective] -> ShowS # |
parseMaxAge :: Integral a => Text -> Either String a Source #
Tries to parse the max-age
or s-maxage
present in the value of Cache-Control
header
findMaxAge :: Integral a => CacheControl -> Either String (Maybe a) Source #
noCacheExists :: CacheControl -> Bool Source #
Checks if the no-cache
directive is present
noStoreExists :: CacheControl -> Bool Source #
Checks if the no-store
directive is present
mustRevalidateExists :: CacheControl -> Bool Source #
Checks if the must-revalidate
directive is present
findCCDOnlyToken :: (Text -> Bool) -> CacheControl -> Maybe Text Source #
findCCDTokenWithVal :: (Text -> Bool) -> CacheControl -> Maybe (Text, Text) Source #
parseCacheControl :: Text -> Either String CacheControl Source #
Parses a Cache-Control
header and returns a list of directives
cacheControlParser :: Parser CacheControl Source #
optionalWhitespaceParser :: Parser (Maybe Char) Source #
cacheDirectiveParser :: Parser CacheControlDirective Source #
tokenParser :: Parser Text Source #
tcharParser :: Parser Char Source #
dquoteParser :: Parser Char Source #
vcharParser :: Parser Char Source #
quotedStringParser :: Parser Text Source #
quotedPairParser :: Parser Char Source #
qdTextParser :: Parser Char Source #