Hello community,
here is the log from the commit of package ghc-http-client for
openSUSE:Leap:15.2 checked in at 2020-02-19 18:39:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/ghc-http-client (Old)
and /work/SRC/openSUSE:Leap:15.2/.ghc-http-client.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client"
Wed Feb 19 18:39:28 2020 rev:12 rq:771341 version:0.6.4
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/ghc-http-client/ghc-http-client.changes
2020-01-15 15:02:10.085802056 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.ghc-http-client.new.26092/ghc-http-client.changes
2020-02-19 18:39:29.286063382 +0100
@@ -1,0 +2,34 @@
+Fri Nov 8 16:13:58 UTC 2019 - Peter Simons <[email protected]>
+
+- Drop obsolete group attributes.
+
+-------------------------------------------------------------------
+Sat Apr 13 02:03:10 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.4.
+ ## 0.6.4
+
+ * Avoid throwing an exception when a malformed HTTP header is received,
+ to be as robust as commonly used HTTP clients.
+ See [#398](https://github.com/snoyberg/http-client/issues/398)
+
+-------------------------------------------------------------------
+Wed Apr 3 02:01:38 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.3.
+ ## 0.6.3
+
+ * Detect response body termination before reading an extra null chunk
+ when possible. This allows connections to be reused in some corner
+ cases. See
+ [#395](https://github.com/snoyberg/http-client/issues/395)
+
+-------------------------------------------------------------------
+Thu Feb 28 03:01:36 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.2.
+ ## 0.6.2
+
+ * Add `shouldStripHeaderOnRedirect` option to `Request`
[#300](https://github.com/snoyberg/http-client/issues/300)
+
+-------------------------------------------------------------------
Old:
----
http-client-0.6.1.1.tar.gz
New:
----
http-client-0.6.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http-client.spec ++++++
--- /var/tmp/diff_new_pack.xctQL8/_old 2020-02-19 18:39:29.658063839 +0100
+++ /var/tmp/diff_new_pack.xctQL8/_new 2020-02-19 18:39:29.662063844 +0100
@@ -19,11 +19,10 @@
%global pkg_name http-client
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.6.1.1
+Version: 0.6.4
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
BuildRequires: ghc-Cabal-devel
@@ -62,7 +61,6 @@
%package devel
Summary: Haskell %{pkg_name} library development files
-Group: Development/Libraries/Haskell
Requires: %{name} = %{version}-%{release}
Requires: ghc-compiler = %{ghc_version}
Requires(post): ghc-compiler = %{ghc_version}
++++++ http-client-0.6.1.1.tar.gz -> http-client-0.6.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/ChangeLog.md
new/http-client-0.6.4/ChangeLog.md
--- old/http-client-0.6.1.1/ChangeLog.md 2019-02-20 10:37:43.000000000
+0100
+++ new/http-client-0.6.4/ChangeLog.md 2019-04-12 07:51:44.000000000 +0200
@@ -1,5 +1,22 @@
# Changelog for http-client
+## 0.6.4
+
+* Avoid throwing an exception when a malformed HTTP header is received,
+ to be as robust as commonly used HTTP clients.
+ See [#398](https://github.com/snoyberg/http-client/issues/398)
+
+## 0.6.3
+
+* Detect response body termination before reading an extra null chunk
+ when possible. This allows connections to be reused in some corner
+ cases. See
+ [#395](https://github.com/snoyberg/http-client/issues/395)
+
+## 0.6.2
+
+* Add `shouldStripHeaderOnRedirect` option to `Request`
[#300](https://github.com/snoyberg/http-client/issues/300)
+
## 0.6.1.1
* Ensure that `Int` parsing doesn't overflow
[#383](https://github.com/snoyberg/http-client/issues/383)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Body.hs
new/http-client-0.6.4/Network/HTTP/Client/Body.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Body.hs 2016-12-19
16:30:12.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client/Body.hs 2019-04-02
15:24:20.000000000 +0200
@@ -8,7 +8,6 @@
, brConsume
, brEmpty
, constBodyReader
- , brAddCleanup
, brReadSome
, brRead
) where
@@ -61,12 +60,6 @@
[] -> ([], S.empty)
x:xs -> (xs, x)
-brAddCleanup :: IO () -> BodyReader -> BodyReader
-brAddCleanup cleanup brRead' = do
- bs <- brRead'
- when (S.null bs) cleanup
- return bs
-
-- | Strictly consume all remaining chunks of data from the stream.
--
-- Since 0.1.0
@@ -111,16 +104,25 @@
Nothing -> start
Just popper -> goPopper popper
-makeUnlimitedReader :: Connection -> IO BodyReader
-makeUnlimitedReader Connection {..} = do
+makeUnlimitedReader
+ :: IO () -- ^ cleanup
+ -> Connection
+ -> IO BodyReader
+makeUnlimitedReader cleanup Connection {..} = do
icomplete <- newIORef False
return $ do
bs <- connectionRead
- when (S.null bs) $ writeIORef icomplete True
+ when (S.null bs) $ do
+ writeIORef icomplete True
+ cleanup
return bs
-makeLengthReader :: Int -> Connection -> IO BodyReader
-makeLengthReader count0 Connection {..} = do
+makeLengthReader
+ :: IO () -- ^ cleanup
+ -> Int
+ -> Connection
+ -> IO BodyReader
+makeLengthReader cleanup count0 Connection {..} = do
icount <- newIORef count0
return $ do
count <- readIORef icount
@@ -134,20 +136,27 @@
let (x, y) = S.splitAt count bs
connectionUnread y
writeIORef icount (-1)
+ cleanup
return x
EQ -> do
writeIORef icount (-1)
+ cleanup
return bs
GT -> do
writeIORef icount (count - S.length bs)
return bs
-makeChunkedReader :: Bool -- ^ raw
- -> Connection
- -> IO BodyReader
-makeChunkedReader raw conn@Connection {..} = do
+makeChunkedReader
+ :: IO () -- ^ cleanup
+ -> Bool -- ^ raw
+ -> Connection
+ -> IO BodyReader
+makeChunkedReader cleanup raw conn@Connection {..} = do
icount <- newIORef 0
- return $ go icount
+ return $ do
+ bs <- go icount
+ when (S.null bs) cleanup
+ pure bs
where
go icount = do
count0 <- readIORef icount
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Headers.hs
new/http-client-0.6.4/Network/HTTP/Client/Headers.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Headers.hs 2018-11-19
06:27:06.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client/Headers.hs 2019-04-12
07:51:44.000000000 +0200
@@ -89,14 +89,21 @@
if S.null line
then return $ front []
else do
- header <- parseHeader line
- parseHeaders (count + 1) $ front . (header:)
+ mheader <- parseHeader line
+ case mheader of
+ Just header ->
+ parseHeaders (count + 1) $ front . (header:)
+ Nothing ->
+ -- Unparseable header line; rather than throwing
+ -- an exception, ignore it for robustness.
+ parseHeaders count front
- parseHeader :: S.ByteString -> IO Header
+ parseHeader :: S.ByteString -> IO (Maybe Header)
parseHeader bs = do
let (key, bs2) = S.break (== charColon) bs
- when (S.null bs2) $ throwHttp $ InvalidHeader bs
- return (CI.mk $! strip key, strip $! S.drop 1 bs2)
+ if S.null bs2
+ then return Nothing
+ else return (Just (CI.mk $! strip key, strip $! S.drop 1 bs2))
strip = S.dropWhile (== charSpace) . fst . S.spanEnd (== charSpace)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Request.hs
new/http-client-0.6.4/Network/HTTP/Client/Request.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Request.hs 2019-02-20
10:34:27.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client/Request.hs 2019-02-27
11:43:18.000000000 +0100
@@ -299,6 +299,7 @@
Just (_ :: IOException) -> return ()
Nothing -> throwIO se
, requestManagerOverride = Nothing
+ , shouldStripHeaderOnRedirect = const False
}
-- | Parses a URL via 'parseRequest_'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Response.hs
new/http-client-0.6.4/Network/HTTP/Client/Response.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Response.hs 2019-02-20
10:34:44.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client/Response.hs 2019-04-02
15:24:20.000000000 +0200
@@ -53,7 +53,11 @@
| 300 <= code && code < 400 = do
l' <- lookup "location" hs
let l = escapeURIString isAllowedInURI (S8.unpack l')
- req' <- setUriRelative req =<< parseURIReference l
+ stripHeaders r =
+ r{requestHeaders =
+ filter (not . shouldStripHeaderOnRedirect req . fst) $
+ requestHeaders r}
+ req' <- fmap stripHeaders <$> setUriRelative req =<< parseURIReference
l
return $
if code == 302 || code == 303
-- According to the spec, this should *only* be for status code
@@ -103,15 +107,14 @@
else do
body1 <-
if isChunked
- then makeChunkedReader rawBody conn
+ then makeChunkedReader (cleanup True) rawBody conn
else
case mcl of
- Just len -> makeLengthReader len conn
- Nothing -> makeUnlimitedReader conn
- body2 <- if needsGunzip req hs
+ Just len -> makeLengthReader (cleanup True)
len conn
+ Nothing -> makeUnlimitedReader (cleanup True)
conn
+ if needsGunzip req hs
then makeGzipReader body1
else return body1
- return $ brAddCleanup (cleanup True) body2
return Response
{ responseStatus = s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Types.hs
new/http-client-0.6.4/Network/HTTP/Client/Types.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Types.hs 2018-11-19
06:27:06.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client/Types.hs 2019-04-05
16:28:05.000000000 +0200
@@ -518,9 +518,9 @@
--
-- @since 0.5.0
, responseTimeout :: ResponseTimeout
- -- ^ Number of microseconds to wait for a response. If
- -- @Nothing@, will wait indefinitely. Default: use
- -- 'managerResponseTimeout' (which by default is 30 seconds).
+ -- ^ Number of microseconds to wait for a response (see 'ResponseTimeout'
+ -- for more information). Default: use 'managerResponseTimeout' (which by
+ -- default is 30 seconds).
--
-- Since 0.1.0
, cookieJar :: Maybe CookieJar
@@ -551,6 +551,12 @@
-- dealing with implicit global managers, such as in @Network.HTTP.Simple@
--
-- @since 0.4.28
+
+ , shouldStripHeaderOnRedirect :: HeaderName -> Bool
+ -- ^ Decide whether a header must be stripped from the request
+ -- when following a redirect. Default: keep all headers intact.
+ --
+ -- @since 0.6.2
}
deriving T.Typeable
@@ -559,8 +565,12 @@
-- @since 0.5.0
data ResponseTimeout
= ResponseTimeoutMicro !Int
+ -- ^ Wait the given number of microseconds and then throw an exception
| ResponseTimeoutNone
+ -- ^ Wait indefinitely
| ResponseTimeoutDefault
+ -- ^ Fall back to the manager setting ('managerResponseTimeout') or, in its
+ -- absence, Wait 30 seconds and then throw an exception.
deriving (Eq, Show)
instance Show Request where
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client.hs
new/http-client-0.6.4/Network/HTTP/Client.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client.hs 2019-02-20
10:21:29.000000000 +0100
+++ new/http-client-0.6.4/Network/HTTP/Client.hs 2019-02-27
11:43:18.000000000 +0100
@@ -159,6 +159,7 @@
, applyBasicProxyAuth
, decompress
, redirectCount
+ , shouldStripHeaderOnRedirect
, checkResponse
, responseTimeout
, cookieJar
@@ -210,6 +211,7 @@
import Data.IORef (newIORef, writeIORef, readIORef, modifyIORef)
import qualified Data.ByteString.Lazy as L
import Data.Foldable (Foldable)
+import Data.Monoid
import Data.Traversable (Traversable)
import Network.HTTP.Types (statusCode)
import GHC.Generics (Generic)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/http-client.cabal
new/http-client-0.6.4/http-client.cabal
--- old/http-client-0.6.1.1/http-client.cabal 2019-02-20 10:37:17.000000000
+0100
+++ new/http-client-0.6.4/http-client.cabal 2019-04-12 07:51:44.000000000
+0200
@@ -1,5 +1,5 @@
name: http-client
-version: 0.6.1.1
+version: 0.6.4
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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.6.1.1/test-nonet/Network/HTTP/Client/BodySpec.hs
new/http-client-0.6.4/test-nonet/Network/HTTP/Client/BodySpec.hs
--- old/http-client-0.6.1.1/test-nonet/Network/HTTP/Client/BodySpec.hs
2016-12-19 16:29:45.000000000 +0100
+++ new/http-client-0.6.4/test-nonet/Network/HTTP/Client/BodySpec.hs
2019-04-02 15:24:20.000000000 +0200
@@ -22,7 +22,7 @@
(conn, _, input) <- dummyConnection
[ "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
]
- reader <- makeChunkedReader False conn
+ reader <- makeChunkedReader (return ()) False conn
body <- brConsume reader
S.concat body `shouldBe` "hello world"
input' <- input
@@ -32,7 +32,7 @@
it "chunked, pieces" $ do
(conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
"5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
- reader <- makeChunkedReader False conn
+ reader <- makeChunkedReader (return ()) False conn
body <- brConsume reader
S.concat body `shouldBe` "hello world"
input' <- input
@@ -43,7 +43,7 @@
(conn, _, input) <- dummyConnection
[ "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
]
- reader <- makeChunkedReader True conn
+ reader <- makeChunkedReader (return ()) True conn
body <- brConsume reader
S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n"
input' <- input
@@ -53,7 +53,7 @@
it "chunked, pieces, raw" $ do
(conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
"5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
- reader <- makeChunkedReader True conn
+ reader <- makeChunkedReader (return ()) True conn
body <- brConsume reader
S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n"
input' <- input
@@ -64,7 +64,7 @@
(conn, _, input) <- dummyConnection
[ "hello world done"
]
- reader <- makeLengthReader 11 conn
+ reader <- makeLengthReader (return ()) 11 conn
body <- brConsume reader
S.concat body `shouldBe` "hello world"
input' <- input
@@ -74,7 +74,7 @@
it "length, pieces" $ do
(conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
"hello world done"
- reader <- makeLengthReader 11 conn
+ reader <- makeLengthReader (return ()) 11 conn
body <- brConsume reader
S.concat body `shouldBe` "hello world"
input' <- input
@@ -85,7 +85,7 @@
let orig = L.fromChunks $ replicate 5000 "Hello world!"
origZ = compress orig
(conn, _, input) <- dummyConnection $ L.toChunks origZ ++ ["ignored"]
- reader' <- makeLengthReader (fromIntegral $ L.length origZ) conn
+ reader' <- makeLengthReader (return ()) (fromIntegral $ L.length
origZ) conn
reader <- makeGzipReader reader'
body <- brConsume reader
L.fromChunks body `shouldBe` orig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.6.1.1/test-nonet/Network/HTTP/ClientSpec.hs
new/http-client-0.6.4/test-nonet/Network/HTTP/ClientSpec.hs
--- old/http-client-0.6.1.1/test-nonet/Network/HTTP/ClientSpec.hs
2019-02-20 10:24:08.000000000 +0100
+++ new/http-client-0.6.4/test-nonet/Network/HTTP/ClientSpec.hs 2019-02-27
11:43:18.000000000 +0100
@@ -13,6 +13,7 @@
import qualified Network.HTTP.Client as NC
import qualified Network.HTTP.Client.Internal as Internal
import Network.HTTP.Types (status413)
+import Network.HTTP.Types.Header
import qualified Network.Socket as NS
import Test.Hspec
import qualified Data.Streaming.Network as N
@@ -38,21 +39,28 @@
let _ = e :: IOError
return ()
-redirectServer :: (Int -> IO a) -> IO a
-redirectServer inner = bracket
+redirectServer :: Maybe Int
+ -- ^ If Just, stop redirecting after that many hops.
+ -> (Int -> IO a) -> IO a
+redirectServer maxRedirects inner = bracket
(N.bindRandomPortTCP "*4")
(NS.close . snd)
$ \(port, lsocket) -> withAsync
(N.runTCPServer (N.serverSettingsTCPSocket lsocket) app)
(const $ inner port)
where
+ redirect ad = do
+ N.appWrite ad "HTTP/1.1 301 Redirect\r\nLocation: /\r\ncontent-length:
5\r\n\r\n"
+ threadDelay 10000
+ N.appWrite ad "hello\r\n"
+ threadDelay 10000
app ad = Async.race_
(silentIOError $ forever (N.appRead ad))
- (silentIOError $ forever $ do
- N.appWrite ad "HTTP/1.1 301 Redirect\r\nLocation:
/\r\ncontent-length: 5\r\n\r\n"
- threadDelay 10000
- N.appWrite ad "hello\r\n"
- threadDelay 10000)
+ (silentIOError $ case maxRedirects of
+ Nothing -> forever $ redirect ad
+ Just n ->
+ replicateM_ n (redirect ad) >>
+ N.appWrite ad "HTTP/1.1 200 OK\r\ncontent-length:
5\r\n\r\nhello\r\n")
redirectCloseServer :: (Int -> IO a) -> IO a
redirectCloseServer inner = bracket
@@ -158,7 +166,18 @@
_ -> False
return ()
mapM_ test ["http://", "https://", "http://:8000", "https://:8001"]
- it "redirecting #41" $ redirectServer $ \port -> do
+ it "headers can be stripped on redirect" $ redirectServer (Just 5) $ \port
-> do
+ req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
+ let req = req' { requestHeaders = [(hAuthorization,
"abguvatgbfrrurer")]
+ , redirectCount = 10
+ , shouldStripHeaderOnRedirect = (== hAuthorization)
+ }
+ man <- newManager defaultManagerSettings
+ withResponseHistory req man $ \hr -> do
+ print $ map (requestHeaders . fst) $ hrRedirects hr
+ mapM_ (\r -> requestHeaders r `shouldBe` []) $
+ map fst $ tail $ hrRedirects hr
+ it "redirecting #41" $ redirectServer Nothing $ \port -> do
req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
let req = req' { redirectCount = 1 }
man <- newManager defaultManagerSettings
@@ -167,7 +186,7 @@
case e of
HttpExceptionRequest _ (TooManyRedirects _) -> True
_ -> False
- it "redirectCount=0" $ redirectServer $ \port -> do
+ it "redirectCount=0" $ redirectServer Nothing $ \port -> do
req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
let req = req' { redirectCount = 0 }
man <- newManager defaultManagerSettings