Make sure decoding doesn't fail when payload ends in the middle of a header. [Fixes #80]