Try to set content-length when possible