private StringBuffer composeHTTPHeader(String request, String path, Map header, int length, boolean keepAlive) {
private StringBuffer composeHTTPHeader(String request, String path, Map header, long length, boolean keepAlive) {
    private StringBuffer composeHTTPHeader(String request, String path, Map header, int length, boolean keepAlive) {        StringBuffer sb = new StringBuffer();        sb.append(request);        sb.append(' ');        if (myIsProxied && !myIsSecured) {            // prepend path with host name.            sb.append("http://");            sb.append(myConnection.getHost().getHost());            sb.append(":");            sb.append(myConnection.getHost().getPort());        }        if (path == null) {            path = "/";        }        if (!"CONNECT".equals(request) && (path.length() == 0 || path.charAt(0) != '/')) {            path = "/" + path;        }        HTTPParser.getCanonicalPath(path, sb);        sb.append(' ');        sb.append("HTTP/1.1");        sb.append(HTTPRequest.CRLF);        sb.append("Host: ");        sb.append(myConnection.getHost().getHost());        sb.append(":");        sb.append(myConnection.getHost().getPort());        sb.append(HTTPRequest.CRLF);        sb.append("User-Agent: ");        sb.append(Version.getVersionString());        sb.append(HTTPRequest.CRLF);        if (keepAlive) {            sb.append("Keep-Alive:");            sb.append(HTTPRequest.CRLF);            sb.append("Connection: TE, Keep-Alive");            sb.append(HTTPRequest.CRLF);        }        sb.append("TE: trailers");        sb.append(HTTPRequest.CRLF);        if (myAuthentication != null) {            sb.append("Authorization: ");            sb.append(myAuthentication);            sb.append(HTTPRequest.CRLF);        }        if ((myIsProxyAuthForced || (myIsProxied && !myIsSecured)) && myProxyAuthentication != null) {            sb.append("Proxy-Authorization: ");            sb.append(myProxyAuthentication);            sb.append(HTTPRequest.CRLF);        }        sb.append("Content-Length: ");        sb.append(length);        sb.append(HTTPRequest.CRLF);        sb.append("Accept-Encoding: gzip");        sb.append(HTTPRequest.CRLF);        if (header == null || !header.containsKey("Content-Type")) {            sb.append("Content-Type: text/xml; charset=\"utf-8\"");            sb.append(HTTPRequest.CRLF);        }        if (header != null) {            for (Iterator keys = header.keySet().iterator(); keys.hasNext();) {                Object key = keys.next();                sb.append(key.toString());                sb.append(": ");                sb.append(header.get(key).toString());                sb.append(HTTPRequest.CRLF);            }        }        sb.append(HTTPRequest.CRLF);        return sb;    }