From: Stephan Bosch Date: Sun, 19 Mar 2017 14:09:03 +0000 (+0100) Subject: lib-http: Added a function to obtain a message suitable for logging from a response... X-Git-Tag: 2.3.0.rc1~1911 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17908b11e2e0cece58f0b653876385da5d62f3c0;p=thirdparty%2Fdovecot%2Fcore.git lib-http: Added a function to obtain a message suitable for logging from a response object. This prevents logging internal error codes (>= 9000). --- diff --git a/src/lib-http/http-response.h b/src/lib-http/http-response.h index 7c5efb1fdf..c354a86731 100644 --- a/src/lib-http/http-response.h +++ b/src/lib-http/http-response.h @@ -59,6 +59,14 @@ http_response_header_get_fields(const struct http_response *resp) return http_header_get_fields(resp->header); } +static inline const char * +http_response_get_message(const struct http_response *resp) +{ + if (resp->status >= HTTP_RESPONSE_STATUS_INTERNAL) + return resp->reason; + return t_strdup_printf("%u %s", resp->status, resp->reason); +} + bool http_response_has_connection_option(const struct http_response *resp, const char *option); int http_response_get_payload_size(const struct http_response *resp,