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