@@ -52,7 +52,7 @@ import Blaze.ByteString.Builder.HTTP
5252 (chunkedTransferEncoding, chunkedTransferTerminator)
5353import Blaze.ByteString.Builder
5454 (copyByteString, Builder, toLazyByteString, toByteStringIO)
55−import Blaze.ByteString.Builder.Char8 (fromChar, fromString)
55+import Blaze.ByteString.Builder.Char8 (fromChar, fromShow)
5656import Data.Monoid (mconcat, mappend)
5757import Network.Socket.SendFile (sendFile)
5858
@@ -190,18 +190,20 @@ parseFirst s = do
190190 [x, y, z] -> return (x, y, z)
191191 _ -> E.throwError $ BadFirstLine $ B.unpack s
192192 let (hfirst, hsecond) = B.splitAt 5 http'
193− unless (hfirst == "HTTP/") $ E.throwError NonHttp
194− let (rpath, qstring) = B.break (== '?') query
195− return (method, rpath, qstring, hsecond)
193+ if (hfirst == "HTTP/")
194+ then
195+ let (rpath, qstring) = B.break (== '?') query
196+ in return (method, rpath, qstring, hsecond)
197+ else E.throwError NonHttp
196198
197199headers :: HttpVersion -> Status -> ResponseHeaders -> Bool -> Builder
198200headers httpversion status responseHeaders isChunked' =
199201 copyByteString "HTTP/"
200202 `mappend` copyByteString httpversion
201203 `mappend` fromChar ' '
202− `mappend` fromString $ show $ statusCode status
204+ `mappend` fromShow (statusCode status)
203205 `mappend` fromChar ' '
204− `mappend` copyByteString $ statusMessage status
206+ `mappend` copyByteString (statusMessage status)
205207 `mappend` copyByteString "\r\n"
206208 `mappend` mconcat (map go responseHeaders)
207209 `mappend`
@@ -210,7 +212,7 @@ headers httpversion status responseHeaders isChunked' =
210212 else copyByteString "\r\n"
211213 where
212214 go (x, y) =
213− copyByteString $ ciOriginal x
215+ copyByteString (ciOriginal x)
214216 `mappend` copyByteString ": "
215217 `mappend` copyByteString y
216218 `mappend` copyByteString "\r\n"