on master help sign in
Fixes warnings and bumped stack lts
commit1932ddde5f9ab10a19216e3768e57910775791f7 authorflip111 <flip101@gmail.com> dateTue 4 Feb 2020, 04:02 (7 years ago) parent36ec4e6
12 files changed+20−18
stack.yaml+1−1 wai-app-static/Network/Wai/Application/Static.hs+1−1 wai-app-static/WaiAppStatic/CmdLine.hs+1 wai-app-static/WaiAppStatic/Listing.hs+1−1 wai-app-static/WaiAppStatic/Storage/Embedded/TH.hs−1 wai-conduit/Network/Wai/Conduit.hs+5−6 wai-extra/example/Main.hs+2−2 wai-websockets/server.lhs+1−1 wai-websockets/wai-websockets.cabal+1 warp-tls/Network/Wai/Handler/WarpTLS.hs+2−2 warp/Network/Wai/Handler/Warp/Recv.hs+2 warp/Network/Wai/Handler/Warp/Run.hs+3−3
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-14.20
1+resolver: lts-14.22
22packages:
33- ./auto-update
44- ./mime-types
wai-app-static/Network/Wai/Application/Static.hs+1−1
@@ -245,7 +245,7 @@ staticAppPieces ss rawPieces req sendResponse = liftIO $ do
245245 response :: StaticResponse -> IO W.ResponseReceived
246246 response (FileResponse file ch) = do
247247 mimetype <- ssGetMimeType ss file
248− let filesize = fileGetSize file
248+ -- let filesize = fileGetSize file
249249 let headers = ("Content-Type", mimetype)
250250 -- Let Warp provide the content-length, since it takes
251251 -- range requests into account
wai-app-static/WaiAppStatic/CmdLine.hs+1
@@ -39,6 +39,7 @@ data Args = Args
3939 }
4040
4141#if MIN_VERSION_optparse_applicative(0, 10, 0)
42+option' :: Mod OptionFields Int -> Parser Int
4243option' = option auto
4344#else
4445option' = option
wai-app-static/WaiAppStatic/Listing.hs+1−1
@@ -64,7 +64,7 @@ defaultListing pieces (Folder contents) = do
6464
6565 -- Add a link to the root of the tree
6666 showFolder' :: Bool -> Pieces -> H.Html
67− showFolder' hasTrailingSlash pieces = showFolder hasTrailingSlash (unsafeToPiece "root" : pieces)
67+ showFolder' hasTrailingSlash pieces' = showFolder hasTrailingSlash (unsafeToPiece "root" : pieces')
6868
6969 showFolder :: Bool -> Pieces -> H.Html
7070 showFolder _ [] = "/" -- won't happen
wai-app-static/WaiAppStatic/Storage/Embedded/TH.hs−1
@@ -7,7 +7,6 @@ module WaiAppStatic.Storage.Embedded.TH(
77
88import Data.ByteString.Builder.Extra (byteStringInsert)
99import Codec.Compression.GZip (compress)
10−import Control.Applicative
1110import Data.ByteString.Unsafe (unsafePackAddressLen)
1211import Data.Either (lefts, rights)
1312import GHC.Exts (Int(..))
wai-conduit/Network/Wai/Conduit.hs+5−6
@@ -17,17 +17,16 @@ import qualified Data.ByteString as S
1717import Control.Monad (unless)
1818import Network.HTTP.Types
1919import Data.ByteString.Builder (Builder)
20−import Data.IORef
2120import qualified Data.Conduit.List as CL
2221
2322-- | Stream the request body.
2423--
2524-- Since 3.0.0
26−sourceRequestBody :: MonadIO m => Request -> Source m ByteString
25+sourceRequestBody :: MonadIO m => Request -> ConduitT () ByteString m ()
2726sourceRequestBody req =
2827 loop
2928 where
30− go = liftIO (requestBody req)
29+ go = liftIO (getRequestBodyChunk req)
3130
3231 loop = do
3332 bs <- go
@@ -38,9 +37,9 @@ sourceRequestBody req =
3837-- | Create an HTTP response out of a @Source@.
3938--
4039-- Since 3.0.0
41−responseSource :: Status -> ResponseHeaders -> Source IO (Flush Builder) -> Response
40+responseSource :: Status -> ResponseHeaders -> ConduitT () (Flush Builder) IO () -> Response
4241responseSource s hs src = responseStream s hs $ \send flush ->
43− src $$ CL.mapM_ (\mbuilder ->
42+ runConduit $ src .| CL.mapM_ (\mbuilder ->
4443 case mbuilder of
4544 Chunk b -> send b
4645 Flush -> flush)
@@ -50,7 +49,7 @@ responseSource s hs src = responseStream s hs $ \send flush ->
5049--
5150-- Since 3.0.0
5251responseRawSource :: (MonadIO m, MonadIO n)
53− => (Source m ByteString -> Sink ByteString n () -> IO ())
52+ => (ConduitT () ByteString m () -> ConduitT ByteString Void n () -> IO ())
5453 -> Response
5554 -> Response
5655responseRawSource app =
wai-extra/example/Main.hs+2−2
@@ -42,10 +42,10 @@ eventRaw = handle 0
4242 where
4343 handle counter emit flush = do
4444 threadDelay 1000000
45− emit $ ServerEvent (Just $ string8 "raw")
45+ _ <- emit $ ServerEvent (Just $ string8 "raw")
4646 Nothing
4747 [string8 . show $ counter]
48− flush
48+ _ <- flush
4949 handle (counter + 1) emit flush
5050
5151main :: IO ()
wai-websockets/server.lhs+1−1
@@ -99,7 +99,7 @@ stays alive on some browsers.
9999
100100> application state pending = do
101101> conn <- WS.acceptRequest pending
102−> WS.forkPingThread conn 30
102+> WS.withPingThread conn 30 (return ()) $ do
103103
104104When a client is successfully connected, we read the first message. This should
105105be in the format of "Hi! I am Jasper", where Jasper is the requested username.
wai-websockets/wai-websockets.cabal+1
@@ -45,6 +45,7 @@ Executable wai-websockets-example
4545 , text
4646 , file-embed
4747 , http-types
48+ other-modules: Network.Wai.Handler.WebSockets
4849 else
4950 buildable: False
5051
warp-tls/Network/Wai/Handler/WarpTLS.hs+2−2
@@ -483,9 +483,9 @@ tryIO = try
483483----------------------------------------------------------------
484484
485485plainHTTP :: TLSSettings -> Settings -> Socket -> S.ByteString -> IO (Connection, Transport)
486−plainHTTP TLSSettings{..} set s bs0 = case onInsecure of
486+plainHTTP TLSSettings{..} _ s bs0 = case onInsecure of
487487 AllowInsecure -> do
488− conn' <- socketConnection set s
488+ conn' <- socketConnection s
489489 cachedRef <- I.newIORef bs0
490490 let conn'' = conn'
491491 { connRecv = recvPlain cachedRef (connRecv conn')
warp/Network/Wai/Handler/Warp/Recv.hs+2
@@ -153,6 +153,8 @@ receiveloop sock ptr size = do
153153 else
154154 return bytes
155155
156+#ifndef mingw32_HOST_OS
156157-- fixme: the type of the return value
157158foreign import ccall unsafe "recv"
158159 c_recv :: CInt -> Ptr CChar -> CSize -> CInt -> IO CInt
160+#endif
warp/Network/Wai/Handler/Warp/Run.hs+3−3
@@ -58,8 +58,8 @@ import Network.Socket (fdSocket)
5858#endif
5959
6060-- | Creating 'Connection' for plain HTTP based on a given socket.
61−socketConnection :: Settings -> Socket -> IO Connection
62−socketConnection set s = do
61+socketConnection :: Socket -> IO Connection
62+socketConnection s = do
6363 bufferPool <- newBufferPool
6464 writeBuf <- allocateBuffer bufferSize
6565 let sendall = Sock.sendAll s
@@ -147,7 +147,7 @@ runSettingsSocket set socket app = do
147147 setSocketCloseOnExec s
148148 -- NoDelay causes an error for AF_UNIX.
149149 setSocketOption s NoDelay 1 `E.catch` \(E.SomeException _) -> return ()
150− conn <- socketConnection set s
150+ conn <- socketConnection s
151151 return (conn, sa)
152152
153153 closeListenSocket = close socket