public static HashMap<String, String> getHeaderRequest(String header) {
        HashMap<String, String> rets = new HashMap<String, String>();
        String[] headers = header.split("\r\n");
        if (headers != null && !"".equals(headers[0])) {
            String[] requests = headers[0].split(" ");
            rets.put("method", requests[0]);
            rets.put("port", "80");//默认80端口
            rets.put("protocol", "http");
            if (requests[1] != null) {
                rets.put("url", requests[1]);
                try {
                    URL url = new URL(requests[1]);
                    rets.put("host", url.getHost());
                    rets.put("port", "" + ((url.getPort() == -1) ? url.getDefaultPort() : url.getPort()));
                    rets.put("protocol", url.getProtocol());
                } catch (Exception e) {
                    for (String h : headers) {
                        if (h.startsWith("Host:")) {
                            String host = h.split(":")[1].trim();
                            rets.put("host", host);
                            rets.put("url", "http://" + host + requests[1]);
                            break;
                        }
                    }
                }
            }
        }
        return rets;
    }