Hello community, here is the log from the commit of package ghc-http2 for openSUSE:Factory checked in at 2016-07-21 08:06:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http2 (Old) and /work/SRC/openSUSE:Factory/.ghc-http2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http2" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http2/ghc-http2.changes 2016-05-31 12:24:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-http2.new/ghc-http2.changes 2016-07-21 08:06:55.000000000 +0200 @@ -1,0 +2,12 @@ +Sun Jul 17 13:12:55 UTC 2016 - [email protected] + +- Update to version 1.6.1 revision 0 with cabal2obs. + This change obsoletes cabal-deps.patch. + +------------------------------------------------------------------- +Sun Jul 10 15:47:36 UTC 2016 - [email protected] + +- update to 1.6.1 +* Added length validation for RequestBodyStream + +------------------------------------------------------------------- Old: ---- cabal-deps.patch http2-1.6.0.tar.gz New: ---- http2-1.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http2.spec ++++++ --- /var/tmp/diff_new_pack.D6uuxh/_old 2016-07-21 08:06:57.000000000 +0200 +++ /var/tmp/diff_new_pack.D6uuxh/_new 2016-07-21 08:06:57.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-http2 # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 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 @@ -15,69 +15,66 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%global pkg_name http2 +%global pkg_name http2 %bcond_with tests - -Name: ghc-http2 -Version: 1.6.0 +Name: ghc-%{pkg_name} +Version: 1.6.1 Release: 0 Summary: HTTP/2.0 library including frames and HPACK -Group: System/Libraries - License: BSD-3-Clause +Group: System/Libraries Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -# PATCH-FIX-OPENSUSE cabal-deps.patch [email protected] -Patch0: cabal-deps.patch - -BuildRoot: %{_tmppath}/%{name}-%{version}-build - BuildRequires: ghc-Cabal-devel -BuildRequires: ghc-rpm-macros # Begin cabal-rpm deps: -BuildRequires: ghc-aeson-devel -BuildRequires: ghc-aeson-pretty-devel BuildRequires: ghc-array-devel +BuildRequires: ghc-bytestring-builder-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-case-insensitive-devel BuildRequires: ghc-containers-devel +BuildRequires: ghc-psqueues-devel +BuildRequires: ghc-rpm-macros +BuildRequires: ghc-stm-devel +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if %{with tests} +BuildRequires: ghc-Glob-devel +BuildRequires: ghc-aeson-devel +BuildRequires: ghc-aeson-pretty-devel BuildRequires: ghc-directory-devel +BuildRequires: ghc-doctest-devel BuildRequires: ghc-filepath-devel BuildRequires: ghc-hex-devel -BuildRequires: ghc-psqueues-devel -BuildRequires: ghc-stm-devel +BuildRequires: ghc-hspec-devel BuildRequires: ghc-text-devel BuildRequires: ghc-unordered-containers-devel BuildRequires: ghc-vector-devel BuildRequires: ghc-word8-devel -%if %{with tests} -BuildRequires: ghc-Glob-devel -BuildRequires: ghc-doctest-devel -BuildRequires: ghc-hspec-devel -BuildRequires: ghc-mwc-random-devel %endif # End cabal-rpm deps +BuildRequires: ghc-aeson-devel +BuildRequires: ghc-aeson-pretty-devel +BuildRequires: ghc-hex-devel +BuildRequires: ghc-vector-devel +BuildRequires: ghc-word8-devel %description HTTP/2.0 library including frames and HPACK. - %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other +Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} Requires(postun): ghc-compiler = %{ghc_version} -Requires: %{name} = %{version}-%{release} %description devel This package provides the Haskell %{pkg_name} library development files. - %prep %setup -q -n %{pkg_name}-%{version} -%patch0 -p1 + %build %ghc_lib_build @@ -89,25 +86,22 @@ %check %if %{with tests} -%cabal test +%{cabal} test %endif %post devel %ghc_pkg_recache - %postun devel %ghc_pkg_recache - %files -f %{name}.files %defattr(-,root,root,-) %doc LICENSE - %files devel -f %{name}-devel.files %defattr(-,root,root,-) - +%doc ChangeLog.md %changelog ++++++ http2-1.6.0.tar.gz -> http2-1.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-1.6.0/Network/HPACK/Buffer.hs new/http2-1.6.1/Network/HPACK/Buffer.hs --- old/http2-1.6.0/Network/HPACK/Buffer.hs 2016-04-07 05:50:22.000000000 +0200 +++ new/http2-1.6.1/Network/HPACK/Buffer.hs 2016-07-08 06:03:48.000000000 +0200 @@ -3,7 +3,7 @@ module Network.HPACK.Buffer ( Buffer , BufferSize - , WorkingBuffer + , WorkingBuffer(..) , newWorkingBuffer , wind , readWord8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-1.6.0/Network/HPACK/HeaderBlock/Decode.hs new/http2-1.6.1/Network/HPACK/HeaderBlock/Decode.hs --- old/http2-1.6.0/Network/HPACK/HeaderBlock/Decode.hs 2016-04-07 05:50:22.000000000 +0200 +++ new/http2-1.6.1/Network/HPACK/HeaderBlock/Decode.hs 2016-07-08 06:03:48.000000000 +0200 @@ -284,7 +284,7 @@ ---------------------------------------------------------------- --- | Converting a header list of WAI's style to +-- | Converting a header list of the http-types style to -- 'TokenHeaderList' and 'ValueTable'. toHeaderTable :: [(CI HeaderName,HeaderValue)] -> IO (TokenHeaderList, ValueTable) toHeaderTable kvs = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-1.6.0/Network/HPACK/Huffman/Encode.hs new/http2-1.6.1/Network/HPACK/Huffman/Encode.hs --- old/http2-1.6.0/Network/HPACK/Huffman/Encode.hs 2016-04-07 05:50:22.000000000 +0200 +++ new/http2-1.6.1/Network/HPACK/Huffman/Encode.hs 2016-07-08 06:03:48.000000000 +0200 @@ -1,4 +1,4 @@ -{-# LANGUAGE BangPatterns, CPP #-} +{-# LANGUAGE BangPatterns, CPP, RecordWildCards #-} module Network.HPACK.Huffman.Encode ( -- * Huffman encoding @@ -10,16 +10,20 @@ #if __GLASGOW_HASKELL__ < 709 import Control.Applicative ((<$>)) #endif +import Control.Exception (throwIO) import Control.Monad (when, void) import Data.Array import Data.Bits ((.|.)) -import qualified Data.ByteString as BS -import Data.ByteString.Internal (ByteString(..)) +import Data.ByteString (ByteString) +import Data.IORef import Data.Word (Word8) +import Foreign.Ptr (plusPtr, minusPtr, Ptr) +import Foreign.Storable (peek, poke) import Network.HPACK.Buffer import Network.HPACK.Huffman.Bit import Network.HPACK.Huffman.Params import Network.HPACK.Huffman.Table +import Network.HPACK.Types (BufferOverrun(..)) ---------------------------------------------------------------- @@ -27,9 +31,17 @@ type ShiftedArray = Array Int Shifted -data Shifted = Shifted !Int -- How many bits in the last byte - !Word8 -- First word. If Int is 0, this is dummy - !ByteString -- Following words, up to 4 bytes +data WS = W0 + | W1 !Word8 + | W2 !Word8 !Word8 + | W3 !Word8 !Word8 !Word8 + | W4 !Word8 !Word8 !Word8 !Word8 + deriving Show + +data Shifted = Shifted !Int -- How many bits in the last byte + !Int -- Total bytes (3rd + 4th) + !Word8 -- First word. If Int is 0, this is dummy + !WS -- Following words, up to 4 bytes deriving Show ---------------------------------------------------------------- @@ -40,20 +52,28 @@ -- | -- -- >>> toShifted [T,T,T,T] 0 --- Shifted 4 240 "" +-- Shifted 4 1 240 W0 -- >>> toShifted [T,T,T,T] 4 --- Shifted 0 15 "" +-- Shifted 0 1 15 W0 -- >>> toShifted [T,T,T,T] 5 --- Shifted 1 7 "\128" +-- Shifted 1 2 7 (W1 128) toShifted :: Bits -> Int -> Shifted -toShifted bits n = Shifted r w bs +toShifted bits n = Shifted r siz w ws where shifted = replicate n F ++ bits len = length shifted !r = len `mod` 8 - bs0 = BS.pack $ map fromBits $ group8 shifted - (!w,!bs) = (BS.head bs0, BS.tail bs0) + ws0 = map fromBits $ group8 shifted + !siz = length ws0 + !w = head ws0 + !ws = case tail ws0 of + [] -> W0 + [w1] -> W1 w1 + [w1,w2] -> W2 w1 w2 + [w1,w2,w3] -> W3 w1 w2 w3 + [w1,w2,w3,w4] -> W4 w1 w2 w3 w4 + _ -> error "toShifted" group8 xs | null zs = pad ys : [] | otherwise = ys : group8 zs @@ -74,26 +94,54 @@ encode dst bs = withReadBuffer bs $ enc dst enc :: WorkingBuffer -> ReadBuffer -> IO Int -enc dst rbuf = returnLength dst $ go 0 +enc WorkingBuffer{..} rbuf = do + beg <- readIORef offset + end <- go 0 beg + writeIORef offset end + let !len = end `minusPtr` beg + return len where - go n = do + go n ptr = do more <- hasOneByte rbuf if more then do !i <- fromIntegral <$> getByte rbuf - let Shifted n' b bs = (aosa ! i) ! n + let Shifted n' len b bs = (aosa ! i) ! n + !ptr' | n' == 0 = ptr `plusPtr` len + | otherwise = ptr `plusPtr` (len - 1) + when (ptr' >= limit) $ throwIO BufferOverrun if n == 0 then - writeWord8 dst b + poke ptr b else do - b0 <- readWord8 dst - writeWord8 dst (b0 .|. b) - copyByteString dst bs - when (n' /= 0) $ wind dst (-1) - go n' + b0 <- peek ptr + poke ptr (b0 .|. b) + copy (ptr `plusPtr` 1) bs + go n' ptr' else - when (n /= 0) $ do - let Shifted _ b _ = (aosa ! idxEos) ! n - b0 <- readWord8 dst - writeWord8 dst (b0 .|. b) + if (n == 0) then + return ptr + else do + let Shifted _ _ b _ = (aosa ! idxEos) ! n + b0 <- peek ptr + poke ptr (b0 .|. b) + let !ptr' = ptr `plusPtr` 1 + return ptr' + +{-# INLINE copy #-} +copy :: Ptr Word8 -> WS -> IO () +copy _ W0 = return () +copy ptr (W1 w1) = poke ptr w1 +copy ptr (W2 w1 w2) = do + poke ptr w1 + poke (ptr `plusPtr` 1) w2 +copy ptr (W3 w1 w2 w3) = do + poke ptr w1 + poke (ptr `plusPtr` 1) w2 + poke (ptr `plusPtr` 2) w3 +copy ptr (W4 w1 w2 w3 w4) = do + poke ptr w1 + poke (ptr `plusPtr` 1) w2 + poke (ptr `plusPtr` 2) w3 + poke (ptr `plusPtr` 3) w4 encodeHuffman :: ByteString -> IO ByteString encodeHuffman bs = withTemporaryBuffer 4096 $ \wbuf -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http2-1.6.0/http2.cabal new/http2-1.6.1/http2.cabal --- old/http2-1.6.0/http2.cabal 2016-04-07 05:50:22.000000000 +0200 +++ new/http2-1.6.1/http2.cabal 2016-07-08 06:03:48.000000000 +0200 @@ -1,5 +1,5 @@ Name: http2 -Version: 1.6.0 +Version: 1.6.1 Author: Kazu Yamamoto <[email protected]> Maintainer: Kazu Yamamoto <[email protected]> License: BSD3
