]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: response: Add convenience functions for status evaluation.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 13 Sep 2018 18:44:22 +0000 (20:44 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Nov 2018 11:21:53 +0000 (13:21 +0200)
src/lib-http/http-response.h

index c354a867314b19a6d6ceedce46c986ddaeca6dcb..30f6147d52a05e66118f4b231926a70d1ca4b7be 100644 (file)
@@ -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);