-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
11
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
In jdk.internal.net.http.common.Utils, the code says:
public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
return (k, v) -> client.authenticator() == null ||
! (k.equalsIgnoreCase("Authorization")
&& k.equalsIgnoreCase("Proxy-Authorization"));
}
But client.authenticator() returns an Optional and thus cannot be null.
This has been fixed in master by the following code:
public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
return (k, v) -> client.authenticator().isEmpty() ||
! (k.equalsIgnoreCase("Authorization")
&& k.equalsIgnoreCase("Proxy-Authorization"));
}
But unfortunately the code hasn't been backported to JDK 11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to implement proxy authentication using JDK 11 HttpClient
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Proxy Authentication should work
ACTUAL -
Proxy Authentication doesn't work
In jdk.internal.net.http.common.Utils, the code says:
public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
return (k, v) -> client.authenticator() == null ||
! (k.equalsIgnoreCase("Authorization")
&& k.equalsIgnoreCase("Proxy-Authorization"));
}
But client.authenticator() returns an Optional and thus cannot be null.
This has been fixed in master by the following code:
public static final BiPredicate<String, String> CONTEXT_RESTRICTED(HttpClient client) {
return (k, v) -> client.authenticator().isEmpty() ||
! (k.equalsIgnoreCase("Authorization")
&& k.equalsIgnoreCase("Proxy-Authorization"));
}
But unfortunately the code hasn't been backported to JDK 11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to implement proxy authentication using JDK 11 HttpClient
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Proxy Authentication should work
ACTUAL -
Proxy Authentication doesn't work
- relates to
-
JDK-8263442 Potential bug in jdk.internal.net.http.common.Utils.CONTEXT_RESTRICTED
- Resolved