On Windows, the R curl package exposes ie_get_proxy_for_url to obtain the system decision for a particular destination. For a policy returning one supported proxy endpoint:

target <- 'https://data.example/report.csv'
selected <- curl::ie_get_proxy_for_url(target)
handle <- curl::new_handle(
  proxy = if (is.null(selected)) '' else selected
)
result <- curl::curl_fetch_memory(target, handle = handle)

The helper can evaluate automatic configuration or discovery. That lookup can itself take time because obtaining and executing the PAC script may require network work.

Its NULL result means no proxy was selected. The example maps that result to an empty proxy option so libcurl does not substitute an inherited environment proxy.

Inspect a result containing a protocol mapping or multiple candidates before treating it as one libcurl endpoint. A list returned by a Windows configuration store is not automatically a valid single proxy URL.

Repeat the selection for other destinations when the policy can route them differently. Do not evaluate one host and save its result as the universal HTTP and HTTPS route.

The lookup selects a route, not a proxy identity. Configure the account and supported authentication method on the handle when required. There is no need to unlock curl's namespace and replace new_handle globally.

Tënë sô zo