equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
30 import java.net.PasswordAuthentication; |
30 import java.net.PasswordAuthentication; |
31 import java.net.URI; |
31 import java.net.URI; |
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.nio.charset.Charset; |
|
36 import java.util.Base64; |
35 import java.util.Base64; |
37 import java.util.LinkedList; |
36 import java.util.LinkedList; |
38 import java.util.List; |
37 import java.util.List; |
39 import java.util.Objects; |
38 import java.util.Objects; |
40 import java.util.WeakHashMap; |
39 import java.util.WeakHashMap; |
378 } |
377 } |
379 } |
378 } |
380 return null; |
379 return null; |
381 } |
380 } |
382 |
381 |
|
382 private static boolean equalsIgnoreCase(String s1, String s2) { |
|
383 return s1 == s2 || (s1 != null && s1.equalsIgnoreCase(s2)); |
|
384 } |
|
385 |
383 synchronized void remove(String authscheme, URI domain, boolean proxy) { |
386 synchronized void remove(String authscheme, URI domain, boolean proxy) { |
384 for (CacheEntry entry : entries) { |
387 var iterator = entries.iterator(); |
385 if (entry.equalsKey(domain, proxy)) { |
388 while (iterator.hasNext()) { |
386 entries.remove(entry); |
389 var entry = iterator.next(); |
|
390 if (equalsIgnoreCase(entry.scheme, authscheme)) { |
|
391 if (entry.equalsKey(domain, proxy)) { |
|
392 iterator.remove(); |
|
393 } |
387 } |
394 } |
388 } |
395 } |
389 } |
396 } |
390 |
397 |
391 synchronized void remove(CacheEntry entry) { |
398 synchronized void remove(CacheEntry entry) { |