mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
New macro valid_status().
This commit is contained in:
parent
d66b20a880
commit
28c7961e67
2 changed files with 3 additions and 1 deletions
2
snac.h
2
snac.h
|
@ -8,6 +8,8 @@ extern int srv_running;
|
||||||
|
|
||||||
extern int dbglevel;
|
extern int dbglevel;
|
||||||
|
|
||||||
|
#define valid_status(status) ((status) >= 200 && (status) <= 299)
|
||||||
|
|
||||||
d_char *xs_time(char *fmt, int local);
|
d_char *xs_time(char *fmt, int local);
|
||||||
#define xs_local_time(fmt) xs_time(fmt, 1)
|
#define xs_local_time(fmt) xs_time(fmt, 1)
|
||||||
#define xs_utc_time(fmt) xs_time(fmt, 0)
|
#define xs_utc_time(fmt) xs_time(fmt, 0)
|
||||||
|
|
|
@ -68,7 +68,7 @@ void webfinger_request(char *qs, int *status, char **actor, char **user)
|
||||||
xs_http_request("GET", url, headers, NULL, 0, status, &payload, &p_size);
|
xs_http_request("GET", url, headers, NULL, 0, status, &payload, &p_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*status >= 200 && *status <= 299) {
|
if (valid_status(*status)) {
|
||||||
xs *obj = xs_json_loads(payload);
|
xs *obj = xs_json_loads(payload);
|
||||||
|
|
||||||
if (user != NULL) {
|
if (user != NULL) {
|
||||||
|
|
Loading…
Reference in a new issue