about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-19 22:31:42 -0800
committerbors <bors@rust-lang.org>2014-01-19 22:31:42 -0800
commita0ecb154110d397aa241ee95da89b3a35ff6e503 (patch)
treeaa2067f832194f282d275f867a4d1d8dc9137c02 /src/rustllvm/RustWrapper.cpp
parent764f2cb6f3517869e31fc7b93ff11dd840db8d30 (diff)
parent99cde8482efaed4757422d24cd46de8fa64c92cb (diff)
downloadrust-a0ecb154110d397aa241ee95da89b3a35ff6e503.tar.gz
rust-a0ecb154110d397aa241ee95da89b3a35ff6e503.zip
auto merge of #11652 : hdima/rust/base64-padding-newlines, r=alexcrichton
Ignore all newline characters in Base64 decoder to make it compatible with other Base64 decoders.

Most of the Base64 decoder implementations ignore all newline characters in the input string. There are some examples:

Python:

```python
>>> "
A
Q
=
=
".decode("base64")
'\x01'
```

Ruby:

```ruby
irb(main):001:0> "
A
Q
=
=
".unpack("m")
=> [""]
```

Erlang:

```erlang
1> base64:decode("
A
Q
=
=
").
<<1>>
```

Moreover some Base64 encoders append newline character at the end of the output string by default:

Python:

```python
>>> "".encode("base64")
'AQ==
'
```

Ruby:

```ruby
irb(main):001:0> [""].pack("m")
=> "AQ==
"
```

So I think it's fairly important for Rust Base64 decoder to accept Base64 inputs even with newline characters in the padding.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions