|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -240,20 +240,23 @@ public HttpRequestImpl response(Response r) throws IOException {
|
240 | 240 | HttpHeaders hdrs = r.headers();
|
241 | 241 | HttpRequestImpl req = r.request();
|
242 | 242 |
|
243 |
| - if (status != UNAUTHORIZED && status != PROXY_UNAUTHORIZED) { |
244 |
| - // check if any authentication succeeded for first time |
245 |
| - if (exchange.serverauth != null && !exchange.serverauth.fromcache) { |
246 |
| - AuthInfo au = exchange.serverauth; |
247 |
| - cache.store(au.scheme, req.uri(), false, au.credentials); |
248 |
| - } |
| 243 | + if (status != PROXY_UNAUTHORIZED) { |
249 | 244 | if (exchange.proxyauth != null && !exchange.proxyauth.fromcache) {
|
250 | 245 | AuthInfo au = exchange.proxyauth;
|
251 | 246 | URI proxyURI = getProxyURI(req);
|
252 | 247 | if (proxyURI != null) {
|
| 248 | + exchange.proxyauth = null; |
253 | 249 | cache.store(au.scheme, proxyURI, true, au.credentials);
|
254 | 250 | }
|
255 | 251 | }
|
| 252 | + if (status != UNAUTHORIZED) { |
| 253 | + // check if any authentication succeeded for first time |
| 254 | + if (exchange.serverauth != null && !exchange.serverauth.fromcache) { |
| 255 | + AuthInfo au = exchange.serverauth; |
| 256 | + cache.store(au.scheme, req.uri(), false, au.credentials); |
| 257 | + } |
256 | 258 | return null;
|
| 259 | + } |
257 | 260 | }
|
258 | 261 |
|
259 | 262 | boolean proxy = status == PROXY_UNAUTHORIZED;
|
|
0 commit comments