Grigori created HTTPCLIENT-1619:
-----------------------------------
Summary: BasicScheme.authenticate(...) is not thread save
Key: HTTPCLIENT-1619
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1619
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpAuth
Affects Versions: 4.3.6, 4.3.5
Reporter: Grigori
// 1. create one HttpClient with multi thread connection manager:
HttpClientConnectionManager connManager = new
PoolingHttpClientConnectionManager(...)
HttpClient client = HttpClientBuilder.create()
.setConnectionManager(connManager)
...
.build();
AuthSchemeBase auth = new BasicScheme();
AuthCache authCache = new BasicAuthCache();
authCache.put(host, auth);
CredentialsProvider provider = ...;
HttpClientContext context = HttpClientContext.create();
context.setCredentialsProvider(provider);
context.setAuthCache(authCache);
// 2. do parallel requests:
// multi thread:
public void doGet() {
...
HttpGet get = new HttpGet(requestUrl);
HttpResponse resp = client.execute(host, get, context);
...
}
In 4.3.5 sometimes got random wrong header: "Authorization: Basic
YXZ2dml0aXR...="
In 4.3.6 sometimes got NullPointerException
Because org.apache.http.impl.auth.BasicScheme.authenticate(...) use not thread
save base64codec:
org.apache.http.impl.auth.BasicScheme:165
final byte[] base64password = base64codec.encode(
EncodingUtils.getBytes(tmp.toString(),
getCredentialsCharset(request)));
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]