Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace blaze-builder with bsb-http-chunked #109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions snap-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Library
build-depends:
attoparsec >= 0.12 && < 0.14,
base >= 4.6 && < 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,
Expand Down Expand Up @@ -211,6 +211,7 @@ Test-suite testsuite
attoparsec,
base,
base16-bytestring >= 0.1 && < 0.2,
bsb-http-chunked,
blaze-builder,
bytestring-builder,
bytestring,
Expand Down Expand Up @@ -321,7 +322,7 @@ Benchmark benchmark
build-depends:
attoparsec,
base,
blaze-builder,
bsb-http-chunked,
bytestring,
bytestring-builder,
criterion >= 0.6 && < 1.5,
Expand Down Expand Up @@ -404,7 +405,7 @@ Executable snap-test-pong-server
build-depends:
attoparsec,
base,
blaze-builder,
bsb-http-chunked,
bytestring,
bytestring-builder,
case-insensitive,
Expand Down Expand Up @@ -497,7 +498,7 @@ Executable snap-test-server
build-depends:
attoparsec,
base,
blaze-builder,
bsb-http-chunked,
bytestring,
bytestring-builder,
case-insensitive,
Expand Down
54 changes: 27 additions & 27 deletions src/Snap/Internal/Http/Server/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change.

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


------------------------------------------------------------------------------
Expand Down