1616package org .pkl .core .http ;
1717
1818import java .io .IOException ;
19- import java .net .URL ;
19+ import java .net .URI ;
2020import java .net .http .HttpRequest ;
2121import java .net .http .HttpResponse ;
2222import java .net .http .HttpTimeoutException ;
@@ -40,7 +40,7 @@ interface Builder {
4040 /**
4141 * Sets the {@code User-Agent} header.
4242 *
43- * <p>Defaults to {@code "Pkl/$version ($os $flavor)"}.
43+ * <p>Defaults to {@code "Pkl/$version ($os; $flavor)"}.
4444 */
4545 Builder setUserAgent (String userAgent );
4646
@@ -73,10 +73,13 @@ interface Builder {
7373 * <p>The given file must contain <a href="https://en.wikipedia.org/wiki/X.509">X.509</a>
7474 * certificates in PEM format.
7575 *
76- * <p>This method can be used to add certificate files located on the JVM class path. To add
77- * certificate files located on the file system, use {@link #addCertificates(Path)}.
76+ * <p>This method is intended to be used for adding certificate files located on the class path.
77+ * To add certificate files located on the file system, use {@link #addCertificates(Path)}.
78+ *
79+ * @throws HttpClientInitException if the given URI has a scheme other than {@code jar:} or
80+ * {@code file:}
7881 */
79- Builder addCertificates (URL file );
82+ Builder addCertificates (URI file );
8083
8184 /**
8285 * Adds the CA certificate files in {@code ~/.pkl/cacerts/} to the client's trust store.
@@ -86,10 +89,23 @@ interface Builder {
8689 * {@link #addBuiltInCertificates() built-in certificates} are added instead.
8790 *
8891 * <p>This method implements the default behavior of Pkl CLIs.
92+ *
93+ * <p>NOTE: This method requires the optional {@code pkl-certs} JAR to be present on the class
94+ * path.
95+ *
96+ * @throws HttpClientInitException if an I/O error occurs while scanning {@code ~/.pkl/cacerts/}
97+ * or the {@code pkl-certs} JAR is not found on the class path
8998 */
90- Builder addDefaultCliCertificates () throws IOException ;
99+ Builder addDefaultCliCertificates ();
91100
92- /** Adds Pkl's built-in CA certificates to the client's trust store. */
101+ /**
102+ * Adds Pkl's built-in CA certificates to the client's trust store.
103+ *
104+ * <p>NOTE: This method requires the optional {@code pkl-certs} JAR to be present on the class
105+ * path.
106+ *
107+ * @throws HttpClientInitException if the {@code pkl-certs} JAR is not found on the class path
108+ */
93109 Builder addBuiltInCertificates ();
94110
95111 /**
@@ -117,7 +133,8 @@ interface Builder {
117133 * <ul>
118134 * <li>Connect timeout: 60 seconds
119135 * <li>Request timeout: 60 seconds
120- * <li>CA certificates: none (falls back to {@link Builder#addBuiltInCertificates})
136+ * <li>CA certificates: none (falls back to the JVM's {@linkplain SSLContext#getDefault()
137+ * default SSL context})
121138 * </ul>
122139 */
123140 static Builder builder () {
0 commit comments