mesmerizingr mesmerizingr - 11 months ago 86
iOS Question

Creating multiple NSURLSession objects in case of HTTPS host

I'd like to know is it good to create multiple

objects when connecting to HTTPS host? The reason I'm asking this is because I should evaluate a server certificate during an initial TLS handshake (the server accepts clients without certificates) and the place I'm going to do that is

But that means I should create some base class that implements this method and derive all future delegates from it when using them for other means like

Also it creates concerns that
would be called for every
I make creating an additional overhead. As for HTTP/1.1
Connection: keep-alive
should be a default behaviour and (ideally) newly-created
should be using connections from some connection pool.


I've found the answer to my question in this Technical Q&A:

Since NSURLSession maintains it's own TLS session cache...

So I guess it's better to keep one NSURLSession if one doesn't want to TLS-handshake every time it performs a connection.