diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index c9a152bcf..7cee0a2f0 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,6 +1,9 @@ Changes since 4.3 ALPHA1 ------------------- +* [HTTPCLIENT-1305] Ensure chunking is disabled when applying Base64 encoding. + Contributed by Oleg Kalnichevski + * [HTTPCLIENT-1298] Add AsynchronousValidator in HttpClientBuilder's list of closeable objects. Contributed by Martin Meinhold diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java b/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java index bb2b0cd5d..485163290 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java @@ -200,7 +200,7 @@ public class BasicScheme extends RFC2617Scheme { tmp.append((credentials.getPassword() == null) ? "null" : credentials.getPassword()); final byte[] base64password = Base64.encodeBase64( - EncodingUtils.getBytes(tmp.toString(), charset)); + EncodingUtils.getBytes(tmp.toString(), charset), false); final CharArrayBuffer buffer = new CharArrayBuffer(32); if (proxy) { diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java b/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java index 8c474789d..5b3b47934 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java @@ -65,7 +65,6 @@ public abstract class GGSSchemeBase extends AuthSchemeBase { private final Log log = LogFactory.getLog(getClass()); private final boolean stripPort; - private final Base64 base64codec; /** Authentication process state */ private State state; @@ -75,7 +74,6 @@ public abstract class GGSSchemeBase extends AuthSchemeBase { GGSSchemeBase(final boolean stripPort) { super(); - this.base64codec = new Base64(); this.state = State.UNINITIATED; this.stripPort = stripPort; } @@ -176,7 +174,7 @@ public abstract class GGSSchemeBase extends AuthSchemeBase { throw new AuthenticationException(gsse.getMessage()); } case TOKEN_GENERATED: - final String tokenstr = new String(base64codec.encode(token)); + final String tokenstr = new String(Base64.encodeBase64(token, false)); if (log.isDebugEnabled()) { log.debug("Sending response '" + tokenstr + "' back to the auth server"); } @@ -203,7 +201,7 @@ public abstract class GGSSchemeBase extends AuthSchemeBase { log.debug("Received challenge '" + challenge + "' from the auth server"); } if (state == State.UNINITIATED) { - token = base64codec.decode(challenge.getBytes()); + token = Base64.decodeBase64(challenge.getBytes()); state = State.CHALLENGE_RECEIVED; } else { log.debug("Authentication already attempted");