From: Stephan Bosch Date: Fri, 8 Nov 2019 16:11:34 +0000 (+0100) Subject: lib-http: server: Replace http_*_error() with e_error(). X-Git-Tag: 2.3.11.2~328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7820325082017e3180bfdc97131f88e38f44d770;p=thirdparty%2Fdovecot%2Fcore.git lib-http: server: Replace http_*_error() with e_error(). --- diff --git a/src/lib-http/http-server-connection.c b/src/lib-http/http-server-connection.c index f6de2c78a5..afa705e641 100644 --- a/src/lib-http/http-server-connection.c +++ b/src/lib-http/http-server-connection.c @@ -46,21 +46,6 @@ http_server_connection_debug(struct http_server_connection *conn, va_end(args); } -static inline void -http_server_connection_error(struct http_server_connection *conn, - const char *format, ...) ATTR_FORMAT(2, 3); - -static inline void -http_server_connection_error(struct http_server_connection *conn, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - e_error(conn->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); -} - static inline void http_server_connection_client_error(struct http_server_connection *conn, const char *format, ...) ATTR_FORMAT(2, 3); @@ -413,8 +398,7 @@ http_server_connection_ssl_init(struct http_server_connection *conn) int ret; if (http_server_init_ssl_ctx(server, &error) < 0) { - http_server_connection_error( - conn, "Couldn't initialize SSL: %s", error); + e_error(conn->event, "Couldn't initialize SSL: %s", error); return -1; } @@ -434,16 +418,15 @@ http_server_connection_ssl_init(struct http_server_connection *conn) &conn->ssl_iostream, &error); } if (ret < 0) { - http_server_connection_error( - conn, "Couldn't initialize SSL server for %s: %s", + e_error(conn->event, + "Couldn't initialize SSL server for %s: %s", conn->conn.name, error); return -1; } http_server_connection_input_resume(conn); if (ssl_iostream_handshake(conn->ssl_iostream) < 0) { - http_server_connection_error( - conn,"SSL handshake failed: %s", + e_error(conn->event, "SSL handshake failed: %s", ssl_iostream_get_last_error(conn->ssl_iostream)); return -1; } @@ -876,8 +859,7 @@ void http_server_connection_handle_output_error( if (output->stream_errno != EPIPE && output->stream_errno != ECONNRESET) { - http_server_connection_error( - conn, "Connection lost: write(%s) failed: %s", + e_error(conn->event, "Connection lost: write(%s) failed: %s", o_stream_get_name(output), o_stream_get_error(output)); http_server_connection_close( diff --git a/src/lib-http/http-server-request.c b/src/lib-http/http-server-request.c index baa3a18f8c..85c00e536a 100644 --- a/src/lib-http/http-server-request.c +++ b/src/lib-http/http-server-request.c @@ -26,21 +26,6 @@ http_server_request_debug(struct http_server_request *req, va_end(args); } -static inline void -http_server_request_error(struct http_server_request *req, - const char *format, ...) ATTR_FORMAT(2, 3); - -static inline void -http_server_request_error(struct http_server_request *req, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - e_error(req->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); -} - static inline void http_server_request_client_error(struct http_server_request *req, const char *format, ...) ATTR_FORMAT(2, 3); @@ -728,8 +713,8 @@ payload_handler_pump_callback(enum iostream_pump_status status, break; case IOSTREAM_PUMP_STATUS_OUTPUT_ERROR: if (output->stream_errno != 0) { - http_server_request_error( - req, "iostream_pump: write(%s) failed: %s", + e_error(req->event, + "iostream_pump: write(%s) failed: %s", o_stream_get_name(output), o_stream_get_error(output)); } @@ -763,8 +748,8 @@ void http_server_request_forward_payload(struct http_server_request *req, if ((ret = i_stream_get_size(input, TRUE, &payload_size)) != 0) { if (ret < 0) { - http_server_request_error( - req, "i_stream_get_size(%s) failed: %s", + e_error(req->event, + "i_stream_get_size(%s) failed: %s", i_stream_get_name(input), i_stream_get_error(input)); http_server_request_fail_close( diff --git a/src/lib-http/http-server-response.c b/src/lib-http/http-server-response.c index 27b7a4f2b4..b873ca846e 100644 --- a/src/lib-http/http-server-response.c +++ b/src/lib-http/http-server-response.c @@ -35,21 +35,6 @@ http_server_response_debug(struct http_server_response *resp, va_end(args); } -static inline void -http_server_response_error(struct http_server_response *resp, - const char *format, ...) ATTR_FORMAT(2, 3); - -static inline void -http_server_response_error(struct http_server_response *resp, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - e_debug(resp->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); -} - /* * Response */ @@ -539,8 +524,7 @@ int http_server_response_send_more(struct http_server_response *resp) if (!resp->payload_chunked && (resp->payload_input->v_offset - resp->payload_offset) != resp->payload_size) { - http_server_response_error( - resp, + e_error(resp->event, "Payload stream %s size changed unexpectedly", i_stream_get_name(resp->payload_input)); http_server_connection_close( @@ -565,8 +549,7 @@ int http_server_response_send_more(struct http_server_response *resp) case OSTREAM_SEND_ISTREAM_RESULT_ERROR_INPUT: /* We're in the middle of sending a response, so the connection will also have to be aborted */ - http_server_response_error(resp, - "read(%s) failed: %s", + e_error(resp->event, "read(%s) failed: %s", i_stream_get_name(resp->payload_input), i_stream_get_error(resp->payload_input)); http_server_connection_close(&conn,