File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
api/src/main/java/io/grpc Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,15 @@ public String getScheme() {
356356 /**
357357 * Returns the percent-decoded "Authority" component of this URI, or null if not present.
358358 *
359+ * <p>NB: This method's decoding is lossy -- It only exists for compatibility with {@link
360+ * java.net.URI}. Prefer {@link #getRawAuthority()} or work instead with authority in terms of its
361+ * individual components ({@link #getUserInfo()}, {@link #getHost()} and {@link #getPort()}). The
362+ * problem with getAuthority() is that it returns the delimited concatenation of the percent-
363+ * decoded userinfo, host and port components. But both userinfo and host can contain the '@'
364+ * character, which becomes indistinguishable from the userinfo/host delimiter after decoding. For
365+ * example, URIs <code>scheme://x@y%40z</code> and <code>scheme://x%40y@z</code> have different
366+ * userinfo and host components but getAuthority() returns "x@y@z" for both of them.
367+ *
359368 * <p>NB: This method assumes the "host" component was encoded as UTF-8, as mandated by RFC 3986.
360369 * This method also assumes the "user information" part of authority was encoded as UTF-8,
361370 * although RFC 3986 doesn't specify an encoding.
You can’t perform that action at this time.
0 commit comments