Hello community, here is the log from the commit of package ghc-http-types for openSUSE:Factory checked in at 2016-06-07 23:48:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http-types (Old) and /work/SRC/openSUSE:Factory/.ghc-http-types.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-types" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http-types/ghc-http-types.changes 2016-01-08 15:22:59.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-http-types.new/ghc-http-types.changes 2016-06-07 23:48:20.000000000 +0200 @@ -1,0 +2,8 @@ +Sun Jun 5 19:18:46 UTC 2016 - [email protected] + +- update to 0.9.1 +- remove useless _service +* New function: parseByteRanges. +* Support for HTTP status 422 "Unprocessable Entity" (RFC 4918). + +------------------------------------------------------------------- Old: ---- _service http-types-0.9.tar.gz New: ---- http-types-0.9.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http-types.spec ++++++ --- /var/tmp/diff_new_pack.CcLaNY/_old 2016-06-07 23:48:21.000000000 +0200 +++ /var/tmp/diff_new_pack.CcLaNY/_new 2016-06-07 23:48:21.000000000 +0200 @@ -20,10 +20,9 @@ %bcond_with tests -%global debug_package %{nil} Name: ghc-http-types -Version: 0.9 +Version: 0.9.1 Release: 0 Summary: Generic HTTP types for Haskell (for both client and server code) License: BSD-3-Clause ++++++ http-types-0.9.tar.gz -> http-types-0.9.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/CHANGELOG new/http-types-0.9.1/CHANGELOG --- old/http-types-0.9/CHANGELOG 1970-01-01 01:00:00.000000000 +0100 +++ new/http-types-0.9.1/CHANGELOG 2016-06-04 18:07:02.000000000 +0200 @@ -0,0 +1,8 @@ +* 0.9.1 [2016-06-04] + +New function: parseByteRanges. +Support for HTTP status 422 "Unprocessable Entity" (RFC 4918). + +* 0.9 [2015-10-09] + +No changelog was maintained up to version 0.9. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/Network/HTTP/Types/Header.hs new/http-types-0.9.1/Network/HTTP/Types/Header.hs --- old/http-types-0.9/Network/HTTP/Types/Header.hs 2015-10-05 20:03:53.000000000 +0200 +++ new/http-types-0.9.1/Network/HTTP/Types/Header.hs 2016-06-04 18:07:02.000000000 +0200 @@ -62,6 +62,7 @@ , ByteRanges , renderByteRangesBuilder , renderByteRanges +, parseByteRanges ) where @@ -72,6 +73,7 @@ import qualified Blaze.ByteString.Builder as Blaze import qualified Blaze.ByteString.Builder.Char8 as Blaze import qualified Data.ByteString as B +import qualified Data.ByteString.Char8 as B8 import qualified Data.CaseInsensitive as CI import Data.ByteString.Char8 () {-IsString-} import Data.Typeable (Typeable) @@ -167,3 +169,47 @@ renderByteRanges :: ByteRanges -> B.ByteString renderByteRanges = Blaze.toByteString . renderByteRangesBuilder + +-- | Parse the value of a Range header into a 'ByteRanges'. +-- +-- >>> parseByteRanges "error" +-- Nothing +-- >>> parseByteRanges "bytes=0-499" +-- Just [ByteRangeFromTo 0 499] +-- >>> parseByteRanges "bytes=500-999" +-- Just [ByteRangeFromTo 500 999] +-- >>> parseByteRanges "bytes=-500" +-- Just [ByteRangeSuffix 500] +-- >>> parseByteRanges "bytes=9500-" +-- Just [ByteRangeFrom 9500] +-- >>> parseByteRanges "bytes=0-0,-1" +-- Just [ByteRangeFromTo 0 0,ByteRangeSuffix 1] +-- >>> parseByteRanges "bytes=500-600,601-999" +-- Just [ByteRangeFromTo 500 600,ByteRangeFromTo 601 999] +-- >>> parseByteRanges "bytes=500-700,601-999" +-- Just [ByteRangeFromTo 500 700,ByteRangeFromTo 601 999] +parseByteRanges :: B.ByteString -> Maybe ByteRanges +parseByteRanges bs1 = do + bs2 <- stripPrefixB "bytes=" bs1 + (r, bs3) <- range bs2 + ranges (r:) bs3 + where + range bs2 = do + (i, bs3) <- B8.readInteger bs2 + if i < 0 -- has prefix "-" ("-0" is not valid, but here treated as "0-") + then Just (ByteRangeSuffix (negate i), bs3) + else do + bs4 <- stripPrefixB "-" bs3 + case B8.readInteger bs4 of + Just (j, bs5) | j >= i -> Just (ByteRangeFromTo i j, bs5) + _ -> Just (ByteRangeFrom i, bs4) + ranges front bs3 + | B.null bs3 = Just (front []) + | otherwise = do + bs4 <- stripPrefixB "," bs3 + (r, bs5) <- range bs4 + ranges (front . (r:)) bs5 + + stripPrefixB x y + | x `B.isPrefixOf` y = Just (B.drop (B.length x) y) + | otherwise = Nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/Network/HTTP/Types/Status.hs new/http-types-0.9.1/Network/HTTP/Types/Status.hs --- old/http-types-0.9/Network/HTTP/Types/Status.hs 2015-10-05 20:03:53.000000000 +0200 +++ new/http-types-0.9.1/Network/HTTP/Types/Status.hs 2016-06-04 18:07:02.000000000 +0200 @@ -74,6 +74,8 @@ , expectationFailed417 , status418 , imATeaPot418 +, status422 +, unprocessableEntity422 , status428 , preconditionRequired428 , status429 @@ -160,6 +162,7 @@ toEnum 415 = status415 toEnum 416 = status416 toEnum 417 = status417 + toEnum 422 = status422 toEnum 428 = status428 toEnum 429 = status429 toEnum 431 = status431 @@ -464,6 +467,16 @@ imATeaPot418 :: Status imATeaPot418 = status418 +-- | Unprocessable Entity 422 +-- (<https://tools.ietf.org/html/rfc4918 RFC 4918>) +status422 :: Status +status422 = mkStatus 422 "Unprocessable Entity" + +-- | Unprocessable Entity 422 +-- (<https://tools.ietf.org/html/rfc4918 RFC 4918>) +unprocessableEntity422 :: Status +unprocessableEntity422 = status422 + -- | Precondition Required 428 -- (<https://tools.ietf.org/html/rfc6585 RFC 6585>) status428 :: Status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/Network/HTTP/Types.hs new/http-types-0.9.1/Network/HTTP/Types.hs --- old/http-types-0.9/Network/HTTP/Types.hs 2015-10-05 20:03:53.000000000 +0200 +++ new/http-types-0.9.1/Network/HTTP/Types.hs 2016-06-04 18:07:02.000000000 +0200 @@ -144,6 +144,7 @@ , ByteRanges , renderByteRangesBuilder , renderByteRanges +, parseByteRanges -- * URI -- ** Query string , QueryItem diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/README new/http-types-0.9.1/README --- old/http-types-0.9/README 2015-10-05 20:03:53.000000000 +0200 +++ new/http-types-0.9.1/README 2016-06-04 18:07:02.000000000 +0200 @@ -1 +1,5 @@ Generic HTTP types for Haskell (for both client and server code). + +This library also contains some utility functions, e.g. related to URI +handling, that are not necessarily restricted in use to HTTP, but the scope is +restricted to things that are useful inside HTTP, i.e. no FTP URI parsing. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-types-0.9/http-types.cabal new/http-types-0.9.1/http-types.cabal --- old/http-types-0.9/http-types.cabal 2015-10-05 20:03:53.000000000 +0200 +++ new/http-types-0.9.1/http-types.cabal 2016-06-04 18:07:02.000000000 +0200 @@ -1,5 +1,5 @@ Name: http-types -Version: 0.9 +Version: 0.9.1 Synopsis: Generic HTTP types for Haskell (for both client and server code). Description: Generic HTTP types for Haskell (for both client and server code). Homepage: https://github.com/aristidb/http-types @@ -10,13 +10,13 @@ Copyright: (C) 2011 Aristid Breitkreuz Category: Network, Web Build-type: Simple -Extra-source-files: README +Extra-source-files: README, CHANGELOG Cabal-version: >=1.8 Source-repository this type: git location: https://github.com/aristidb/http-types.git - tag: 0.9 + tag: 0.9.1 Source-repository head type: git
