Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure copy_stream write sends all bytes read (#6348)
On target streams that may do partial reads, the logic here fails to write all content read from the source stream. The return value of Channel.write is never checked, but the total bytes written is incremented, resulting in silently losing data. The patch loops until all bytes have been written to the output channel after each read. CRuby does similar logic. We may need to add additional blocking write or thread event checks here, in case the target stream blocks during the write loop, but that will require the different `transfer` paths to be expanded to support nonblocking IO channels. Fixes #6078 Back-port of bc9a5ac Co-authored-by: Charles Oliver Nutter <headius@headius.com>
- Loading branch information