From: Stephan Bosch Date: Thu, 13 Sep 2018 18:44:22 +0000 (+0200) Subject: lib-http: response: Add convenience functions for status evaluation. X-Git-Tag: 2.3.4~154 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5671fef864a20bac7a3bc0ee56b7a11a81ab084d;p=thirdparty%2Fdovecot%2Fcore.git lib-http: response: Add convenience functions for status evaluation. --- diff --git a/src/lib-http/http-response.h b/src/lib-http/http-response.h index c354a86731..30f6147d52 100644 --- a/src/lib-http/http-response.h +++ b/src/lib-http/http-response.h @@ -31,6 +31,18 @@ struct http_response { bool connection_close:1; }; +static inline bool +http_response_is_success(const struct http_response *resp) +{ + return ((resp->status / 100) == 2); +} + +static inline bool +http_response_is_internal_error(const struct http_response *resp) +{ + return (resp->status >= HTTP_RESPONSE_STATUS_INTERNAL); +} + void http_response_init(struct http_response *resp, unsigned int status, const char *reason);