Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

2 participants

Lars Daniel Stenberg
Lars

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.

Daniel Stenberg
Owner
--- 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?

Lars

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

Daniel Stenberg
Owner

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!

Lars

Ah, right :) Thanks!

Lars larsmans closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2012
  1. Lars
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/connect.c
2  lib/connect.c
View
@@ -1101,7 +1101,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
if(sockfd == CURL_SOCKET_BAD) {
/* no good connect was made */
- failf(data, "couldn't connect to host");
+ failf(data, "couldn't connect to %s:%d", conn->host.name, conn->port);
return CURLE_COULDNT_CONNECT;
}
Something went wrong with that request. Please try again.