kwin commented on code in PR #1878:
URL: https://github.com/apache/maven-resolver/pull/1878#discussion_r3234631814


##########
maven-resolver-util/src/main/java/org/eclipse/aether/util/connector/transport/http/HttpTransporterUtils.java:
##########
@@ -299,4 +301,30 @@ public static Optional<InetAddress> getHttpLocalAddress(
         }
         return Optional.empty();
     }
+
+    /**
+     * Shared code to create "base {@link URI}" for most common HTTP remote 
repositories and all HTTP transports.
+     *
+     * @since 2.0.18
+     */
+    public static URI getBaseUri(RemoteRepository repository) throws 
URISyntaxException {
+        URI uri = new URI(repository.getUrl()).parseServerAuthority();
+        if (uri.isOpaque()) {
+            throw new URISyntaxException(repository.getUrl(), "URL must not be 
opaque");
+        }
+        if (uri.getRawFragment() != null || uri.getRawQuery() != null) {
+            throw new URISyntaxException(repository.getUrl(), "URL must not 
have fragment or query");
+        }
+        String path = uri.getRawPath();
+        if (path == null) {
+            path = "/";
+        }
+        if (!path.startsWith("/")) {

Review Comment:
   I don't think this can ever happen! Path is according to 
https://www.rfc-editor.org/rfc/rfc3986#section-3.3 either empty or starts with 
"/".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to