http_client: Restore behavior for dummy http client#11710
http_client: Restore behavior for dummy http client#11710
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughcreate_http_client() now treats Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/flb_http_client.c (1)
1019-1039: De-duplicate this connection-binding path.This null-handling fix looks correct, but it now lives beside a second copy of the same
u_conn/netsetup inhttp_client_bind_connection(). That split is likely why the dummy-client path drifted here in the first place. Please extract the shared binding logic so both call sites stay in sync, and reformat the newif/elseblocks to the repo’s next-line brace style.As per coding guidelines,
**/*.{c,cpp}: Always use braces forif/else/while/doblocks, with opening braces on the next line.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/flb_http_client.c` around lines 1019 - 1039, Extract the duplicated u_conn/net binding logic into a single static helper function (e.g., bind_request_net_setup or http_client_set_net_binding) that takes the flb_http_client pointer c and struct flb_upstream_conn *u_conn, moves the null checks currently around c->u_conn, c->original_net_setup and c->request_net_setup into that helper, and returns/sets up the dummy-client path when u_conn is NULL; then replace both call sites (the current new block and http_client_bind_connection()) to call this helper so they stay in sync, preserve the exact behavior for the u_conn->net vs u_conn->upstream cases, and reformat all if/else/while blocks to use next-line opening braces per repo style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/flb_http_client.c`:
- Around line 1019-1039: Extract the duplicated u_conn/net binding logic into a
single static helper function (e.g., bind_request_net_setup or
http_client_set_net_binding) that takes the flb_http_client pointer c and struct
flb_upstream_conn *u_conn, moves the null checks currently around c->u_conn,
c->original_net_setup and c->request_net_setup into that helper, and
returns/sets up the dummy-client path when u_conn is NULL; then replace both
call sites (the current new block and http_client_bind_connection()) to call
this helper so they stay in sync, preserve the exact behavior for the
u_conn->net vs u_conn->upstream cases, and reformat all if/else/while blocks to
use next-line opening braces per repo style.
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
2e5ba09 to
26242ef
Compare
Previously, we can use dummy http client wihtout upstream connections.
This is using in out_es plugin's test case for response format checking.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit