* 2. Store the original hostname in a ThreadLocal so we don't need to do the same string processing again later
* 2. Set the URI to 127.0.0.1 to pass into Odo
* 3. Call the original handleConnect from SeleniumProxyHandler(copied to handle an Odo SslRelay)
*/
public void handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {
URI uri = request.getURI();
String original = uri.toString();
LOG.info("Hostname: " + original);
String host = original;
String port = null;
int colon = original.indexOf(':');
if (colon != -1) {
host = original.substring(0, colon);
port = original.substring(colon + 1);
}
// store the original host name
requestOriginalHostName.set(host);
// make a copy of the URI(have to create a new URI otherwise things are copied by reference and get changed)
URI realURI = new URI(request.getURI());
requestOriginalURI.set(realURI);
// send requests to Odo HTTPS port
int httpsPort = com.groupon.odo.proxylib.Utils.GetSystemPort(Constants.SYS_HTTPS_PORT);
uri.setURI("127.0.0.1:" + httpsPort);