hookup 0.2.3 → 0.3
raw patch · 3 files changed
+14/−6 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Hookup: HostnameResolutionFailure :: IOError -> ConnectionFailure
+ Hookup: HostnameResolutionFailure :: HostName -> String -> ConnectionFailure
Files
- ChangeLog.md +4/−0
- hookup.cabal +2/−2
- src/Hookup.hs +8/−4
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for hookup +## 0.3 -- 2019-07++* Changed the hostname resolution exception constructor to be more useful+ ## 0.2.3 -- 2019-05 * Added functions to get TLS peer certificate information
hookup.cabal view
@@ -1,5 +1,5 @@ name: hookup-version: 0.2.3+version: 0.3 synopsis: Abstraction over creating network connections with SOCKS5 and TLS description: This package provides an abstraction for communicating with line-oriented network services while abstracting over the use of SOCKS5 and TLS (via OpenSSL)@@ -26,7 +26,7 @@ other-modules: Hookup.OpenSSL, Hookup.Socks5 extra-libraries: ssl- build-depends: base >=4.9 && <4.13,+ build-depends: base >=4.11 && <4.14, network >=2.6 && <3.1, bytestring >=0.10 && <0.11, attoparsec >=0.13 && <0.14,
src/Hookup.hs view
@@ -62,6 +62,7 @@ import Control.Concurrent import Control.Exception import Control.Monad+import System.IO.Error (isDoesNotExistError, ioeGetErrorString) import Data.ByteString (ByteString) import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8@@ -128,7 +129,7 @@ -- | Type for errors that can be thrown by this package. data ConnectionFailure -- | Failure during 'getAddrInfo' resolving remote host- = HostnameResolutionFailure IOError+ = HostnameResolutionFailure HostName String -- | Failure during 'connect' to remote host | ConnectionFailure [IOError] -- | Failure during 'recvLine'@@ -152,8 +153,8 @@ displayException (ConnectionFailure xs) = "connection attempt failed due to: " ++ intercalate ", " (map displayException xs)- displayException (HostnameResolutionFailure x) =- "hostname resolution failed: " ++ displayException x+ displayException (HostnameResolutionFailure h s) =+ "hostname resolution failed (" ++ h ++ "): " ++ s displayException SocksAuthenticationError = "SOCKS authentication method rejected" displayException SocksProtocolError =@@ -262,7 +263,10 @@ res <- try (Socket.getAddrInfo (Just hints) (Just h) (Just (show p))) case res of Right ais -> attemptConnections [] ais- Left ioe -> throwIO (HostnameResolutionFailure ioe)+ Left ioe+ | isDoesNotExistError ioe ->+ throwIO (HostnameResolutionFailure h (ioeGetErrorString ioe))+ | otherwise -> throwIO ioe -- unexpected -- | Try establishing a connection to the services indicated by