The logic to compute the number of bytes to copy with a chunked file
upload was failing to take into account the amount of data that had been
consumed, but was still pending in the parse buffer. This would cause
strange behavior ranging from "just works" to "fails". There was also a
strange "works, one byte at a time" mode. Using the correct stream_pos
offset eliminates the bad behavior.
This fix also adds debug statements to make the correct behavior easier to see.
Fixes: http://tracker.ceph.com/issues/21003 Signed-off-by: Marcus Watts <mwatts@redhat.com>