Fix line-end detection for binary streams upload.

- Related: #1016