From 8abc58b698a2aa4c157a8b3de37b55102ecfa50e Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Mon, 12 Mar 2018 21:13:31 +0100 Subject: [PATCH 1/2] Replace blaze-builder with bsb-http-chunked --- snap-server.cabal | 10 ++--- src/Snap/Internal/Http/Server/Parser.hs | 54 ++++++++++++------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/snap-server.cabal b/snap-server.cabal index 0651e2f2..497db434 100644 --- a/snap-server.cabal +++ b/snap-server.cabal @@ -95,7 +95,7 @@ Library build-depends: attoparsec >= 0.12 && < 0.14, base >= 4 && < 4.12, - blaze-builder >= 0.4 && < 0.5, + bsb-http-chunked < 0.1, bytestring >= 0.9.1 && < 0.11, bytestring-builder >= 0.10.4 && < 0.11, case-insensitive >= 1.1 && < 1.3, @@ -210,7 +210,7 @@ Test-suite testsuite attoparsec >= 0.12 && < 0.14, base >= 4 && < 4.12, base16-bytestring >= 0.1 && < 0.2, - blaze-builder >= 0.4 && < 0.5, + bsb-http-chunked < 0.1, bytestring-builder >= 0.10.4 && < 0.11, bytestring >= 0.9.1 && < 0.11, case-insensitive >= 1.1 && < 1.3, @@ -320,7 +320,7 @@ Benchmark benchmark build-depends: attoparsec >= 0.12 && < 0.14, base >= 4 && < 5, - blaze-builder >= 0.4 && < 0.5, + bsb-http-chunked < 0.1, bytestring >= 0.9 && < 0.11, bytestring-builder >= 0.10.4 && < 0.11, criterion >= 0.6 && < 1.5, @@ -403,7 +403,7 @@ Executable snap-test-pong-server build-depends: attoparsec >= 0.12 && < 0.14, base >= 4 && < 5, - blaze-builder >= 0.4 && < 0.5, + bsb-http-chunked < 0.1, bytestring >= 0.9.1 && < 0.11, bytestring-builder >= 0.10.4 && < 0.11, case-insensitive >= 1.1 && < 1.3, @@ -496,7 +496,7 @@ Executable snap-test-server build-depends: attoparsec >= 0.12 && < 0.14, base >= 4 && < 5, - blaze-builder >= 0.4 && < 0.5, + bsb-http-chunked < 0.1, bytestring >= 0.9.1 && < 0.11, bytestring-builder >= 0.10.4 && < 0.11, case-insensitive >= 1.1 && < 1.3, diff --git a/src/Snap/Internal/Http/Server/Parser.hs b/src/Snap/Internal/Http/Server/Parser.hs index a97c4f50..28063360 100644 --- a/src/Snap/Internal/Http/Server/Parser.hs +++ b/src/Snap/Internal/Http/Server/Parser.hs @@ -26,41 +26,41 @@ module Snap.Internal.Http.Server.Parser ------------------------------------------------------------------------------ #if !MIN_VERSION_base(4,8,0) -import Control.Applicative ((<$>)) +import Control.Applicative ((<$>)) #endif -import Control.Exception (Exception, throwIO) -import qualified Control.Exception as E -import Control.Monad (void, when) -import Data.Attoparsec.ByteString.Char8 (Parser, hexadecimal, skipWhile, take) -import qualified Data.ByteString.Char8 as S -import Data.ByteString.Internal (ByteString (..), c2w, memchr, w2c) +import Control.Exception (Exception, throwIO) +import qualified Control.Exception as E +import Control.Monad (void, when) +import Data.Attoparsec.ByteString.Char8 (Parser, hexadecimal, skipWhile, take) +import qualified Data.ByteString.Char8 as S +import Data.ByteString.Internal (ByteString (..), c2w, memchr, w2c) #if MIN_VERSION_bytestring(0, 10, 6) -import Data.ByteString.Internal (accursedUnutterablePerformIO) +import Data.ByteString.Internal (accursedUnutterablePerformIO) #else -import Data.ByteString.Internal (inlinePerformIO) +import Data.ByteString.Internal (inlinePerformIO) #endif -import qualified Data.ByteString.Unsafe as S +import qualified Data.ByteString.Unsafe as S #if !MIN_VERSION_io_streams(1,2,0) -import Data.IORef (newIORef, readIORef, writeIORef) +import Data.IORef (newIORef, readIORef, writeIORef) #endif -import Data.List (sort) -import Data.Typeable (Typeable) -import qualified Data.Vector as V -import qualified Data.Vector.Mutable as MV -import Foreign.ForeignPtr (withForeignPtr) -import Foreign.Ptr (minusPtr, nullPtr, plusPtr) -import Prelude hiding (take) +import Data.List (sort) +import Data.Typeable (Typeable) +import qualified Data.Vector as V +import qualified Data.Vector.Mutable as MV +import Foreign.ForeignPtr (withForeignPtr) +import Foreign.Ptr (minusPtr, nullPtr, plusPtr) +import Prelude hiding (take) ------------------------------------------------------------------------------ -import Blaze.ByteString.Builder.HTTP (chunkedTransferEncoding, chunkedTransferTerminator) -import Data.ByteString.Builder (Builder) -import System.IO.Streams (InputStream, OutputStream) -import qualified System.IO.Streams as Streams -import System.IO.Streams.Attoparsec (parseFromStream) +import Data.ByteString.Builder.HTTP.Chunked (chunkedTransferEncoding, chunkedTransferTerminator) +import Data.ByteString.Builder (Builder) +import System.IO.Streams (InputStream, OutputStream) +import qualified System.IO.Streams as Streams +import System.IO.Streams.Attoparsec (parseFromStream) ------------------------------------------------------------------------------ -import Snap.Internal.Http.Types (Method (..)) -import Snap.Internal.Parsing (crlf, parseCookie, parseUrlEncoded, unsafeFromNat, ()) -import Snap.Types.Headers (Headers) -import qualified Snap.Types.Headers as H +import Snap.Internal.Http.Types (Method (..)) +import Snap.Internal.Parsing (crlf, parseCookie, parseUrlEncoded, unsafeFromNat, ()) +import Snap.Types.Headers (Headers) +import qualified Snap.Types.Headers as H ------------------------------------------------------------------------------ From 650f4df8aaadbb90891c0339e1c68f2efe0c456f Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Thu, 15 Mar 2018 00:44:15 +0100 Subject: [PATCH 2/2] Fix cabal file --- snap-server.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap-server.cabal b/snap-server.cabal index 52465cc5..e4821a3d 100644 --- a/snap-server.cabal +++ b/snap-server.cabal @@ -211,7 +211,7 @@ Test-suite testsuite attoparsec, base, base16-bytestring >= 0.1 && < 0.2, - bsb-http-chunked + bsb-http-chunked, blaze-builder, bytestring-builder, bytestring,