equal
deleted
inserted
replaced
32 import java.net.InetSocketAddress; |
32 import java.net.InetSocketAddress; |
33 import java.net.URISyntaxException; |
33 import java.net.URISyntaxException; |
34 import java.net.URL; |
34 import java.net.URL; |
35 import java.util.Base64; |
35 import java.util.Base64; |
36 import java.util.LinkedList; |
36 import java.util.LinkedList; |
37 import java.util.List; |
|
38 import java.util.Objects; |
37 import java.util.Objects; |
39 import java.util.WeakHashMap; |
38 import java.util.WeakHashMap; |
40 import java.net.http.HttpHeaders; |
39 import java.net.http.HttpHeaders; |
41 import jdk.internal.net.http.common.Log; |
40 import jdk.internal.net.http.common.Log; |
42 import jdk.internal.net.http.common.Utils; |
41 import jdk.internal.net.http.common.Utils; |
257 return null; |
256 return null; |
258 } |
257 } |
259 |
258 |
260 boolean proxy = status == PROXY_UNAUTHORIZED; |
259 boolean proxy = status == PROXY_UNAUTHORIZED; |
261 String authname = proxy ? "Proxy-Authenticate" : "WWW-Authenticate"; |
260 String authname = proxy ? "Proxy-Authenticate" : "WWW-Authenticate"; |
262 String authval = hdrs.firstValue(authname).orElseThrow(() -> { |
261 String authval = hdrs.firstValue(authname).orElse(null); |
263 return new IOException("Invalid auth header"); |
262 if (authval == null) { |
264 }); |
263 if (exchange.client().authenticator().isPresent()) { |
|
264 throw new IOException(authname + " header missing for response code " + status); |
|
265 } else { |
|
266 // No authenticator? let the caller deal with this. |
|
267 return null; |
|
268 } |
|
269 } |
|
270 |
265 HeaderParser parser = new HeaderParser(authval); |
271 HeaderParser parser = new HeaderParser(authval); |
266 String scheme = parser.findKey(0); |
272 String scheme = parser.findKey(0); |
267 |
273 |
268 // TODO: Need to generalise from Basic only. Delegate to a provider class etc. |
274 // TODO: Need to generalise from Basic only. Delegate to a provider class etc. |
269 |
275 |