http chunked encoding support; logic changed