commit ghc-connection for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-connection for openSUSE:Factory checked in at 2019-04-28 20:12:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-connection (Old) and /work/SRC/openSUSE:Factory/.ghc-connection.new.5536 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-connection" Sun Apr 28 20:12:20 2019 rev:11 rq:698547 version:0.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-connection/ghc-connection.changes 2018-10-25 08:23:42.275874483 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-connection.new.5536/ghc-connection.changes 2019-04-28 20:12:35.434450652 +0200 @@ -1,0 +2,7 @@ +Tue Apr 23 02:01:50 UTC 2019 - psimons@suse.com + +- Update connection to version 0.3.0. + Upstream has not updated the file "CHANGELOG.md" since the last + release. + +------------------------------------------------------------------- Old: ---- connection-0.2.8.tar.gz New: ---- connection-0.3.0.tar.gz connection.cabal ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-connection.spec ++++++ --- /var/tmp/diff_new_pack.EQsK2K/_old 2019-04-28 20:12:35.922450349 +0200 +++ /var/tmp/diff_new_pack.EQsK2K/_new 2019-04-28 20:12:35.926450346 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-connection # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,16 @@ %global pkg_name connection Name: ghc-%{pkg_name} -Version: 0.2.8 +Version: 0.3.0 Release: 0 Summary: Simple and easy network connections API License: BSD-3-Clause Group: Development/Libraries/Haskell URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz +Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel -BuildRequires: ghc-byteable-devel +BuildRequires: ghc-basement-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-data-default-class-devel @@ -60,6 +61,7 @@ %prep %setup -q -n %{pkg_name}-%{version} +cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ connection-0.2.8.tar.gz -> connection-0.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/connection-0.2.8/LICENSE new/connection-0.3.0/LICENSE --- old/connection-0.2.8/LICENSE 2014-10-23 14:32:22.000000000 +0200 +++ new/connection-0.3.0/LICENSE 2019-01-27 12:50:58.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2012 Vincent Hanquez <vincent@snarc.org> +Copyright (c) 2012-2019 Vincent Hanquez <vincent@snarc.org> All rights reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/connection-0.2.8/Network/Connection/Types.hs new/connection-0.3.0/Network/Connection/Types.hs --- old/connection-0.2.8/Network/Connection/Types.hs 2016-05-04 20:28:17.000000000 +0200 +++ new/connection-0.3.0/Network/Connection/Types.hs 2019-04-22 09:12:58.000000000 +0200 @@ -16,7 +16,6 @@ import Data.X509.CertificateStore import Data.ByteString (ByteString) -import Network.BSD (HostName) import Network.Socket (PortNumber, Socket) import qualified Network.TLS as TLS @@ -27,6 +26,10 @@ | ConnectionSocket Socket | ConnectionTLS TLS.Context + +-- | Hostname This could either be a name string (punycode encoded) or an ipv4/ipv6 +type HostName = String + -- | Connection Parameters to establish a Connection. -- -- The strict minimum is an hostname and the port. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/connection-0.2.8/Network/Connection.hs new/connection-0.3.0/Network/Connection.hs --- old/connection-0.2.8/Network/Connection.hs 2017-03-20 23:42:12.000000000 +0100 +++ new/connection-0.3.0/Network/Connection.hs 2019-04-22 12:26:35.000000000 +0200 @@ -47,9 +47,9 @@ -- * TLS related operation , connectionSetSecure , connectionIsSecure + , connectionSessionManager ) where -import Control.Applicative import Control.Concurrent.MVar import Control.Monad (join) import qualified Control.Exception as E @@ -60,11 +60,8 @@ import System.X509 (getSystemCertificateStore) -import Network.Socks5 -import qualified Network as N +import Network.Socks5 (defaultSocksConf, socksConnectWithSocket, SocksAddress(..), SocksHostAddress(..)) import Network.Socket -import Network.BSD (getProtocolNumber) -import qualified Network.Socket as N (close) import qualified Network.Socket.ByteString as N import Data.Default.Class @@ -114,7 +111,7 @@ makeTLSParams :: ConnectionContext -> ConnectionID -> TLSSettings -> TLS.ClientParams makeTLSParams cg cid ts@(TLSSettingsSimple {}) = (TLS.defaultParamsClient (fst cid) portString) - { TLS.clientSupported = def { TLS.supportedCiphers = TLS.ciphersuite_all } + { TLS.clientSupported = def { TLS.supportedCiphers = TLS.ciphersuite_default } , TLS.clientShared = def { TLS.sharedCAStore = globalCertificateStore cg , TLS.sharedValidationCache = validationCache @@ -171,63 +168,77 @@ -> ConnectionParams -- ^ The parameters for this connection (where to connect, and such). -> IO Connection -- ^ The new established connection on success. connectTo cg cParams = do - conFct <- getConFct (connectionUseSocks cParams) - let doConnect = conFct (connectionHostname cParams) (N.PortNumber $ connectionPort cParams) - E.bracketOnError doConnect N.close $ \h-> + let conFct = doConnect (connectionUseSocks cParams) + (connectionHostname cParams) + (connectionPort cParams) + E.bracketOnError conFct (close . fst) $ \(h, _) -> connectFromSocket cg h cParams where - getConFct Nothing = return resolve' - getConFct (Just (OtherProxy h p)) = return $ \_ _ -> resolve' h (N.PortNumber p) - getConFct (Just (SockSettingsSimple h p)) = return $ socksConnectTo' h (N.PortNumber p) - getConFct (Just (SockSettingsEnvironment v)) = do - -- if we can't get the environment variable or that the variable cannot be parsed - -- we connect directly. - let name = maybe "SOCKS_SERVER" id v - evar <- E.try (getEnv name) - case evar of - Left (_ :: E.IOException) -> return resolve' - Right var -> - case parseSocks var of - Nothing -> return resolve' - Just (sHost, sPort) -> return $ socksConnectTo' sHost (N.PortNumber $ fromIntegral (sPort :: Int)) - - -- Try to parse "host:port" or "host" - parseSocks s = - case break (== ':') s of - (sHost, "") -> Just (sHost, 1080) - (sHost, ':':portS) -> - case reads portS of - [(sPort,"")] -> Just (sHost, sPort) - _ -> Nothing - _ -> Nothing - - resolve' host portid = do - let serv = case portid of - N.Service serv -> serv - N.PortNumber n -> show n - _ -> error "cannot resolve service" - proto <- getProtocolNumber "tcp" - let hints = defaultHints { addrFlags = [AI_ADDRCONFIG] - , addrProtocol = proto - , addrSocketType = Stream } - addrs <- getAddrInfo (Just hints) (Just host) (Just serv) - firstSuccessful $ map tryToConnect addrs + sockConnect sockHost sockPort h p = do + (sockServ, servAddr) <- resolve' sockHost sockPort + let sockConf = defaultSocksConf servAddr + let destAddr = SocksAddress (SocksAddrDomainName $ BC.pack h) p + (dest, _) <- socksConnectWithSocket sockServ sockConf destAddr + case dest of + SocksAddrIPV4 h4 -> return (sockServ, SockAddrInet p h4) + SocksAddrIPV6 h6 -> return (sockServ, SockAddrInet6 p 0 h6 0) + SocksAddrDomainName _ -> error "internal error: socks connect return a resolved address as domain name" + + + doConnect proxy h p = + case proxy of + Nothing -> resolve' h p + Just (OtherProxy proxyHost proxyPort) -> resolve' proxyHost proxyPort + Just (SockSettingsSimple sockHost sockPort) -> + sockConnect sockHost sockPort h p + Just (SockSettingsEnvironment envName) -> do + -- if we can't get the environment variable or that the string cannot be parsed + -- we connect directly. + let name = maybe "SOCKS_SERVER" id envName + evar <- E.try (getEnv name) + case evar of + Left (_ :: E.IOException) -> resolve' h p + Right var -> + case parseSocks var of + Nothing -> resolve' h p + Just (sockHost, sockPort) -> sockConnect sockHost sockPort h p + + -- Try to parse "host:port" or "host" + -- if port is ommited then the default SOCKS port (1080) is assumed + parseSocks :: String -> Maybe (String, PortNumber) + parseSocks s = + case break (== ':') s of + (sHost, "") -> Just (sHost, 1080) + (sHost, ':':portS) -> + case reads portS of + [(sPort,"")] -> Just (sHost, sPort) + _ -> Nothing + _ -> Nothing + + -- Try to resolve the host/port into an address (zero to many of them), then + -- try to connect from the first address to the last, returning the first one that + -- succeed + resolve' :: String -> PortNumber -> IO (Socket, SockAddr) + resolve' host port = do + let hints = defaultHints { addrFlags = [AI_ADDRCONFIG], addrSocketType = Stream } + addrs <- getAddrInfo (Just hints) (Just host) (Just $ show port) + firstSuccessful $ map tryToConnect addrs + where + tryToConnect addr = + E.bracketOnError + (socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)) + (close) + (\sock -> connect sock (addrAddress addr) >> return (sock, addrAddress addr)) + firstSuccessful = go [] where - tryToConnect addr = - E.bracketOnError - (socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)) - (N.close) - (\sock -> connect sock (addrAddress addr) >> return sock) - firstSuccessful = go [] - where - go :: [E.IOException] -> [IO a] -> IO a - go [] [] = E.throwIO $ HostNotResolved host - go l@(_:_) [] = E.throwIO $ HostCannotConnect host l - go acc (act:followingActs) = do - er <- E.try act - case er of - Left err -> go (err:acc) followingActs - Right r -> return r + go :: [E.IOException] -> [IO a] -> IO a + go [] [] = E.throwIO $ HostNotResolved host + go l@(_:_) [] = E.throwIO $ HostCannotConnect host l + go acc (act:followingActs) = do + er <- E.try act + case er of + Left err -> go (err:acc) followingActs + Right r -> return r -- | Put a block of data in the connection. connectionPut :: Connection -> ByteString -> IO () @@ -369,7 +380,7 @@ connectionClose :: Connection -> IO () connectionClose = withBackend backendClose where backendClose (ConnectionTLS ctx) = ignoreIOExc (TLS.bye ctx) `E.finally` TLS.contextClose ctx - backendClose (ConnectionSocket sock) = N.close sock + backendClose (ConnectionSocket sock) = close sock backendClose (ConnectionStream h) = hClose h ignoreIOExc action = action `E.catch` \(_ :: E.IOException) -> return () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/connection-0.2.8/connection.cabal new/connection-0.3.0/connection.cabal --- old/connection-0.2.8/connection.cabal 2017-03-20 23:42:35.000000000 +0100 +++ new/connection-0.3.0/connection.cabal 2019-04-22 12:11:03.000000000 +0200 @@ -1,5 +1,5 @@ Name: connection -Version: 0.2.8 +Version: 0.3.0 Description: Simple network library for all your connection need. . @@ -17,19 +17,19 @@ Category: Network stability: experimental Cabal-Version: >=1.6 -Homepage: http://github.com/vincenthz/hs-connection +Homepage: https://github.com/vincenthz/hs-connection extra-source-files: README.md CHANGELOG.md Library Build-Depends: base >= 3 && < 5 + , basement , bytestring - , byteable , containers , data-default-class - , network >= 2.3 - , tls >= 1.3 - , socks >= 0.5.5 + , network >= 2.6 + , tls >= 1.4 + , socks >= 0.6 , x509 >= 1.5 , x509-store >= 1.5 , x509-system >= 1.5 ++++++ connection.cabal ++++++ Name: connection Version: 0.3.0 x-revision: 1 Description: Simple network library for all your connection need. . Features: Really simple to use, SSL/TLS, SOCKS. . This library provides a very simple api to create sockets to a destination with the choice of SSL/TLS, and SOCKS. License: BSD3 License-file: LICENSE Copyright: Vincent Hanquez <vincent@snarc.org> Author: Vincent Hanquez <vincent@snarc.org> Maintainer: Vincent Hanquez <vincent@snarc.org> Synopsis: Simple and easy network connections API Build-Type: Simple Category: Network stability: experimental Cabal-Version: >=1.6 Homepage: https://github.com/vincenthz/hs-connection extra-source-files: README.md CHANGELOG.md Library Build-Depends: base >= 4.8 && < 5 , basement , bytestring , containers , data-default-class , network >= 2.6 , tls >= 1.4 , socks >= 0.6 , x509 >= 1.5 , x509-store >= 1.5 , x509-system >= 1.5 , x509-validation >= 1.5 Exposed-modules: Network.Connection Other-modules: Network.Connection.Types ghc-options: -Wall source-repository head type: git location: https://github.com/vincenthz/hs-connection
participants (1)
-
root