Hello community,
here is the log from the commit of package ghc-http-client for openSUSE:Factory
checked in at 2019-03-06 15:47:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old)
and /work/SRC/openSUSE:Factory/.ghc-http-client.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client"
Wed Mar 6 15:47:14 2019 rev:31 rq:681683 version:0.6.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes
2019-02-24 17:18:42.812415141 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-http-client.new.28833/ghc-http-client.changes
2019-03-06 15:47:17.664452290 +0100
@@ -1,0 +2,8 @@
+Thu Feb 28 03:01:36 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.2.
+ ## 0.6.2
+
+ * Add `shouldStripHeaderOnRedirect` option to `Request`
[#300](https://github.com/snoyberg/http-client/issues/300)
+
+-------------------------------------------------------------------
Old:
----
http-client-0.6.1.1.tar.gz
New:
----
http-client-0.6.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http-client.spec ++++++
--- /var/tmp/diff_new_pack.7OJez3/_old 2019-03-06 15:47:18.472452076 +0100
+++ /var/tmp/diff_new_pack.7OJez3/_new 2019-03-06 15:47:18.476452074 +0100
@@ -19,7 +19,7 @@
%global pkg_name http-client
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.6.1.1
+Version: 0.6.2
Release: 0
Summary: An HTTP client engine
License: MIT
++++++ http-client-0.6.1.1.tar.gz -> http-client-0.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/ChangeLog.md
new/http-client-0.6.2/ChangeLog.md
--- old/http-client-0.6.1.1/ChangeLog.md 2019-02-20 10:37:43.000000000
+0100
+++ new/http-client-0.6.2/ChangeLog.md 2019-02-27 11:43:18.000000000 +0100
@@ -1,5 +1,9 @@
# Changelog for http-client
+## 0.6.2
+
+* Add `shouldStripHeaderOnRedirect` option to `Request`
[#300](https://github.com/snoyberg/http-client/issues/300)
+
## 0.6.1.1
* Ensure that `Int` parsing doesn't overflow
[#383](https://github.com/snoyberg/http-client/issues/383)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Request.hs
new/http-client-0.6.2/Network/HTTP/Client/Request.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Request.hs 2019-02-20
10:34:27.000000000 +0100
+++ new/http-client-0.6.2/Network/HTTP/Client/Request.hs 2019-02-27
11:43:18.000000000 +0100
@@ -299,6 +299,7 @@
Just (_ :: IOException) -> return ()
Nothing -> throwIO se
, requestManagerOverride = Nothing
+ , shouldStripHeaderOnRedirect = const False
}
-- | Parses a URL via 'parseRequest_'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Response.hs
new/http-client-0.6.2/Network/HTTP/Client/Response.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Response.hs 2019-02-20
10:34:44.000000000 +0100
+++ new/http-client-0.6.2/Network/HTTP/Client/Response.hs 2019-02-27
11:43:18.000000000 +0100
@@ -53,7 +53,11 @@
| 300 <= code && code < 400 = do
l' <- lookup "location" hs
let l = escapeURIString isAllowedInURI (S8.unpack l')
- req' <- setUriRelative req =<< parseURIReference l
+ stripHeaders r =
+ r{requestHeaders =
+ filter (not . shouldStripHeaderOnRedirect req . fst) $
+ requestHeaders r}
+ req' <- fmap stripHeaders <$> setUriRelative req =<< parseURIReference
l
return $
if code == 302 || code == 303
-- According to the spec, this should *only* be for status code
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client/Types.hs
new/http-client-0.6.2/Network/HTTP/Client/Types.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client/Types.hs 2018-11-19
06:27:06.000000000 +0100
+++ new/http-client-0.6.2/Network/HTTP/Client/Types.hs 2019-02-27
11:43:18.000000000 +0100
@@ -551,6 +551,12 @@
-- dealing with implicit global managers, such as in @Network.HTTP.Simple@
--
-- @since 0.4.28
+
+ , shouldStripHeaderOnRedirect :: HeaderName -> Bool
+ -- ^ Decide whether a header must be stripped from the request
+ -- when following a redirect. Default: keep all headers intact.
+ --
+ -- @since 0.6.2
}
deriving T.Typeable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/Network/HTTP/Client.hs
new/http-client-0.6.2/Network/HTTP/Client.hs
--- old/http-client-0.6.1.1/Network/HTTP/Client.hs 2019-02-20
10:21:29.000000000 +0100
+++ new/http-client-0.6.2/Network/HTTP/Client.hs 2019-02-27
11:43:18.000000000 +0100
@@ -159,6 +159,7 @@
, applyBasicProxyAuth
, decompress
, redirectCount
+ , shouldStripHeaderOnRedirect
, checkResponse
, responseTimeout
, cookieJar
@@ -210,6 +211,7 @@
import Data.IORef (newIORef, writeIORef, readIORef, modifyIORef)
import qualified Data.ByteString.Lazy as L
import Data.Foldable (Foldable)
+import Data.Monoid
import Data.Traversable (Traversable)
import Network.HTTP.Types (statusCode)
import GHC.Generics (Generic)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.6.1.1/http-client.cabal
new/http-client-0.6.2/http-client.cabal
--- old/http-client-0.6.1.1/http-client.cabal 2019-02-20 10:37:17.000000000
+0100
+++ new/http-client-0.6.2/http-client.cabal 2019-02-27 11:43:18.000000000
+0100
@@ -1,5 +1,5 @@
name: http-client
-version: 0.6.1.1
+version: 0.6.2
synopsis: An HTTP client engine
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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.6.1.1/test-nonet/Network/HTTP/ClientSpec.hs
new/http-client-0.6.2/test-nonet/Network/HTTP/ClientSpec.hs
--- old/http-client-0.6.1.1/test-nonet/Network/HTTP/ClientSpec.hs
2019-02-20 10:24:08.000000000 +0100
+++ new/http-client-0.6.2/test-nonet/Network/HTTP/ClientSpec.hs 2019-02-27
11:43:18.000000000 +0100
@@ -13,6 +13,7 @@
import qualified Network.HTTP.Client as NC
import qualified Network.HTTP.Client.Internal as Internal
import Network.HTTP.Types (status413)
+import Network.HTTP.Types.Header
import qualified Network.Socket as NS
import Test.Hspec
import qualified Data.Streaming.Network as N
@@ -38,21 +39,28 @@
let _ = e :: IOError
return ()
-redirectServer :: (Int -> IO a) -> IO a
-redirectServer inner = bracket
+redirectServer :: Maybe Int
+ -- ^ If Just, stop redirecting after that many hops.
+ -> (Int -> IO a) -> IO a
+redirectServer maxRedirects inner = bracket
(N.bindRandomPortTCP "*4")
(NS.close . snd)
$ \(port, lsocket) -> withAsync
(N.runTCPServer (N.serverSettingsTCPSocket lsocket) app)
(const $ inner port)
where
+ redirect ad = do
+ N.appWrite ad "HTTP/1.1 301 Redirect\r\nLocation: /\r\ncontent-length:
5\r\n\r\n"
+ threadDelay 10000
+ N.appWrite ad "hello\r\n"
+ threadDelay 10000
app ad = Async.race_
(silentIOError $ forever (N.appRead ad))
- (silentIOError $ forever $ do
- N.appWrite ad "HTTP/1.1 301 Redirect\r\nLocation:
/\r\ncontent-length: 5\r\n\r\n"
- threadDelay 10000
- N.appWrite ad "hello\r\n"
- threadDelay 10000)
+ (silentIOError $ case maxRedirects of
+ Nothing -> forever $ redirect ad
+ Just n ->
+ replicateM_ n (redirect ad) >>
+ N.appWrite ad "HTTP/1.1 200 OK\r\ncontent-length:
5\r\n\r\nhello\r\n")
redirectCloseServer :: (Int -> IO a) -> IO a
redirectCloseServer inner = bracket
@@ -158,7 +166,18 @@
_ -> False
return ()
mapM_ test ["http://", "https://", "http://:8000", "https://:8001"]
- it "redirecting #41" $ redirectServer $ \port -> do
+ it "headers can be stripped on redirect" $ redirectServer (Just 5) $ \port
-> do
+ req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
+ let req = req' { requestHeaders = [(hAuthorization,
"abguvatgbfrrurer")]
+ , redirectCount = 10
+ , shouldStripHeaderOnRedirect = (== hAuthorization)
+ }
+ man <- newManager defaultManagerSettings
+ withResponseHistory req man $ \hr -> do
+ print $ map (requestHeaders . fst) $ hrRedirects hr
+ mapM_ (\r -> requestHeaders r `shouldBe` []) $
+ map fst $ tail $ hrRedirects hr
+ it "redirecting #41" $ redirectServer Nothing $ \port -> do
req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
let req = req' { redirectCount = 1 }
man <- newManager defaultManagerSettings
@@ -167,7 +186,7 @@
case e of
HttpExceptionRequest _ (TooManyRedirects _) -> True
_ -> False
- it "redirectCount=0" $ redirectServer $ \port -> do
+ it "redirectCount=0" $ redirectServer Nothing $ \port -> do
req' <- parseUrlThrow $ "http://127.0.0.1:" ++ show port
let req = req' { redirectCount = 0 }
man <- newManager defaultManagerSettings