REQ_GET,
REQ_HEAD,
REQ_POST,
+ REQ_PUT,
__REQ_MAX
};
[REQ_GET] = "GET",
[REQ_HEAD] = "HEAD",
[REQ_POST] = "POST",
+ [REQ_PUT] = "PUT",
};
struct uclient_http {
blobmsg_for_each_attr(cur, uh->headers.head, rem)
ustream_printf(uh->us, "%s: %s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
- if (uh->req_type == REQ_POST)
+ if (uh->req_type == REQ_POST || uh->req_type == REQ_PUT)
ustream_printf(uh->us, "Transfer-Encoding: chunked\r\n");
uclient_http_add_auth_header(uh);
return -1;
uclient_http_send_headers(uh);
- if (uh->req_type == REQ_POST)
+ if (uh->req_type == REQ_POST || uh->req_type == REQ_PUT)
ustream_printf(uh->us, "0\r\n\r\n");
uh->state = HTTP_STATE_REQUEST_DONE;
read_len += sep + 2 - data;
data = sep + 2;
- if (!uh->read_chunked)
+ if (!uh->read_chunked) {
uh->eof = true;
+ uh->uc.data_eof = true;
+ }
}
if (len > data_end - data)
len = uh->content_length;
uh->content_length -= len;
- if (!uh->content_length)
+ if (!uh->content_length) {
uh->eof = true;
+ uh->uc.data_eof = true;
+ }
}
if (len > 0) {