Skip to content

Commit 01ca214

Browse files
committed
Bugzilla Bug 27781
Base64 chunked encoding not compliant with RFC 2045 section 2.1 CRLF git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130329 13f79535-47bb-0310-9956-ffa450edef68
1 parent ba44f3b commit 01ca214

3 files changed

Lines changed: 216 additions & 15 deletions

File tree

RELEASE-NOTES.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$Id: RELEASE-NOTES.txt,v 1.18 2004/03/23 19:26:50 ggregory Exp $
1+
$Id: RELEASE-NOTES.txt,v 1.19 2004/03/24 18:39:25 ggregory Exp $
22

33
Commons Codec Package
44
Version 1.3-dev
@@ -28,9 +28,14 @@ NEW FEATURES:
2828

2929
BUG FIXES:
3030

31-
* Fix for Bug 25995: [Codec] Default URL encoding logic broken.
32-
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25995
31+
* Fixed Bug 25995
32+
Default URL encoding logic broken.
33+
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25995
3334

35+
* Fixed Bug 27781
36+
Base64 chunked encoding not compliant with RFC 2045 section 2.1 CRLF
37+
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27781
38+
3439
* Added missing tags in Javadoc comments.
3540

3641
* General Javadoc improvements.

src/java/org/apache/commons/codec/binary/Base64.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,26 @@
3131
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
3232
* @author Apache Software Foundation
3333
* @since 1.0-dev
34-
* @version $Id: Base64.java,v 1.18 2004/03/18 17:34:56 ggregory Exp $
34+
* @version $Id: Base64.java,v 1.19 2004/03/24 18:37:25 ggregory Exp $
3535
*/
3636
public class Base64 implements BinaryEncoder, BinaryDecoder {
3737

3838
/**
39-
* Chunk size according to RFC 2045.
39+
* Chunk size per RFC 2045 section 6.8.
4040
*
4141
* <p>The {@value} character limit does not count the trailing CRLF, but counts
4242
* all other characters, including any equal signs.</p>
4343
*
44-
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
44+
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a>
4545
*/
4646
static final int CHUNK_SIZE = 76;
4747

4848
/**
49-
* Chunk separator, we use a newline to separate chunks
50-
* of encoded data (if you ask for it to be chunked).
49+
* Chunk separator per RFC 2045 section 2.1.
50+
*
51+
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
5152
*/
52-
static final byte[] CHUNK_SEPARATOR = "\n".getBytes();
53+
static final byte[] CHUNK_SEPARATOR = "\r\n".getBytes();
5354

5455
/**
5556
* The base length.
@@ -167,8 +168,8 @@ public static boolean isArrayByteBase64(byte[] arrayOctect) {
167168
}
168169

169170
/**
170-
* Encodes binary data using the base64 algorithm (this
171-
* does not "chunk" the output).
171+
* Encodes binary data using the base64 algorithm but
172+
* does not chunk the output.
172173
*
173174
* @param binaryData binary data to encode
174175
* @return Base64 characters
@@ -227,7 +228,8 @@ public byte[] decode(byte[] pArray) {
227228
}
228229

229230
/**
230-
* Encodes hex octects into Base64.
231+
* Encodes binary data using the base64 algorithm, optionally
232+
* chunking the output into 76 character blocks.
231233
*
232234
* @param binaryData Array containing binary data to encode.
233235
* @param isChunked if isChunked is true this encoder will chunk

0 commit comments

Comments
 (0)