only set content-length if it exists.