#562: cabal-install update fails going through a HTTP proxy

Valery V. Vorotyntsev valery.vv at gmail.com
Sun Nov 29 16:30:14 EST 2009


Sigbjorn Finne <sigbjorn.finne at gmail.com> wrote:
>
> Despite repeated attempts from this end, I am unable to reproduce
> this via local proxies.
>
> Hence chasing down whatever problem is biting you (and others) is
> tricky without a repro case.

I'll try this change tomorrow:

-----BEGIN DIFF-----
diff --git a/Network/TCP.hs b/Network/TCP.hs
index 7d3dbe7..04b8e2a 100644
--- a/Network/TCP.hs
+++ b/Network/TCP.hs
@@ -34,7 +34,7 @@ module Network.TCP

 import Network.BSD (getHostByName, hostAddresses)
 import Network.Socket
-   ( Socket, SockAddr(SockAddrInet), SocketOption(KeepAlive)
+  ( Socket, SockAddr(SockAddrInet), SocketOption(KeepAlive, Linger)
    , SocketType(Stream), inet_addr, connect
    , shutdown, ShutdownCmd(..)
    , sClose, setSocketOption, getPeerName
@@ -189,6 +189,7 @@ openTCPConnection_ :: BufferType ty => String ->
Int -> Bool -
 openTCPConnection_ uri port stashInput = do
     s <- socket AF_INET Stream 6
     setSocketOption s KeepAlive 1
+    setSocketOption s Linger 5
     hostA <- getHostAddr uri
     let a = SockAddrInet (toEnum port) hostA
     catchIO (connect s a) (\e -> sClose s >> ioError e)
-----END DIFF-----

| If there is still data waiting to be transmitted over the
| connection, normally `close' tries to complete this transmission.
| You can control this behavior using the `SO_LINGER' socket option to
| specify a timeout period; see *note _Socket Options_.
 [http://www.gnu.org/s/libc/manual/html_node/Closing-a-Socket.html]

-- 
vvv


More information about the Libraries mailing list