commit 5bf3133
grunfink
·
2025-10-14 03:21:33 +0000 UTC
parent 9e6d583
xs_webmention.h: updated.
2 files changed,
+7,
-5
+1,
-1
1@@ -1 +1 @@
2-/* ad90abcefd455c0ba0faf155dc2976490dbde0b0 2025-08-23T20:36:11+02:00 */
3+/* 0a8b987d7bb945fe7844411727d03ac73f417455 2025-10-14T05:21:05+02:00 */
+6,
-4
1@@ -10,6 +10,8 @@ int xs_webmention_hook(const char *source, const char *target, const char *user_
2
3 #ifdef XS_IMPLEMENTATION
4
5+#include "xs_http.h"
6+
7 int xs_webmention_send(const char *source, const char *target, const char *user_agent)
8 /* sends a Webmention to target.
9 Returns: < 0, error; 0, no Webmention endpoint; > 0, Webmention sent */
10@@ -29,7 +31,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
11 h_req = xs_http_request("HEAD", target, headers, NULL, 0, &status, NULL, &p_size, 0);
12
13 /* return immediate failures */
14- if (status < 200 || status > 299)
15+ if (!xs_http_valid_status(status))
16 return -1;
17
18 const char *link = xs_dict_get(h_req, "link");
19@@ -51,7 +53,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
20
21 g_req = xs_http_request("GET", target, headers, NULL, 0, &status, &payload, &p_size, 0);
22
23- if (status < 200 || status > 299)
24+ if (!xs_http_valid_status(status))
25 return -1;
26
27 const char *ctype = xs_dict_get(g_req, "content-type");
28@@ -107,7 +109,7 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
29
30 xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0);
31
32- if (status < 200 || status > 299)
33+ if (!xs_http_valid_status(status))
34 status = -4;
35 else
36 status = 1;
37@@ -136,7 +138,7 @@ int xs_webmention_hook(const char *source, const char *target, const char *user_
38
39 g_req = xs_http_request("GET", source, headers, NULL, 0, &status, &payload, &p_size, 0);
40
41- if (status < 200 || status > 299)
42+ if (!xs_http_valid_status(status))
43 return -1;
44
45 if (!xs_is_string(payload))