added length control for chunked and normal http response