URLSessionConfiguration's httpMaximumConnectionsPerHost not working in iOS 10?

In a production app, I am setting the httpMaximumConnectionsPerHost property to 1 on a URLSessionConfiguration object when creating a URLSession. This allows me to queue a number of downloads, but only download 1 file at a time. Recently I noticed that all queued files download simultaneously on iOS 10 devices.


Has anyone else noticed this change? Is this intentional or a bug?


Note: I am setting the value of httpMaximumConnectionsPerHost both before and after creating the session, because of a post I found months ago that suggested that some properties of URLSessionConfiguration must be set after creating a URLSession in order for them to take effect.


    let configuration = URLSessionConfiguration.background(withIdentifier: sessionIdentifier)
    configuration.httpMaximumConnectionsPerHost = 1
   
    session = URLSession(
      configuration: configuration,
      delegate: self,
      delegateQueue: nil
    )
   
    session.configuration.httpMaximumConnectionsPerHost = 1

Replies

unfortunately our server can process 1 request at a time.

One request at a time? Or one connection at a time?

This matters because there hasn’t been a one-to-one mapping between requests and connections since HTTP 1.1 was introduced. And it’s even more important in HTTP/2 because that multiplexes all requests over a single connection.

IMPORTANT httpMaximumConnectionsPerHost is expected to control the number of simultaneous connections to a host, not the number of simultaneous requests.

Which brings me back to the question from my last post on this thread: Is this server HTTP/2?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"