21#define SOTA_NET_MAX_REDIRECTS 3
26 return status == 301 || status == 302 || status == 303 || status == 307 || status == 308;
42int sota_net_post(
void *user,
const char *url,
const char *token,
const char *body,
43 char *resp,
size_t cap);
void sota_net_dl_close(void *user)
End the download and free its connection.
int sota_net_dl_read(void *user, uint8_t *buf, size_t cap)
Read the next bytes of the body: a count, 0 once the whole body has arrived, SOTA_NET_AGAIN,...
static int sota_net_is_redirect(int status)
A status sota_net_dl_open() returns for a redirect.
Definition sota_net.h:24
int sota_net_dl_open(void *user, const char *url, int64_t *len, char *location, size_t location_cap)
Start a firmware download: a GET without the Authorization header (the pre-signed URL carries its own...
int sota_net_post(void *user, const char *url, const char *token, const char *body, char *resp, size_t cap)
POST body as JSON to url, with "Authorization: Bearer <token>".
@ SOTA_NET_ERROR
The connection failed.
Definition sota_net.h:31
@ SOTA_NET_AGAIN
No byte yet: the core calls again, and gives up with download_stalled after http_timeout_ms.
Definition sota_net.h:32