fix: Support IPv6 bind addresses in http_server helper#5239
fix: Support IPv6 bind addresses in http_server helper#5239I501307 wants to merge 9 commits intofluent:masterfrom
Conversation
Fixes URI::InvalidURIError when binding to IPv6 addresses like '::' or '::1'. The http_server helper was generating invalid URIs such as 'http://:::24231' instead of the RFC 3986 compliant 'http://[::]:24231'. Changes: - Wrap IPv6 addresses in brackets when constructing URIs - Add unit tests for IPv6 localhost (::1) and wildcard (::) binding - Update CHANGELOG.md This bug affected all Fluentd versions including v1.19.1 and caused crashes when attempting to bind HTTP servers to IPv6 addresses in dual-stack environments. Resolves: Invalid URI generation for IPv6 bind addresses Signed-off-by: Jesse Awan <jesse.awan@sap.com>
a279091 to
eb72e2a
Compare
|
Could a maintainer please add the |
- Updated server.rb to check if IPv6 addresses are already bracketed - Added tests for pre-bracketed addresses ([::1] and [::]) - Improved ipv6_enabled? helper to verify both binding and resolution - Updated CHANGELOG to document pre-bracketed address handling Signed-off-by: Jesse Awan <jesse.awan@sap.com>
|
@Watson1978 Same issue I encountered within a plugin as well here : |
Signed-off-by: Jesse Awan <jesse.awan@sap.com>
bca5979 to
77b380a
Compare
|
@I501307 Seems it fails the test in CI. Can you take a look at it? |
Signed-off-by: Jesse Awan <jesse.awan@sap.com>
35a521a to
22e03d2
Compare
Root Cause: The Fix (2 parts): server.rb - Normalize addresses on initialization
test_http_server_helper.rb - Replace flaky binding tests Before: Tests tried to bind to IPv6 addresses → failed on CI due to IPv6 networking issues All 19 http_server tests pass (0 errors, 0 failures) |
@Watson1978 The Windows failures are unrelated to this PR - they're in All http_server_helper tests pass on all platforms. Can a maintainer re-run |
- Rename addr_display to ip_literal per RFC 3986 terminology - Move ipv6_enabled? helper to test/helper.rb for reusability - Improve IPv6 detection with proper socket binding and address resolution checks Signed-off-by: Jesse Awan <jesse.awan@sap.com>
b703cbd to
f6d21ff
Compare
@kenhys Done! I've renamed the variable to ip_literal and moved ipv6_enabled? to test/helper.rb with improved IPv6 detection logic. Thanks for the review feedback! |
|
I've tried to fix load error of |
ah great. |
There was a problem hiding this comment.
After: Tests only validate formatting logic → no networking required, works everywhere
Verified locally:
Thanks!
It works great without network, but if plugin helper implementation was changed (in the future), also
need to follow test code too.
If we forgot to follow (it might be accidentally happen), it becomes meaningless test cases there.
So I have concern about extracting internal logic directly to test code.
What do you think? @Watson1978
Sorry, I didn't get to look closely at the test code. Indeed. It should not only test the logic itself. |
Signed-off-by: Jesse Awan <jesse.awan@sap.com>
Signed-off-by: Jesse Awan <jesse.awan@sap.com>
Integration tests are now added https://github.com/fluent/fluentd/pull/5239/changes#diff-0733209104ce038bd67b2898b481ab3b6ff2634063b71948ae8a230bb3d5bcf3R23-R29 🌻 |
|
|
@kenhys Please let me know if more tests are required. |
… tests Signed-off-by: Jesse Awan <jesse.awan@sap.com>
0280d82 to
046cc25
Compare
|
@kenhys we good to go 🚀 |
Which issue(s) this PR fixes:
Fixes # (if there's an issue, or remove this line)
What this PR does / why we need it:
Fixes URI::InvalidURIError when binding to IPv6 addresses. The http_server
helper was generating invalid URIs like 'http://:::24231' instead of the
RFC 3986 compliant 'http://[::]:24231'.
Release Note:
http_server helper: Fix IPv6 bind address support