scotty 0.11.1 → 0.11.2
raw patch · 6 files changed
+32/−16 lines, 6 filesdep ~network
Dependency ranges changed: network
Files
- Web/Scotty.hs +1/−1
- Web/Scotty/Trans.hs +1/−1
- Web/Scotty/Util.hs +6/−8
- changelog.md +3/−0
- scotty.cabal +5/−3
- test/Web/ScottySpec.hs +16/−3
Web/Scotty.hs view
@@ -41,8 +41,8 @@ import Data.ByteString.Lazy.Char8 (ByteString) import Data.Text.Lazy (Text) -import Network (Socket) import Network.HTTP.Types (Status, StdMethod)+import Network.Socket (Socket) import Network.Wai (Application, Middleware, Request, StreamingBody) import Network.Wai.Handler.Warp (Port)
Web/Scotty/Trans.hs view
@@ -47,8 +47,8 @@ import Data.Default.Class (def) -import Network (Socket) import Network.HTTP.Types (status404, status500)+import Network.Socket (Socket) import Network.Wai import Network.Wai.Handler.Warp (Port, runSettings, runSettingsSocket, setPort, getPort)
Web/Scotty/Util.hs view
@@ -12,7 +12,7 @@ , socketDescription ) where -import Network (Socket, PortID(..), socketPort)+import Network.Socket (SockAddr(..), Socket, getSocketName, socketPort) import Network.Wai import Network.HTTP.Types@@ -66,10 +66,8 @@ -- Assemble a description from the Socket's PortID. socketDescription :: Socket -> IO String-socketDescription = fmap d . socketPort- where d p = case p of- Service s -> "service " ++ s- PortNumber n -> "port " ++ show n-#if !defined(mingw32_HOST_OS)- UnixSocket u -> "unix socket " ++ u-#endif+socketDescription sock = do+ sockName <- getSocketName sock+ case sockName of+ SockAddrUnix u -> return $ "unix socket " ++ u+ _ -> fmap (\port -> "port " ++ show port) $ socketPort sock
changelog.md view
@@ -1,3 +1,6 @@+## 0.11.2 [2018.07.02]+* Migrate from `Network` to `Network.Socket` to avoid deprecation warnings.+ ## 0.11.1 [2018.04.07] * Add `MonadThrow` and `MonadCatch` instances for `ActionT` [abhinav] * Fix `matchAny` so that all methods are matched, not just standard ones
scotty.cabal view
@@ -1,5 +1,5 @@ Name: scotty-Version: 0.11.1+Version: 0.11.2 Synopsis: Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp Homepage: https://github.com/scotty-web/scotty Bug-reports: https://github.com/scotty-web/scotty/issues@@ -49,6 +49,8 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2+ , GHC == 8.4.3+ , GHC == 8.6.1 Extra-source-files: README.md changelog.md@@ -77,7 +79,7 @@ Web.Scotty.Route Web.Scotty.Util default-language: Haskell2010- build-depends: aeson >= 0.6.2.1 && < 1.4,+ build-depends: aeson >= 0.6.2.1 && < 1.5, base >= 4.6 && < 5, blaze-builder >= 0.3.3.0 && < 0.5, bytestring >= 0.10.0.2 && < 0.11,@@ -89,7 +91,7 @@ monad-control >= 1.0.0.3 && < 1.1, mtl >= 2.1.2 && < 2.3, nats >= 0.1 && < 2,- network >= 2.6.0.2 && < 2.7,+ network >= 2.6.0.2 && < 2.8, regex-compat >= 0.95.1 && < 0.96, text >= 0.11.3.1 && < 1.3, transformers >= 0.3.0.0 && < 0.6,
test/Web/ScottySpec.hs view
@@ -18,11 +18,11 @@ #if !defined(mingw32_HOST_OS) import Control.Concurrent.Async (withAsync)+import Control.Exception (bracketOnError) import qualified Data.ByteString as BS import Data.ByteString (ByteString) import Data.Default.Class (def)-import Network (listenOn, PortID(..))-import Network.Socket (Family(..), SockAddr(..), SocketType(..), close, connect, socket)+import Network.Socket (Family(..), SockAddr(..), Socket, SocketOption(..), SocketType(..), bind, close, connect, listen, maxListenQueue, setSocketOption, socket) import Network.Socket.ByteString (send, recv) import System.Directory (removeFile) #endif@@ -180,7 +180,20 @@ withServer :: ScottyM () -> IO a -> IO a withServer actions inner = E.bracket- (listenOn $ UnixSocket socketPath)+ (listenOn socketPath) (\sock -> close sock >> removeFile socketPath) (\sock -> withAsync (Scotty.scottySocket def sock actions) $ const inner)++-- See https://github.com/haskell/network/issues/318+listenOn :: String -> IO Socket+listenOn path =+ bracketOnError+ (socket AF_UNIX Stream 0)+ close+ (\sock -> do+ setSocketOption sock ReuseAddr 1+ bind sock (SockAddrUnix path)+ listen sock maxListenQueue+ return sock+ ) #endif