@@ -11,7 +11,8 @@ import Blaze.ByteString.Builder.HTTP (chunkedTransferEncoding, chunkedTransferTe
1111import Control.Applicative
1212import Control.Exception
1313import Control.Monad.IO.Class (MonadIO, liftIO)
14−import qualified Data.ByteString.Char8 as B
14+import Data.ByteString (ByteString)
15+import qualified Data.ByteString.Char8 as B (pack)
1516import qualified Data.CaseInsensitive as CI
1617import Data.Conduit
1718import Data.Conduit.Blaze (builderToByteString)
@@ -119,7 +120,7 @@ sendResponse th req conn (ResponseSource s hs bodyFlush)
119120----------------------------------------------------------------
120121
121122-- | Use 'connSendAll' to send this data while respecting timeout rules.
122−connSink :: Connection -> T.Handle -> Sink B.ByteString (ResourceT IO) ()
123+connSink :: Connection -> T.Handle -> Sink ByteString (ResourceT IO) ()
123124connSink Connection { connSendAll = send } th =
124125 sink
125126 where
@@ -166,16 +167,19 @@ infoFromResponse hs (isPersist,isChunked) = (isKeepAlive, needsChunked)
166167 isKeepAlive = isPersist && (isChunked || hasLength)
167168 hasLength = isJust $ checkLength hs
168169
169−checkLength :: H.ResponseHeaders -> Maybe B.ByteString
170+checkLength :: H.ResponseHeaders -> Maybe ByteString
170171checkLength = lookup H.hContentLength
171172
172173----------------------------------------------------------------
173174
174175hasBody :: H.Status -> Request -> Bool
175−hasBody s req = s /= H.Status 204 ""
176− && s /= H.status304
177− && H.statusCode s >= 200
178− && requestMethod req /= H.methodHead
176+hasBody s req = sc /= 204
177+ && sc /= 304
178+ && sc >= 200
179+ && method /= H.methodHead
180+ where
181+ sc = H.statusCode s
182+ method = requestMethod req
179183
180184----------------------------------------------------------------
181185
@@ -197,7 +201,7 @@ warpVersionHeader = (hServer, ver)
197201
198202----------------------------------------------------------------
199203
200−composeHeader :: H.HttpVersion -> H.Status -> H.ResponseHeaders -> B.ByteString
204+composeHeader :: H.HttpVersion -> H.Status -> H.ResponseHeaders -> ByteString
201205composeHeader version s hs = RH.composeHeader version s (addServerHeader hs)
202206
203207composeHeaderBuilder :: H.HttpVersion -> H.Status -> H.ResponseHeaders -> Bool -> Builder