}
if (request == null) {
_logger.severe("Asked to fetch a null request");
return null;
}
HttpUrl url = request.getURL();
if (url == null) {
_logger.severe("Asked to fetch a request with a null URL");
return null;
}
// if the previous auth method was not "Basic", force a new connection
if (_authCreds != null && !_authCreds.startsWith("Basic"))
_lastRequestTime = 0;
if (_proxyAuthCreds != null && !_proxyAuthCreds.startsWith("Basic"))
_lastRequestTime = 0;
// Get any provided credentials from the request
_authCreds = request.getHeader("Authorization");
_proxyAuthCreds = request.getHeader("Proxy-Authorization");
String keyFingerprint = request.getHeader("X-SSLClientCertificate");
request.deleteHeader("X-SSLClientCertificate");
if (keyFingerprint == null && _keyFingerprint == null) {
// no problem
} else if (keyFingerprint != null && _keyFingerprint != null && keyFingerprint.equals(_keyFingerprint)) {
// no problem
} else {
// force a new connection, and change the fingerprint
_keyFingerprint = keyFingerprint;
_lastRequestTime = 0;
}
String status;
String oldProxyAuthHeader = null;
if (_proxyAuthCreds == null && _authenticator!= null && useProxy(url))
_proxyAuthCreds = _authenticator.getProxyCredentials(url.toString().startsWith("https") ? _httpsProxy : _httpProxy, null);
String proxyAuthHeader = constructAuthenticationHeader(null, _proxyAuthCreds);
String oldAuthHeader = null;
if (_authCreds == null && _authenticator!= null)
_authCreds = _authenticator.getCredentials(url, null);