Transfer encoding chunked, and more cleanup

Commits, f9bb2fe, 60a976a, ef77348, and 4f22b0c I thought were made in another pull request, but I can't find it anywhere, maybe it didn't happen and I imagined it? Anyway, sorry all of this is included, if you don't want those first 4 commits, let me know.

---

472f37e seems to work regarding issue https://github.com/chricke/php5rp_ng/issues/3
Give it a test when you get a chance, thanks!