Hello everyone,
I've tried to update httpclient and httpasyncclient to latest revisions and got
the following exception:
org.apache.http.HttpException: Unsupported cookie policy: default
at
org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:151)
at
org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:132)
at
org.apache.http.impl.nio.client.MainClientExec.prepareRequest(MainClientExec.java:553)
at
org.apache.http.impl.nio.client.MainClientExec.prepare(MainClientExec.java:156)
at
org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:125)
at
org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:128)
This is caused by r1620939 (Replaced BEST_MATCH with DEFAULT policy) at
httpclient:
HttpClientBuilder registers DEFAULT policy in CookieSpecProvider while
HttpAsyncClientBuilder doesn't know about DEFAULT policy, which leads to
exception in RequestAddCookies.
I understand perfectly well that trunk builds doesn't have to provide sane
behaviour, but it seems that next stable HttpClient release will be
incompatible with HttpAsyncClient 4.0, which seems pretty strange.
Probably RequestAddCookies.process(...) should just return from function
instead of throwing exception on unknown cookie policy? i.e. apply patch like
this:
---
httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
(revision 1622724)
+++
httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
(working copy)
@@ -148,7 +148,11 @@
// Get an instance of the selected cookie policy
final CookieSpecProvider provider = registry.lookup(policy);
if (provider == null) {
- throw new HttpException("Unsupported cookie policy: " + policy);
+ if (this.log.isDebugEnabled()) {
+ this.log.debug("Unsupported cookie policy: " + policy);
+ }
+
+ return;
}
final CookieSpec cookieSpec = provider.create(clientContext);
// Get all cookies available in the HTTP state
--
Thanks in advance,
Dmitry Potapov
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]