Skip to content

flb_http_do: Errors in flb_http_get_response_data are ignored #10756

@prashantv

Description

@prashantv

Bug Report

flb_http_do is incorrectly returning 0 even if flb_http_get_response_data fails.

Debugging the kubernetes filter, I enabeld debug logs and saw

[filter:kubernetes:kubernetes.3] Request (ns=<redacted>, pod=<redacted>) http_do=0, HTTP Status: 200

I thought that the http_do=0 would mean success, but the filter was not working correctly for the pod.

I then noticed other logs for the http_client:

[http_client] cannot increase buffer: current=32000 requested=64768 max=32000

Putting these together, I realized that the size of the response for my pod was too large. The confusing part was that the debug log suggested this response was successful (return 0), when the response was not read.

To Reproduce

Call flb_http_do to a URL that returns a large payload (E.g., ~70kb).

Expected behavior

flb_http_do to return an error, not success, when the response body is not read fully.

Code

ret = flb_http_get_response_data(c, 0);
}
/* Check 'Connection' response header */
ret = check_connection(c);

If flb_http_get_response_data returns an error, it should be handled before the ret is overwritten with check_connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions