Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-http-client for openSUSE:Factory
checked in at 2022-02-11 23:09:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old)
and /work/SRC/openSUSE:Factory/.ghc-http-client.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client"
Fri Feb 11 23:09:10 2022 rev:45 rq:953484 version:0.7.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes
2021-09-10 23:41:44.762587142 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-http-client.new.1956/ghc-http-client.changes
2022-02-11 23:11:04.967236346 +0100
@@ -1,0 +2,15 @@
+Fri Feb 4 09:27:45 UTC 2022 - Peter Simons <[email protected]>
+
+- Update http-client to version 0.7.11.
+ ## 0.7.11
+
+ * Allow making requests to raw IPv6 hosts
[#477](https://github.com/snoyberg/http-client/pull/477)
+ * Catch "resource vanished" exception on initial response read
[#480](https://github.com/snoyberg/http-client/pull/480)
+ * Search for reachable IP addresses asynchronously (RFC 6555, 8305) after
calling `getAddrInfo` to reduce latency
[#472](https://github.com/snoyberg/http-client/pull/472).
+
+ ## 0.7.10
+
+ * Consume trailers and last CRLF of chunked body. The trailers are not
exposed,
+ unless the raw body is requested.
+
+-------------------------------------------------------------------
Old:
----
http-client-0.7.9.tar.gz
New:
----
http-client-0.7.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http-client.spec ++++++
--- /var/tmp/diff_new_pack.IT1bRj/_old 2022-02-11 23:11:05.419237653 +0100
+++ /var/tmp/diff_new_pack.IT1bRj/_new 2022-02-11 23:11:05.423237665 +0100
@@ -1,7 +1,7 @@
#
# spec file for package ghc-http-client
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%global pkg_name http-client
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.7.9
+Version: 0.7.11
Release: 0
Summary: An HTTP client engine
License: MIT
@@ -27,6 +27,7 @@
Source0:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-array-devel
+BuildRequires: ghc-async-devel
BuildRequires: ghc-base64-bytestring-devel
BuildRequires: ghc-blaze-builder-devel
BuildRequires: ghc-bytestring-devel
@@ -50,7 +51,6 @@
BuildRequires: ghc-transformers-devel
ExcludeArch: %{ix86}
%if %{with tests}
-BuildRequires: ghc-async-devel
BuildRequires: ghc-directory-devel
BuildRequires: ghc-hspec-devel
BuildRequires: ghc-monad-control-devel
++++++ http-client-0.7.9.tar.gz -> http-client-0.7.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/ChangeLog.md
new/http-client-0.7.11/ChangeLog.md
--- old/http-client-0.7.9/ChangeLog.md 2021-09-10 03:35:17.000000000 +0200
+++ new/http-client-0.7.11/ChangeLog.md 2022-02-04 10:27:01.000000000 +0100
@@ -1,5 +1,16 @@
# Changelog for http-client
+## 0.7.11
+
+* Allow making requests to raw IPv6 hosts
[#477](https://github.com/snoyberg/http-client/pull/477)
+* Catch "resource vanished" exception on initial response read
[#480](https://github.com/snoyberg/http-client/pull/480)
+* Search for reachable IP addresses asynchronously (RFC 6555, 8305) after
calling `getAddrInfo` to reduce latency
[#472](https://github.com/snoyberg/http-client/pull/472).
+
+## 0.7.10
+
+* Consume trailers and last CRLF of chunked body. The trailers are not exposed,
+ unless the raw body is requested.
+
## 0.7.9
* Exceptions from streamed request body now cause the request to fail.
Previously they were
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/Network/HTTP/Client/Body.hs
new/http-client-0.7.11/Network/HTTP/Client/Body.hs
--- old/http-client-0.7.9/Network/HTTP/Client/Body.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/Network/HTTP/Client/Body.hs 2022-01-31
16:09:24.000000000 +0100
@@ -1,5 +1,6 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE MultiWayIf #-}
module Network.HTTP.Client.Body
( makeChunkedReader
, makeLengthReader
@@ -166,8 +167,11 @@
else return (empty, count0)
if count <= 0
then do
+ -- count == -1 indicates that all chunks have been consumed
writeIORef icount (-1)
- return $ if count /= (-1) && raw then rawCount else empty
+ if | count /= -1 && raw -> S.append rawCount <$>
readTrailersRaw
+ | count /= -1 -> consumeTrailers *> pure empty
+ | otherwise -> pure empty
else do
(bs, count') <- readChunk count
writeIORef icount count'
@@ -222,3 +226,11 @@
| 65 <= w && w <= 70 = Just $ fromIntegral w - 55
| 97 <= w && w <= 102 = Just $ fromIntegral w - 87
| otherwise = Nothing
+
+ readTrailersRaw = do
+ bs <- connectionReadLine conn
+ if S.null bs
+ then pure "\r\n"
+ else (bs `S.append` "\r\n" `S.append`) <$> readTrailersRaw
+
+ consumeTrailers = connectionDropTillBlankLine conn
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/Network/HTTP/Client/Connection.hs
new/http-client-0.7.11/Network/HTTP/Client/Connection.hs
--- old/http-client-0.7.9/Network/HTTP/Client/Connection.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/Network/HTTP/Client/Connection.hs 2022-02-04
10:26:32.000000000 +0100
@@ -11,19 +11,25 @@
, makeConnection
, socketConnection
, withSocket
+ , strippedHostName
) where
import Data.ByteString (ByteString, empty)
import Data.IORef
import Control.Monad
+import Control.Concurrent
+import Control.Concurrent.Async
import Network.HTTP.Client.Types
import Network.Socket (Socket, HostAddress)
import qualified Network.Socket as NS
import Network.Socket.ByteString (sendAll, recv)
import qualified Control.Exception as E
import qualified Data.ByteString as S
-import Data.Word (Word8)
+import Data.Foldable (for_)
import Data.Function (fix)
+import Data.Maybe (listToMaybe)
+import Data.Word (Word8)
+
connectionReadLine :: Connection -> IO ByteString
connectionReadLine conn = do
@@ -149,6 +155,24 @@
withSocket tweakSocket hostAddress' host' port' $ \ sock ->
socketConnection sock chunksize
+-- | strippedHostName takes a URI host name, as extracted
+-- by 'Network.URI.regName', and strips square brackets
+-- around IPv6 addresses.
+--
+-- The result is suitable for passing to services such as
+-- name resolution ('Network.Socket.getAddr').
+--
+-- @since
+strippedHostName :: String -> String
+strippedHostName hostName =
+ case hostName of
+ '[':'v':_ -> hostName -- IPvFuture, no obvious way to deal with this
+ '[':rest ->
+ case break (== ']') rest of
+ (ipv6, "]") -> ipv6
+ _ -> hostName -- invalid host name
+ _ -> hostName
+
withSocket :: (Socket -> IO ())
-> Maybe HostAddress
-> String -- ^ host
@@ -159,7 +183,7 @@
let hints = NS.defaultHints { NS.addrSocketType = NS.Stream }
addrs <- case hostAddress' of
Nothing ->
- NS.getAddrInfo (Just hints) (Just host') (Just $ show port')
+ NS.getAddrInfo (Just hints) (Just $ strippedHostName host') (Just
$ show port')
Just ha ->
return
[NS.AddrInfo
@@ -184,10 +208,30 @@
NS.connect sock (NS.addrAddress addr)
return sock)
+-- Pick up an IP using an approximation of the happy-eyeballs algorithm:
+-- https://datatracker.ietf.org/doc/html/rfc8305
+--
firstSuccessful :: [NS.AddrInfo] -> (NS.AddrInfo -> IO a) -> IO a
-firstSuccessful [] _ = error "getAddrInfo returned empty list"
-firstSuccessful (a:as) cb =
- cb a `E.catch` \(e :: E.IOException) ->
- case as of
- [] -> E.throwIO e
- _ -> firstSuccessful as cb
+firstSuccessful [] _ = error "getAddrInfo returned empty list"
+firstSuccessful addresses cb = do
+ result <- newEmptyMVar
+ either E.throwIO pure =<<
+ withAsync (tryAddresses result)
+ (\_ -> takeMVar result)
+ where
+ -- https://datatracker.ietf.org/doc/html/rfc8305#section-5
+ connectionAttemptDelay = 250 * 1000
+
+ tryAddresses result = do
+ z <- forConcurrently (zip addresses [0..]) $ \(addr, n) -> do
+ when (n > 0) $ threadDelay $ n * connectionAttemptDelay
+ tryAddress addr
+
+ case listToMaybe (reverse z) of
+ Just e@(Left _) -> tryPutMVar result e
+ _ -> error $ "tryAddresses invariant violated: " <>
show addresses
+ where
+ tryAddress addr = do
+ r :: Either E.IOException a <- E.try $! cb addr
+ for_ r $ \_ -> tryPutMVar result r
+ pure r
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/Network/HTTP/Client/Core.hs
new/http-client-0.7.11/Network/HTTP/Client/Core.hs
--- old/http-client-0.7.9/Network/HTTP/Client/Core.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/Network/HTTP/Client/Core.hs 2022-01-31
16:09:24.000000000 +0100
@@ -12,6 +12,7 @@
, httpRedirect
, httpRedirect'
, withConnection
+ , handleClosedRead
) where
import Network.HTTP.Types
@@ -30,6 +31,7 @@
import Control.Monad (void)
import System.Timeout (timeout)
import Data.KeyedPool
+import GHC.IO.Exception (IOException(..), IOErrorType(..))
-- | Perform a @Request@ using a connection acquired from the given @Manager@,
-- and then provide the @Response@ to the given function. This function is
@@ -235,6 +237,17 @@
(res, mbReq) <- http0 req'
return (res, fromMaybe req0 mbReq, isJust mbReq)
+handleClosedRead :: SomeException -> IO L.ByteString
+handleClosedRead se
+ | Just ConnectionClosed <- fmap unHttpExceptionContentWrapper
(fromException se)
+ = return L.empty
+ | Just (HttpExceptionRequest _ ConnectionClosed) <- fromException se
+ = return L.empty
+ | Just (IOError _ ResourceVanished _ _ _ _) <- fromException se
+ = return L.empty
+ | otherwise
+ = throwIO se
+
-- | Redirect loop.
--
-- This extended version of 'httpRaw' also returns the Request potentially
modified by @managerModifyRequest@.
@@ -258,15 +271,7 @@
-- The connection may already be closed, e.g.
-- when using withResponseHistory. See
-- https://github.com/snoyberg/http-client/issues/169
- `Control.Exception.catch` \se ->
- case () of
- ()
- | Just ConnectionClosed <-
- fmap unHttpExceptionContentWrapper
- (fromException se) -> return L.empty
- | Just (HttpExceptionRequest _ ConnectionClosed) <-
- fromException se -> return L.empty
- _ -> throwIO se
+ `Control.Exception.catch` handleClosedRead
responseClose res
-- And now perform the actual redirect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/Network/HTTP/Client/Types.hs
new/http-client-0.7.11/Network/HTTP/Client/Types.hs
--- old/http-client-0.7.9/Network/HTTP/Client/Types.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/Network/HTTP/Client/Types.hs 2022-01-31
16:09:24.000000000 +0100
@@ -342,7 +342,7 @@
-- | Define a HTTP proxy, consisting of a hostname and port number.
data Proxy = Proxy
- { proxyHost :: S.ByteString -- ^ The host name of the HTTP proxy.
+ { proxyHost :: S.ByteString -- ^ The host name of the HTTP proxy in URI
format. IPv6 addresses in square brackets.
, proxyPort :: Int -- ^ The port number of the HTTP proxy.
}
deriving (Show, Read, Eq, Ord, T.Typeable)
@@ -494,6 +494,9 @@
-- ^ Requested host name, used for both the IP address to connect to and
-- the @host@ request header.
--
+ -- This is in URI format, with raw IPv6 addresses enclosed in square
brackets.
+ -- Use 'strippedHostName' when making network connections.
+ --
-- Since 0.1.0
, port :: Int
-- ^ The port to connect to. Also used for generating the @host@ request
header.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/Network/HTTP/Client.hs
new/http-client-0.7.11/Network/HTTP/Client.hs
--- old/http-client-0.7.9/Network/HTTP/Client.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/Network/HTTP/Client.hs 2022-01-31
16:09:24.000000000 +0100
@@ -203,12 +203,13 @@
, equivCookieJar
, Proxy (..)
, withConnection
+ , strippedHostName
-- * Cookies
, module Network.HTTP.Client.Cookies
) where
import Network.HTTP.Client.Body
-import Network.HTTP.Client.Connection (makeConnection, socketConnection)
+import Network.HTTP.Client.Connection (makeConnection, socketConnection,
strippedHostName)
import Network.HTTP.Client.Cookies
import Network.HTTP.Client.Core
import Network.HTTP.Client.Manager
@@ -223,7 +224,7 @@
import Network.HTTP.Types (statusCode)
import GHC.Generics (Generic)
import Data.Typeable (Typeable)
-import Control.Exception (bracket, handle, throwIO)
+import Control.Exception (bracket, catch, handle, throwIO)
-- | A datatype holding information on redirected requests and the final
response.
--
@@ -270,6 +271,7 @@
Just req'' -> do
writeIORef reqRef req''
body <- brReadSome (responseBody res) 1024
+ `catch` handleClosedRead
modifyIORef historyRef (. ((req, res { responseBody = body
}):))
return (res, req'', True)
(_, res) <- httpRedirect' (redirectCount reqOrig) go reqOrig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/http-client.cabal
new/http-client-0.7.11/http-client.cabal
--- old/http-client-0.7.9/http-client.cabal 2021-09-10 03:35:17.000000000
+0200
+++ new/http-client-0.7.11/http-client.cabal 2022-02-04 10:26:32.000000000
+0100
@@ -1,5 +1,5 @@
name: http-client
-version: 0.7.9
+version: 0.7.11
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
@@ -59,6 +59,7 @@
, ghc-prim
, stm >= 2.3
, iproute >= 1.7.5
+ , async
if flag(network-uri)
build-depends: network >= 2.6, network-uri >= 2.6
else
@@ -87,6 +88,7 @@
hs-source-dirs: test
default-language: Haskell2010
other-modules: Network.HTTP.ClientSpec
+ build-tool-depends: hspec-discover:hspec-discover
build-depends: base
, http-client
, hspec
@@ -121,6 +123,8 @@
Network.HTTP.Client.RequestSpec
Network.HTTP.Client.RequestBodySpec
Network.HTTP.Client.CookieSpec
+ Network.HTTP.Client.ConnectionSpec
+ build-tool-depends: hspec-discover:hspec-discover
build-depends: base
, http-client
, hspec
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.7.9/test/Network/HTTP/ClientSpec.hs
new/http-client-0.7.11/test/Network/HTTP/ClientSpec.hs
--- old/http-client-0.7.9/test/Network/HTTP/ClientSpec.hs 2021-07-23
05:15:43.000000000 +0200
+++ new/http-client-0.7.11/test/Network/HTTP/ClientSpec.hs 2022-01-31
16:09:24.000000000 +0100
@@ -6,6 +6,7 @@
import Network.HTTP.Client.Internal
import Network.HTTP.Types (status200, found302, status405)
import Network.HTTP.Types.Status
+import qualified Network.Socket as NS
import Test.Hspec
import Control.Applicative ((<$>))
import Data.ByteString.Lazy.Char8 () -- orphan instance
@@ -106,3 +107,23 @@
man <- newManager settings
response <- httpLbs "http://httpbin.org/redirect-to?url=foo" man
responseStatus response `shouldBe` found302
+
+ -- skipped because CI doesn't have working IPv6
+ xdescribe "raw IPV6 address as hostname" $ do
+ it "works" $ do
+ -- We rely on example.com serving a web page over IPv6.
+ -- The request (currently) actually ends up as 404 due to
+ -- virtual hosting, but we just care that the networking
+ -- side works.
+ (addr:_) <- NS.getAddrInfo
+ (Just NS.defaultHints { NS.addrFamily = NS.AF_INET6 })
+ (Just "example.com")
+ (Just "http")
+ -- ipv6Port will be of the form [::1]:80, which is good enough
+ -- for our purposes; ideally we'd easily get just the ::1.
+ let ipv6Port = show $ NS.addrAddress addr
+ ipv6Port `shouldStartWith` "["
+ req <- parseUrlThrow $ "http://" ++ ipv6Port
+ man <- newManager defaultManagerSettings
+ _ <- httpLbs (setRequestIgnoreStatus req) man
+ return ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.7.9/test-nonet/Network/HTTP/Client/BodySpec.hs
new/http-client-0.7.11/test-nonet/Network/HTTP/Client/BodySpec.hs
--- old/http-client-0.7.9/test-nonet/Network/HTTP/Client/BodySpec.hs
2021-07-23 05:15:43.000000000 +0200
+++ new/http-client-0.7.11/test-nonet/Network/HTTP/Client/BodySpec.hs
2022-01-31 16:09:24.000000000 +0100
@@ -20,7 +20,18 @@
spec = describe "BodySpec" $ do
it "chunked, single" $ do
(conn, _, input) <- dummyConnection
- [ "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
+ [ "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\nnot consumed"
+ ]
+ reader <- makeChunkedReader (return ()) False conn
+ body <- brConsume reader
+ S.concat body `shouldBe` "hello world"
+ input' <- input
+ S.concat input' `shouldBe` "not consumed"
+ brComplete reader `shouldReturn` True
+
+ it "chunked, single, with trailers" $ do
+ (conn, _, input) <- dummyConnection
+ [ "5\r\nhello\r\n6\r\n world\r\n0\r\ntrailers-are: ignored\r\nbut:
consumed\r\n\r\nnot consumed"
]
reader <- makeChunkedReader (return ()) False conn
body <- brConsume reader
@@ -31,7 +42,17 @@
it "chunked, pieces" $ do
(conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
- "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
+ "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\nnot consumed"
+ reader <- makeChunkedReader (return ()) False conn
+ body <- brConsume reader
+ S.concat body `shouldBe` "hello world"
+ input' <- input
+ S.concat input' `shouldBe` "not consumed"
+ brComplete reader `shouldReturn` True
+
+ it "chunked, pieces, with trailers" $ do
+ (conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
+ "5\r\nhello\r\n6\r\n world\r\n0\r\ntrailers-are: ignored\r\nbut:
consumed\r\n\r\nnot consumed"
reader <- makeChunkedReader (return ()) False conn
body <- brConsume reader
S.concat body `shouldBe` "hello world"
@@ -41,21 +62,42 @@
it "chunked, raw" $ do
(conn, _, input) <- dummyConnection
- [ "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
+ [ "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\nnot consumed"
+ ]
+ reader <- makeChunkedReader (return ()) True conn
+ body <- brConsume reader
+ S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\n"
+ input' <- input
+ S.concat input' `shouldBe` "not consumed"
+ brComplete reader `shouldReturn` True
+
+ it "chunked, raw, with trailers" $ do
+ (conn, _, input) <- dummyConnection
+ [ "5\r\nhello\r\n6\r\n world\r\n0\r\ntrailers-are:
returned\r\nin-raw: body\r\n\r\nnot consumed"
]
reader <- makeChunkedReader (return ()) True conn
body <- brConsume reader
- S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n"
+ S.concat body `shouldBe` "5\r\nhello\r\n6\r\n
world\r\n0\r\ntrailers-are: returned\r\nin-raw: body\r\n\r\n"
input' <- input
S.concat input' `shouldBe` "not consumed"
brComplete reader `shouldReturn` True
it "chunked, pieces, raw" $ do
(conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
- "5\r\nhello\r\n6\r\n world\r\n0\r\nnot consumed"
+ "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\nnot consumed"
+ reader <- makeChunkedReader (return ()) True conn
+ body <- brConsume reader
+ S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n\r\n"
+ input' <- input
+ S.concat input' `shouldBe` "not consumed"
+ brComplete reader `shouldReturn` True
+
+ it "chunked, pieces, raw, with trailers" $ do
+ (conn, _, input) <- dummyConnection $ map S.singleton $ S.unpack
+ "5\r\nhello\r\n6\r\n world\r\n0\r\ntrailers-are:
returned\r\nin-raw: body\r\n\r\nnot consumed"
reader <- makeChunkedReader (return ()) True conn
body <- brConsume reader
- S.concat body `shouldBe` "5\r\nhello\r\n6\r\n world\r\n0\r\n"
+ S.concat body `shouldBe` "5\r\nhello\r\n6\r\n
world\r\n0\r\ntrailers-are: returned\r\nin-raw: body\r\n\r\n"
input' <- input
S.concat input' `shouldBe` "not consumed"
brComplete reader `shouldReturn` True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.7.9/test-nonet/Network/HTTP/Client/ConnectionSpec.hs
new/http-client-0.7.11/test-nonet/Network/HTTP/Client/ConnectionSpec.hs
--- old/http-client-0.7.9/test-nonet/Network/HTTP/Client/ConnectionSpec.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/http-client-0.7.11/test-nonet/Network/HTTP/Client/ConnectionSpec.hs
2022-01-31 16:09:24.000000000 +0100
@@ -0,0 +1,23 @@
+module Network.HTTP.Client.ConnectionSpec where
+
+import Network.HTTP.Client (strippedHostName)
+import Test.Hspec
+
+spec :: Spec
+spec = do
+ describe "strippedHostName" $ do
+ it "passes along a normal domain name" $ do
+ strippedHostName "example.com" `shouldBe` "example.com"
+ it "passes along an IPv4 address" $ do
+ strippedHostName "127.0.0.1" `shouldBe` "127.0.0.1"
+ it "strips brackets of an IPv4 address" $ do
+ strippedHostName "[::1]" `shouldBe` "::1"
+ strippedHostName "[::127.0.0.1]" `shouldBe` "::127.0.0.1"
+
+ describe "pathological cases" $ do
+ -- just need to handle these gracefully, it's unclear
+ -- what the result should be
+ it "doesn't touch future ip address formats" $ do
+ strippedHostName "[v2.huh]" `shouldBe` "[v2.huh]"
+ it "doesn't strip trailing stuff" $ do
+ strippedHostName "[::1]foo" `shouldBe` "[::1]foo"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.7.9/test-nonet/Network/HTTP/Client/ResponseSpec.hs
new/http-client-0.7.11/test-nonet/Network/HTTP/Client/ResponseSpec.hs
--- old/http-client-0.7.9/test-nonet/Network/HTTP/Client/ResponseSpec.hs
2021-07-23 05:15:43.000000000 +0200
+++ new/http-client-0.7.11/test-nonet/Network/HTTP/Client/ResponseSpec.hs
2022-01-31 16:09:24.000000000 +0100
@@ -59,7 +59,7 @@
, "Transfer-encoding: chunked\r\n\r\n"
, "5\r\nHello\r"
, "\n2\r\n W"
- , "\r\n4 ignored\r\norld\r\n0\r\nHTTP/1.1"
+ , "\r\n4 ignored\r\norld\r\n0\r\n\r\nHTTP/1.1"
]
Response {..} <- getResponse' conn
responseStatus `shouldBe` status200