简体   繁体   English

我可以在使用 NSURLSession 的 iOS 应用程序中关闭 SPDY 吗?

[英]Can I turn SPDY off in an iOS app that uses NSURLSession?

My iOS app is having networking issues when it loads images from an HTTPS nginx web server with SPDY enabled.我的 iOS 应用程序在从启用了 SPDY 的 HTTPS nginx Web 服务器加载图像时出现网络问题。 The issue is described here: Sending SPDY requests results in "The request timed out" errors with NSUrlSession in iOS此处描述了该问题: Sending SPDY requests results in "The request timed out" errors with NSUrlSession in iOS

I am using NSURLSession for my networking.我正在使用 NSURLSession 进行网络连接。 I did experiments and confirmed that my problem is fixed if I turn SPDY off on the server side.我做了实验并确认如果我在服务器端关闭 SPDY,我的问题就解决了。 Unfortunately I can not turn SPDY off on production nginx server because I have no control over it.不幸的是,我无法在生产 nginx 服务器上关闭 SPDY,因为我无法控制它。 Can I turn SPDY off in the iOS app instead?我可以在 iOS 应用程序中关闭 SPDY 吗?

OS X: 10.10.4 (14E46), iOS: 8 and 9, Xcode: 7.0 (7A218), nginx: 1.9.4 OS X:10.10.4 (14E46),iOS:8 和 9,Xcode:7.0 (7A218),nginx:1.9.4

You might be able to pre-populate the Upgrade header field in your NSURLRequest with something that nginx will handle as a non-SPDY, non-HTTP/2 request, eg可以使用 nginx 将作为非 SPDY、非 HTTP/2 请求处理的内容预先填充 NSURLRequest 中的 Upgrade 标头字段,例如

Upgrade: TLS/1.2升级:TLS/1.2

but the URL loading system might just stomp on it, in which case the only way to disable it would by configuring the server to compare the user agent string (or any other header that you provide) and refusing to upgrade the connection.但是 URL 加载系统可能只是踩在它上面,在这种情况下,禁用它的唯一方法是配置服务器以比较用户代理字符串(或您提供的任何其他标头)并拒绝升级连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM