Github user agherardi commented on a diff in the pull request:
https://github.com/apache/httpcomponents-client/pull/88#discussion_r152082458
--- Diff:
httpclient5/src/main/java/org/apache/hc/client5/http/auth/AuthCache.java ---
@@ -45,4 +45,8 @@
void clear();
+ boolean canCache(String name);
+
+ boolean needsUpdatingAfterReusing(String name);
--- End diff --
canCache() is not specific to a particular auth scheme. I think it's better
than using an annotation because it allows one to control which schemes an auth
cache implementation can store, without having to write a new scheme class and
a new scheme factory. But since you're the man, if you would rather use the
annotation that's fine by me.
needsUpdatingAfterReusing() is needed to have the system re-cache a digest
scheme after reuse. As I explained in the scenario above, when a digest scheme
is allocated to a request, it should not be reused until a successful response
to that request is received.
The alternative is to change RequestAuthCache like in here
https://github.com/apache/httpcomponents-client/pull/88/commits/8a107d6ff40edfe2f83c6655ae1d816584deb0c4#diff-9ba10ad1fe707824930ac6fb842c871b.
That code I added calls
targetAuthExchange.setState(AuthExchange.State.CHALLENGED). I can put that call
inside an if (scheme is digest), so it's digest specific. The point is that
either the cache or the DigestScheme need to be told when the scheme has been
reused successfully and can be made available for new requests. Please let me
know if you have a different suggestion.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]