<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/CFNetworkExecuteProxyAutoConfigurationScript(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFNetworkExecuteProxyAutoConfigurationScript"
  },
  "title" : "CFNetworkExecuteProxyAutoConfigurationScript(_:_:_:_:)"
}
-->

# CFNetworkExecuteProxyAutoConfigurationScript(_:_:_:_:)

Downloads a proxy autoconfiguration script and executes it.

```
func CFNetworkExecuteProxyAutoConfigurationScript(_ proxyAutoConfigurationScript: CFString, _ targetURL: CFURL, _ cb: CFProxyAutoConfigurationResultCallback, _ clientContext: UnsafeMutablePointer<CFStreamClientContext>) -> CFRunLoopSource
```

## Parameters

`proxyAutoConfigurationScript`

A `CFString` containing the code of the autoconfiguration script to be executed.

`targetURL`

The URL that your application intends to eventually download using the proxies.

`cb`

A callback to be called when execution of the script is finished.

`clientContext`

A stream context containing a client info object and optionally retain and release callbacks for that object.

## Discussion

This function returns a run loop source that the caller should schedule. Once execution of the script has completed, the specified callback function is called.

> Note:
> If you want to terminate the request before completion, you should invalidate the run loop source.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)