net-ssh/net-sftp — pull request #26 by accardi (2013-05-07 17:39:35+00:00)
Title: Fix fragmentation download failure

**Context**
We process thousands of large files over sftp, so that bugs like this fragmentation failure surface almost immediately despite the file size and network conditions required to tickle it. We cannot consider using the net-sftp gem in a production environment without addressing this issue, so I'm hoping that a reviewer could spare some time to work with us to merge this fix!

**Change Details**
Fixes Session#when_channel_polled to properly account for 4 byte length
header, so that it waits for the complete packet to arrive instead of
processing an incomplete packet and loosing sync with server.

A new test method, gets_packet_in_two, enables testing of fragmentation
edge cases. expect_file_transfer now takes a :fragment_len parameter,
allowing for DRY testing of common fragmentation cases like this one.