Revert "swift 2.3"

This reverts commit bfa163f3c2e85776d8bcf0c24eca65b7398f403d.
This commit is contained in:
Erik 2016-06-14 19:41:18 -04:00
parent bfa163f3c2
commit 6fd3294fba
4 changed files with 15 additions and 15 deletions

View File

@ -218,8 +218,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
return (NSURL(), NSURL())
}
let urlPolling = NSURLComponents(string: url.absoluteString!)!
let urlWebSocket = NSURLComponents(string: url.absoluteString!)!
let urlPolling = NSURLComponents(string: url.absoluteString)!
let urlWebSocket = NSURLComponents(string: url.absoluteString)!
var queryString = ""
urlWebSocket.path = socketPath

View File

@ -70,7 +70,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
self.options = options
self.socketURL = socketURL
if socketURL.absoluteString!.hasPrefix("https://") {
if socketURL.absoluteString.hasPrefix("https://") {
self.options.insertIgnore(.Secure(true))
}

View File

@ -141,9 +141,9 @@ public class SSLSecurity : NSObject {
}
var policy: SecPolicyRef
if self.validatedDN {
policy = SecPolicyCreateSSL(true, domain)!
policy = SecPolicyCreateSSL(true, domain)
} else {
policy = SecPolicyCreateBasicX509()!
policy = SecPolicyCreateBasicX509()
}
SecTrustSetPolicies(trust,policy)
if self.usePublicKeys {
@ -164,10 +164,10 @@ public class SSLSecurity : NSObject {
collect.append(SecCertificateCreateWithData(nil,cert)!)
}
SecTrustSetAnchorCertificates(trust,collect)
var result = SecTrustResultType(rawValue: 0)
SecTrustEvaluate(trust, &result!)
let r = Int(result!.rawValue)
if r == Int(SecTrustResultType.Unspecified.rawValue) || r == Int(SecTrustResultType.Proceed.rawValue) {
var result: SecTrustResultType = 0
SecTrustEvaluate(trust,&result)
let r = Int(result)
if r == kSecTrustResultUnspecified || r == kSecTrustResultProceed {
var trustedCount = 0
for serverCert in serverCerts {
for cert in certs {
@ -195,7 +195,7 @@ public class SSLSecurity : NSObject {
func extractPublicKey(data: NSData) -> SecKeyRef? {
guard let cert = SecCertificateCreateWithData(nil, data) else { return nil }
return extractPublicKeyFromCert(cert, policy: SecPolicyCreateBasicX509()!)
return extractPublicKeyFromCert(cert, policy: SecPolicyCreateBasicX509())
}
/**
@ -211,7 +211,7 @@ public class SSLSecurity : NSObject {
guard let trust = possibleTrust else { return nil }
var result = SecTrustResultType(rawValue:0)!
var result: SecTrustResultType = 0
SecTrustEvaluate(trust, &result)
return SecTrustCopyPublicKey(trust)
}
@ -246,7 +246,7 @@ public class SSLSecurity : NSObject {
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in
var keys = keys
let cert = SecTrustGetCertificateAtIndex(trust, index)
if let key = extractPublicKeyFromCert(cert!, policy: policy!) {
if let key = extractPublicKeyFromCert(cert!, policy: policy) {
keys.append(key)
}
@ -257,4 +257,4 @@ public class SSLSecurity : NSObject {
}
}
}

View File

@ -227,7 +227,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
var port = url.port
if port == nil {
if ["wss", "https"].contains(url.scheme!) {
if ["wss", "https"].contains(url.scheme) {
port = 443
} else {
port = 80
@ -285,7 +285,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
guard let inStream = inputStream, let outStream = outputStream else { return }
inStream.delegate = self
outStream.delegate = self
if ["wss", "https"].contains(url.scheme!) {
if ["wss", "https"].contains(url.scheme) {
inStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
outStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
} else {