Improved the http response assembly and fixed some of the memory leaks associated with it.