Ventura: NWConnection returns server error in waiting state instead of failed state

In our macOS SystemExtension, we are using Network.framework for creating web socket connection to our remote WSS server. We provide authentication token in cookies of the connection and websocket server validates it before upgrading the connection from HTTP to WebSocket. If the cookie is invalid, server returns 403 HTTP status code and closes the connection.

When server returns 403, in Big Sur and Monterey, we get state update of failed(let error) where error is NWError.posix(.ECONNABORTED). However, in Ventura, we are getting state waiting(let error) where error is NWError.posix(.ECONNABORTED).

As per documentation, waiting state should be received if there is any network error in establishing the connection and connection goes into waiting for network path change. But in this case, TCP connection to server is established, HTTP headers are received and validated by server and then get rejected. So shouldn't this result into connection failed instead of waiting?

This behaviour has only changed on Ventura. On Big Sur and Monterey we still get failed with error.

As per documentation, waiting state should be received if there is any network error in establishing the connection and connection goes into waiting for network path change.

Well, more abstractly, .waiting(_:) means that it’s worth retrying the connection when network conditions change, and I agree that it’s a poor match for this error. I recommend that you file a bug about this change in behaviour.

Please post your bug number, just for the record.

Share and Enjoy

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

I have a similar problem, in iOS. Do you have a solution??

Ventura: NWConnection returns server error in waiting state instead of failed state
 
 
Q