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