aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-05-04 18:10:36 +0200
committergrunfink <grunfink@comam.es>2025-05-04 18:10:36 +0200
commit97568a7c930cf7aaa5e4f6c72c3831837c32b111 (patch)
tree5c521afd349974b74e347c8a5ee3d6b3c4304c02
parentf75939e094fd77ebaaca4ac154efae233ce711d5 (diff)
Better error handling in xs_webmention_send().
-rw-r--r--xs_webmention.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/xs_webmention.h b/xs_webmention.h
index 4ef2308..8415629 100644
--- a/xs_webmention.h
+++ b/xs_webmention.h
@@ -105,11 +105,16 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
xs *body = xs_fmt("source=%s&target=%s", source, target);
xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0);
+
+ if (status < 200 || status > 299)
+ status = -4;
+ else
+ status = 1;
}
else
status = 0;
- return status >= 200 && status <= 299;
+ return status;
}