[英]iOS 13 NSURLSession websocket does not use TLS 1.3
I'm trying to use TLS 1.3 on my websocket connection that is based on NSURLSession webSocketTaskWithRequest:
.我正在尝试在基于NSURLSession webSocketTaskWithRequest:
websocket 连接上使用 TLS 1.3。 Strangely it does not ask the server for TLS 1.3.奇怪的是,它没有向服务器询问 TLS 1.3。 But when I use pretty much same code for HTTPS request, it uses TLS 1.3 for its request.但是当我对 HTTPS 请求使用几乎相同的代码时,它使用 TLS 1.3 作为其请求。 Any idea how to properly use TLS 1.3 for websocket?知道如何为 websocket 正确使用 TLS 1.3 吗?
//HTTPS
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
sessionConfig.TLSMaximumSupportedProtocol = kTLSProtocolMaxSupported;
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
[request setURL:url];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response) {
...
}];
//WebSocket
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
config.TLSMaximumSupportedProtocol = kTLSProtocolMaxSupported;
NSURLSession *session = [NSURLSession sessionWithConfiguration:config
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
self.task = [session webSocketTaskWithRequest:request];
[self listen];
[self.task resume];
Apparently Xcode 11.3.1 will use TLS 1.2 over TLS 1.3.显然 Xcode 11.3.1 将使用 TLS 1.2 而不是 TLS 1.3。 I'm not sure why this happens.. but using Xcode 11.5 fixed my issue我不确定为什么会发生这种情况……但是使用 Xcode 11.5 解决了我的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.