private void httpProxy(
final SimpleHttpServerConnection conn,
final SimpleRequest request) throws IOException {
RequestLine oldreqline = request.getRequestLine();
URI uri = new URI(oldreqline.getUri(), true);
SimpleHost host = new SimpleHost(uri.getHost(), uri.getPort());
SimpleHttpServerConnection proxyconn = this.connmanager.openConnection(host);
proxyconn.setSocketTimeout(0);
try {
// Rewrite target url
RequestLine newreqline = new RequestLine(
oldreqline.getMethod(),
uri.getEscapedPath(),
oldreqline.getHttpVersion());
request.setRequestLine(newreqline);
// Remove proxy-auth headers if present
request.removeHeaders("Proxy-Authorization");
// Manage connection persistence