commit 97568a7

grunfink  ·  2025-05-04 16:10:36 +0000 UTC
parent f75939e
Better error handling in xs_webmention_send().
1 files changed,  +6, -1
+6, -1
 1@@ -105,11 +105,16 @@ int xs_webmention_send(const char *source, const char *target, const char *user_
 2         xs *body = xs_fmt("source=%s&target=%s", source, target);
 3 
 4         xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0);
 5+
 6+        if (status < 200 || status > 299)
 7+            status = -4;
 8+        else
 9+            status = 1;
10     }
11     else
12         status = 0;
13 
14-    return status >= 200 && status <= 299;
15+    return status;
16 }
17 
18