# HG changeset patch # User Stephan Bosch # Date 1489932543 -3600 # Node ID f9bed7bc73e0ab0d7ef7c6fdf575f5b02bc7d1c2 # Parent d5b80aa17fcec506215592e605e305fd8a95bfcc lib-http: Added a function to obtain a message suitable for logging from a response object. This prevents logging internal error codes (>= 9000). diff -r d5b80aa17fce -r f9bed7bc73e0 src/lib-http/http-response.h --- 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,