REQ_HEAD,
REQ_POST,
REQ_PUT,
+ REQ_DELETE,
__REQ_MAX
};
[REQ_HEAD] = "HEAD",
[REQ_POST] = "POST",
[REQ_PUT] = "PUT",
+ [REQ_DELETE] = "DELETE",
};
struct uclient_http {
if (uh->eof)
return;
- if (uh->state == HTTP_STATE_RECV_DATA && uc->cb->data_read)
- uc->cb->data_read(uc);
+ if (uh->state == HTTP_STATE_RECV_DATA) {
+ /* Now it's uclient user turn to read some data */
+ uloop_timeout_cancel(&uc->connection_timeout);
+
+ if (uc->cb->data_read)
+ uc->cb->data_read(uc);
+ }
}
static void __uclient_notify_write(struct uclient_http *uh)
}
static int
-uclient_http_send_data(struct uclient *cl, char *buf, unsigned int len)
+uclient_http_send_data(struct uclient *cl, const char *buf, unsigned int len)
{
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
uclient_notify_eof(uh);
+ /* Now that we consumed something and if this isn't EOF, start timer again */
+ if (!uh->uc.eof && !cl->connection_timeout.pending)
+ uloop_timeout_set(&cl->connection_timeout, cl->timeout_msecs);
+
return len;
}