niax / rust-email

Implementation of MIME Messages for Rust
MIT License
62 stars 34 forks source link

Don't let headers contain newlines, fix fn emit_folded() #60

Open Hocuri opened 3 years ago

Hocuri commented 3 years ago

The problem was:

MIME_LINE_LENGTH is 78. If a line is 78 chars long and ends with a
space, then the previous implementation would insert a line break after
the space (as the line lenghth of 78 is reached).

Then, it would forget about it and go on with the next char, which is
the existing line break.

Therefore we have two line breaks in a row, i.e. an empty line.

The easiest way I found to fix this was, not parse the input character
by character but split it using the stdlib and then work with the
individual words.

fix #59

@niax can we do this this way, or are we going to get other problems?