how to do http rest call from Network Extension(In Test Environment)

Hi, we have c++ module inside Network Extension which does rest call. we want to do http rest call in test environment, but it's not responding. status code is 0. https working fine.

I tried adding NSAppTransportSecurity -> NSAllowsArbitraryLoads -> true, but it's crashing because of it.

how can we make http request from Network Extension in test enviroment?

Replies

What API is your C++ code using for this HTTP request? Are you using Objective-C++ to call URLSession? Or doing something else?

Share and Enjoy

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

  • @eskimo C++ code is cross platform library for tunnel related tasks. It uses libcurl to do HTTP/HTTPS requests.

Add a Comment

Hi @eskimo C++ code is cross platform library for tunnel related tasks. It uses libcurl to do HTTP/HTTPS requests. what may be the reason for http not working? how to get exception for http?

uses libcurl to do HTTP/HTTPS

In that case ATS is a red herring. ATS only applies to connections using URLSession or stuff layered on top of it and, AFAIK, libcurl uses BSD Sockets directly.

I tried adding NSAppTransportSecurity -> NSAllowsArbitraryLoads -> true, but it's crashing because of it.

Well, ATS changes can’t cause your program to crash. The most they can do is cause network requests to fail (or succeed). If your program is crashing when you make an ATS change, that’s a bug you need to investigate because network requests can fail (or succeed) for a variety of other reasons.

we want to do http rest call in test environment, but it's not responding. status code is 0.

An HTTP status code? Is that coming back from your server? Or being synthesised by libcurl?

Share and Enjoy

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

  • @eskimo status code is not coming back from server. It's synthesised by libcurl.

Add a Comment