Skip to content

Commit

Permalink
Merge pull request #44 from attemptoGmbH/master
Browse files Browse the repository at this point in the history
Fixed crash in Windows app when using self signed certificate
  • Loading branch information
EddyVerbruggen authored May 5, 2017
2 parents 66d24c2 + 8a58b0d commit 6b4317a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-sslcertificatechecker"
version="5.0.0">
version="5.0.1">

<name>SSL Certificate Checker</name>

Expand Down
14 changes: 5 additions & 9 deletions src/windows/sslCertCheckPluginProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ cordova.commandProxy.add("SSLCertificateChecker", {
if (strippedURL.indexOf("/") > -1) {
strippedURL = strippedURL.substring(0, strippedURL.indexOf("/"));
}
if (strippedURL.indexOf(":") > -1) {
strippedURL = strippedURL.substring(0, strippedURL.indexOf(":"));
}
hostName = new Windows.Networking.HostName(strippedURL);
} catch (error) {
errorCallback("CONNECTION_FAILED. Details: Invalid serverURL, " + serverURL);
Expand All @@ -55,15 +58,8 @@ cordova.commandProxy.add("SSLCertificateChecker", {
}, function (reason) {
if (stateHolder.clientSocket.information.serverCertificateErrorSeverity ===
Windows.Networking.Sockets.SocketSslErrorSeverity.ignorable) {
return shouldIgnoreCertificateErrorsAsync(
stateHolder.clientSocket.information.serverCertificateErrors)
.then(function (userAcceptedRetry) {
if (userAcceptedRetry) {
return connectSocketWithRetryHandleSslErrorAsync(hostName, serviceName);
}
errorCallback("CONNECTION_NOT_SECURE");
return
});
// ignorable (http or self signed certificate), move on to .done
return;
}
errorCallback("CONNECTION_FAILED. Details: " + reason);
})
Expand Down

0 comments on commit 6b4317a

Please sign in to comment.