]> gitweb @ CieloNegro.org - Lucu.git/blob - Network/HTTP/Lucu/Chunk.hs
Many bugfixes
[Lucu.git] / Network / HTTP / Lucu / Chunk.hs
1 {-# LANGUAGE
2     UnicodeSyntax
3   #-}
4 module Network.HTTP.Lucu.Chunk
5     ( chunkHeaderP
6     , chunkFooterP
7     , chunkTrailerP
8     )
9     where
10 import Control.Applicative
11 import Data.Attoparsec.Char8
12 import Data.Bits
13 import Network.HTTP.Lucu.Headers
14 import Network.HTTP.Lucu.Parser.Http
15
16 chunkHeaderP ∷ (Integral a, Bits a) ⇒ Parser a
17 {-# INLINEABLE chunkHeaderP #-}
18 chunkHeaderP = do len ← hexadecimal
19                   extension
20                   crlf
21                   return len
22     where
23       extension ∷ Parser ()
24       extension
25           = skipMany ( char ';' *>
26                        token    *>
27                        char '=' *>
28                        (token <|> quotedStr) )
29
30 chunkFooterP ∷ Parser ()
31 chunkFooterP = crlf
32
33 chunkTrailerP ∷ Parser Headers
34 chunkTrailerP = headersP