-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
impr(android): implement TLSv3 support #11195
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b13eb11
feat(android): implement TLSv3 support
e3b0825
docs: include TLSv3
47f0aad
Merge branch 'master' into TIMOB-26956
garymathews 164f4ce
build(tests): include unit tests
6742f6a
Merge branch 'master' into TIMOB-26956
garymathews 7c3b741
Merge branch 'master' into TIMOB-26956
garymathews a4a78cc
Merge branch 'master' into TIMOB-26956
garymathews 091cfb1
fix(ios): implement TLSv3 support
0ae3310
Merge branch 'master' into TIMOB-26956
garymathews f39c2ef
build(tests): update network test
18000b4
build(tests): fix tlsv3 regex
08cba01
Merge branch 'master' into TIMOB-26956
garymathews File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2019 Axway, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
var should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.Network.HTTPClient', function () { | ||
this.timeout(6e4); | ||
|
||
it.android('TLSv3 support', function (finish) { | ||
// Only supported on Android 10+ | ||
if (parseInt(Ti.Platform.version.split('.')[0]) < 10) { | ||
return finish(); | ||
} | ||
|
||
const client = Ti.Network.createHTTPClient({ | ||
onload: e => { | ||
const html = e.source.responseText; | ||
if (html.includes('protocol_ssl3">Yes')) { | ||
finish(); | ||
} | ||
}, | ||
onerror: | ||
e => { finish(new Error('Could not determine TLSv3 support.')); }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
timeout: 8000 | ||
}); | ||
client.open('GET', 'https://ssllabs.com/ssltest/viewMyClient.html'); | ||
client.send(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
var should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.Network', function () { | ||
|
||
// Constants | ||
var NETWORK_TYPES = [ 'NETWORK_LAN', 'NETWORK_MOBILE', 'NETWORK_NONE', 'NETWORK_UNKNOWN', 'NETWORK_WIFI' ], | ||
NOTIFICATION_TYPES = [ 'NOTIFICATION_TYPE_ALERT', 'NOTIFICATION_TYPE_BADGE', 'NOTIFICATION_TYPE_NEWSSTAND', 'NOTIFICATION_TYPE_SOUND' ], | ||
TLS_VERSIONS = [ 'TLS_VERSION_1_0', 'TLS_VERSION_1_1', 'TLS_VERSION_1_2', 'TLS_VERSION_1_3' ], | ||
i; | ||
// TODO Test that each group has unique values! | ||
for (i = 0; i < NETWORK_TYPES.length; i++) { | ||
it(NETWORK_TYPES[i], function () { // eslint-disable-line no-loop-func | ||
should(Ti.Network).have.constant(NETWORK_TYPES[i]).which.is.a.Number; | ||
}); | ||
} | ||
for (i = 0; i < NOTIFICATION_TYPES.length; i++) { | ||
// iOS-specific properties | ||
it.ios(NOTIFICATION_TYPES[i], function () { // eslint-disable-line no-loop-func | ||
should(Ti.Network).have.constant(NOTIFICATION_TYPES[i]).which.is.a.Number; | ||
}); | ||
} | ||
for (i = 0; i < TLS_VERSIONS.length; i++) { | ||
// FIXME Fails on Android and iOS for some reason! They say they're undefined, not Number | ||
// FIXME Windows fails to find the property up the prototype chain in utilities/assertions, line 33 | ||
it.allBroken(TLS_VERSIONS[i], function () { // eslint-disable-line no-loop-func | ||
should(Ti.Network).have.constant(TLS_VERSIONS[i]).which.is.a.Number; | ||
}); | ||
} | ||
|
||
it('PROGRESS_UNKNOWN', function () { | ||
should(Ti.Network).have.constant('PROGRESS_UNKNOWN').which.is.a.Number; | ||
}); | ||
|
||
// Properties | ||
it('apiName', function () { | ||
should(Ti.Network).have.a.readOnlyProperty('apiName').which.is.a.String; | ||
should(Ti.Network.apiName).be.eql('Ti.Network'); | ||
}); | ||
|
||
it('networkType', function () { | ||
should(Ti.Network).have.a.readOnlyProperty('networkType').which.is.a.Number; | ||
// Has to be one of the defined constants | ||
should([ Ti.Network.NETWORK_LAN, | ||
Ti.Network.NETWORK_MOBILE, | ||
Ti.Network.NETWORK_NONE, | ||
Ti.Network.NETWORK_UNKNOWN, | ||
Ti.Network.NETWORK_WIFI ].indexOf(Ti.Network.networkType)).not.eql(-1); | ||
}); | ||
|
||
it('networkTypeName', function () { | ||
should(Ti.Network).have.a.readOnlyProperty('networkTypeName').which.is.a.String; | ||
if (Ti.Network.networkType == Ti.Network.NETWORK_LAN) { // eslint-disable-line eqeqeq | ||
Ti.Network.networkTypeName.should.eql('LAN'); | ||
} else if (Ti.Network.networkType == Ti.Network.NETWORK_MOBILE) { // eslint-disable-line eqeqeq | ||
Ti.Network.networkTypeName.should.eql('MOBILE'); | ||
} else if (Ti.Network.networkType == Ti.Network.NETWORK_NONE) { // eslint-disable-line eqeqeq | ||
Ti.Network.networkTypeName.should.eql('NONE'); | ||
} else if (Ti.Network.networkType == Ti.Network.NETWORK_UNKNOWN) { // eslint-disable-line eqeqeq | ||
Ti.Network.networkTypeName.should.eql('UNKNOWN'); | ||
} else if (Ti.Network.networkType == Ti.Network.NETWORK_WIFI) { // eslint-disable-line eqeqeq | ||
Ti.Network.networkTypeName.should.eql('WIFI'); | ||
} | ||
}); | ||
|
||
it('online', function () { | ||
should(Ti.Network).have.a.readOnlyProperty('online').which.is.a.Boolean; | ||
}); | ||
|
||
// Methods | ||
// These seem to "intermittently" be unefined on Windows! | ||
it.windowsBroken('encodeURIComponent()', function () { | ||
var text; | ||
should(Ti.Network.encodeURIComponent).be.a.Function; | ||
text = Ti.Network.encodeURIComponent('Look what I found! I like this:'); | ||
text.should.eql('Look%20what%20I%20found!%20I%20like%20this%3A'); | ||
}); | ||
|
||
it.windowsBroken('decodeURIComponent()', function () { | ||
var text; | ||
should(Ti.Network.decodeURIComponent).be.a.Function; | ||
text = Ti.Network.decodeURIComponent('Look%20what%20I%20found!%20I%20like%20this%3A'); | ||
text.should.eql('Look what I found! I like this:'); | ||
}); | ||
|
||
it('createHTTPClient()', function () { | ||
should(Ti.Network.createHTTPClient).be.a.Function; | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.