fix the bug for reading from remote server: read http body based on content-length header