From 9a6debb0c6e4576d60647b4b566eae86868c3b93 Mon Sep 17 00:00:00 2001 From: 0x501D Date: Mon, 17 Aug 2020 13:49:22 +0300 Subject: [PATCH] core: add error 404 handling --- libicap.h | 1 + src/ic_core.c | 3 +++ src/ic_err.h | 1 + 3 files changed, 5 insertions(+) diff --git a/libicap.h b/libicap.h index dc9de91..8e2c58d 100644 --- a/libicap.h +++ b/libicap.h @@ -11,6 +11,7 @@ extern "C" { #define IC_CODE_OK 200 #define IC_CODE_NO_CONTENT 204 #define IC_CODE_BAD_REQUEST 400 +#define IC_CODE_NOT_FOUND 404 #define IC_CODE_REQ_TIMEOUT 408 typedef struct ic_query { diff --git a/src/ic_core.c b/src/ic_core.c index ad69358..bc528c0 100644 --- a/src/ic_core.c +++ b/src/ic_core.c @@ -141,6 +141,7 @@ IC_EXPORT const char *ic_err_msg[] = { "Bad request", "Cannot get methods list from server response", "Connection to ICAP service is closed", + "ICAP service not found", "Request timeout" }; @@ -1580,6 +1581,8 @@ static int ic_read_from_service(ic_query_int_t *q) rc = 2; } else if (q->srv.rc == IC_CODE_REQ_TIMEOUT) { return -IC_ERR_REQ_TIMEOUT; + } else if (q->srv.rc == IC_CODE_NOT_FOUND) { + return -IC_ERR_NOT_FOUND; } if (q->srv.null_body) { diff --git a/src/ic_err.h b/src/ic_err.h index a668d40..ca246b6 100644 --- a/src/ic_err.h +++ b/src/ic_err.h @@ -30,6 +30,7 @@ enum { IC_ERR_METHODS_NOT_FOUND, IC_ERR_CONN_CLOSED, IC_ERR_REQ_TIMEOUT, + IC_ERR_NOT_FOUND, IC_ERR_COUNT };