Source:
protected void normalizeRequest(HttpRequest request) { boolean normalized = request.normalized(); if (LOG.isDebugEnabled()) LOG.debug("Normalizing {}", !normalized, request); if (normalized) return; String path = request.getPath(); if (path.trim().length() == 0) { path = "/"; request.path(path); } URI uri = request.getURI(); ProxyConfiguration.Proxy proxy = destination.getProxy(); if (proxy instanceof HttpProxy && !HttpClient.isSchemeSecure(request.getScheme()) && uri != null) { path = uri.toString(); request.path(path); } HttpVersion version = request.getVersion(); HttpFields headers = request.getHeaders(); if (version.getVersion() <= 11) { if (!headers.contains(HttpHeader.HOST)) request.header(getHttpDestination().getHostField()); } Request.Content content = request.getBody(); if (content == null) { request.body(new BytesRequestContent()); } else { if (!headers.contains(HttpHeader.CONTENT_TYPE)) { String contentType = content.getContentType(); if (contentType == null) contentType = getHttpClient().getDefaultRequestContentType(); if (contentType != null) { HttpField field = new HttpField(HttpHeader.CONTENT_TYPE, contentType); request.header(field); } } long contentLength = content.getLength(); if (contentLength >= 0) { if (!headers.contains(HttpHeader.CONTENT_LENGTH)) request.header(new HttpField.LongValueHttpField(HttpHeader.CONTENT_LENGTH, contentLength)); } } CookieStore cookieStore = getHttpClient().getCookieStore(); if (cookieStore != null) { StringBuilder cookies = null; if (uri != null) cookies = convertCookies(HttpCookieStore.matchPath(uri, cookieStore.get(uri)), null); cookies = convertCookies(request.getCookies(), cookies); if (cookies != null) { HttpField cookieField = new HttpField(HttpHeader.COOKIE, cookies.toString()); request.header(cookieField); } } applyAuthentication(request, proxy != null ? proxy.getURI() : null); applyAuthentication(request, uri); }

Target:
protected void normalizeRequest(HttpRequest request) { boolean normalized = request.normalized(); if (LOG.isDebugEnabled()) LOG.debug("Normalizing {}", !normalized, request); if (normalized) return; String path = request.getPath(); if (path.trim().length() == 0) { path = "/"; request.path(path); } URI uri = request.getURI(); ProxyConfiguration.Proxy proxy = destination.getProxy(); if (proxy instanceof HttpProxy && !HttpClient.isSchemeSecure(request.getScheme()) && uri != null) { path = uri.toString(); request.path(path); } HttpVersion version = request.getVersion(); HttpFields headers = request.getHeaders(); if (version.getVersion() <= 11) { if (!headers.contains(HttpHeader.HOST)) request.addHeader(getHttpDestination().getHostField()); } Request.Content content = request.getBody(); if (content == null) { request.body(new BytesRequestContent()); } else { if (!headers.contains(HttpHeader.CONTENT_TYPE)) { String contentType = content.getContentType(); if (contentType == null) contentType = getHttpClient().getDefaultRequestContentType(); if (contentType != null) { HttpField field = new HttpField(HttpHeader.CONTENT_TYPE, contentType); request.addHeader(field); } } long contentLength = content.getLength(); if (contentLength >= 0) { if (!headers.contains(HttpHeader.CONTENT_LENGTH)) request.addHeader(new HttpField.LongValueHttpField(HttpHeader.CONTENT_LENGTH, contentLength)); } } CookieStore cookieStore = getHttpClient().getCookieStore(); if (cookieStore != null) { StringBuilder cookies = null; if (uri != null) cookies = convertCookies(HttpCookieStore.matchPath(uri, cookieStore.get(uri)), null); cookies = convertCookies(request.getCookies(), cookies); if (cookies != null) { HttpField cookieField = new HttpField(HttpHeader.COOKIE, cookies.toString()); request.addHeader(cookieField); } } applyAuthentication(request, proxy != null ? proxy.getURI() : null); applyAuthentication(request, uri); }