Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8830123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:59:44+00:00 2026-06-14T07:59:44+00:00

Is it possible to destroy a persistent connection that has been created with NSURLConnection?

  • 0

Is it possible to destroy a persistent connection that has been created with NSURLConnection? I need to be able to destroy the persistent connection and do another SSL handshake.

As it is now, calling [conn cancel] leaves a persistent connection behind that gets used with the next connection request to that host, which I don’t want to happen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:59:48+00:00Added an answer on June 14, 2026 at 7:59 am

    As it turns out, I believe the Secure Transport TLS session cache is to blame.

    I also asked the question on the apple developer forums, and got a response from an Apple person. He pointed me to this Apple sample code readme where it says:

    At the bottom of the TLS stack on both iOS and Mac OS X is a component known as Secure Transport. Secure Transport maintains a per-process TLS session cache. When you connect via TLS, the cache stores information about the TLS negotiation so that subsequent connections can connect more quickly. The on-the-wire mechanism is described at the link below.

    http://en.wikipedia.org/wiki/Transport_Layer_Security#Resumed_TLS_handshake

    This presents some interesting gotchas, especially while you’re debugging. For example, consider the following sequence:

    1. You use the Debug tab to set the TLS Server Validation to Disabled.

    2. You connect to a site with a self-signed identity. The connection succeeds because you’ve disabled TLS server trust validation. This adds an entry to the Secure Transport TLS session cache.

    3. You use the Debug tab to set the TLS Server Validation to Default.

    4. You immediately connect to the same site as you did in step 2. This should fail, because of the change in server trust validation policy, but it succeeds because you never receive an NSURLAuthenticationMethodServerTrust challenge. Under the covers, Secure Transport has resumed the TLS session, which means that the challenge never bubbles up to your level.

    5. On the other hand, if you delay for 11 minutes between steps 3 and 4, things work as expected (well, fail as expected :-). This is because Secure Transport’s TLS session cache has a timeout of 10 minutes.

    In the real world this isn’t a huge problem, but it can be very confusing during debugging. There’s no programmatic way to clear the Secure Transport TLS session cache but, as the cache is per-process, you can avoid this problem during debugging by simply quitting and relaunching your application. Remember that, starting with iOS 4, pressing the Home button does not necessarily quit your application. Instead, you should use quit the application from the recent applications list.

    So, based on that, a user would have to either kill their app and restart it or wait more than 10 minutes before sending another request.

    I did another google search with this new information and found this Apple technical Q&A article that matches this problem exactly. Near the bottom, it mentions adding a trailing ‘.’ to domain names (and hopefully IP addresses) for requests in order to force a TLS session cache miss (if you can’t modify the server in some way, which I can’t), so I am going to try this and hopefully it will work. I will post my findings after I test it.

    ### EDIT ###

    I tested adding a ‘.’ to the end of the ip address, and the request was still completed successfully.

    But I was thinking about the problem in general, and there’s really no reason to force another SSL handshake. In my case, the solution to this problem is to keep a copy of the last known SecCertificateRef that was returned from the server. When making another request to the server, if a cached TLS session is used (connection:didReceiveAuthenticationChallenge: was not called), we know that the saved SecCertificateRef is still valid. If connection:didReceiveAuthenticationChallenge: is called, we can get the new SecCertificateRef at that time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

anyone has idea if and how is it possible to destroy / change php
Is it possible to destroy the threads created by OpenMP? When the program starts,
Possible Duplicate: check whether internet connection is available with C# I just want to
Is it possible for a PHP object instance to destroy/unset itself? Say I had
Is it possible to use ruby code in RJS files? For example, the destroy.js.rjs
Is it possible to create a hidden UIWebView programmatically and then release it(destroy it
Possible Duplicate: (PHP) how to destroy or unset session when user close the browser
Possible Duplicate: how can i find out how many objects are created of a
Possible Duplicate: Destroy or unset session when user close the browser without clicking on
Possible Duplicate: Rails - Help understanding how to use :dependent => :destroy I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.