changeset 21788:fe1059ceaa1e

global: Use http_response_get_message() to log HTTP responses.
author Stephan Bosch <stephan.bosch@dovecot.fi>
date Sun, 19 Mar 2017 15:47:41 +0100
parents f9bed7bc73e0
children 71d43e069358
files src/auth/auth-policy.c src/lib-http/http-client-connection.c src/plugins/fts-solr/solr-connection.c src/plugins/fts/fts-parser-tika.c src/plugins/push-notification/push-notification-driver-ox.c
diffstat 5 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-policy.c	Sun Mar 19 15:09:03 2017 +0100
+++ b/src/auth/auth-policy.c	Sun Mar 19 15:47:41 2017 +0100
@@ -340,7 +340,8 @@
 
 	if ((response->status / 10) != 20) {
 		auth_request_log_error(context->request, "policy",
-			"Policy server HTTP error: %d %s", response->status, response->reason);
+			"Policy server HTTP error: %s",
+			http_response_get_message(response));
 		if (context->callback != NULL)
 			context->callback(context->result, context->callback_context);
 		return;
--- a/src/lib-http/http-client-connection.c	Sun Mar 19 15:09:03 2017 +0100
+++ b/src/lib-http/http-client-connection.c	Sun Mar 19 15:47:41 2017 +0100
@@ -1387,8 +1387,8 @@
 
 	if (response->status != 200) {
 		http_client_connection_failure(conn, t_strdup_printf(
-			"Tunnel connect(%s) failed: %d %s", name,
-				response->status, response->reason));
+			"Tunnel connect(%s) failed: %s", name,
+				http_response_get_message(response)));
 		return;
 	}
 
--- a/src/plugins/fts-solr/solr-connection.c	Sun Mar 19 15:09:03 2017 +0100
+++ b/src/plugins/fts-solr/solr-connection.c	Sun Mar 19 15:47:41 2017 +0100
@@ -408,8 +408,8 @@
 				struct solr_connection *conn)
 {
 	if (response->status / 100 != 2) {
-		i_error("fts_solr: Lookup failed: %u %s",
-			response->status, response->reason);
+		i_error("fts_solr: Lookup failed: %s",
+			http_response_get_message(response));
 		conn->request_status = -1;
 		return;
 	}
@@ -481,8 +481,8 @@
 				struct solr_connection *conn)
 {
 	if (response->status / 100 != 2) {
-		i_error("fts_solr: Indexing failed: %u %s",
-			response->status, response->reason);
+		i_error("fts_solr: Indexing failed: %s",
+			http_response_get_message(response));
 		conn->request_status = -1;
 	}
 }
--- a/src/plugins/fts/fts-parser-tika.c	Sun Mar 19 15:09:03 2017 +0100
+++ b/src/plugins/fts/fts-parser-tika.c	Sun Mar 19 15:47:41 2017 +0100
@@ -97,9 +97,9 @@
 	case 415: /* Unsupported Media Type */
 	case 422: /* Unprocessable Entity */
 		if (parser->user->mail_debug) {
-			i_debug("fts_tika: PUT %s failed: %u %s",
+			i_debug("fts_tika: PUT %s failed: %s",
 				mail_user_plugin_getenv(parser->user, "fts_tika"),
-				response->status, response->reason);
+				http_response_get_message(response));
 		}
 		parser->payload = i_stream_create_from_data("", 0);
 		break;
@@ -114,16 +114,16 @@
 		   isn't available anymore here. So we'd need to indicate
 		   in fts_parser_deinit() that we want to retry.
 		   FIXME: do this in v2.3. For now we'll just ignore it. */
-		i_info("fts_tika: PUT %s failed: %u %s - ignoring",
+		i_info("fts_tika: PUT %s failed: %s - ignoring",
 		       mail_user_plugin_getenv(parser->user, "fts_tika"),
-		       response->status, response->reason);
+		       http_response_get_message(response));
 		parser->payload = i_stream_create_from_data("", 0);
 		break;
 
 	default:
-		i_error("fts_tika: PUT %s failed: %u %s",
+		i_error("fts_tika: PUT %s failed: %s",
 			mail_user_plugin_getenv(parser->user, "fts_tika"),
-			response->status, response->reason);
+			http_response_get_message(response));
 		parser->failed = TRUE;
 		break;
 	}
--- a/src/plugins/push-notification/push-notification-driver-ox.c	Sun Mar 19 15:09:03 2017 +0100
+++ b/src/plugins/push-notification/push-notification-driver-ox.c	Sun Mar 19 15:47:41 2017 +0100
@@ -295,15 +295,15 @@
         // Success.
 	if (user->mail_debug) {
             push_notification_driver_debug(OX_LOG_LABEL, user,
-                                           "Notification sent successfully: %u %s",
-                                           response->status, response->reason);
+                                           "Notification sent successfully: %s",
+                                           http_response_get_message(response));
 	}
         break;
 
     default:
         // Error.
-        i_error(OX_LOG_LABEL "Error when sending notification: %u %s",
-                response->status, response->reason);
+        i_error(OX_LOG_LABEL "Error when sending notification: %s",
+                http_response_get_message(response));
         break;
     }
 }