private void parseHeaders() throws IOException {
        if(!headerRead) {
            headerRead = true;
            for (String header : readHeaders()) {
                if (header.startsWith("Content-Length:")) {
                    contentLength = Integer.parseInt(header.substring("Content-Length:".length()).trim());
                } else if(header.startsWith("Transfer-Encoding:") && header.contains("chunked")) {
                    chunked = true;
                } else if(header.startsWith("Accept-Ranges:") && header.contains("bytes")) {
                    supportsRange = true;
                }
            }
        }
    }