I've started on a patch for this, though I need to do a bit more testing. I'm only getting the tests to fail when I serve chunked responses from my localhost. Web servers these days are too efficient, I'm afraid. I need it to deliver the chunks more slowly so the socket blocks.
https://github.com/whoopdedo/dokuwiki/tree/httpclient
And my server that gives out random bytes of chunked data
http://whoopdedo.org/chunked.php?n=10000