Repository navigation
[Regression in 5.5] Fix double-bracketing of IPv6 literals - #1548
Merged
garydgregory merged 1 commit intoDec 1, 2026
Merged
Conversation
Preserve already bracketed IPv6 literals and encoded zone IDs when formatting URI authorities. Add regression coverage for IPv6 address forms, ports, user info, zone encoding, and non-IPv6 inputs.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the IPv6 authority-formatting change.
No open issues 🎉
What changed in this PR
Fixes IPv6 authority formatting to prevent double brackets in HTTP Host headers while preserving existing zone-ID encoding.
Changes:
- Appends already bracketed IPv6 literals unchanged and documents that behavior.
- Adds regression coverage for IPv6 forms, zone IDs, ports, user info, and non-IPv6 inputs.
| File | Description |
|---|---|
httpcore5/src/test/java/org/apache/hc/core5/net/TestZoneIdSupport.java |
Tests IPv6 formatting, zone encoding, and unchanged buffers for non-IPv6 inputs. |
httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java |
Tests bracketed IPv6 authorities with varied user info and ports. |
httpcore5/src/main/java/org/apache/hc/core5/net/ZoneIdSupport.java |
Preserves already bracketed IPv6 literals and updates the method documentation. |
Review effort: Balanced
ok2c
approved these changes
Dec 1, 2026
ok2c
left a comment
Member
There was a problem hiding this comment.
@garydgregory Looks good to me
@arturobernalg Could you please take a look?
arturobernalg
approved these changes
Dec 1, 2026
arturobernalg
left a comment
Member
There was a problem hiding this comment.
Oh........ this restores 5.4.x behavior. LGTM
ok2c
pushed a commit
that referenced
this pull request
Dec 2, 2026
Preserve already bracketed IPv6 literals and encoded zone IDs when formatting URI authorities. Add regression coverage for IPv6 address forms, ports, user info, zone encoding, and non-IPv6 inputs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a regression in 5.5 since 5.4.4.
Preserve already bracketed IPv6 literals and encoded zone IDs when formatting URI authorities.
Add regression coverage for IPv6 address forms, ports, user info, zone encoding, and non-IPv6 inputs.
The client will send the wrong HTTP
Hostheader which will cause the server to return a 4xx bad request error.A client-based reproducer can be boiled down to:
For example:
extracted from this log:
Here is the failure on the Server side (Jetty):