Skip to content

Commit 7533d1f

Browse files
fujimotosedsiper
authored andcommitted
http_client: mark connection as non-reuseable on failure
flb_http_client supports internal buffer size limit. If server tries to send more data than the maximum size limit, the client will refuse to receive it. This behaviour is problematic when combined with keep-alive mode; Since flb_http_do() can leave some data in the socket, the next HTTP request can be confused by the leftover. For example, if the socket has the following data (unread): "data":["from", "previous", "conn"]} The next HTTP request will see the following response: "data":["from", "previous", "conn"]}HTTP/1.1 200 OK Content-Type: text/html Accept-Ranges: bytes Last-Modified: Sat, 30 May 2020 23:47:16 GMT ... Signed-off-by: Fujimoto Seiji <[email protected]>
1 parent 1c4c200 commit 7533d1f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/flb_http_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ int flb_http_do(struct flb_http_client *c, size_t *bytes)
10801080
* We could not allocate more space, let the caller handle
10811081
* this.
10821082
*/
1083+
flb_upstream_conn_recycle(c->u_conn, FLB_FALSE);
10831084
return 0;
10841085
}
10851086
available = flb_http_buffer_available(c) - 1;

0 commit comments

Comments
 (0)