On 18/02/18 13:46, Tobias Schramm wrote:
Add some error handling for errors during assembly of headers
Signed-off-by: Tobias Schramm <toblemi...@gmail.com>
Hi,
3 nitpicks inline ...
---
uclient-http.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/uclient-http.c b/uclient-http.c
index 20b8a9a..04f16a3 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -568,36 +568,36 @@ fail:
return err;
}
[...]
@@ -620,11 +620,14 @@ uclient_http_send_headers(struct uclient_http *uh)
if (uclient_request_supports_body(uh->req_type))
ustream_printf(uh->us, "Transfer-Encoding: chunked\r\n");
- uclient_http_add_auth_header(uh);
+ if ((err = uclient_http_add_auth_header(uh)))
+ return err;
please use this style ...
err = ...;
if (err)
return err;
[...]
@@ -1020,12 +1023,14 @@ uclient_http_set_header(struct uclient *cl, const char
*name, const char *value)
static int
uclient_http_send_data(struct uclient *cl, const char *buf, unsigned int len)
{
+ int err;
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
if (uh->state >= HTTP_STATE_REQUEST_DONE)
return -1;
- uclient_http_send_headers(uh);
+ if ((err = uclient_http_send_headers(uh)))
+ return err;
and here aswell
if (len > 0) {
ustream_printf(uh->us, "%X\r\n", len);
@@ -1039,12 +1044,15 @@ uclient_http_send_data(struct uclient *cl, const char
*buf, unsigned int len)
static int
uclient_http_request_done(struct uclient *cl)
{
+ int err;
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
if (uh->state >= HTTP_STATE_REQUEST_DONE)
return -1;
- uclient_http_send_headers(uh);
+ if ((err = uclient_http_send_headers(uh)))
+ return err;
and here aswell
John
+
if (uclient_request_supports_body(uh->req_type))
ustream_printf(uh->us, "0\r\n\r\n");
uh->state = HTTP_STATE_REQUEST_DONE;
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel