Mercurial > dovecot > core-2.2
changeset 21787:f9bed7bc73e0
lib-http: Added a function to obtain a message suitable for logging from a response object.
This prevents logging internal error codes (>= 9000).
author | Stephan Bosch <stephan.bosch@dovecot.fi> |
---|---|
date | Sun, 19 Mar 2017 15:09:03 +0100 |
parents | d5b80aa17fce |
children | fe1059ceaa1e |
files | src/lib-http/http-response.h |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-response.h Sun Mar 19 15:06:13 2017 +0100 +++ b/src/lib-http/http-response.h Sun Mar 19 15:09:03 2017 +0100 @@ -63,6 +63,14 @@ 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,