Hi Oleg,
A few months back, if you will recall, I ported much of ManifoldCF to use
the HttpClient 4.3 builder structures for its various connectors.
Unfortunately, one thing we'd previously fixed came unfixed when I did
this. We have a user who has a site that is being posted to that requires
basic auth. We were getting an exception with HttpClient 4.2 having to do
with non-repeatable request entities. We solved that by turning on
expect-continue.
For 4.3, we still have expect-continue on, but now we are getting similar
problems:
>>>>>>
Caused by: org.apache.http.client.NonRepeatableRequestException:
Cannot retry request with a non-repeatable request entity.
at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:208)
at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
>>>>>>
The code used to set up HttpClient looks like this:
>>>>>>
RequestConfig.Builder requestBuilder = RequestConfig.custom()
.setCircularRedirectsAllowed(true)
.setSocketTimeout(socketTimeout)
.setStaleConnectionCheckEnabled(true)
.setExpectContinueEnabled(true)
.setConnectTimeout(connectionTimeout)
.setConnectionRequestTimeout(socketTimeout);
HttpClientBuilder clientBuilder = HttpClients.custom()
.setConnectionManager(connectionManager)
.setMaxConnTotal(1)
.disableAutomaticRetries()
.setDefaultRequestConfig(requestBuilder.build())
.setRedirectStrategy(new DefaultRedirectStrategy())
.setSSLSocketFactory(myFactory)
.setRequestExecutor(new HttpRequestExecutor(socketTimeout))
.setDefaultSocketConfig(SocketConfig.custom()
.setTcpNoDelay(true)
.setSoTimeout(socketTimeout)
.build()
);
if (userID != null && userID.length() > 0 && password != null)
{
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
Credentials credentials = new
UsernamePasswordCredentials(userID, password);
if (realm != null)
credentialsProvider.setCredentials(new
AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, realm),
credentials);
else
credentialsProvider.setCredentials(AuthScope.ANY, credentials);
clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
HttpClient localClient = clientBuilder.build();
<<<<<<
Wire logs show *no* expect/continue at all taking place. Can you tell
me what we are doing wrong?
Thanks,
Karl