set content-length and content-type headers