Repository navigation
Setting and Listing Options
SetOpt configures a single option on an easy handle. The first parameter is the option name, the second is the value.
curl.SetOpt("URL", "https://example.com")
curl.SetOpt("FOLLOWLOCATION", 1)
curl.SetOpt("MAXREDIRS", 30)
curl.SetOpt("USERAGENT", "LibQurl/1.0")Option names accept three equivalent forms. Bare names are the preferred style in this wiki. See Terminology and Conventions for the full explanation.
Most options do not require a handle parameter. It defaults to the first created easy handle. Pass one explicitly when you have multiple:
curl.SetOpt("URL", "https://example.com", easy_handle)GetOpt returns the current value of an option, or Null() if it was never set.
val := curl.GetOpt("USERAGENT")
if (Type(val) = "Null")
MsgBox "USERAGENT is not set."
else
MsgBox valListOpts returns a human-readable string of all options currently set on a handle.
MsgBox curl.ListOpts()
; or for a specific handle:
MsgBox curl.ListOpts(easy_handle)LibQurl exposes the full libcurl option set. The following are some of the the most frequently used. For the complete list, see the libcurl options reference.
Common CURLOPTs
| Option | Purpose |
|---|---|
URL |
Target URL for the transfer. |
CUSTOMREQUEST |
Override the HTTP verb. e.g. "PUT", "DELETE", "PATCH". |
POST / POSTFIELDS
|
Enable and set POST body data. Usually set via SetPost(). |
UPLOAD |
Enable upload mode. Usually set via SetUpload(). |
HTTPHEADER |
Custom request headers. Usually set via SetHeaders(). |
CAINFO |
Path to CA certificate bundle for SSL verification. |
FOLLOWLOCATION |
Follow HTTP redirects. On by default. |
MAXREDIRS |
Redirect limit. Default 30. |
TIMEOUT |
Total transfer timeout in seconds. |
CONNECTTIMEOUT |
Connection timeout in seconds. |
USERAGENT |
Value for the User-Agent header. |
ACCEPT_ENCODING |
Accepted compression encodings. Empty string enables all. On by default. |
MultiSetOpt configures options on a multi handle. The naming convention is the same bare-name style:
curl.MultiSetOpt("MAXCONNECTS", 10)
curl.MultiSetOpt("MAX_HOST_CONNECTIONS", 25)MultiGetOpt retrieves them:
val := curl.MultiGetOpt("MAXCONNECTS")
if (Type(val) = "Null")
MsgBox "MAXCONNECTS is not set."For the full list of multi options, see the libcurl multi interface reference.
LibQurl uses the documented option discovery API to extract SetOpt constants as it loads. Therefore, you can determine what is known to your copy of libcurl by inspecting curl.Opt`:
; All CURLOPT options known to your version of libcurl
MsgBox curl.PrintObj(curl.Opt)-
Setting and Inspecting Headers — the
SetHeadersconvenience method and header retrieval -
POST and Upload —
SetPostandSetUploadtype dispatch - Easy Handle Reference — full method list
Foundations
Operations
- Download Modes
- Setting and Listing Options
- Setting and Inspecting Headers
- POST and Upload
- Multiple Easy Handles
- Async and Multi Interface
- URL Construction
- Share Interface
- MIME and Multipart
- Raw Send and Receive
- Pause and Resume
- WebSocket
- SSL Sessions
- Debug and Diagnostics
API Reference
- Easy Handle Reference
- Multi Handle Reference
- Share Handle Reference
- MIME Handle Reference
- URL Handle Reference
- Utility Methods Reference
- WebSocket Reference
Code Snippets