ok2c commented on code in PR #597:
URL:
https://github.com/apache/httpcomponents-client/pull/597#discussion_r1826989375
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/DigestScheme.java:
##########
@@ -590,4 +618,27 @@ private boolean containsInvalidABNFChars(final String
value) {
}
return false;
}
+
+ /**
+ * Resolves the specified algorithm name to a standard form based on
recognized algorithm suffixes.
+ * <p>
+ * This method translates session-based algorithms (e.g., "-sess" suffix)
to their base forms
+ * for correct MessageDigest usage. If no algorithm is specified or
"MD5-sess" is provided,
+ * it defaults to "MD5". The method also maps "SHA-512-256" to
"SHA-512/256" to align with
+ * Java's naming for SHA-512/256.
+ * </p>
+ *
+ * @param algorithm the algorithm name to resolve, such as "MD5-sess",
"SHA-256-sess", or "SHA-512-256-sess"
+ * @return the resolved base algorithm name, or the original algorithm
name if no mapping applies
+ */
+ private String resolveAlgorithm(final String algorithm) {
+ if (algorithm == null || algorithm.equalsIgnoreCase("MD5-sess")) {
Review Comment:
@arturobernalg I am not suggesting this enum be made a part of the public
APIs. It could be package private and could be changes whenever required. But
it is merely a thought.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]