Improvements for http protocol

This PR is still works in progress, not ready to merge~