Skip to content

Commit

Permalink
blaze-builder 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Nov 10, 2010
1 parent 1a10fd7 commit 80682f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Network/HTTP/Enumerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ import Data.Bits
import Data.Maybe (fromMaybe)
import Data.ByteString.Lazy.Internal (defaultChunkSize)
import Codec.Binary.UTF8.String (encodeString)
import qualified Text.Blaze.Builder.Core as Blaze
import qualified Blaze.ByteString.Builder as Blaze
import Data.Monoid (Monoid (..))

-- | The OpenSSL library requires some initialization of variables to be used,
Expand Down Expand Up @@ -577,18 +577,18 @@ urlEncodedBody headers req = req
body = Blaze.toLazyByteString $ body' headers
body' [] = mempty
body' [x] = pair x
body' (x:xs) = pair x `mappend` Blaze.singleton 38 `mappend` body' xs
body' (x:xs) = pair x `mappend` Blaze.fromWord8 38 `mappend` body' xs
pair (x, y)
| S.null y = single x
| otherwise =
single x `mappend` Blaze.singleton 61 `mappend` single y
single = Blaze.writeList go . S.unpack
go 32 = Blaze.writeByte 43 -- space to plus
go c | unreserved c = Blaze.writeByte c
single x `mappend` Blaze.fromWord8 61 `mappend` single y
single = Blaze.fromWrite4List go . S.unpack
go 32 = Blaze.writeWord8 43 -- space to plus
go c | unreserved c = Blaze.writeWord8 c
go c =
let x = shiftR c 4
y = c .&. 15
in Blaze.writeByte 37 `mappend` hexChar x `mappend` hexChar y
in Blaze.writeWord8 37 `mappend` hexChar x `mappend` hexChar y
unreserved 45 = True -- hyphen
unreserved 46 = True -- period
unreserved 95 = True -- underscore
Expand All @@ -599,8 +599,8 @@ urlEncodedBody headers req = req
| 97 <= c && c <= 122 = True -- A - Z
unreserved _ = False
hexChar c
| c < 10 = Blaze.writeByte $ c + 48
| c < 16 = Blaze.writeByte $ c + 55
| c < 10 = Blaze.writeWord8 $ c + 48
| c < 16 = Blaze.writeWord8 $ c + 55
| otherwise = error $ "hexChar: " ++ show c

catchParser :: Monad m => String -> Iteratee a m b -> Iteratee a m b
Expand Down
4 changes: 2 additions & 2 deletions http-enumerator.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: http-enumerator
version: 0.2.0.4
version: 0.2.0.5
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down Expand Up @@ -31,7 +31,7 @@ library
, attoparsec >= 0.8.0.2 && < 0.9
, attoparsec-enumerator >= 0.2 && < 0.3
, utf8-string >= 0.3.4 && < 0.4
, blaze-builder >= 0.1 && < 0.2
, blaze-builder >= 0.2 && < 0.3
, zlib-bindings >= 0.0.0 && < 0.1
if flag(openssl)
build-depends: HsOpenSSL >= 0.8 && < 0.9
Expand Down

0 comments on commit 80682f7

Please sign in to comment.