How to disable "cache" when using CFNetworkExecuteProxyAutoConfigurationURL

Hi Experts,

I found the request for PAC was not triggered each time when using CFNetworkExecuteProxyAutoConfigurationURL. Looks like there is a cache inside, if so how can I disable that cache? like NSURLRequestReloadIgnoringLocalCacheData? Thanks in advance.

Btw, so far if I update any proxy setting of the system or wait for some time, then the "cache" will be refreshed and new request will be sent when using CFNetworkExecuteProxyAutoConfigurationURL.

Post not yet marked as solved Up vote post of Android2Test Down vote post of Android2Test
701 views

Replies

Do you mean to set the NSURLSessionConfiguration's URLCache property to nil? Is that what you are asking here or something else? See the URLCache documentation for more here.

Thanks, @meaton. What I am asking is for CFNetworkExecuteProxyAutoConfigurationURL(https://developer.apple.com/documentation/cfnetwork/1426392-cfnetworkexecuteproxyautoconfigu?language=objc), such as below code:

CFRunLoopSourceRef source(CFNetworkExecuteProxyAutoConfigurationURL(pacURLRef, targetURLRef, callback, &context));

It would download a PAC and executes it. However, looks like it would not download PAC for each invocation. I think there might have a cache related to CFNetwork in its implementation. I want it to send a new request to download PAC for each invocation instead of using a cached one.

So far I can reach that goal by implementing the download PAC part and feeding its content to CFNetworkExecuteProxyAutoConfigurationScript. Not sure if there is a simple way to disable the "cache" for API CFNetworkExecuteProxyAutoConfigurationURL or not.