http_client: fix handling of remote broken connections
@@ -622,6 +622,7 @@ int flb_http_do(struct flb_http_client *c, size_t *bytes)
}
/* Always append a NULL byte */
+ if (r_bytes >= 0) {
c->resp.data_len += r_bytes;
c->resp.data[c->resp.data_len] = '\0';
@@ -636,6 +637,12 @@ int flb_http_do(struct flb_http_client *c, size_t *bytes)
continue;
}
}
+ else {
+ flb_error("[http_client] broken connection to %s:%i ?",
+ c->u_conn->u->tcp_host, c->u_conn->u->tcp_port);
+ return -1;
+ }
+ }
return 0;
}
