Hello community, here is the log from the commit of package ghc-wuss for openSUSE:Factory checked in at 2017-01-31 12:41:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-wuss (Old) and /work/SRC/openSUSE:Factory/.ghc-wuss.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-wuss" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-wuss/ghc-wuss.changes 2017-01-18 21:41:42.785377257 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-wuss.new/ghc-wuss.changes 2017-02-03 17:40:35.812109289 +0100 @@ -1,0 +2,10 @@ +Sun Dec 4 19:48:21 UTC 2016 - psimons@suse.com + +- Update to version 1.1.3 with cabal2obs. + +------------------------------------------------------------------- +Thu Sep 15 06:47:22 UTC 2016 - psimons@suse.com + +- Update to version 1.1.1 revision 0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- wuss-1.0.4.tar.gz New: ---- wuss-1.1.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-wuss.spec ++++++ --- /var/tmp/diff_new_pack.DEicl8/_old 2017-02-03 17:40:36.124065134 +0100 +++ /var/tmp/diff_new_pack.DEicl8/_new 2017-02-03 17:40:36.128064568 +0100 @@ -18,22 +18,20 @@ %global pkg_name wuss Name: ghc-%{pkg_name} -Version: 1.0.4 +Version: 1.1.3 Release: 0 Summary: Secure WebSocket (WSS) clients License: MIT -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: BuildRequires: ghc-bytestring-devel BuildRequires: ghc-connection-devel BuildRequires: ghc-network-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-websockets-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build -# End cabal-rpm deps %description Wuss is a library that lets you easily create secure WebSocket clients over the @@ -58,15 +56,12 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %post devel %ghc_pkg_recache ++++++ wuss-1.0.4.tar.gz -> wuss-1.1.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wuss-1.0.4/Wuss.hs new/wuss-1.1.3/Wuss.hs --- old/wuss-1.0.4/Wuss.hs 2016-04-15 22:37:07.000000000 +0200 +++ new/wuss-1.1.3/Wuss.hs 2016-11-30 14:27:53.000000000 +0100 @@ -1,3 +1,5 @@ +{-# LANGUAGE NoImplicitPrelude #-} + {- | Wuss is a library that lets you easily create secure WebSocket clients over the WSS protocol. It is a small addition to @@ -39,17 +41,25 @@ module Wuss ( runSecureClient , runSecureClientWith + , Config(..) + , defaultConfig + , runSecureClientWithConfig ) where -import qualified Data.ByteString as BS -import Data.ByteString.Lazy (toStrict) -import qualified Data.ByteString.Lazy as BL -import Network.Connection (Connection, ConnectionParams (..), TLSSettings (..), - connectTo, connectionGetChunk, connectionPut, initConnectionContext) -import Network.Socket (HostName, PortNumber) -import Network.WebSockets (ClientApp, ConnectionOptions, Headers, - defaultConnectionOptions, runClientWithStream) -import Network.WebSockets.Stream (makeStream) +import qualified Control.Applicative as Applicative +import qualified Control.Exception as Exception +import qualified Data.Bool as Bool +import qualified Data.ByteString as StrictBytes +import qualified Data.ByteString.Lazy as LazyBytes +import qualified Data.Maybe as Maybe +import qualified Data.String as String +import qualified Network.Connection as Connection +import qualified Network.Socket as Socket +import qualified Network.WebSockets as WebSockets +import qualified Network.WebSockets.Stream as Stream +import qualified System.IO as IO +import qualified System.IO.Error as IO.Error + {- | A secure replacement for 'Network.WebSockets.runClient'. @@ -58,15 +68,16 @@ >>> runSecureClient "echo.websocket.org" 443 "/" app -} runSecureClient - :: HostName -- ^ Host - -> PortNumber -- ^ Port - -> String -- ^ Path - -> ClientApp a -- ^ Application - -> IO a -runSecureClient host port path app = - let options = defaultConnectionOptions - headers = [] - in runSecureClientWith host port path options headers app + :: Socket.HostName -- ^ Host + -> Socket.PortNumber -- ^ Port + -> String.String -- ^ Path + -> WebSockets.ClientApp a -- ^ Application + -> IO.IO a +runSecureClient host port path app = do + let options = WebSockets.defaultConnectionOptions + let headers = [] + runSecureClientWith host port path options headers app + {- | A secure replacement for 'Network.WebSockets.runClientWith'. @@ -107,36 +118,101 @@ > return () -} runSecureClientWith - :: HostName -- ^ Host - -> PortNumber -- ^ Port - -> String -- ^ Path - -> ConnectionOptions -- ^ Options - -> Headers -- ^ Headers - -> ClientApp a -- ^ Application - -> IO a + :: Socket.HostName -- ^ Host + -> Socket.PortNumber -- ^ Port + -> String.String -- ^ Path + -> WebSockets.ConnectionOptions -- ^ Options + -> WebSockets.Headers -- ^ Headers + -> WebSockets.ClientApp a -- ^ Application + -> IO.IO a runSecureClientWith host port path options headers app = do - context <- initConnectionContext - connection <- connectTo context (connectionParams host port) - stream <- makeStream (reader connection) (writer connection) - runClientWithStream stream host path options headers app - -connectionParams :: HostName -> PortNumber -> ConnectionParams -connectionParams host port = ConnectionParams - { connectionHostname = host - , connectionPort = port - , connectionUseSecure = Just tlsSettings - , connectionUseSocks = Nothing - } + let config = defaultConfig + runSecureClientWithConfig host port path config options headers app + -tlsSettings :: TLSSettings -tlsSettings = TLSSettingsSimple - { settingDisableCertificateValidation = False - , settingDisableSession = False - , settingUseServerName = False +-- | Configures a secure WebSocket connection. +data Config = Config + { connectionGet :: Connection.Connection -> IO.IO StrictBytes.ByteString + -- ^ How to get bytes from the connection. Typically + -- 'Connection.connectionGetChunk', but could be something else like + -- 'Connection.connectionGetLine'. } -reader :: Connection -> IO (Maybe BS.ByteString) -reader connection = fmap Just (connectionGetChunk connection) -writer :: Connection -> Maybe BL.ByteString -> IO () -writer connection = maybe (return ()) (connectionPut connection . toStrict) +-- | The default 'Config' value used by 'runSecureClientWith'. +defaultConfig + :: Config +defaultConfig = do + Config + { connectionGet = Connection.connectionGetChunk + } + + +-- | Runs a secure WebSockets client with the given 'Config'. +runSecureClientWithConfig + :: Socket.HostName -- ^ Host + -> Socket.PortNumber -- ^ Port + -> String.String -- ^ Path + -> Config -- ^ Config + -> WebSockets.ConnectionOptions -- ^ Options + -> WebSockets.Headers -- ^ Headers + -> WebSockets.ClientApp a -- ^ Application + -> IO.IO a +runSecureClientWithConfig host port path config options headers app = do + context <- Connection.initConnectionContext + Exception.bracket + (Connection.connectTo context (connectionParams host port)) + Connection.connectionClose + (\connection -> do + stream <- + Stream.makeStream (reader config connection) (writer connection) + WebSockets.runClientWithStream stream host path options headers app) + + +connectionParams + :: Socket.HostName + -> Socket.PortNumber + -> Connection.ConnectionParams +connectionParams host port = do + Connection.ConnectionParams + { Connection.connectionHostname = host + , Connection.connectionPort = port + , Connection.connectionUseSecure = Maybe.Just tlsSettings + , Connection.connectionUseSocks = Maybe.Nothing + } + + +tlsSettings + :: Connection.TLSSettings +tlsSettings = do + Connection.TLSSettingsSimple + { Connection.settingDisableCertificateValidation = Bool.False + , Connection.settingDisableSession = Bool.False + , Connection.settingUseServerName = Bool.False + } + + +reader + :: Config + -> Connection.Connection + -> IO.IO (Maybe.Maybe StrictBytes.ByteString) +reader config connection = + IO.Error.catchIOError (do + chunk <- (connectionGet config) connection + Applicative.pure (Maybe.Just chunk)) + (\e -> + if IO.Error.isEOFError e + then Applicative.pure Maybe.Nothing + else Exception.throwIO e) + + +writer + :: Connection.Connection + -> Maybe.Maybe LazyBytes.ByteString + -> IO.IO () +writer connection maybeBytes = do + case maybeBytes of + Maybe.Nothing -> do + Applicative.pure () + Maybe.Just bytes -> do + Connection.connectionPut connection (LazyBytes.toStrict bytes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wuss-1.0.4/package.yaml new/wuss-1.1.3/package.yaml --- old/wuss-1.0.4/package.yaml 2016-04-15 22:37:07.000000000 +0200 +++ new/wuss-1.1.3/package.yaml 2016-11-30 14:27:53.000000000 +0100 @@ -16,13 +16,13 @@ library: dependencies: - base ==4.* - - bytestring + - bytestring ==0.10.* - connection ==0.2.* - network - - websockets ==0.9.* + - websockets >=0.9 && <0.11 exposed-modules: Wuss license: MIT maintainer: Taylor Fausak name: wuss synopsis: Secure WebSocket (WSS) clients -version: '1.0.4' +version: '1.1.3' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wuss-1.0.4/stack.yaml new/wuss-1.1.3/stack.yaml --- old/wuss-1.0.4/stack.yaml 2016-04-15 22:37:07.000000000 +0200 +++ new/wuss-1.1.3/stack.yaml 2016-11-30 14:27:53.000000000 +0100 @@ -1,3 +1 @@ -install-ghc: true -require-stack-version: ! '>=1.0.4' -resolver: lts-5.12 +resolver: nightly-2016-07-05 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wuss-1.0.4/wuss.cabal new/wuss-1.1.3/wuss.cabal --- old/wuss-1.0.4/wuss.cabal 2016-04-15 22:38:07.000000000 +0200 +++ new/wuss-1.1.3/wuss.cabal 2016-11-30 14:28:47.000000000 +0100 @@ -1,9 +1,9 @@ --- This file has been generated from package.yaml by hpack version 0.9.0. +-- This file has been generated from package.yaml by hpack version 0.14.0. -- -- see: https://github.com/sol/hpack name: wuss -version: 1.0.4 +version: 1.1.3 synopsis: Secure WebSocket (WSS) clients description: Wuss is a library that lets you easily create secure WebSocket clients over the WSS protocol. It is a small addition to <https://hackage.haskell.org/package/websockets the websockets package> and is adapted from existing solutions by <https://gist.github.com/jaspervdj/7198388 @jaspervdj>, <https://gist.github.com/mpickering/f1b7ba3190a4bb5884f3 @mpickering>, and <https://gist.github.com/elfenlaid/7b5c28065e67e4cf0767 @elfenlaid>. category: Network @@ -28,10 +28,10 @@ ghc-options: -Wall build-depends: base ==4.* - , bytestring + , bytestring ==0.10.* , connection ==0.2.* , network - , websockets ==0.9.* + , websockets >=0.9 && <0.11 exposed-modules: Wuss other-modules: