Fix transfer length detection (regression from 52cdf69c6de30b08e6a3216b151107b26140b520)

This was affecting requests as well as responses.
Fixes #42