in withSocket we always pass port to NS.getAddrInfo, but we don't pass a hint that the underlying c function is called with a numeric serviceName, that was once the case, so I wonder why that would be removed.
If it was accidental, the fix would be as simple as
diff --git a/http-client/Network/HTTP/Client/Connection.hs b/http-client/Network/HTTP/Client/Connection.hs
index 823072bd..c29407f6 100644
--- a/http-client/Network/HTTP/Client/Connection.hs
+++ b/http-client/Network/HTTP/Client/Connection.hs
@@ -193,7 +193,7 @@ withSocket :: (Socket -> IO ())
-> (Socket -> IO a)
-> IO a
withSocket tweakSocket hostAddress' host' port' f = do
- let hints = NS.defaultHints { NS.addrSocketType = NS.Stream }
+ let hints = NS.defaultHints { NS.addrSocketType = NS.Stream, NS.addrFlags = [ NS.AI_NUMERICSERV, NS.AI_ADDRCONFIG ] }
addrs <- case hostAddress' of
Nothing ->
NS.getAddrInfo (Just hints) (Just $ strippedHostName host') (Just $ show port')
in
withSocketwe always passporttoNS.getAddrInfo, but we don't pass a hint that the underlyingcfunction is called with a numericserviceName, that was once the case, so I wonder why that would be removed.If it was accidental, the fix would be as simple as