Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-http2 for openSUSE:Factory checked in at 2021-06-23 17:38:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http2 (Old) and /work/SRC/openSUSE:Factory/.ghc-http2.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http2" Wed Jun 23 17:38:23 2021 rev:7 rq:901453 version:3.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http2/ghc-http2.changes 2021-04-26 16:40:32.430165842 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-http2.new.2625/ghc-http2.changes 2021-06-23 17:38:29.332492691 +0200 @@ -1,0 +2,9 @@ +Thu Jun 10 14:29:34 UTC 2021 - [email protected] + +- Update http2 to version 3.0.2. + ## 3.0.2 + + * Skip inserting entries that do not fit in the encoding table + (#28)[https://github.com/kazu-yamamoto/http2/pull/28] + +------------------------------------------------------------------- Old: ---- http2-3.0.1.tar.gz New: ---- http2-3.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http2.spec ++++++ --- /var/tmp/diff_new_pack.Xq12Fr/_old 2021-06-23 17:38:30.108493759 +0200 +++ /var/tmp/diff_new_pack.Xq12Fr/_new 2021-06-23 17:38:30.108493759 +0200 @@ -19,7 +19,7 @@ %global pkg_name http2 %bcond_with tests Name: ghc-%{pkg_name} -Version: 3.0.1 +Version: 3.0.2 Release: 0 Summary: HTTP/2 library License: BSD-3-Clause ++++++ http2-3.0.1.tar.gz -> http2-3.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-3.0.1/ChangeLog.md new/http2-3.0.2/ChangeLog.md --- old/http2-3.0.1/ChangeLog.md 2021-04-21 02:48:12.000000000 +0200 +++ new/http2-3.0.2/ChangeLog.md 2021-06-10 03:44:58.000000000 +0200 @@ -1,3 +1,8 @@ +## 3.0.2 + +* Skip inserting entries that do not fit in the encoding table + (#28)[https://github.com/kazu-yamamoto/http2/pull/28] + ## 3.0.1 * Including a necessary file for testing. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-3.0.1/Network/HPACK/Table/Dynamic.hs new/http2-3.0.2/Network/HPACK/Table/Dynamic.hs --- old/http2-3.0.1/Network/HPACK/Table/Dynamic.hs 2021-04-21 02:48:11.000000000 +0200 +++ new/http2-3.0.2/Network/HPACK/Table/Dynamic.hs 2021-06-10 03:44:58.000000000 +0200 @@ -222,7 +222,6 @@ -- | Renewing 'DynamicTable' with necessary entries copied. renewDynamicTable :: Size -> DynamicTable -> IO () -renewDynamicTable 0 _ = return () -- FIXME: handle case 'Max table size = 0'. renewDynamicTable maxsiz dyntbl@DynamicTable{..} = do renew <- shouldRenew dyntbl maxsiz when renew $ do @@ -309,14 +308,17 @@ table <- readIORef circularTable let i = off dsize' = dsize + entrySize e - off' <- adj maxN (off - 1) - unsafeWrite table i e - writeIORef offset off' - writeIORef numOfEntries $ n + 1 - writeIORef dynamicTableSize dsize' - case codeInfo of - EncodeInfo rev _ -> insertRevIndex e (DIndex i) rev - _ -> return () + if maxN == 0 + then return () + else do + off' <- adj maxN (off - 1) + unsafeWrite table i e + writeIORef offset off' + writeIORef numOfEntries $ n + 1 + writeIORef dynamicTableSize dsize' + case codeInfo of + EncodeInfo rev _ -> insertRevIndex e (DIndex i) rev + _ -> return () adjustTableSize :: DynamicTable -> IO [Entry] adjustTableSize dyntbl@DynamicTable{..} = adjust [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-3.0.1/http2.cabal new/http2-3.0.2/http2.cabal --- old/http2-3.0.1/http2.cabal 2021-04-21 02:48:12.000000000 +0200 +++ new/http2-3.0.2/http2.cabal 2021-06-10 03:44:58.000000000 +0200 @@ -1,5 +1,5 @@ Name: http2 -Version: 3.0.1 +Version: 3.0.2 Author: Kazu Yamamoto <[email protected]> Maintainer: Kazu Yamamoto <[email protected]> License: BSD3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-3.0.1/test/HPACK/EncodeSpec.hs new/http2-3.0.2/test/HPACK/EncodeSpec.hs --- old/http2-3.0.1/test/HPACK/EncodeSpec.hs 2021-04-21 02:48:12.000000000 +0200 +++ new/http2-3.0.2/test/HPACK/EncodeSpec.hs 2021-06-10 03:44:58.000000000 +0200 @@ -7,6 +7,8 @@ #endif import qualified Control.Exception as E import qualified Data.ByteString as BS +import Data.Bits +import Data.Maybe (fromMaybe) import Network.HPACK import Test.Hspec @@ -14,45 +16,78 @@ spec = do describe "encodeHeader and decodeHeader" $ do it "works for Naive" $ - run EncodeStrategy {compressionAlgo = Naive, useHuffman = False} [] + run Nothing EncodeStrategy {compressionAlgo = Naive, useHuffman = False} [] it "works for NaiveH" $ - run EncodeStrategy {compressionAlgo = Naive, useHuffman = True} [] + run Nothing EncodeStrategy {compressionAlgo = Naive, useHuffman = True} [] it "works for Static" $ - run EncodeStrategy {compressionAlgo = Static, useHuffman = False} [] + run Nothing EncodeStrategy {compressionAlgo = Static, useHuffman = False} [] it "works for StaticH" $ - run EncodeStrategy {compressionAlgo = Static, useHuffman = True} [] + run Nothing EncodeStrategy {compressionAlgo = Static, useHuffman = True} [] it "works for Linear" $ - run EncodeStrategy {compressionAlgo = Linear, useHuffman = False} [] -- linearLens + run Nothing EncodeStrategy {compressionAlgo = Linear, useHuffman = False} [] -- linearLens it "works for LinearH" $ - run EncodeStrategy {compressionAlgo = Linear, useHuffman = True} [] + run Nothing EncodeStrategy {compressionAlgo = Linear, useHuffman = True} [] + describe "encodeHeader with a 0-size table" $ do + it "works for Linear" $ + run (Just 0) EncodeStrategy {compressionAlgo = Linear, useHuffman = False} [] + it "does not use indexed fields" $ do + runNotIndexed EncodeStrategy {compressionAlgo = Linear, useHuffman = False} -run :: EncodeStrategy -> [Int] -> Expectation -run stgy lens = do +run :: Maybe Int -> EncodeStrategy -> [Int] -> Expectation +run msz stgy lens0 = do + let sz = fromMaybe defaultDynamicTableSize msz hdrs <- read <$> readFile "bench-hpack/headers.hs" - withDynamicTableForEncoding defaultDynamicTableSize $ \etbl -> - withDynamicTableForDecoding defaultDynamicTableSize 4096 $ \dtbl -> - go etbl dtbl stgy hdrs lens `shouldReturn` True + withDynamicTableForEncoding sz $ \etbl -> + withDynamicTableForDecoding sz 4096 $ \dtbl -> + go etbl dtbl hdrs lens0 `shouldReturn` True + where + go :: DynamicTable -> DynamicTable -> [HeaderList] -> [Int] -> IO Bool + go _ _ [] _ = return True + go etbl dtbl (h:hs) lens = do + bs <- encodeHeader stgy 4096 etbl h `E.catch` \(E.SomeException e) -> do + putStrLn $ "encodeHeader: " ++ show e + print h + E.throwIO e + lens' <- case lens of + l:ls + | BS.length bs == l -> return ls + | otherwise -> error $ "The length of encoded headers should be " ++ show l ++ " but " ++ show (BS.length bs) + [] -> return [] + h' <- decodeHeader dtbl bs `E.catch` \(E.SomeException e) -> do + putStrLn $ "decodeHeader: " ++ show e + print h + E.throwIO e + if h == h' then + go etbl dtbl hs lens' + else do + return False -go :: DynamicTable -> DynamicTable -> EncodeStrategy -> [HeaderList] -> [Int] -> IO Bool -go _ _ _ [] _ = return True -go etbl dtbl stgy (h:hs) lens = do - bs <- encodeHeader stgy 4096 etbl h `E.catch` \(E.SomeException e) -> do - putStrLn $ "encodeHeader: " ++ show e - print h - E.throwIO e - lens' <- case lens of - l:ls - | BS.length bs == l -> return ls - | otherwise -> error $ "The length of encoded headers should be " ++ show l ++ " but " ++ show (BS.length bs) - [] -> return [] - h' <- decodeHeader dtbl bs `E.catch` \(E.SomeException e) -> do - putStrLn $ "decodeHeader: " ++ show e - print h - E.throwIO e - if h == h' then - go etbl dtbl stgy hs lens' - else do - return False +runNotIndexed :: EncodeStrategy -> Expectation +runNotIndexed stgy = do + hdrs <- read <$> readFile "bench-hpack/headers.hs" + withDynamicTableForEncoding 0 $ \etbl -> + withDynamicTableForDecoding 0 4096 $ \dtbl -> + mapM_ (go etbl dtbl) (hdrs :: [HeaderList]) + where + go etbl _dtbl h = do + print h + bs <- encodeHeader stgy 4096 etbl h `E.catch` \(E.SomeException e) -> do + putStrLn $ "encodeHeader: " ++ show e + print h + E.throwIO e + findIndexed bs `shouldBe` False + +-- check whether indexed fields are used (HPACK spec 6.1) +findIndexed :: BS.ByteString -> Bool +findIndexed = go . BS.unpack + where + go [] = False + go (b : bs) + | testBit b 7 = if clearBit b 7 <= 61 then go bs else True + | b == 0x40 || b == 0 = go (skip (skip bs)) + | otherwise = go (skip bs) + skip (b : bs) = drop (fromIntegral (clearBit b 7)) bs + skip [] = [] {- fixme: form where these values come? linearLens :: [Int]
