Hello community, here is the log from the commit of package ghc-http-client for openSUSE:Factory checked in at 2018-07-24 17:19:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old) and /work/SRC/openSUSE:Factory/.ghc-http-client.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client" Tue Jul 24 17:19:55 2018 rev:26 rq:623793 version:0.5.13.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes 2018-05-30 12:26:03.812823118 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-http-client.new/ghc-http-client.changes 2018-07-24 17:19:55.931111298 +0200 @@ -1,0 +2,21 @@ +Wed Jul 18 14:26:28 UTC 2018 - [email protected] + +- Cosmetic: replace tabs with blanks, strip trailing white space, + and update copyright headers with spec-cleaner. + +------------------------------------------------------------------- +Fri Jul 13 14:31:24 UTC 2018 - [email protected] + +- Update http-client to version 0.5.13.1. + ## 0.5.13.1 + + * Add a workaround for a cabal bug [haskell-infra/hackage-trustees#165](https://github.com/haskell-infra/hackage-trustees/issues/165) + + ## 0.5.13 + + * Adds `setRequestCheckStatus` and `throwErrorStatusCodes` functions. + See [#304](https://github.com/snoyberg/http-client/issues/304) + * Add `withConnection` function. + See [#352](https://github.com/snoyberg/http-client/pull/352). + +------------------------------------------------------------------- @@ -192 +212,0 @@ - Old: ---- http-client-0.5.12.1.tar.gz http-client.cabal New: ---- http-client-0.5.13.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http-client.spec ++++++ --- /var/tmp/diff_new_pack.RNgXYz/_old 2018-07-24 17:19:57.267113015 +0200 +++ /var/tmp/diff_new_pack.RNgXYz/_new 2018-07-24 17:19:57.267113015 +0200 @@ -19,14 +19,13 @@ %global pkg_name http-client %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.5.12.1 +Version: 0.5.13.1 Release: 0 Summary: An HTTP client engine License: MIT 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-array-devel BuildRequires: ghc-blaze-builder-devel @@ -74,7 +73,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ http-client-0.5.12.1.tar.gz -> http-client-0.5.13.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/ChangeLog.md new/http-client-0.5.13.1/ChangeLog.md --- old/http-client-0.5.12.1/ChangeLog.md 2018-04-15 15:40:18.000000000 +0200 +++ new/http-client-0.5.13.1/ChangeLog.md 2018-07-01 03:15:33.000000000 +0200 @@ -1,3 +1,14 @@ +## 0.5.13.1 + +* Add a workaround for a cabal bug [haskell-infra/hackage-trustees#165](https://github.com/haskell-infra/hackage-trustees/issues/165) + +## 0.5.13 + +* Adds `setRequestCheckStatus` and `throwErrorStatusCodes` functions. + See [#304](https://github.com/snoyberg/http-client/issues/304) +* Add `withConnection` function. + See [#352](https://github.com/snoyberg/http-client/pull/352). + ## 0.5.12.1 * Make the chunked transfer-encoding detection case insensitive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Data/KeyedPool.hs new/http-client-0.5.13.1/Data/KeyedPool.hs --- old/http-client-0.5.12.1/Data/KeyedPool.hs 2018-01-16 14:28:38.000000000 +0100 +++ new/http-client-0.5.13.1/Data/KeyedPool.hs 2018-07-01 03:15:12.000000000 +0200 @@ -33,6 +33,7 @@ , managedResource , managedReused , managedRelease + , keepAlive , Reuse (..) , dummyManaged ) where @@ -45,7 +46,7 @@ import Data.Maybe (isJust) import qualified Data.Map.Strict as Map import Data.Time (UTCTime, getCurrentTime, addUTCTime) -import Data.IORef (IORef, newIORef, mkWeakIORef) +import Data.IORef (IORef, newIORef, mkWeakIORef, readIORef) import qualified Data.Foldable as F import GHC.Conc (unsafeIOToSTM) import System.IO.Unsafe (unsafePerformIO) @@ -318,3 +319,7 @@ ignoreExceptions :: IO () -> IO () ignoreExceptions f = f `catch` \(_ :: SomeException) -> return () + +-- | Prevent the managed resource from getting released before you want to use. +keepAlive :: Managed resource -> IO () +keepAlive = readIORef . _managedAlive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Network/HTTP/Client/Cookies.hs new/http-client-0.5.13.1/Network/HTTP/Client/Cookies.hs --- old/http-client-0.5.12.1/Network/HTTP/Client/Cookies.hs 2016-12-19 16:29:45.000000000 +0100 +++ new/http-client-0.5.13.1/Network/HTTP/Client/Cookies.hs 2018-07-01 03:15:12.000000000 +0200 @@ -121,7 +121,7 @@ insertCookiesIntoRequest :: Req.Request -- ^ The request to insert into -> CookieJar -- ^ Current cookie jar -> UTCTime -- ^ Value that should be used as \"now\" - -> (Req.Request, CookieJar) -- ^ (Ouptut request, Updated cookie jar (last-access-time is updated)) + -> (Req.Request, CookieJar) -- ^ (Output request, Updated cookie jar (last-access-time is updated)) insertCookiesIntoRequest request cookie_jar now | BS.null cookie_string = (request, cookie_jar') | otherwise = (request {Req.requestHeaders = cookie_header : purgedHeaders}, cookie_jar') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Network/HTTP/Client/Core.hs new/http-client-0.5.13.1/Network/HTTP/Client/Core.hs --- old/http-client-0.5.12.1/Network/HTTP/Client/Core.hs 2018-04-15 08:19:28.000000000 +0200 +++ new/http-client-0.5.13.1/Network/HTTP/Client/Core.hs 2018-07-01 03:15:12.000000000 +0200 @@ -11,6 +11,7 @@ , responseClose , httpRedirect , httpRedirect' + , withConnection ) where import Network.HTTP.Types @@ -270,3 +271,15 @@ -- Since 0.1.0 responseClose :: Response a -> IO () responseClose = runResponseClose . responseClose' + +-- | Perform an action using a @Connection@ acquired from the given @Manager@. +-- +-- You should use this only when you have to read and write interactively +-- through the connection (e.g. connection by the WebSocket protocol). +-- +-- @since 0.5.13 +withConnection :: Request -> Manager -> (Connection -> IO a) -> IO a +withConnection origReq man action = do + mHttpConn <- getConn (mSetProxy man origReq) man + action (managedResource mHttpConn) <* keepAlive mHttpConn + `finally` managedRelease mHttpConn DontReuse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Network/HTTP/Client/Request.hs new/http-client-0.5.13.1/Network/HTTP/Client/Request.hs --- old/http-client-0.5.12.1/Network/HTTP/Client/Request.hs 2018-03-26 12:24:22.000000000 +0200 +++ new/http-client-0.5.13.1/Network/HTTP/Client/Request.hs 2018-07-01 03:15:12.000000000 +0200 @@ -26,6 +26,7 @@ , needsGunzip , requestBuilder , setRequestIgnoreStatus + , setRequestCheckStatus , setQueryString #if MIN_VERSION_http_types(0,12,1) , setQueryStringPartialEscape @@ -33,6 +34,7 @@ , streamFile , observedStreamFile , extractBasicAuthInfo + , throwErrorStatusCodes ) where import Data.Int (Int64) @@ -42,6 +44,7 @@ import Data.Char (toLower) import Control.Applicative as A ((<$>)) import Control.Monad (unless, guard) +import Control.Monad.IO.Class (MonadIO, liftIO) import Numeric (showHex) import Blaze.ByteString.Builder (Builder, fromByteString, fromLazyByteString, toByteStringIO, flush) @@ -77,24 +80,32 @@ parseUrl = parseUrlThrow {-# DEPRECATED parseUrl "Please use parseUrlThrow, parseRequest, or parseRequest_ instead" #-} --- | Same as 'parseRequest', except will throw an 'HttpException' in --- the event of a non-2XX response. +-- | Same as 'parseRequest', except will throw an 'HttpException' in the +-- event of a non-2XX response. This uses 'throwErrorStatusCodes' to +-- implement 'checkResponse'. -- -- @since 0.4.30 parseUrlThrow :: MonadThrow m => String -> m Request parseUrlThrow = liftM yesThrow . parseRequest where - yesThrow req = req - { checkResponse = \_req res -> - let W.Status sci _ = responseStatus res in - if 200 <= sci && sci < 300 - then return () - else do - chunk <- brReadSome (responseBody res) 1024 - let res' = fmap (const ()) res - throwHttp $ StatusCodeException res' (L.toStrict chunk) - } + yesThrow req = req { checkResponse = throwErrorStatusCodes } + +-- | Throws a 'StatusCodeException' wrapped in 'HttpExceptionRequest', +-- if the response's status code indicates an error (if it isn't 2xx). +-- This can be used to implement 'checkResponse'. +-- +-- @since 0.5.13 +throwErrorStatusCodes :: MonadIO m => Request -> Response BodyReader -> m () +throwErrorStatusCodes req res = do + let W.Status sci _ = responseStatus res + if 200 <= sci && sci < 300 + then return () + else liftIO $ do + chunk <- brReadSome (responseBody res) 1024 + let res' = fmap (const ()) res + let ex = StatusCodeException res' (L.toStrict chunk) + throwIO $ HttpExceptionRequest req ex -- | Convert a URL into a 'Request'. -- @@ -114,7 +125,7 @@ -- Note that the request method must be provided as all capital letters. -- -- A 'Request' created by this function won't cause exceptions on non-2XX --- response status codes. +-- response status codes. -- -- To create a request which throws on non-2XX status codes, see 'parseUrlThrow' -- @@ -136,23 +147,23 @@ Nothing -> req Just m -> req { method = S8.pack m } --- | Same as 'parseRequest', but in the cases of a parse error --- generates an impure exception. Mostly useful for static strings which --- are known to be correctly formatted. +-- | Same as 'parseRequest', but parse errors cause an impure exception. +-- Mostly useful for static strings which are known to be correctly +-- formatted. parseRequest_ :: String -> Request parseRequest_ = either throw id . parseRequest -- | Convert a 'URI' into a 'Request'. -- --- This can fail if the given 'URI' is not absolute, or if the +-- This can fail if the given 'URI' is not absolute, or if the -- 'URI' scheme is not @"http"@ or @"https"@. In these cases the function -- will throw an error via 'MonadThrow'. -- -- This function defaults some of the values in 'Request', such as setting 'method' to -- @"GET"@ and 'requestHeaders' to @[]@. --- +-- -- A 'Request' created by this function won't cause exceptions on non-2XX --- response status codes. +-- response status codes. -- -- @since 0.5.12 requestFromURI :: MonadThrow m => URI -> m Request @@ -246,7 +257,10 @@ False {- HTTP -} -> return 80 True {- HTTPS -} -> return 443 --- | A default request value +-- | A default request value, a GET request of localhost/:80, with an +-- empty request body. +-- +-- Note that the default 'checkResponse' does nothing. -- -- @since 0.4.30 defaultRequest :: Request @@ -504,6 +518,13 @@ setRequestIgnoreStatus :: Request -> Request setRequestIgnoreStatus req = req { checkResponse = \_ _ -> return () } +-- | Modify the request so that non-2XX status codes generate a runtime +-- 'StatusCodeException', by using 'throwErrorStatusCodes' +-- +-- @since 0.5.13 +setRequestCheckStatus :: Request -> Request +setRequestCheckStatus req = req { checkResponse = throwErrorStatusCodes } + -- | Set the query string to the given key/value pairs. -- -- Since 0.3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Network/HTTP/Client/Types.hs new/http-client-0.5.13.1/Network/HTTP/Client/Types.hs --- old/http-client-0.5.12.1/Network/HTTP/Client/Types.hs 2018-04-09 15:40:11.000000000 +0200 +++ new/http-client-0.5.13.1/Network/HTTP/Client/Types.hs 2018-07-01 03:15:12.000000000 +0200 @@ -77,7 +77,7 @@ -- ^ Send data to server , connectionClose :: IO () -- ^ Close connection. Any successive operation on the connection - -- (exept closing) should fail with `ConnectionClosed` exception. + -- (except closing) should fail with `ConnectionClosed` exception. -- It is allowed to close connection multiple times. } deriving T.Typeable @@ -156,7 +156,7 @@ -- -- @since 0.5.0 | ConnectionFailure SomeException - -- ^ An exception occured when trying to connect to the + -- ^ An exception occurred when trying to connect to the -- server. -- -- @since 0.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/Network/HTTP/Client.hs new/http-client-0.5.13.1/Network/HTTP/Client.hs --- old/http-client-0.5.12.1/Network/HTTP/Client.hs 2018-04-09 15:40:11.000000000 +0200 +++ new/http-client-0.5.13.1/Network/HTTP/Client.hs 2018-07-01 03:15:12.000000000 +0200 @@ -136,11 +136,11 @@ , requestFromURI , requestFromURI_ , defaultRequest - , applyBasicAuth , urlEncodedBody , getUri , setRequestIgnoreStatus + , setRequestCheckStatus , setQueryString #if MIN_VERSION_http_types(0,12,1) , setQueryStringPartialEscape @@ -178,6 +178,7 @@ , responseHeaders , responseBody , responseCookieJar + , throwErrorStatusCodes -- ** Response body , BodyReader , brRead @@ -192,6 +193,7 @@ , Cookie (..) , CookieJar , Proxy (..) + , withConnection -- * Cookies , module Network.HTTP.Client.Cookies ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.5.12.1/http-client.cabal new/http-client-0.5.13.1/http-client.cabal --- old/http-client-0.5.12.1/http-client.cabal 2018-04-15 08:19:12.000000000 +0200 +++ new/http-client-0.5.13.1/http-client.cabal 2018-07-01 03:15:46.000000000 +0200 @@ -1,5 +1,5 @@ name: http-client -version: 0.5.12.1 +version: 0.5.13.1 synopsis: An HTTP client engine description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage: https://github.com/snoyberg/http-client @@ -68,7 +68,12 @@ -- See build failure at https://travis-ci.org/snoyberg/http-client/jobs/359573631 if impl(ghc < 7.10) - buildable: False + -- Disable building with GHC before 8.0.2. + -- Due to a cabal bug, do not use buildable: False, + -- but instead give it an impossible constraint. + -- See: https://github.com/haskell-infra/hackage-trustees/issues/165 + build-depends: unsupported-ghc-version > 1 && < 1 + if os(mingw32) build-depends: Win32, safe
