Hello community, here is the log from the commit of package ghc-http-client for openSUSE:Factory checked in at 2015-09-24 06:15:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old) and /work/SRC/openSUSE:Factory/.ghc-http-client.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes 2015-09-17 09:19:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-http-client.new/ghc-http-client.changes 2015-09-24 06:15:10.000000000 +0200 @@ -1,0 +2,6 @@ +Sun Sep 20 19:18:53 UTC 2015 - [email protected] + +- update to 0.4.23 +* Case insensitive cookie domains + +------------------------------------------------------------------- Old: ---- http-client-0.4.22.1.tar.gz New: ---- http-client-0.4.23.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http-client.spec ++++++ --- /var/tmp/diff_new_pack.qjr2a7/_old 2015-09-24 06:15:11.000000000 +0200 +++ /var/tmp/diff_new_pack.qjr2a7/_new 2015-09-24 06:15:11.000000000 +0200 @@ -21,7 +21,7 @@ %bcond_with tests Name: ghc-http-client -Version: 0.4.22.1 +Version: 0.4.23 Release: 0 Summary: HTTP client engine, intended as a base layer License: MIT ++++++ http-client-0.4.22.1.tar.gz -> http-client-0.4.23.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.22.1/ChangeLog.md new/http-client-0.4.23/ChangeLog.md --- old/http-client-0.4.22.1/ChangeLog.md 2015-09-13 10:23:50.000000000 +0200 +++ new/http-client-0.4.23/ChangeLog.md 2015-09-18 10:59:49.000000000 +0200 @@ -1,3 +1,7 @@ +## 0.4.23 + +* Case insensitive cookie domains [#158](https://github.com/snoyberg/http-client/issues/158) + ## 0.4.22 * ProxyConnectException now returns Right HttpException. [#155](https://github.com/snoyberg/http-client/pull/155) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.22.1/Network/HTTP/Client/Cookies.hs new/http-client-0.4.23/Network/HTTP/Client/Cookies.hs --- old/http-client-0.4.22.1/Network/HTTP/Client/Cookies.hs 2015-09-13 10:23:50.000000000 +0200 +++ new/http-client-0.4.23/Network/HTTP/Client/Cookies.hs 2015-09-18 10:59:49.000000000 +0200 @@ -52,13 +52,17 @@ -- | This corresponds to the subcomponent algorithm entitled \"Domain Matching\" detailed -- in section 5.1.3 -domainMatches :: BS.ByteString -> BS.ByteString -> Bool -domainMatches string domainString +domainMatches :: BS.ByteString -- ^ Domain to test + -> BS.ByteString -- ^ Domain from a cookie + -> Bool +domainMatches string' domainString' | string == domainString = True | BS.length string < BS.length domainString + 1 = False | domainString `BS.isSuffixOf` string && BS.singleton (BS.last difference) == "." && not (isIpAddress string) = True | otherwise = False where difference = BS.take (BS.length string - BS.length domainString) string + string = CI.foldCase string' + domainString = CI.foldCase domainString' -- | This corresponds to the subcomponent algorithm entitled \"Paths\" detailed -- in section 5.1.4 @@ -136,7 +140,7 @@ computeCookieString request cookie_jar now is_http_api = (output_line, cookie_jar') where matching_cookie cookie = condition1 && condition2 && condition3 && condition4 where condition1 - | cookie_host_only cookie = Req.host request == cookie_domain cookie + | cookie_host_only cookie = CI.foldCase (Req.host request) == CI.foldCase (cookie_domain cookie) | otherwise = domainMatches (Req.host request) (cookie_domain cookie) condition2 = pathMatches (Req.path request) (cookie_path cookie) condition3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.22.1/Network/HTTP/Client/Types.hs new/http-client-0.4.23/Network/HTTP/Client/Types.hs --- old/http-client-0.4.22.1/Network/HTTP/Client/Types.hs 2015-09-13 10:23:50.000000000 +0200 +++ new/http-client-0.4.23/Network/HTTP/Client/Types.hs 2015-09-18 10:59:49.000000000 +0200 @@ -55,6 +55,7 @@ import Data.Text (Text) import Data.Streaming.Zlib (ZlibException) import Control.Concurrent.MVar (MVar) +import Data.CaseInsensitive as CI -- | An @IO@ action that represents an incoming response body coming from the -- server. Data provided by this action has already been gunzipped and @@ -159,7 +160,7 @@ instance Eq Cookie where (==) a b = name_matches && domain_matches && path_matches where name_matches = cookie_name a == cookie_name b - domain_matches = cookie_domain a == cookie_domain b + domain_matches = CI.foldCase (cookie_domain a) == CI.foldCase (cookie_domain b) path_matches = cookie_path a == cookie_path b instance Ord Cookie where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.22.1/http-client.cabal new/http-client-0.4.23/http-client.cabal --- old/http-client-0.4.22.1/http-client.cabal 2015-09-13 10:23:50.000000000 +0200 +++ new/http-client-0.4.23/http-client.cabal 2015-09-18 10:59:49.000000000 +0200 @@ -1,5 +1,5 @@ name: http-client -version: 0.4.22.1 +version: 0.4.23 synopsis: An HTTP client engine, intended as a base layer for more user-friendly packages. 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 @@ -99,6 +99,7 @@ Network.HTTP.Client.HeadersSpec Network.HTTP.Client.RequestSpec Network.HTTP.Client.RequestBodySpec + Network.HTTP.Client.CookieSpec build-depends: base , http-client , hspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.22.1/test-nonet/Network/HTTP/Client/CookieSpec.hs new/http-client-0.4.23/test-nonet/Network/HTTP/Client/CookieSpec.hs --- old/http-client-0.4.22.1/test-nonet/Network/HTTP/Client/CookieSpec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/http-client-0.4.23/test-nonet/Network/HTTP/Client/CookieSpec.hs 2015-09-18 10:59:49.000000000 +0200 @@ -0,0 +1,27 @@ +{-# LANGUAGE OverloadedStrings #-} +module Network.HTTP.Client.CookieSpec where + +import Data.Time.Clock +import Network.HTTP.Client.Internal +import Network.HTTP.Types +import Test.Hspec + +main :: IO () +main = hspec spec + +spec :: Spec +spec = describe "CookieSpec" $ do + it "cookie equality - case insensitive Eq" $ do + now <- getCurrentTime + let cookie1 = Cookie "test" "value" now "doMain.Org" "/" now now False False False False + cookie2 = Cookie "test" "value" now "DOMAIn.ORg" "/" now now False False False False + cookie1 `shouldBe` cookie2 + + it "domainMatches - case insensitive" $ do + domainMatches "www.org" "www.org" `shouldBe` True + domainMatches "wWw.OrG" "Www.oRG" `shouldBe` True + domainMatches "wxw.OrG" "Www.oRG" `shouldBe` False + + it "domainMatches - case insensitive, partial" $ do + domainMatches "www.org" "xxx.www.org" `shouldBe` False + domainMatches "xxx.www.org" "WWW.ORG" `shouldBe` True
