From 8f3b32b9ea6743ff4f1a8b7a710589b389637e8d Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 4 Feb 2023 11:21:22 -0600 Subject: [PATCH] http: pre-encode URIs to fully handle unicode in path --- src/main/java/me/itzg/helpers/http/FetchBuilderBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itzg/helpers/http/FetchBuilderBase.java b/src/main/java/me/itzg/helpers/http/FetchBuilderBase.java index cf3dcbbc..a6baa09d 100644 --- a/src/main/java/me/itzg/helpers/http/FetchBuilderBase.java +++ b/src/main/java/me/itzg/helpers/http/FetchBuilderBase.java @@ -36,7 +36,9 @@ static class State { private final Map requestHeaders = new HashMap<>(); State(URI uri, SharedFetch sharedFetch) { - this.uri = uri; + // Netty seems to half-way URL encode paths that have unicode, + // so instead we'll pre-"encode" the URI + this.uri = URI.create(uri.toASCIIString()); this.sharedFetch = sharedFetch; } }