Use Locale.ROOT when lowercasing rewrite URIs (#1618)

Use Locale.ROOT to apply the lowecase format. For URI scheme and host
locale-neutral casing is the semantically the correct choice. Added a
unit test that sets the default locale to tr-TR and that would fail
without the fix.
This commit is contained in:
Mirko Alicastro authored and GitHub committed 2026-05-26 09:37:42 -07:00
1 parent a1eea47b3f
commit ff319faef3
2 files changed
+22 -2

No files matched your search

@@ -26,6 +26,7 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
@@ -205,9 +206,9 @@ final class RequestRewritingClient implements HttpClient {
private URI normalizeRewrite(URI uri) {
try {
return new URI(
uri.getScheme().toLowerCase(),
uri.getScheme().toLowerCase(Locale.ROOT),
uri.getUserInfo(),
uri.getHost().toLowerCase(),
uri.getHost().toLowerCase(Locale.ROOT),
uri.getPort(),
uri.getPath(),
uri.getQuery(),