http_client_http2: bracket IPv6 authority hosts#11922
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 (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds IPv6-literal detection and authority formatting for HTTP/2 requests, replaces inline authority construction in the request commit path with the new helper, and adds an integration test (with h2) that verifies bracketed IPv6 :authority on the IPv6 loopback. ChangesIPv6 HTTP/2 Authority Header Formatting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)src/flb_http_client_http2.csrc/flb_http_client_http2.c:29:10: fatal error: 'fluent-bit/flb_info.h' file not found ... [truncated 746 characters] ... r-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include" 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/flb_http_client_http2.c`:
- Around line 109-123: The IPv6 scoped address handling currently strips the
zone when constructing host_for_authority by copying only the part before '%'
into address_buffer; instead, validate the IPv6 address using the substring
before '%' (using inet_pton on address_buffer) but preserve the original scoped
host (the full host string containing '%' and the scope id) when assigning
*host_for_authority so the emitted :authority keeps the scope suffix. Apply the
same change in the other symmetric block that performs the same
inet_pton/host_for_authority assignment (the second occurrence using
zone_id/host_length/address_buffer/inet_pton/host_for_authority).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a01409cb-bb33-4287-991e-938a58ac62bf
📒 Files selected for processing (4)
src/flb_http_client_http2.ctests/integration/requirements.txttests/integration/scenarios/out_opentelemetry/config/out_otel_http2_ipv6_logs.yamltests/integration/scenarios/out_opentelemetry/tests/test_out_opentelemetry_001.py
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
4fe85f0 to
a7e5c40
Compare
fixes #11895
Fix HTTP/2
:authoritygeneration for IPv6 literal hosts by formattingunbracketed IPv6 addresses as
[host]:port.Root Cause
The HTTP/2 client built
request->authorityby appending:<port>directly torequest->host. For IPv6 literals this produced invalid authority values suchas
::1:4317, which strict HTTP/2 servers reject. The older HTTP/1 Host headerpath already handled IPv6 bracketing, but the newer HTTP/2 request path did not.
Changes
src/flb_http_client_http2.c.[ipv6]:portfor unbracketed IPv6 literals.:authority.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
Improvements
Tests