diff options
author | David Shaw <[email protected]> | 2003-11-01 14:27:10 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-11-01 14:27:10 +0000 |
commit | 9a69b07bd7c19083ec91281b9faade3dd322f4c7 (patch) | |
tree | b61e87ca23882471151233d858d20cf65933d644 | |
parent | * trustdb.h, trustdb.c (register_trusted_keyid): New. Adds a keyid to the (diff) | |
download | gnupg-9a69b07bd7c19083ec91281b9faade3dd322f4c7.tar.gz gnupg-9a69b07bd7c19083ec91281b9faade3dd322f4c7.zip |
* http.c (connect_server): Differentiate between generic "can't connect"
errors and the more specific "host not found". Suggested by Samuel
Tardieu.
-rw-r--r-- | util/ChangeLog | 6 | ||||
-rw-r--r-- | util/http.c | 16 |
2 files changed, 18 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 5501fd5c8..da8806977 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,9 @@ +2003-11-01 David Shaw <[email protected]> + + * http.c (connect_server): Differentiate between generic "can't + connect" errors and the more specific "host not found". Suggested + by Samuel Tardieu. + 2003-10-29 Werner Koch <[email protected]> * miscutil.c (answer_is_okay_cancel): New. diff --git a/util/http.c b/util/http.c index 28faf455e..e981fff4a 100644 --- a/util/http.c +++ b/util/http.c @@ -710,7 +710,7 @@ start_server() static int connect_server( const char *server, ushort port, unsigned int flags ) { - int sock=-1,srv,srvcount=0,connected=0; + int sock=-1,srv,srvcount=0,connected=0,hostfound=0; struct srventry *srvlist=NULL; #ifdef _WIN32 @@ -778,7 +778,9 @@ connect_server( const char *server, ushort port, unsigned int flags ) sprintf(portstr,"%u",srvlist[srv].port); memset(&hints,0,sizeof(hints)); hints.ai_socktype=SOCK_STREAM; - if(getaddrinfo(srvlist[srv].target,portstr,&hints,&res)!=0) + if(getaddrinfo(srvlist[srv].target,portstr,&hints,&res)==0) + hostfound=1; + else continue; for(ai=res;ai;ai=ai->ai_next) @@ -849,9 +851,15 @@ connect_server( const char *server, ushort port, unsigned int flags ) if(!connected) { #ifdef _WIN32 - log_error("%s: host not found: ec=%d\n",server,(int)WSAGetLastError()); + if(hostfound) + log_error("%s: Unable to connect: ec=%d\n",server,(int)WSAGetLastError()); + else + log_error("%s: Host not found: ec=%d\n",server,(int)WSAGetLastError()); #else - log_error("%s: host not found\n",server); + if(hostfound) + log_error("%s: %s\n",server,strerror(errno)); + else + log_error("%s: Host not found\n",server); #endif if(sock!=-1) sock_close(sock); |