Make compatible with Apache commons codec 1.4

In pre-1.5 versions, this method will use 'chunking', causing invalid
HTTP. This adds trailing carriage return and line feed characters. This
patch tries to stay compatible with 1.4 as this version is provided with
multiple Java application servers, such as JBoss EAP 6(.1).

Warning: the Google http-client library also uses Apache commons codec
Base64 functions and may expect that encoded strings are not chunked
although it uses the affected methods. This effectively means Google
http-client should only be used with commons-codec 1.5(+).