diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2015-06-03 19:20:41 -0400 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2015-06-03 19:20:41 -0400 |
commit | 9c03b396c0a36af28cbaf490c75850af18f780d2 (patch) | |
tree | 5c4d94933a2d12df30d1ce1af6eb87d27e024402 /platform | |
parent | 2bd7e4550296ce5f58abef93667bb92464317dc9 (diff) | |
parent | 295dc73c1af288c85e75a4fcaccdd9cb1580afd2 (diff) | |
download | qtlocation-mapboxgl-9c03b396c0a36af28cbaf490c75850af18f780d2.tar.gz |
Merge remote-tracking branch 'origin/master' into HEAD
Conflicts:
src/mbgl/renderer/painter_fill.cpp
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 32 | ||||
-rw-r--r-- | platform/ios/resources/star_tilestream_net.der | bin | 0 -> 1338 bytes |
2 files changed, 29 insertions, 3 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index e7f400c5dc..bf730af945 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -148,6 +148,8 @@ const NSTimeInterval MGLFlushInterval = 60; @property (atomic) NSURLSession *session; @property (atomic) NSData *digicertCert; @property (atomic) NSData *geoTrustCert; +@property (atomic) NSData *testServerCert; +@property (atomic) BOOL usesTestServer; // Main thread only @property (nonatomic) CLLocationManager *locationManager; @@ -239,6 +241,10 @@ const NSTimeInterval MGLFlushInterval = 60; NSString *testURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLMetricsTestServerURL"]; if (testURL != nil) { MGLMapboxEventsAPIBase = testURL; + _usesTestServer = YES; + } else { + // Explicitly Set For Clarity + _usesTestServer = NO; } _paused = YES; @@ -256,6 +262,10 @@ const NSTimeInterval MGLFlushInterval = 60; if (cerPath != nil) { _digicertCert = [NSData dataWithContentsOfFile:cerPath]; } + cerPath = [resourceBundle pathForResource:@"star_tilestream_net" ofType:@"der"]; + if (cerPath != nil) { + _testServerCert = [NSData dataWithContentsOfFile:cerPath]; + } // Events Control _eventQueue = [[NSMutableArray alloc] init]; @@ -848,7 +858,7 @@ const NSTimeInterval MGLFlushInterval = 60; // Look for a pinned certificate in the server's certificate chain long numKeys = SecTrustGetCertificateCount(serverTrust); - BOOL found = false; + BOOL found = NO; // Try GeoTrust Cert First for (int lc = 0; lc < numKeys; lc++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); @@ -858,7 +868,7 @@ const NSTimeInterval MGLFlushInterval = 60; if ([remoteCertificateData isEqualToData:_geoTrustCert]) { // Found the certificate; continue connecting completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - found = true; + found = YES; break; } } @@ -873,11 +883,27 @@ const NSTimeInterval MGLFlushInterval = 60; if ([remoteCertificateData isEqualToData:_digicertCert]) { // Found the certificate; continue connecting completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - found = true; + found = YES; break; } } + if (!found && _usesTestServer) { + // See if this is test server + for (int lc = 0; lc < numKeys; lc++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); + NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); + + // Compare Remote Key With Local Version + if ([remoteCertificateData isEqualToData:_testServerCert]) { + // Found the certificate; continue connecting + completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); + found = YES; + break; + } + } + } + if (!found) { // The certificate wasn't found in GeoTrust nor Digicert. Cancel the connection. completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); diff --git a/platform/ios/resources/star_tilestream_net.der b/platform/ios/resources/star_tilestream_net.der Binary files differnew file mode 100644 index 0000000000..e302cd7686 --- /dev/null +++ b/platform/ios/resources/star_tilestream_net.der |