Posts

Post not yet marked as solved
1 Replies
311 Views
Hi all I am experiencing some odd behavior when I use CFNetworkCopyProxiesForURL. Namely, it works perfectly for unauthenticated http/https and auto configure (proxy.pac) files, but it seems to assume that credentialed proxies are not valid for the the given URL, returning a result of kCFProxyTypeNone whenever I attempt to use a credentialed proxy. If it instead use SCDynamicStoreCopyProxies to get the system proxies and use the first one found, it works correctly to proxy my connection to the destination, but I would rather use CFNetworkCopyProxiesForURL if possible as that would be more specific. (lldb) n Process 2789 stopped * thread #61, queue = 'com.apple.root.default-qos', stop reason = step over   frame #0: 0x00000002f858e868 myprocess.dylib`get_proxy_settings_for_url(uri=0x0000600000c40010) at my_proxy.mm:315:33    312   // We have to use a unique ptr type here because of the COPY in the function name, which tells us we take ownership    313   auto proxies = apple::cf_ptr<CFArrayRef>{ CFNetworkCopyProxiesForURL(target_uri_ref.get(),    314                                      system_proxies.get()) }; -> 315   if (CFArrayGetCount(proxies.get()) == 0 )    316   {    317     LOG_INFO("No proxy configuration found"_ts);    318     return std::nullopt; Target 0: (myprocess) stopped. (lldb) po proxies.get() <__NSArrayM 0x600000c16130>( {   kCFProxyTypeKey = kCFProxyTypeNone; } ) (lldb) po system_proxies.get() {   ExceptionsList =   (     "192.168.1.61"   );   HTTPEnable = 1;   HTTPPort = 3128;   HTTPProxy = "192.168.1.61";   HTTPUser = mike;   "__SCOPED__" =   {     en0 =     {       ExceptionsList =       (         "192.168.1.61"       );       HTTPEnable = 1;       HTTPPort = 3128;       HTTPProxy = "192.168.1.61";       HTTPUser = mike;     };   }; } (lldb) po target_uri_ref.get() https://mycompany.com/mac Thanks! Alex
Posted
by afschuld.
Last updated
.