[#1524] Fix resource leak in HttpContentEncoder
Optimize HttpContentEncoder to do less memory copies as those are not needed