[Haskell-cafe] bug in Network.Browser

Alexander Kotelnikov sacha at myxomop.com
Sun Aug 15 15:43:20 EDT 2010


Hello.

Yesterday I hit a bug in Network.Browser: connection in the connection
pool is not reused if you are connecting to a destination with
qualified port (not 80 for HTTP or 80 but explicitly provided like
http://www.google.com:80). The reason for the failure is quite trivial,
but I had not found an easy fix which won't break anything.


Problem is that in TCP.hs function

isTCPConnectedTo :: HandleStream ty -> String -> IO Bool
isTCPConnectedTo conn name = do
   v <- readMVar (getRef conn)
   case v of
     ConnClosed -> return False
     _
      | map toLower (connHost v) == map toLower name ->
          catch (getPeerName (connSock v) >> return True) (const $ return False)
      | otherwise -> return False

socket's hostname, (connHost v) is compared to hostname or hostname:port
which is stored in name.

Hope this message will reach this code maintainers

Alexander



More information about the Haskell-Cafe mailing list