dovecot-2.2: lib-http: Pass DNS lookup error message to caller i...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 4 12:21:16 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/25d77e31d914
changeset: 16142:25d77e31d914
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 04 12:21:04 2013 +0300
description:
lib-http: Pass DNS lookup error message to caller instead of logging it.

diffstat:

 src/lib-http/http-client-host.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r cd3482684bd2 -r 25d77e31d914 src/lib-http/http-client-host.c
--- a/src/lib-http/http-client-host.c	Wed Apr 03 11:36:56 2013 +0300
+++ b/src/lib-http/http-client-host.c	Thu Apr 04 12:21:04 2013 +0300
@@ -164,13 +164,15 @@
 }
 
 static void
-http_client_host_lookup_failure(struct http_client_host *host)
+http_client_host_lookup_failure(struct http_client_host *host, const char *error)
 {
 	struct http_client_host_port *hport;
 
+	error = t_strdup_printf("Failed to lookup host %s: %s",
+				host->name, error);
 	array_foreach_modifiable(&host->ports, hport) {
 		http_client_host_port_error(hport,
-			HTTP_CLIENT_REQUEST_ERROR_HOST_LOOKUP_FAILED, "Failed to lookup host");
+			HTTP_CLIENT_REQUEST_ERROR_HOST_LOOKUP_FAILED, error);
 	}
 }
 
@@ -184,9 +186,7 @@
 	host->dns_lookup = NULL;
 
 	if (result->ret != 0) {
-		i_error("http-client: dns_lookup(%s) failed: %s",
-			host->name, result->error);
-		http_client_host_lookup_failure(host);
+		http_client_host_lookup_failure(host, result->error);
 		return;
 	}
 
@@ -235,9 +235,7 @@
 	} else if (dns_set.dns_client_socket_path == NULL) {
 		ret = net_gethostbyname(host->name,	&ips, &ips_count);
 		if (ret != 0) {
-			i_error("http-client: net_gethostbyname(%s) failed: %s",
-				host->name,	net_gethosterror(ret));
-			http_client_host_lookup_failure(host);
+			http_client_host_lookup_failure(host, net_gethosterror(ret));
 			return;
 		}
 


More information about the dovecot-cvs mailing list