HTTPCLIENT-1305: Ensure chunking is disabled when applying Base64 encoding

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1438495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-01-25 13:19:23 +00:00
parent 983bef040d
commit 500434f256
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,9 @@
Changes since 4.3 ALPHA1
-------------------
* [HTTPCLIENT-1305] Ensure chunking is disabled when applying Base64 encoding.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1298] Add AsynchronousValidator in HttpClientBuilder's list of closeable objects.
Contributed by Martin Meinhold <mmeinhold at atlassian.com>

View File

@ -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) {

View File

@ -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");