How to solve timeout issues caused by bad HTTP persistent connection?

前端 未结 3 1710
独厮守ぢ
独厮守ぢ 2021-02-06 09:12

I\'ve been struggling with an HTTP timeout issue recently. After more than one month of investigation I\'m quite sure that it is caused by bad HTTP persistent connections. Detai

3条回答
  •  别那么骄傲
    2021-02-06 09:48

    After 2 weeks of research, I can give answers to question 3 and 4:

    1. nginx's persistent connection timeout is set to 5s on server, which should not be the cause. Server engineers found those timed-out requests are actually normally received and responded. So it is more likely a client side issue. Since I have a minimal reproducible code to rule out my code as the cause, the cause should be in iOS.
    2. The only way I found is to use CFNetwork. Higher level API such as NSURLConnection or NSURLSession's Connection header will be overwritten by system.

提交回复
热议问题