Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 11.2.1 Xcode 9.2 BoringSSL SSL_ERROR_ZERO_RETURN(6)

I'm hitting this error all of a sudden in my project that has a WKWebView displaying a page. The page loads fine like it used to. But now when I attempt to navigate to another page from that page, I get this error:

[BoringSSL] Function boringssl_session_errorlog: line 2871 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert

It seems like it's related to my pc / device as I've never hit this before.

A few things I found said I need to make sure I have the other linked flag set to -ObjC. Also setting Allows Arbitrary Loads to Yes. Both of those are set and the error continues.

The web page is using TLS 1.2.

like image 336
Tom Hammond Avatar asked Jan 31 '18 02:01

Tom Hammond


1 Answers

The exact reason for the error shown can't be determined without more detailed logging.

CFNetwork handles the core of Foundation’s networking classes — It also has the (often overlooked) capability of detailed logging via the CFNETWORK_DIAGNOSTICS environment variable.

Programmatically enabling CFNetwork diagnostic logging:

setenv("CFNETWORK_DIAGNOSTICS", "3", 1);

It should be set to an integer value from 0 to 3, where 0 is off and higher numbers give progressively more logging. During normal development you can set this environment variable via Xcode’s scheme editor. When the app is run from Xcode, the CFNetwork log entries will appear in the debug console area (if not visible, choose View > Debug Area > Show Debug Area).

The environment variable should be placed right at the beginning of the app’s launch sequence. Normally putting this at the start of main is sufficient, but if you have C++ static initialisers that use CFNetwork you’ll have to put it before those.

Note: In Swift this code would go in main.swift. By default Swift apps don’t have a main.swift; “The Swift Programming Language” explains how to add one.
*Also note, in Swift remove the semi-colon at the end of the setenv.

Setting the environment variable above should definitely help in determining where the issue is, or at the very least give you a starting point to begin diagnosing a somewhat vague error message.

↳ CFNetwork Diagnostic Logging

like image 117
l'L'l Avatar answered Oct 29 '22 17:10

l'L'l