calculate content length correctly
Merge pull request #12 from jacobk/master

Calculate content-length correctly to support variable-width encoding