Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Protect websocket url argument. (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and doumafang committed Jan 4, 2019
1 parent eb3f28b commit 0f7a042
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion WeexSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ Pod::Spec.new do |s|
'ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h',
'ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h',
'ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.h',
'ios/sdk/WeexSDK/Sources/Manager/WXDisplayLinkManager.h',
'ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h',
'ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h',
'ios/sdk/WeexSDK/Sources/Utility/WXConvert.h',
Expand Down
11 changes: 11 additions & 0 deletions ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ @implementation WXWebSocketModule

- (void)WebSocket:(NSString *)url protocol:(NSString *)protocol
{
// check url
NSURL* theURL = [NSURL URLWithString:url];
if (theURL == nil) {
return;
}
NSString *scheme = theURL.scheme.lowercaseString;
if (!([scheme isEqualToString:@"ws"] || [scheme isEqualToString:@"http"] ||
[scheme isEqualToString:@"wss"] || [scheme isEqualToString:@"https"])) {
return;
}

if(loader)
{
[loader clear];
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ - (void) startRecord:(NSString*) instanceId
[self updateDiffStats:KEY_PAGE_STATS_IMG_UN_RECYCLE_NUM withDiffValue:0];
}

- (void) endRecord;
- (void) endRecord
{
if (_isEnd) {
return;
Expand Down

0 comments on commit 0f7a042

Please sign in to comment.