Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Curl_connecthost: friendlier "couldn't connect" message #44

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

larsmans commented Oct 31, 2012

connect errors now reproduce the relevant host and port number in the error message. I found this useful in scripts that do a lot of curl commands.

Owner

bagder commented Nov 7, 2012

--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1101,7 +1101,9 @@ CURLcode Curl_connecthost(struct connectdata *conn,  /* co

   if(sockfd == CURL_SOCKET_BAD) {
     /* no good connect was made */
-    failf(data, "couldn't connect to host");
+    failf(data, "couldn't connect to %s at %s:%d",
+          conn->bits.proxy?"proxy":"host",
+          conn->bits.proxy?conn->proxy.name:conn->host.name, conn->port);
     return CURLE_COULDNT_CONNECT;
   }

Perhaps?

Contributor

larsmans commented Nov 7, 2012

Looks good to me, but I can't test that without a proxy :)

Owner

bagder commented Nov 7, 2012

yes you can: 'curl -x localhost:9999 www.example.org' ... :-) But no worries, I figured it was good enough and I've just pushed this change (credited to you).

Thanks!

Contributor

larsmans commented Nov 7, 2012

Ah, right :) Thanks!

@larsmans larsmans closed this Nov 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment