} if (path.length() == 0 || path.charAt(0) != '/') { path = "/" + path;
    private void sendHeader(String method, String path, Map header, InputStream requestBody) throws IOException {        if (path == null || "".equals(path.trim())) {            path = "/";        }        StringBuffer sb = new StringBuffer();        sb.append(method);        sb.append(' ');                boolean isProxied = myProxyAuth != null;         if (isProxied && !isSecured()) {            // prepend path with host name.            sb.append("http://");            sb.append(mySVNRepositoryLocation.getHost());            sb.append(":");            sb.append(mySVNRepositoryLocation.getPort());        }        DAVUtil.getCanonicalPath(path, sb);        sb.append(' ');        sb.append("HTTP/1.1");        sb.append(DefaultHTTPConnection.CRLF);        sb.append("Host: ");        sb.append(mySVNRepositoryLocation.getHost());        sb.append(":");        sb.append(mySVNRepositoryLocation.getPort());        sb.append(DefaultHTTPConnection.CRLF);        sb.append("User-Agent: ");        sb.append(Version.getVersionString());        sb.append(DefaultHTTPConnection.CRLF);        sb.append("Keep-Alive:");        sb.append(DefaultHTTPConnection.CRLF);        sb.append("Connection: TE, Keep-Alive");        sb.append(DefaultHTTPConnection.CRLF);        sb.append("TE: trailers");        sb.append(DefaultHTTPConnection.CRLF);        if (isProxied && !isSecured() && myProxyAuth != null) {            sb.append("Proxy-Authorization: " + getProxyAuthString(myProxyAuth.getProxyUserName(), myProxyAuth.getProxyPassword()));            sb.append(DefaultHTTPConnection.CRLF);        }        boolean chunked = false;        if (requestBody instanceof ByteArrayInputStream) {            sb.append("Content-Length: ");            sb.append(requestBody.available());        } else if (requestBody instanceof IMeasurable) {             sb.append("Content-Length: ");            sb.append(((IMeasurable) requestBody).getLength());        } else if (requestBody != null) {            sb.append("Transfer-Encoding: chunked");            chunked = true;        } else {            sb.append("Content-Lenght: 0");        }        sb.append(DefaultHTTPConnection.CRLF);        sb.append("Accept-Encoding: gzip");        sb.append(DefaultHTTPConnection.CRLF);        if (header != null) {            if (!header.containsKey("Content-Type")) {                sb.append("Content-Type: text/xml; charset=\"utf-8\"");                sb.append(DefaultHTTPConnection.CRLF);            }            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(DefaultHTTPConnection.CRLF);            }        }        getOutputStream().write(sb.toString().getBytes());        getOutputStream().write(DefaultHTTPConnection.CRLF_BYTES);        if (requestBody != null) {            byte[] buffer = new byte[1024*32];            while (true) {                int read = requestBody.read(buffer);                if (chunked) {                    if (read > 0) {                        getOutputStream().write(Integer.toHexString(read).getBytes());                        getOutputStream().write(DefaultHTTPConnection.CRLF_BYTES);                        getOutputStream().write(buffer, 0, read);                        getOutputStream().write(DefaultHTTPConnection.CRLF_BYTES);                    } else {                        getOutputStream().write('0');                        getOutputStream().write(DefaultHTTPConnection.CRLF_BYTES);                        getOutputStream().write(DefaultHTTPConnection.CRLF_BYTES);                        break;                    }                } else {                    if (read > 0) {                        getOutputStream().write(buffer, 0, read);                    } else {                        break;                    }                }            }        }        getOutputStream().flush();    }