private void parseHeader(String header) throws Exception {
        logger.info(this.toString() + " Parse HTTP Header");
        String[] lines = header.split("\r\n");
        if (lines.length == 0) {
            throw new Exception("invalid header");
        }

        String hline = lines[0];
        String[] row = hline.split(" ");
        if (row.length != 3) {
            throw new Exception("invalid header");
        }
        if (!row[2].toUpperCase().equals(HttpVersion.VERSION)) {
            throw new Exception("Only supported " + HttpVersion.VERSION);
        }
        if (!row[0].equals("GET") && !row[0].equals("POST")) {
            throw new Exception("invalid header");
        }
        request.header.put(HttpHeader.HEAD_METHOD, row[0].trim());
        request.header.put(HttpHeader.HEAD_URL, row[1].trim());
        request.header.put(HttpHeader.HEAD_VERSION, row[2].trim());
        for (String line : lines) {
            row = line.split(": ");
            if (row.length != 2) {
                continue;
            }
            request.header.put(row[0].trim(), row[1].trim());
        }
        if (!request.header.containsKey(HttpHeader.CONTENT_LENGTH)) {
            request.header.put(HttpHeader.CONTENT_LENGTH, "0");
        }
        bodyLen = Integer.parseInt(request.header.get(HttpHeader.CONTENT_LENGTH));
        if (bodyLen < 0) {
            throw new Exception("invalid header");
        }
        logger.debug(request.toString());
    }