Today I spent most of the day figuring out that
n_to_read = head.hlit + head.hdist + 257
n_to_read = head.hlit + head.hdist + 258
And I still don’t know why, exactly. In related news, I can now almost decompress gzipped files.
I think the life lesson here is “sometimes it takes forever to figure things out and it is no fun” :)