/** * Always make sure the channel who got cached support the proper protocol. * It could only occurs when a HttpMethod. CONNECT is used against a proxy * that requires upgrading from http to https. */ public void verifyChannelPipeline(ChannelPipeline pipeline, String scheme) throws IOException, GeneralSecurityException { boolean sslHandlerConfigured = isSslHandlerConfigured(pipeline); if (isSecure(scheme)) { if (!sslHandlerConfigured) pipeline.addFirst(SSL_HANDLER, new SslInitializer(this)); } else if (sslHandlerConfigured) pipeline.remove(SSL_HANDLER); }
public void verifyChannelPipeline(ChannelPipeline pipeline, String scheme) throws IOException, GeneralSecurityException { boolean sslHandlerConfigured = isSslHandlerConfigured(pipeline); if (isSecure(scheme)) { if (!sslHandlerConfigured) pipeline.addFirst(SSL_HANDLER, new SslInitializer(this)); } else if (sslHandlerConfigured) pipeline.remove(SSL_HANDLER); }
public void upgradeProtocol(ChannelPipeline pipeline, String scheme, String host, int port) throws IOException, GeneralSecurityException { if (pipeline.get(HTTP_HANDLER) != null) pipeline.remove(HTTP_HANDLER); if (isSecure(scheme)) if (isSslHandlerConfigured(pipeline)) { pipeline.addAfter(SSL_HANDLER, HTTP_HANDLER, newHttpClientCodec()); } else { pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); pipeline.addFirst(SSL_HANDLER, createSslHandler(host, port)); } else pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); if (isWebSocket(scheme)) { pipeline.addAfter(HTTP_PROCESSOR, WS_PROCESSOR, wsProcessor); pipeline.remove(HTTP_PROCESSOR); } }
boolean connect = method == HttpMethod.CONNECT; boolean allowConnectionPooling = config.isAllowPoolingConnections() && (!HttpUtils.isSecure(uri) || config.isAllowPoolingSslConnections()); .set(ORIGIN, "http://" + uri.getHost() + ":" + (uri.getPort() == -1 ? isSecure(uri.getScheme()) ? 443 : 80 : uri.getPort()))//
boolean useSSl = isSecure(uri) && !useProxy;
public void upgradeProtocol(ChannelPipeline pipeline, String scheme, String host, int port) throws IOException, GeneralSecurityException { if (pipeline.get(HTTP_HANDLER) != null) pipeline.remove(HTTP_HANDLER); if (isSecure(scheme)) if (isSslHandlerConfigured(pipeline)) { pipeline.addAfter(SSL_HANDLER, HTTP_HANDLER, newHttpClientCodec()); } else { pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); pipeline.addFirst(SSL_HANDLER, createSslHandler(host, port)); } else pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); if (isWebSocket(scheme)) { pipeline.addAfter(HTTP_PROCESSOR, WS_PROCESSOR, wsProcessor); pipeline.remove(HTTP_PROCESSOR); } }
boolean useSSl = isSecure(uri) && !useProxy;
boolean connect = method == HttpMethod.CONNECT; boolean allowConnectionPooling = config.isAllowPoolingConnections() && (!HttpUtils.isSecure(uri) || config.isAllowPoolingSslConnections()); String origin = "http://" + uri.getHost() + ":" + (uri.getPort() == -1 ? isSecure(uri.getScheme()) ? 443 : 80 : uri.getPort());