aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-10-14 05:21:33 +0200
committergrunfink <grunfink@comam.es>2025-10-14 05:21:33 +0200
commit5bf3133f9173464ae2a29ad9bbb9c3cb46468441 (patch)
tree9b0f5b92691fedb370e4c32c70c88c42abe337f0
parent9e6d583a4fccd6150a9cd2c5ea32ef16cfa0516e (diff)
xs_webmention.h: updated.
-rw-r--r--xs_version.h2
-rw-r--r--xs_webmention.h10
2 files changed, 7 insertions, 5 deletions
diff --git a/xs_version.h b/xs_version.h
index cd52531..34a7a45 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
-/* ad90abcefd455c0ba0faf155dc2976490dbde0b0 2025-08-23T20:36:11+02:00 */
+/* 0a8b987d7bb945fe7844411727d03ac73f417455 2025-10-14T05:21:05+02:00 */
diff --git a/xs_webmention.h b/xs_webmention.h
index e177573..f9578b4 100644
--- a/xs_webmention.h
+++ b/xs_webmention.h
@@ -10,6 +10,8 @@ int xs_webmention_hook(const char *source, const char *target, const char *user_
#ifdef XS_IMPLEMENTATION
+#include "xs_http.h"
+
int xs_webmention_send(const char *source, const char *target, const char *user_agent)
/* sends a Webmention to target.
Returns: < 0, error; 0, no Webmention endpoint; > 0, Webmention sent */
@@ -29,7 +31,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
h_req = xs_http_request("HEAD", target, headers, NULL, 0, &status, NULL, &p_size, 0);
/* return immediate failures */
- if (status < 200 || status > 299)
+ if (!xs_http_valid_status(status))
return -1;
const char *link = xs_dict_get(h_req, "link");
@@ -51,7 +53,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
g_req = xs_http_request("GET", target, headers, NULL, 0, &status, &payload, &p_size, 0);
- if (status < 200 || status > 299)
+ if (!xs_http_valid_status(status))
return -1;
const char *ctype = xs_dict_get(g_req, "content-type");
@@ -107,7 +109,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0);
- if (status < 200 || status > 299)
+ if (!xs_http_valid_status(status))
status = -4;
else
status = 1;
@@ -136,7 +138,7 @@ int xs_webmention_hook(const char *source, const char *target, const char *user_
g_req = xs_http_request("GET", source, headers, NULL, 0, &status, &payload, &p_size, 0);
- if (status < 200 || status > 299)
+ if (!xs_http_valid_status(status))
return -1;
if (!xs_is_string(payload))