commit c6e8f3f771fbf7f948086eedb7cc0f3567ab88b3 from: Omar Polo date: Wed Oct 13 08:23:06 2021 UTC switch URL -> URI URL throws an exception about an unknown scheme "gemini". I don't intend to write a URLConnectionHandler class for gemini, I'm happy with my Response class, so switch to a URI that doesn't have that trouble. After all, that constructor is there only because it's handy to do new Response("gemini://localhost/index.gmi") commit - 8d963df80852a8938e8e84b17da773285557eded commit + c6e8f3f771fbf7f948086eedb7cc0f3567ab88b3 blob - 460e69e2a77a520dc77f68251dd6a9ec1ae2b890 blob + 4af7e16b04b98418e28a04a0aaa4f1259fa4b0af --- java/com/omarpolo/gemini/Response.java +++ java/com/omarpolo/gemini/Response.java @@ -2,9 +2,7 @@ package com.omarpolo.gemini; import javax.net.ssl.*; import java.io.*; -import java.net.MalformedURLException; -import java.net.Socket; -import java.net.URL; +import java.net.*; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; @@ -56,11 +54,11 @@ public class Response implements AutoCloseable { public static class MalformedResponse extends Exception {} - public Response(String url) throws IOException, MalformedResponse { - this(new URL(url)); + public Response(String uri) throws IOException, MalformedResponse, URISyntaxException { + this(new URI(uri)); } - public Response(URL url) throws IOException, MalformedResponse { + public Response(URI url) throws IOException, MalformedResponse { this(url.getHost(), url.getPort(), url.toString() + "\r\n"); }