@@ -19,8 +19,8 @@ import Control.Arrow ((***))
1919import Data.Char (toLower)
2020import qualified System.IO
2121import qualified Data.String as String
22−import Blaze.ByteString.Builder (fromByteString, toLazyByteString, flush)
23−import Blaze.ByteString.Builder.Char8 (fromChar, fromString)
22+import Data.ByteString.Builder (byteString, toLazyByteString, char7, string8)
23+import Data.ByteString.Builder.Extra (flush)
2424import Data.ByteString.Lazy.Internal (defaultChunkSize)
2525import System.IO (Handle)
2626import Network.HTTP.Types (Status (..), hRange, hContentType, hContentLength)
@@ -30,12 +30,7 @@ import qualified Data.CaseInsensitive as CI
3030import Data.Monoid (mconcat, mempty, mappend)
3131#endif
3232
33−#if MIN_VERSION_streaming_commons(0, 2, 0)
3433import qualified Data.Streaming.ByteString.Builder as Blaze
35−#else
36−import qualified Data.Streaming.Blaze as Blaze
37−#endif
38−
3934import Data.Function (fix)
4035import Control.Monad (unless, void)
4136
@@ -136,11 +131,7 @@ runGeneric vars inputH outputH xsendfile app = do
136131 return ResponseReceived
137132 _ -> do
138133 let (s, hs, wb) = responseToStream res
139−#if MIN_VERSION_streaming_commons(0, 2, 0)
140134 (blazeRecv, blazeFinish) <- Blaze.newBuilderRecv Blaze.defaultStrategy
141−#else
142− (blazeRecv, blazeFinish) <- Blaze.newBlazeRecv Blaze.defaultStrategy
143−#endif
144135 wb $ \b -> do
145136 let sendBuilder builder = do
146137 popper <- blazeRecv builder
@@ -149,30 +140,30 @@ runGeneric vars inputH outputH xsendfile app = do
149140 unless (B.null bs) $ do
150141 outputH bs
151142 loop
152− sendBuilder $ headers s hs `mappend` fromChar '\n'
143+ sendBuilder $ headers s hs `mappend` char7 '\n'
153144 b sendBuilder (sendBuilder flush)
154145 blazeFinish >>= maybe (return ()) outputH
155146 return ResponseReceived
156147 where
157148 headers s hs = mconcat (map header $ status s : map header' (fixHeaders hs))
158− status (Status i m) = (fromByteString "Status", mconcat
159− [ fromString $ show i
160− , fromChar ' '
161− , fromByteString m
149+ status (Status i m) = (byteString "Status", mconcat
150+ [ string8 $ show i
151+ , char7 ' '
152+ , byteString m
162153 ])
163− header' (x, y) = (fromByteString $ CI.original x, fromByteString y)
154+ header' (x, y) = (byteString $ CI.original x, byteString y)
164155 header (x, y) = mconcat
165156 [ x
166− , fromByteString ": "
157+ , byteString ": "
167158 , y
168− , fromChar '\n'
159+ , char7 '\n'
169160 ]
170161 sfBuilder s hs sf fp = mconcat
171162 [ headers s hs
172− , header $ (fromByteString sf, fromString fp)
173− , fromChar '\n'
174− , fromByteString sf
175− , fromByteString " not supported"
163+ , header $ (byteString sf, string8 fp)
164+ , char7 '\n'
165+ , byteString sf
166+ , byteString " not supported"
176167 ]
177168 fixHeaders h =
178169 case lookup hContentType h of