core: check & fix Content-Length when sending on tcp