Function Repository Resource:

SetGlobalCURLOptions

Source Notebook

Overwrite the default CURL options passed to all Wolfram Language CURL handles

Contributed by: Antonis Aristeidou

ResourceFunction["SetGlobalCURLOptions"]["option"value, ]

sets CURL option to value globally.

ResourceFunction["SetGlobalCURLOptions"][Default]

reverts to default CURL behavior.

Details

This overwrites definitions within CURLLink` and could potentially cause unintended side-effects.
SetGlobalCURLOptions applies options using CURLLink`CURLOption to all handles created using CURLLink`HTTP`Private`setStandardOptions.
All custom set options are set within the new symbol CURLLink`Private`$GlobalCURLOptions.
Running the function multiple times will append to the option list CURLLink`Private`$GlobalCURLOptions.

Examples

Basic Examples (4) 

Overwrite the system default redirect behavior:

In[1]:=
ResourceFunction["SetGlobalCURLOptions"][
 "CURLOPT_FOLLOWLOCATION" -> False]
Out[1]=

Redirects are now stopped:

In[2]:=
URLRead["https://httpbin.org/redirect/3", "StatusCode"]
Out[2]=

Revert back to the defaults:

In[3]:=
ResourceFunction["SetGlobalCURLOptions"][Default]
Out[3]=

Redirects now are followed:

In[4]:=
URLRead["https://httpbin.org/redirect/3", "StatusCode"]
Out[4]=

Properties and Relations (3) 

SetGlobalCURLOptions accepts any of the options listed with CURLLink`$CURLOptions:

In[5]:=
Keys[CURLLink`$CURLOptions] // Short
Out[5]=

Trying to revert to default without any changes will do nothing:

In[6]:=
ResourceFunction["SetGlobalCURLOptions"][Default]
Out[6]=

Running more than once will append to the options list:

In[7]:=
ResourceFunction["SetGlobalCURLOptions"][
  "CURLOPT_FOLLOWLOCATION" -> False];
ResourceFunction["SetGlobalCURLOptions"][
  "CURLOPT_REFERER" -> "Example"];
CURLLink`Private`$GlobalCURLOptions
Out[8]=

Resetting to defaults Unsets $GlobalCURLOptions:

In[9]:=
ResourceFunction["SetGlobalCURLOptions"][Default];
CURLLink`Private`$GlobalCURLOptions
Out[10]=

Possible Issues (1) 

Providing an unsupported option will print an error message and return a Failure:

In[11]:=
ResourceFunction["SetGlobalCURLOptions"]["UnknownOption" -> 1]
Out[11]=

Publisher

Antonis Aristeidou

Requirements

Wolfram Language 12.3 (May 2021) or above

Version History

  • 1.0.0 – 01 May 2026

License Information