fix array out of bound error when http client posts big request body

This patch also improves performance a bit by not copying request buffer.

Fix issue #78.