Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break on kCFStreamErrorDomainSSL

I'm trying to debug an app that makes a lot of HTTP calls. I'm seeing this in the console:

2015-09-08 17:21:01.458 MyApp[3186:3064431] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

I understand how to add exceptions to my plist, but is there way to add a breakpoint where these requests are failing to see what is being requested?

like image 795
Ben Flynn Avatar asked Sep 09 '15 00:09

Ben Flynn


2 Answers

I wasn't able to make much of the stack trace when adding those breakpoints; however, this blog post helped me figure out which domains were failing:

http://timekl.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/

tl;dr: set the environment variable CFNETWORK_DIAGNOSTICS to 1 (how to set environment variables, if you need a hand: http://nshipster.com/launch-arguments-and-environment-variables/). this will log all the CFNetwork activity to a file that you'll see in the console; search that file for 'Did Fail' and you can see which requests are failing and why.

like image 190
bennettk Avatar answered Sep 29 '22 23:09

bennettk


Try adding a symbolic breakpoint in HTTPProtocol::failWithStreamError and/or StrictSecurityPolicy::logInsecureLoadFailure.

(This unfortunately may not make it easy to get the stack trace of the actual request, since this exception occurs asynchronously with the actual request creation code. But it might help you anyway.)

like image 44
lincolnq Avatar answered Sep 29 '22 22:09

lincolnq