commit ghc-http-client for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-http-client for openSUSE:Factory checked in at 2019-04-28 20:12:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old) and /work/SRC/openSUSE:Factory/.ghc-http-client.new.5536 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-http-client" Sun Apr 28 20:12:50 2019 rev:32 rq:698551 version:0.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes 2019-03-06 15:47:17.664452290 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-http-client.new.5536/ghc-http-client.changes 2019-04-28 20:12:57.894436694 +0200 @@ -1,0 +2,21 @@ +Sat Apr 13 02:03:10 UTC 2019 - psimons@suse.com + +- 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 - psimons@suse.com + +- 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) + +------------------------------------------------------------------- Old: ---- http-client-0.6.2.tar.gz New: ---- http-client-0.6.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http-client.spec ++++++ --- /var/tmp/diff_new_pack.WsgqkI/_old 2019-04-28 20:13:02.166434039 +0200 +++ /var/tmp/diff_new_pack.WsgqkI/_new 2019-04-28 20:13:02.166434039 +0200 @@ -19,7 +19,7 @@ %global pkg_name http-client %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.6.2 +Version: 0.6.4 Release: 0 Summary: An HTTP client engine License: MIT ++++++ http-client-0.6.2.tar.gz -> http-client-0.6.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.6.2/ChangeLog.md new/http-client-0.6.4/ChangeLog.md --- old/http-client-0.6.2/ChangeLog.md 2019-02-27 11:43:18.000000000 +0100 +++ new/http-client-0.6.4/ChangeLog.md 2019-04-12 07:51:44.000000000 +0200 @@ -1,5 +1,18 @@ # 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.6.2/Network/HTTP/Client/Body.hs new/http-client-0.6.4/Network/HTTP/Client/Body.hs --- old/http-client-0.6.2/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.2/Network/HTTP/Client/Headers.hs new/http-client-0.6.4/Network/HTTP/Client/Headers.hs --- old/http-client-0.6.2/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.2/Network/HTTP/Client/Response.hs new/http-client-0.6.4/Network/HTTP/Client/Response.hs --- old/http-client-0.6.2/Network/HTTP/Client/Response.hs 2019-02-27 11:43:18.000000000 +0100 +++ new/http-client-0.6.4/Network/HTTP/Client/Response.hs 2019-04-02 15:24:20.000000000 +0200 @@ -107,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.2/Network/HTTP/Client/Types.hs new/http-client-0.6.4/Network/HTTP/Client/Types.hs --- old/http-client-0.6.2/Network/HTTP/Client/Types.hs 2019-02-27 11:43:18.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 @@ -565,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.2/http-client.cabal new/http-client-0.6.4/http-client.cabal --- old/http-client-0.6.2/http-client.cabal 2019-02-27 11:43:18.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.2 +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.2/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.2/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
participants (1)
-
root