diff options
| author | 2025-05-04 18:10:36 +0200 | |
|---|---|---|
| committer | 2025-05-04 18:10:36 +0200 | |
| commit | 97568a7c930cf7aaa5e4f6c72c3831837c32b111 (patch) | |
| tree | 5c521afd349974b74e347c8a5ee3d6b3c4304c02 | |
| parent | Updated TODO. (diff) | |
| download | penes-snac2-97568a7c930cf7aaa5e4f6c72c3831837c32b111.tar.gz penes-snac2-97568a7c930cf7aaa5e4f6c72c3831837c32b111.tar.xz penes-snac2-97568a7c930cf7aaa5e4f6c72c3831837c32b111.zip | |
Better error handling in xs_webmention_send().
| -rw-r--r-- | xs_webmention.h | 7 |
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_ | |||
| 105 | xs *body = xs_fmt("source=%s&target=%s", source, target); | 105 | xs *body = xs_fmt("source=%s&target=%s", source, target); |
| 106 | 106 | ||
| 107 | xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0); | 107 | xs *rsp = xs_http_request("POST", endpoint, headers, body, strlen(body), &status, NULL, 0, 0); |
| 108 | |||
| 109 | if (status < 200 || status > 299) | ||
| 110 | status = -4; | ||
| 111 | else | ||
| 112 | status = 1; | ||
| 108 | } | 113 | } |
| 109 | else | 114 | else |
| 110 | status = 0; | 115 | status = 0; |
| 111 | 116 | ||
| 112 | return status >= 200 && status <= 299; | 117 | return status; |
| 113 | } | 118 | } |
| 114 | 119 | ||
| 115 | 120 | ||