Is there a way or special curl option to recognize a no-connection-situation when curlGetResponse_ is used?
For example, there is some curl-command:
withCurlDo $ respBody <$> (curlGetResponse_ "google.com" [CurlFailOnError True] ∷ IO (CurlResponse_ [(String, String)] ByteString))
If there is a connection to host, it returns some IO ByteString.
But if there is no any connection, it takes 40 seconds and returns empty string.
Is there a way to throw and exception or some Left value, when connection is lost and host is unreachable?
You can set appropriate timeout with ConnectTimeout option and then check response code for timeout errors: