Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.2.x] Move SSL context initialization to the client initialization #43842

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.workers.max=3
version=1.2.56
version=1.2.57
group=org.ballerinalang
bootstrappedOn=1.1.0-alpha
26 changes: 13 additions & 13 deletions gradle/javaLibsProject.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
dist 'org.wso2.carbon:org.wso2.carbon.core:5.1.0'
dist 'org.wso2.securevault:org.wso2.securevault:1.0.0-wso2v2'
dist 'org.wso2.transport.file:org.wso2.transport.local-file-system:6.0.55'
dist 'org.wso2.transport.http:org.wso2.transport.http.netty:6.3.51'
dist 'org.wso2.transport.http:org.wso2.transport.http.netty:6.3.54'
dist 'org.bouncycastle:bcprov-jdk18on:1.78.1'
dist 'org.bouncycastle:bcpkix-jdk18on:1.78.1'
dist 'org.bouncycastle:bcutil-jdk18on:1.78.1'
Expand All @@ -58,23 +58,23 @@ dependencies {
dist 'com.github.jknack:handlebars:4.3.1'
dist 'com.sun.mail:javax.mail:1.6.2'
dist 'jaxen:jaxen:1.1.6'
dist 'io.netty:netty-buffer:4.1.115.Final'
dist 'io.netty:netty-codec-http2:4.1.115.Final'
dist 'io.netty:netty-codec-http:4.1.115.Final'
dist 'io.netty:netty-codec:4.1.115.Final'
dist 'io.netty:netty-common:4.1.115.Final'
dist 'io.netty:netty-handler-proxy:4.1.115.Final'
dist 'io.netty:netty-handler:4.1.115.Final'
dist 'io.netty:netty-resolver:4.1.115.Final'
dist 'io.netty:netty-transport-native-unix-common:4.1.115.Final'
dist 'io.netty:netty-buffer:4.1.118.Final'
dist 'io.netty:netty-codec-http2:4.1.118.Final'
dist 'io.netty:netty-codec-http:4.1.118.Final'
dist 'io.netty:netty-codec:4.1.118.Final'
dist 'io.netty:netty-common:4.1.118.Final'
dist 'io.netty:netty-handler-proxy:4.1.118.Final'
dist 'io.netty:netty-handler:4.1.118.Final'
dist 'io.netty:netty-resolver:4.1.118.Final'
dist 'io.netty:netty-transport-native-unix-common:4.1.118.Final'
dist 'io.netty:netty-tcnative-classes:2.0.65.Final'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:windows-x86_64'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:linux-aarch_64'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:linux-x86_64'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:osx-aarch_64'
dist 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:osx-x86_64'
dist 'io.netty:netty-transport:4.1.115.Final'
dist 'io.netty:netty-transport:4.1.118.Final'
dist 'commons-pool.wso2:commons-pool:1.5.6.wso2v1'
dist 'org.wso2.carbon.messaging:org.wso2.carbon.messaging:2.3.7'
dist 'org.wso2.carbon.metrics:org.wso2.carbon.metrics.core:2.3.7'
Expand All @@ -90,8 +90,8 @@ dependencies {
dist 'org.jboss.logging:jboss-logging:3.3.1.Final'
dist 'commons-collections:commons-collections:3.2.2'
dist 'org.apache.geronimo.specs:geronimo-json_1.0_spec:1.0-alpha-1'
dist 'io.netty:netty-transport-native-epoll:4.1.115.Final'
dist 'io.netty:netty-transport-native-kqueue:4.1.115.Final'
dist 'io.netty:netty-transport-native-epoll:4.1.118.Final'
dist 'io.netty:netty-transport-native-kqueue:4.1.118.Final'
dist 'org.apache.ws.commons.axiom:axiom-api:1.2.22'
dist 'org.apache.ws.commons.axiom:axiom-impl:1.2.22'
dist 'commons-codec:commons-codec:1.15'
Expand Down
18 changes: 9 additions & 9 deletions gradle/javaProject.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dependencies {
implementation 'org.wso2.carbon.messaging:org.wso2.carbon.messaging:2.3.7'
implementation 'org.wso2.orbit.org.antlr:antlr4-runtime:4.5.1.wso2v1'
implementation 'org.yaml:snakeyaml:2.0'
implementation 'org.wso2.transport.http:org.wso2.transport.http.netty:6.3.51'
implementation 'org.wso2.transport.http:org.wso2.transport.http.netty:6.3.54'
implementation 'org.wso2.transport.file:org.wso2.transport.local-file-system:6.0.55'
implementation 'org.wso2.staxon:staxon-core:1.2.0.wso2v2'
implementation 'org.quartz-scheduler:quartz:2.3.2'
Expand All @@ -109,21 +109,21 @@ dependencies {
implementation 'io.ballerina.messaging:broker-core:0.970.5'
implementation 'io.ballerina.messaging:broker-amqp:0.970.5'
implementation 'io.dropwizard.metrics:metrics-core:4.1.7'
implementation 'io.netty:netty-codec:4.1.115.Final'
implementation 'io.netty:netty-buffer:4.1.115.Final'
implementation 'io.netty:netty-common:4.1.115.Final'
implementation 'io.netty:netty-codec-http:4.1.115.Final'
implementation 'io.netty:netty-codec-http2:4.1.115.Final'
implementation 'io.netty:netty-handler:4.1.115.Final'
implementation 'io.netty:netty-transport-native-unix-common:4.1.115.Final'
implementation 'io.netty:netty-codec:4.1.118.Final'
implementation 'io.netty:netty-buffer:4.1.118.Final'
implementation 'io.netty:netty-common:4.1.118.Final'
implementation 'io.netty:netty-codec-http:4.1.118.Final'
implementation 'io.netty:netty-codec-http2:4.1.118.Final'
implementation 'io.netty:netty-handler:4.1.118.Final'
implementation 'io.netty:netty-transport-native-unix-common:4.1.118.Final'
implementation 'io.netty:netty-tcnative-classes:2.0.65.Final'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:windows-x86_64'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:linux-aarch_64'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:linux-x86_64'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:osx-aarch_64'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.65.Final:osx-x86_64'
implementation 'io.netty:netty-transport:4.1.115.Final'
implementation 'io.netty:netty-transport:4.1.118.Final'
implementation 'io.nats:java-nats-streaming:2.2.1'
implementation 'io.nats:jnats:2.6.0'
implementation 'io.opentracing:opentracing-api:0.33.0'
Expand Down
44 changes: 22 additions & 22 deletions stdlib/grpc/src/main/ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,78 +21,78 @@ target = "java8"

[[platform.libraries]]
artifactId = "org.wso2.transport.http.netty"
version = "6.3.51"
path = "./lib/org.wso2.transport.http.netty-6.3.51.jar"
version = "6.3.54"
path = "./lib/org.wso2.transport.http.netty-6.3.54.jar"
groupId = "org.wso2.transport.http"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-common"
version = "4.1.115.Final"
path = "./lib/netty-common-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-common-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-buffer"
version = "4.1.115.Final"
path = "./lib/netty-buffer-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-buffer-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-transport"
version = "4.1.115.Final"
path = "./lib/netty-transport-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-transport-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-resolver"
version = "4.1.115.Final"
path = "./lib/netty-resolver-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-resolver-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-handler"
version = "4.1.115.Final"
path = "./lib/netty-handler-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-handler-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-codec-http"
version = "4.1.115.Final"
path = "./lib/netty-codec-http-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-http-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-codec"
version = "4.1.115.Final"
path = "./lib/netty-codec-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-handler-proxy"
version = "4.1.115.Final"
path = "./lib/netty-handler-proxy-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-handler-proxy-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-codec-http2"
version = "4.1.115.Final"
path = "./lib/netty-codec-http2-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-http2-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

[[platform.libraries]]
artifactId = "netty-transport-native-unix-common"
version = "4.1.115.Final"
path = "./lib/netty-transport-native-unix-common-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-transport-native-unix-common-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["grpc"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ public static Object externInit(ObjectValue clientEndpoint, String urlString,
senderConfiguration.setHttpVersion(Constants.HTTP_2_0);
senderConfiguration.setForceHttp2(true);
HttpClientConnector clientConnector = HttpUtil.createHttpWsConnectionFactory()
.createHttpClientConnector(properties, senderConfiguration, poolManager);
.createHttpsClientConnector(properties, senderConfiguration, poolManager);

clientEndpoint.addNativeData(CLIENT_CONNECTOR, clientConnector);
clientEndpoint.addNativeData(ENDPOINT_URL, urlString);
} catch (ErrorValue ex) {
return ex;
} catch (RuntimeException ex) {
} catch (Exception ex) {
return MessageUtils.getConnectorError(new StatusRuntimeException(Status
.fromCode(Status.Code.INTERNAL.toStatus().getCode()).withCause(ex)));
}
Expand Down
44 changes: 22 additions & 22 deletions stdlib/http/src/main/ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,78 +14,78 @@ target = "java8"

[[platform.libraries]]
artifactId = "org.wso2.transport.http.netty"
version = "6.3.51"
path = "./lib/org.wso2.transport.http.netty-6.3.51.jar"
version = "6.3.54"
path = "./lib/org.wso2.transport.http.netty-6.3.54.jar"
groupId = "org.wso2.transport.http"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-common"
version = "4.1.115.Final"
path = "./lib/netty-common-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-common-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-buffer"
version = "4.1.115.Final"
path = "./lib/netty-buffer-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-buffer-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-transport"
version = "4.1.115.Final"
path = "./lib/netty-transport-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-transport-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-resolver"
version = "4.1.115.Final"
path = "./lib/netty-resolver-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-resolver-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-handler"
version = "4.1.115.Final"
path = "./lib/netty-handler-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-handler-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-codec-http"
version = "4.1.115.Final"
path = "./lib/netty-codec-http-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-http-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-codec"
version = "4.1.115.Final"
path = "./lib/netty-codec-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-handler-proxy"
version = "4.1.115.Final"
path = "./lib/netty-handler-proxy-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-handler-proxy-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-codec-http2"
version = "4.1.115.Final"
path = "./lib/netty-codec-http2-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-codec-http2-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

[[platform.libraries]]
artifactId = "netty-transport-native-unix-common"
version = "4.1.115.Final"
path = "./lib/netty-transport-native-unix-common-4.1.115.Final.jar"
version = "4.1.118.Final"
path = "./lib/netty-transport-native-unix-common-4.1.118.Final.jar"
groupId = "io.netty"
modules = ["http"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ private boolean checkForConflicts(ListenerConfiguration listenerConfiguration, H
return false;
}

public WebSocketClientConnector getWebSocketClientConnector(WebSocketClientConnectorConfig configuration) {
return httpConnectorFactory.createWsClientConnector(configuration);
public WebSocketClientConnector getWebSocketClientConnector(WebSocketClientConnectorConfig configuration)
throws Exception {
return httpConnectorFactory.createWsClientConnectorWithSSL(configuration);
}

public TransportsConfiguration getTransportConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ public static void createSimpleHttpClient(ObjectValue httpClient,
poolManager = getConnectionManager(userDefinedPoolConfig);
}

HttpClientConnector httpClientConnector = HttpUtil.createHttpWsConnectionFactory()
.createHttpClientConnector(properties, senderConfiguration, poolManager);
httpClient.addNativeData(HttpConstants.CLIENT, httpClientConnector);
try {
HttpClientConnector httpClientConnector = HttpUtil.createHttpWsConnectionFactory()
.createHttpsClientConnector(properties, senderConfiguration, poolManager);
httpClient.addNativeData(HttpConstants.CLIENT, httpClientConnector);
} catch (Exception e) {
throw HttpUtil.createHttpError(e.getMessage(), HttpErrorType.GENERIC_CLIENT_ERROR);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,16 @@ public static boolean failover(ObjectValue webSocketClient, WebSocketService wsS
if (currentIndex != failoverContext.getInitialIndex()) {
failoverContext.setCurrentIndex(currentIndex);
createDelay(failoverContext.getFailoverInterval());
establishWebSocketConnection(createWebSocketClientConnector(targets.get(currentIndex).toString(),
webSocketClient), webSocketClient, wsService);
return true;
try {
establishWebSocketConnection(createWebSocketClientConnector(targets.get(currentIndex).toString(),
webSocketClient), webSocketClient, wsService);
return true;
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug(LOG_MESSAGE, "Couldn't create the WebSocket client connector for the target: "
+ targets.get(currentIndex).toString(), e.getMessage());
}
}
}
if (logger.isDebugEnabled()) {
logger.debug(LOG_MESSAGE, "Couldn't connect to one of the server in the targets: ", targets);
Expand Down Expand Up @@ -522,7 +529,8 @@ public static void waitForHandshake(CountDownLatch countDownLatch) {
}

private static WebSocketClientConnector createWebSocketClientConnector(String remoteUrl,
ObjectValue webSocketClient) {
ObjectValue webSocketClient)
throws Exception {
@SuppressWarnings(WebSocketConstants.UNCHECKED)
MapValue<String, Object> clientEndpointConfig = (MapValue<String, Object>) webSocketClient.getMapValue(
HttpConstants.CLIENT_ENDPOINT_CONFIG);
Expand All @@ -532,7 +540,7 @@ private static WebSocketClientConnector createWebSocketClientConnector(String re
HttpWsConnectorFactory connectorFactory = ((HttpWsConnectorFactory) webSocketClient.
getNativeData(WebSocketConstants.CONNECTOR_FACTORY));
// Creates the client connector
return connectorFactory.createWsClientConnector(clientConnectorConfig);
return connectorFactory.createWsClientConnectorWithSSL(clientConnectorConfig);
}

/**
Expand Down
Loading
Loading