diff options
author | Luka Perkov <luka@openwrt.org> | 2014-05-05 02:35:11 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-05-05 11:23:12 +0200 |
commit | 698af467888d8d99086f758ff7a3ad9a7f777aa3 (patch) | |
tree | d17623da5d8c605137a50458901c68d076dff7b2 /uclient-http.c | |
parent | e034277e8e3bbae9f1dbccf2b21075c0ff84ddb5 (diff) | |
download | uclient-698af467888d8d99086f758ff7a3ad9a7f777aa3.tar.gz |
add support for PUT requests
Signed-off-by: Luka Perkov <luka@openwrt.org>
Diffstat (limited to 'uclient-http.c')
-rw-r--r-- | uclient-http.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/uclient-http.c b/uclient-http.c index 16ffe96..ee161e6 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -40,6 +40,7 @@ enum request_type { REQ_GET, REQ_HEAD, REQ_POST, + REQ_PUT, __REQ_MAX }; @@ -56,6 +57,7 @@ static const char * const request_types[__REQ_MAX] = { [REQ_GET] = "GET", [REQ_HEAD] = "HEAD", [REQ_POST] = "POST", + [REQ_PUT] = "PUT", }; struct uclient_http { @@ -507,7 +509,7 @@ uclient_http_send_headers(struct uclient_http *uh) 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); @@ -884,7 +886,7 @@ uclient_http_request_done(struct uclient *cl) 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; |