Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-cookie for openSUSE:Factory checked in at 2024-12-20 23:10:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-cookie (Old) and /work/SRC/openSUSE:Factory/.ghc-cookie.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cookie" Fri Dec 20 23:10:28 2024 rev:16 rq:1231432 version:0.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-cookie/ghc-cookie.changes 2023-04-04 21:19:28.416828214 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-cookie.new.1881/ghc-cookie.changes 2024-12-20 23:10:48.504937860 +0100 @@ -1,0 +2,12 @@ +Mon Mar 4 08:52:49 UTC 2024 - Peter Simons <[email protected]> + +- Update cookie to version 0.5.0. + ## 0.5.0 + + * Remove surrounding double quotes from cookie values when parsing [#31](https://github.com/snoyberg/cookie/pull/31) + + This is a breaking change, as it changes the behavior of `parseCookies` and `parseSetCookie` to no + longer include the surrounding double quotes in the cookie value. This is the correct behavior + according to the RFC. + +------------------------------------------------------------------- Old: ---- cookie-0.4.6.tar.gz New: ---- cookie-0.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-cookie.spec ++++++ --- /var/tmp/diff_new_pack.fjJp9j/_old 2024-12-20 23:10:49.480978059 +0100 +++ /var/tmp/diff_new_pack.fjJp9j/_new 2024-12-20 23:10:49.484978224 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-cookie # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.4.6 +Version: 0.5.0 Release: 0 Summary: HTTP cookie parsing and rendering License: MIT ++++++ cookie-0.4.6.tar.gz -> cookie-0.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cookie-0.4.6/ChangeLog.md new/cookie-0.5.0/ChangeLog.md --- old/cookie-0.4.6/ChangeLog.md 2023-01-04 11:55:45.000000000 +0100 +++ new/cookie-0.5.0/ChangeLog.md 2024-03-04 09:52:42.000000000 +0100 @@ -1,3 +1,11 @@ +## 0.5.0 + +* Remove surrounding double quotes from cookie values when parsing [#31](https://github.com/snoyberg/cookie/pull/31) + + This is a breaking change, as it changes the behavior of `parseCookies` and `parseSetCookie` to no + longer include the surrounding double quotes in the cookie value. This is the correct behavior + according to the RFC. + ## 0.4.6 * Resolve redundant import of Data.Monoid [#26](https://github.com/snoyberg/cookie/pull/26) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cookie-0.4.6/Web/Cookie.hs new/cookie-0.5.0/Web/Cookie.hs --- old/cookie-0.4.6/Web/Cookie.hs 2023-01-04 11:55:45.000000000 +0100 +++ new/cookie-0.5.0/Web/Cookie.hs 2024-03-04 09:52:42.000000000 +0100 @@ -85,13 +85,22 @@ parseCookie s = let (key, value) = breakDiscard 61 s -- equals sign key' = S.dropWhile (== 32) key -- space - in (key', value) + value' = dropEnds 34 value -- double quote + in (key', value') breakDiscard :: Word8 -> S.ByteString -> (S.ByteString, S.ByteString) breakDiscard w s = let (x, y) = S.break (== w) s in (x, S.drop 1 y) +dropEnds :: Word8 -> S.ByteString -> S.ByteString +dropEnds w s = + case S.unsnoc s of + Just (s', w') | w' == w -> case S.uncons s' of + Just (w'', s'') | w'' == w -> s'' + _ -> s + _ -> s + type CookieBuilder = (Builder, Builder) renderCookiesBuilder :: [CookieBuilder] -> Builder @@ -240,7 +249,7 @@ parseSetCookie :: S.ByteString -> SetCookie parseSetCookie a = SetCookie { setCookieName = name - , setCookieValue = value + , setCookieValue = dropEnds 34 value -- double quote , setCookiePath = lookup "path" flags , setCookieExpires = lookup "expires" flags >>= parseCookieExpires diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cookie-0.4.6/cookie.cabal new/cookie-0.5.0/cookie.cabal --- old/cookie-0.4.6/cookie.cabal 2023-01-04 12:22:11.000000000 +0100 +++ new/cookie-0.5.0/cookie.cabal 2024-03-04 09:52:42.000000000 +0100 @@ -1,5 +1,5 @@ name: cookie -version: 0.4.6 +version: 0.5.0 license: MIT license-file: LICENSE author: Michael Snoyman <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cookie-0.4.6/test/Spec.hs new/cookie-0.5.0/test/Spec.hs --- old/cookie-0.4.6/test/Spec.hs 2023-01-04 11:55:45.000000000 +0100 +++ new/cookie-0.5.0/test/Spec.hs 2024-03-04 09:52:42.000000000 +0100 @@ -22,6 +22,8 @@ , testProperty "parse/render SetCookie" propParseRenderSetCookie , testProperty "parse/render cookies text" propParseRenderCookiesText , testCase "parseCookies" caseParseCookies + , testCase "parseQuotedCookies" caseParseQuotedCookies + , testCase "parseQuotedSetCookie" caseParseQuotedSetCookie , twoDigit 24 2024 , twoDigit 69 2069 , twoDigit 70 1970 @@ -106,3 +108,17 @@ , show x , " 04:52:08 GMT" ] + +caseParseQuotedCookies :: Assertion +caseParseQuotedCookies = do + let input = S8.pack "a=\"a1\";b=\"b2\"; c=\"c3\"" + expected = [("a", "a1"), ("b", "b2"), ("c", "c3")] + map (S8.pack *** S8.pack) expected @=? parseCookies input + +caseParseQuotedSetCookie :: Assertion +caseParseQuotedSetCookie = do + let input = S8.pack "a=\"a1\"" + result = parseSetCookie input + resultNameAndValue = (setCookieName result, setCookieValue result) + expected = (S8.pack "a", S8.pack "a1") + expected @=? resultNameAndValue
