Suwayomi / Suwayomi-Server

A rewrite of Tachiyomi for the Desktop
Mozilla Public License 2.0
3.84k stars 198 forks source link

Fix PersistentCookieStore for domains with an underscore #989

Closed AeonLucid closed 3 weeks ago

AeonLucid commented 1 month ago

The java.net.URI class does not parse hostnames with an underscore properly. See a relevant OpenJDK bug report here https://bugs.openjdk.org/browse/JDK-8221675. Their proposed workaround is

URI.toURL().getHost()

This pull request adds .toURL() calls.

Example code

final URI uri1 = new URI("https://iweb_1.mangapicgallery.com");
final URI uri2 = new URI("https://iweb1.mangapicgallery.com");

System.out.println("Host 1 " + uri1.getHost());
System.out.println("Host 1 " + uri1.toURL().getHost());
System.out.println("Host 2 " + uri2.getHost());

Output

Host 1 null
Host 1 iweb_1.mangapicgallery.com
Host 2 iweb1.mangapicgallery.com