{-# LANGUAGE UnicodeSyntax #-} module Network.HTTP.Lucu.Chunk ( chunkHeader , chunkFooter , chunkTrailer ) where import Control.Applicative import Data.Attoparsec.Char8 import Data.Bits import Data.Default import Network.HTTP.Lucu.Headers import Network.HTTP.Lucu.Parser.Http chunkHeader ∷ (Integral a, Bits a) ⇒ Parser a {-# INLINEABLE chunkHeader #-} chunkHeader = do len ← hexadecimal extension crlf return len where extension ∷ Parser () extension = skipMany ( char ';' *> token *> char '=' *> (token <|> quotedStr) ) chunkFooter ∷ Parser () {-# INLINE chunkFooter #-} chunkFooter = crlf chunkTrailer ∷ Parser Headers {-# INLINE chunkTrailer #-} chunkTrailer = def