curl
| Kind | ffi-c |
|---|---|
| Capabilities | ffi net |
| Categories | network web ffi |
| Keywords | curl http client libcurl ffi |
libcurl bindings for Kit - HTTP client for GET, POST, PUT, DELETE requests
Files
| File | Description |
|---|---|
.editorconfig | Editor formatting configuration |
.gitignore | Git ignore rules for build artifacts and dependencies |
.tool-versions | asdf tool versions (Zig, Kit) |
LICENSE | MIT license file |
README.md | This file |
c/kit_curl.c | C FFI wrapper |
c/kit_curl.h | C header for FFI wrapper |
examples/basic.kit | Basic usage example |
kit.toml | Package manifest with metadata and dependencies |
src/curl.kit | kit-curl: libcurl Bindings for Kit |
tests/curl.test.kit | Tests for curl |
tests/ffi.test.kit | Tests for ffi |
tests/network.test.kit | Tests for network |
Dependencies
No Kit package dependencies.
Requires libcurl as a system library:
| Platform | Install Command |
|---|---|
| macOS | brew install curl (usually pre-installed) |
| Ubuntu | sudo apt install libcurl4-openssl-dev |
| Fedora | sudo dnf install libcurl-devel |
Installation
kit add gitlab.com/kit-lang/packages/kit-curl.gitUsage
import Kit.Curl as Curl
main =
# Fetch a URL and get the response body
match Curl.fetch "https://httpbin.org/get"
| Ok resp ->
println "Status: ${Int.to-string resp.status}"
println "Body: ${resp.body}"
| Err e -> println "Failed: ${e}"
# POST JSON data
match Curl.post-json "https://httpbin.org/post" "{\"key\": \"value\"}"
| Ok resp -> println "Posted! Status: ${Int.to-string resp.status}"
| Err e -> println "Failed: ${e}"
# Simple GET/POST/PUT/DELETE (fire-and-forget)
match Curl.get "https://httpbin.org/get"
| Ok -msg -> println "GET succeeded"
| Err e -> println "GET failed: ${e}"
# URL encoding
encoded = Curl.url-encode "hello world & more"
println "Encoded: ${encoded}"
# Check reachability
if Curl.is-reachable? "https://example.com" then
println "example.com is reachable"High-Level API
The high-level API provides convenient functions for common HTTP operations:
| Function | Signature | Description |
|---|---|---|
fetch | String -> Result {status, body} String | GET with response body |
fetch-with-headers | String -> Result {status, body, headers} String | GET with headers |
post-json | String -> String -> Result {status, body} String | POST with JSON |
post-form | String -> List {name, value} -> Result {status, body} String | Multipart form POST |
upload-file | String -> String -> String -> Result {status, body} String | File upload |
fetch-all | List String -> List (Result String String) | Fetch multiple URLs |
fetch-race | List String -> Result String String | First successful fetch |
get | String -> Result String String | Simple GET |
post | String -> String -> Result String String | Simple POST |
put | String -> String -> Result String String | Simple PUT |
delete | String -> Result String String | Simple DELETE |
head-request | String -> Result String String | HEAD request |
url-encode | String -> String | URL-encode a string |
url-decode | String -> String | URL-decode a string |
is-reachable? | String -> Bool | Check URL reachability |
version-info | -> {version, host, ssl, ...} | libcurl version details |
has-feature? | Int -> Bool | Check feature support |
option-info | String -> Result {name, id, option-type} String | Option metadata by name |
Low-Level API
For advanced use cases, the low-level API exposes direct libcurl bindings:
import Kit.Curl as Curl
main =
# Manual handle management
Curl.global-init Curl.curl-global-default
defer Curl.global-cleanup
handle = Curl.init
Curl.setopt-str handle Curl.curlopt-url "https://httpbin.org/get"
Curl.setopt-long handle Curl.curlopt-followlocation 1
Curl.setopt-long handle Curl.curlopt-timeout 30
code = Curl.perform-capture handle
if code == Curl.curle-ok then
body = Curl.get-response-body
status = Curl.get-response-code handle
println "Status: ${Int.to-string status}"
println "Body: ${body}"
else
println "Error: ${Curl.strerror code}"
Curl.cleanup handleThe low-level API includes:
- Easy interface:
init,cleanup,perform,setopt-*,info-* - Multi interface:
multi-init,multi-add-handle,multi-perform,multi-poll - URL API:
url-init,url-set,url-get,url-cleanup - MIME API:
mime-init,mime-addpart,mime-name,mime-data,mime-filedata - Share interface:
share-init,share-setopt-long,share-cleanup - WebSocket:
ws-recv,ws-send,ws-get-recv-data - Header API:
header,nextheader,header-get-name,header-get-value - Version info:
version,version-info,has-feature? - Option introspection:
option-info,option-info-by-id
Error Types
type CurlError =
| CurlInitError {message: String}
| CurlConnectionError {message: String}
| CurlTimeoutError {message: String}
| CurlProtocolError {message: String}
| CurlSslError {message: String}Development
Running Examples
Compile and run examples:
kit build examples/basic.kit -o basic && ./basicRunning Tests
Run the test suite:
kit testRun the test suite with coverage:
kit test --coverageRunning kit dev
Run the standard development workflow (format, check, test):
kit devThis will:
- Format and check source files in
src/ - Run tests in
tests/with coverage
Generating Documentation
Generate API documentation from doc comments:
kit docNote: Kit sources with doc comments (##) will generate HTML documents in docs/*.html
Cleaning Build Artifacts
Remove generated files, caches, and build artifacts:
kit task cleanNote: Defined in kit.toml.
Local Installation
To install this package locally for development:
kit installThis installs the package to ~/.kit/packages/@kit/curl/, making it available for import as Kit.Curl in other projects.
License
This package is released under the MIT License - see LICENSE for details.
libcurl is licensed under a MIT/X-inspired license.
Exported Functions & Types
CurlError
Curl error type for typed error handling. Variants distinguish between different failure modes.
Variants
CurlInitError {message}CurlConnectionError {message}CurlTimeoutError {message}CurlProtocolError {message}CurlSslError {message}init
Initialize a curl easy session. Returns a handle (Ptr).
-> Ptr
cleanup
Clean up a curl easy session.
Ptr -> Unit
perform
Perform a blocking transfer.
Ptr -> Int
reset
Reset all options on a curl handle to defaults.
Ptr -> Unit
setopt-long
Set a long option on a curl handle.
Ptr -> Int -> Int -> Int
setopt-ptr
Set a pointer option on a curl handle.
Ptr -> Int -> Ptr -> Int
setopt-str
Set a string option on a curl handle.
Ptr -> Int -> String -> Int
setopt-off-t
Set a 64-bit integer option on a curl handle (for large file sizes, speed limits).
Ptr -> Int -> Int -> Int
setopt-blob
Set a blob option on a curl handle (for in-memory certs, keys).
Ptr -> Int -> Ptr -> Int -> Int
duphandle
Clone a curl easy handle with all its options.
Ptr -> Ptr
pause
Pause or unpause a transfer.
Ptr -> Int -> Int
upkeep
Perform connection upkeep (keepalive).
Ptr -> Int
getinfo-slist
Get an slist info value after transfer (cookie list, SSL engines).
Ptr -> Int -> Ptr
info-str
Get a string info value after transfer (e.g., effective URL, content type).
Ptr -> Int -> String
info-long
Get a long info value after transfer (e.g., response code, header size).
Ptr -> Int -> Int
info-double
Get a double info value after transfer (e.g., total time, connect time).
Ptr -> Int -> Float
info-off-t
Get a 64-bit info value after transfer (e.g., microsecond timings).
Ptr -> Int -> Int
strerror
Get human-readable error string for a CURLcode.
Int -> String
global-init
Initialize the curl library globally. Call once at program start.
Int -> Unit
global-cleanup
Clean up the curl library globally. Call once at program end.
-> Unit
global-sslset
Select SSL backend. Must be called BEFORE global-init. Returns CURLsslset: 0=OK, 1=UNKNOWN_BACKEND, 2=TOO_LATE, 3=NO_BACKENDS.
Int -> String -> Int
global-init-mem
Initialize curl with custom memory allocator callbacks (as Ptr function pointers).
Int -> Ptr -> Ptr -> Ptr -> Ptr -> Ptr -> Int
escape
URL-encode a string using a curl handle.
Ptr -> String -> Int -> String
unescape
URL-decode a string using a curl handle.
Ptr -> String -> Int -> Ptr -> String
slist-append
Append a string to a curl slist (linked list for headers).
Ptr -> String -> Ptr
slist-free
Free an entire curl slist.
Ptr -> Unit
perform-capture
Perform a transfer and capture the response body internally.
Ptr -> Int
get-response-body
Get the captured response body from the last perform-capture call.
-> String
get-response-code
Get the HTTP response code from a curl handle.
Ptr -> Int
get-response-headers
Get all captured response headers as a single newline-separated string.
-> String
get-header-count
Get the number of captured response headers.
-> Int
get-header-at
Get a specific response header by index (returns "Name: Value").
NonNegativeInt -> String
mime-init
Create a MIME structure for multipart form data.
Ptr -> Ptr
mime-free
Destroy a MIME structure.
Ptr -> Unit
mime-addpart
Add a part to a MIME structure. Returns a part handle (Ptr).
Ptr -> Ptr
mime-name
Set the name of a MIME part (form field name).
Ptr -> NonEmptyString -> Unit
mime-data
Set data for a MIME part from a string. Pass -1 for datasize to auto-detect.
Ptr -> String -> Int -> Int
mime-filedata
Set data for a MIME part from a file path.
Ptr -> NonEmptyString -> Int
mime-filename
Set the remote filename for a MIME part.
Ptr -> NonEmptyString -> Int
mime-type
Set the MIME type for a part (e.g., "application/json").
Ptr -> String -> Int
mime-encoder
Set encoding for a MIME part (e.g., "base64", "quoted-printable").
Ptr -> String -> Int
mime-headers
Set custom headers for a MIME part.
Ptr -> Ptr -> Int -> Int
mime-subparts
Set nested multipart content for a MIME part.
Ptr -> Ptr -> Int
mime-data-cb
Set MIME part data via streaming callback (copies data, libcurl reads on demand). This uses curl_mime_data_cb internally with pre-built read/seek/free callbacks.
Parameters:
Ptr -> String -> Int -> Int
get-read-callback-ptr
Get pointer to pre-built read callback function (for advanced use with Ptr).
-> Ptr
get-seek-callback-ptr
Get pointer to pre-built seek callback function (for advanced use with Ptr).
-> Ptr
get-free-callback-ptr
Get pointer to pre-built free callback function (for advanced use with Ptr).
-> Ptr
version
Get the libcurl version string.
-> String
multi-init
Create a multi handle for parallel transfers.
-> Ptr
multi-cleanup
Destroy a multi handle.
Ptr -> Unit
multi-add-handle
Add an easy handle to a multi handle.
Ptr -> Ptr -> Int
multi-remove-handle
Remove an easy handle from a multi handle.
Ptr -> Ptr -> Int
multi-wakeup
Wake up a sleeping multi-poll call from another thread.
Ptr -> Int
multi-setopt-long
Set a long option on a multi handle.
Ptr -> Int -> Int -> Int
multi-perform
Drive all transfers in a multi handle. Returns CURLMcode.
Ptr -> Int
multi-get-running-handles
Get running handles count from last multi-perform call.
-> Int
multi-poll
Wait for activity on a multi handle (modern). Returns CURLMcode.
Ptr -> NonNegativeInt -> Int
multi-wait
Wait for activity on a multi handle (older). Returns CURLMcode.
Ptr -> NonNegativeInt -> Int
multi-get-numfds
Get numfds from last poll/wait call.
-> Int
multi-timeout-ms
Get timeout in milliseconds until next multi-perform should be called.
Ptr -> Int
multi-info-read
Read next completed transfer info. Returns 1 if available, 0 if none.
Ptr -> Int
multi-info-easy-handle
Get easy handle from last multi-info-read.
-> Ptr
multi-info-result
Get CURLcode result from last multi-info-read.
-> Int
multi-info-msgs-in-queue
Get messages remaining in queue from last multi-info-read.
-> Int
multi-strerror
Get error string for a CURLMcode.
Int -> String
multi-socket-action
Drive transfers using socket-based event loop integration. sockfd: socket descriptor, ev-bitmask: CURL_CSELECT_IN/OUT/ERR flags. Use CURL_SOCKET_TIMEOUT (-1) to trigger timeout processing. Running handles available via multi-get-running-handles after call.
Ptr -> Int -> Int -> Int
url-init
Create a URL handle for parsing/building URLs.
-> Ptr
url-cleanup
Destroy a URL handle.
Ptr -> Unit
url-dup
Clone a URL handle with all its components.
Ptr -> Ptr
url-set
Set a URL component (scheme, host, path, etc.). Returns CURLUcode.
Ptr -> Int -> String -> Int -> Int
url-get
Get a URL component. Returns the component string (empty on error).
Ptr -> Int -> Int -> String
url-get-code
Get the CURLUcode from the last url-get call.
-> Int
url-strerror
Get error string for a CURLUcode.
Int -> String
share-init
Create a share handle for sharing data between easy handles.
-> Ptr
share-cleanup
Destroy a share handle.
Ptr -> Unit
share-setopt-long
Set a long option on a share handle.
Ptr -> Int -> Int -> Int
share-strerror
Get error string for a CURLSHcode.
Int -> String
ws-recv
Receive WebSocket data. Returns CURLcode.
Ptr -> Int -> Int
ws-get-recv-data
Get received data from last ws-recv call.
-> String
ws-get-recv-len
Get number of bytes received from last ws-recv call.
-> Int
ws-get-recv-flags
Get WebSocket frame flags from last ws-recv call.
-> Int
ws-get-recv-offset
Get bytes offset in frame from last ws-recv call.
-> Int
ws-get-recv-bytesleft
Get bytes remaining in frame from last ws-recv call.
-> Int
ws-send
Send WebSocket data. Returns CURLcode.
Ptr -> String -> Int -> Int -> Int
ws-get-sent
Get number of bytes sent from last ws-send call.
-> Int
free
Free curl-allocated memory.
Ptr -> Unit
getdate
Parse a date string into a Unix timestamp (seconds since epoch). Returns -1 if the date string could not be parsed.
String -> Int
header
Look up a response header by name after a transfer. Returns CURLHcode (0 = success). Use header-get-* functions for results.
Parameters:
Ptr -> NonEmptyString -> NonNegativeInt -> Int -> Int -> Int
header-get-name
Get the header name from last successful header lookup.
-> String
header-get-value
Get the header value from last successful header lookup.
-> String
header-get-amount
Get the count of headers with this name.
-> Int
header-get-index
Get the index of this header instance.
-> Int
header-get-origin
Get the origin bitmask of this header.
-> Int
nextheader
Iterate to the next header. Returns 1 if found, 0 if no more. Pass prev-name="" and prev-index=-1 to start iteration.
Ptr -> Int -> Int -> String -> Int -> Int
version-info-init
Populate version info fields. Call before using version-info-* getters.
-> Unit
version-info-version
Get the libcurl version number string (e.g., "8.5.0").
-> String
version-info-host
Get the host platform string.
-> String
version-info-ssl
Get the SSL library version string (e.g., "OpenSSL/3.1.0").
-> String
version-info-libz
Get the zlib version string.
-> String
version-info-features
Get the features bitmask (CURL_VERSION_* flags).
-> Int
version-info-protocols
Get comma-separated list of supported protocols.
-> String
version-info-protocols-count
Get the number of supported protocols.
-> Int
option-id-by-name
Look up option ID by name. Returns the option ID or -1 if not found.
String -> Int
option-type-by-name
Look up option type by name. Returns the CURLOT_* type or -1 if not found.
String -> Int
option-name-by-name
Look up canonical option name by name. Returns "" if not found.
String -> String
option-name-by-id
Look up option name by ID. Returns "" if not found.
Int -> String
option-type-by-id
Look up option type by ID. Returns the CURLOT_* type or -1 if not found.
Int -> Int
curle-ok
Success return code (no error).
curle-unsupported-protocol
Unsupported protocol error code.
curle-failed-init
Failed initialization error code.
curle-url-malformat
Malformed URL error code.
curle-couldnt-resolve-host
Could not resolve host error code.
curle-couldnt-connect
Could not connect error code.
curle-operation-timedout
Operation timed out error code.
curle-ssl-connect-error
SSL connection error code.
curlopt-verbose
Enable verbose output option.
curlopt-header
Include header in output option.
curlopt-noprogress
Disable progress meter option.
curlopt-nobody
Do not include body in output option.
curlopt-url
URL to work with option.
curlopt-port
Port number to connect to option.
curlopt-timeout
Maximum time allowed for operation in seconds option.
curlopt-timeout-ms
Maximum time allowed for operation in milliseconds option.
curlopt-connecttimeout
Connection timeout in seconds option.
curlopt-connecttimeout-ms
Connection timeout in milliseconds option.
curlopt-httpget
Force HTTP GET request option.
curlopt-post
Make HTTP POST request option.
curlopt-postfields
POST data to send option.
curlopt-postfieldsize
Size of POST data option.
curlopt-httpheader
Custom HTTP headers option.
curlopt-useragent
User agent string option.
curlopt-referer
Referer header option.
curlopt-followlocation
Follow HTTP redirects option.
curlopt-maxredirs
Maximum number of redirects to follow option.
curlopt-customrequest
Custom HTTP method option.
curlopt-ssl-verifypeer
Verify SSL peer certificate option.
curlopt-ssl-verifyhost
Verify SSL host certificate option.
curlopt-cainfo
CA certificate bundle file path option.
curlopt-capath
CA certificate directory path option.
curlopt-cookie
Cookie string to send option.
curlopt-cookiefile
File to read cookies from (empty string enables in-memory cookie engine).
curlopt-cookiejar
File to write cookies to option.
curlopt-httpauth
HTTP authentication methods option.
curlopt-username
Username for authentication option.
curlopt-password
Password for authentication option.
curlopt-userpwd
Username and password for authentication option.
curlopt-writefunction
Callback for writing received data option.
curlopt-writedata
User data for write callback option.
curlopt-readfunction
Callback for reading data to send option.
curlopt-readdata
User data for read callback option.
curlopt-headerfunction
Callback for processing headers option.
curlopt-headerdata
User data for header callback option.
curlinfo-response-code
HTTP response code info constant.
curlinfo-total-time
Total time for transfer info constant.
curlinfo-namelookup-time
Name lookup time info constant.
curlinfo-connect-time
Connection time info constant.
curlinfo-content-type
Content type info constant.
curlinfo-content-length-download
Content length download info constant.
curlinfo-redirect-count
Redirect count info constant.
curl-global-default
Default global initialization flag.
curl-global-ssl
SSL global initialization flag.
curl-global-win32
Win32 global initialization flag.
curl-global-all
All global initialization flags.
curl-global-nothing
No global initialization flag.
curlsslset-ok
SSL backend was set successfully.
curlsslset-unknown-backend
Specified SSL backend not recognized.
curlsslset-too-late
Called too late (after global-init).
curlsslset-no-backends
No SSL backends available.
curl-socket-timeout
Timeout socket descriptor for multi-socket-action.
curl-cselect-in
Socket readable event flag.
curl-cselect-out
Socket writable event flag.
curl-cselect-err
Socket error event flag.
curlauth-basic
Basic HTTP authentication constant.
curlauth-digest
Digest HTTP authentication constant.
curlauth-bearer
Bearer HTTP authentication constant.
curl-pause-recv
Pause receiving data.
curl-pause-send
Pause sending data.
curl-pause-all
Pause both sending and receiving.
curl-pause-cont
Unpause (continue transfer).
curlopt-accept-encoding
Accept-Encoding header (gzip, deflate, br) option.
curlopt-http-version
HTTP version to use option.
curlopt-range
Byte range to request option.
curlopt-resume-from
Resume transfer from offset option.
curlopt-resume-from-large
Resume transfer from large offset option.
curlopt-failonerror
Fail on HTTP 4xx+ errors option.
curlopt-upload
Enable upload mode option.
curlopt-copypostfields
Copy POST data option.
curlopt-postfieldsize-large
Large POST data size option.
curlopt-mimepost
MIME POST data option.
curlopt-autoreferer
Auto-set Referer header option.
curlopt-transfer-encoding
Request Transfer-Encoding option.
curlopt-expect-100-timeout-ms
Expect 100-continue timeout in milliseconds option.
curlopt-headeropt
Header options option.
curlopt-proxyheader
Proxy-specific headers option.
curlopt-request-target
Custom request target option.
curlopt-http09-allowed
Allow HTTP/0.9 responses option.
curlopt-path-as-is
Do not normalize URL path option.
curlopt-proxy
Proxy URL option.
curlopt-proxyport
Proxy port option.
curlopt-proxytype
Proxy type option.
curlopt-proxyuserpwd
Proxy user:password option.
curlopt-proxyusername
Proxy username option.
curlopt-proxypassword
Proxy password option.
curlopt-proxyauth
Proxy auth methods option.
curlopt-noproxy
No-proxy host list option.
curlopt-httpproxytunnel
HTTP proxy tunnel option.
curlopt-pre-proxy
Pre-proxy (SOCKS before HTTP proxy) option.
curlopt-sslcert
Client certificate file option.
curlopt-sslcerttype
Certificate type (PEM, DER) option.
curlopt-sslkey
Private key file option.
curlopt-sslkeytype
Key type option.
curlopt-keypasswd
Key password option.
curlopt-sslversion
SSL version option.
curlopt-ssl-cipher-list
SSL cipher list option.
curlopt-tls13-ciphers
TLS 1.3 cipher suites option.
curlopt-ssl-options
SSL behavior flags option.
curlopt-ssl-sessionid-cache
Session ID cache option.
curlopt-ssl-verifystatus
OCSP stapling verification option.
curlopt-pinnedpublickey
Public key pinning option.
curlopt-crlfile
CRL file option.
curlopt-issuercert
Issuer certificate option.
curlopt-certinfo
Certificate chain info option.
curlopt-sslcert-blob
Certificate from memory (blob) option.
curlopt-sslkey-blob
Key from memory (blob) option.
curlopt-cainfo-blob
CA info from memory (blob) option.
curlopt-sslengine
SSL engine option.
curlopt-sslengine-default
Default SSL engine option.
curlopt-ssl-ec-curves
EC curves option.
curlopt-proxy-cainfo
Proxy CA info option.
curlopt-proxy-capath
Proxy CA path option.
curlopt-proxy-sslcert
Proxy client certificate option.
curlopt-proxy-sslcerttype
Proxy certificate type option.
curlopt-proxy-sslkey
Proxy client key option.
curlopt-proxy-sslkeytype
Proxy key type option.
curlopt-proxy-keypasswd
Proxy key password option.
curlopt-proxy-ssl-cipher-list
Proxy cipher list option.
curlopt-proxy-tls13-ciphers
Proxy TLS 1.3 ciphers option.
curlopt-proxy-ssl-options
Proxy SSL behavior flags option.
curlopt-proxy-ssl-verifypeer
Proxy verify peer option.
curlopt-proxy-ssl-verifyhost
Proxy verify host option.
curlopt-proxy-sslversion
Proxy SSL version option.
curlopt-proxy-crlfile
Proxy CRL file option.
curlopt-proxy-pinnedpublickey
Proxy pinned public key option.
curlopt-tlsauth-username
TLS-SRP username option.
curlopt-tlsauth-password
TLS-SRP password option.
curlopt-tlsauth-type
TLS auth type option.
curlopt-proxy-tlsauth-username
Proxy TLS-SRP username option.
curlopt-proxy-tlsauth-password
Proxy TLS-SRP password option.
curlopt-proxy-tlsauth-type
Proxy TLS auth type option.
curlopt-dns-cache-timeout
DNS cache timeout in seconds option.
curlopt-dns-servers
Custom DNS servers option.
curlopt-dns-interface
DNS interface option.
curlopt-dns-local-ip4
DNS local IPv4 address option.
curlopt-dns-local-ip6
DNS local IPv6 address option.
curlopt-dns-shuffle-addresses
Shuffle DNS addresses option.
curlopt-doh-url
DNS-over-HTTPS URL option.
curlopt-doh-ssl-verifypeer
DoH SSL verify peer option.
curlopt-doh-ssl-verifyhost
DoH SSL verify host option.
curlopt-doh-ssl-verifystatus
DoH SSL verify status option.
curlopt-tcp-nodelay
Disable Nagle's algorithm option.
curlopt-tcp-keepalive
TCP keep-alive option.
curlopt-tcp-keepidle
Keep-alive idle time option.
curlopt-tcp-keepintvl
Keep-alive interval option.
curlopt-tcp-keepcnt
Keep-alive probe count option.
curlopt-tcp-fastopen
TCP Fast Open option.
curlopt-localport
Local port option.
curlopt-localportrange
Local port range option.
curlopt-ipresolve
IP version preference option.
curlopt-connect-only
Connect only (no transfer) option.
curlopt-interface
Source interface option.
curlopt-address-scope
IPv6 address scope option.
curlopt-happy-eyeballs-timeout-ms
Happy Eyeballs timeout in milliseconds option.
curlopt-upkeep-interval-ms
Connection upkeep interval in milliseconds option.
curlopt-fresh-connect
Force fresh connection option.
curlopt-forbid-reuse
Forbid connection reuse option.
curlopt-maxconnects
Max connection cache size option.
curlopt-maxage-conn
Max idle connection age option.
curlopt-maxlifetime-conn
Max connection lifetime option.
curlopt-nosignal
No signals option.
curlopt-buffersize
Receive buffer size option.
curlopt-pipewait
Wait for HTTP multiplexing option.
curlopt-stream-weight
HTTP/2 stream weight option.
curlopt-connect-to
Connect-to host mapping option.
curlopt-max-send-speed-large
Upload speed limit (off_t) option.
curlopt-max-recv-speed-large
Download speed limit (off_t) option.
curlopt-low-speed-limit
Low speed bytes/sec threshold option.
curlopt-low-speed-time
Low speed time threshold option.
curlopt-infilesize
Upload file size option.
curlopt-infilesize-large
Large upload size (off_t) option.
curlopt-maxfilesize
Max download size option.
curlopt-maxfilesize-large
Max download size (off_t) option.
curlopt-login-options
Login options option.
curlopt-sasl-authzid
SASL authorization identity option.
curlopt-sasl-ir
SASL initial response option.
curlopt-xoauth2-bearer
OAuth2 bearer token option.
curlopt-aws-sigv4
AWS Signature V4 option.
curlopt-unrestricted-auth
Auth on redirects option.
curlopt-netrc
Netrc usage option.
curlopt-netrc-file
Netrc file path option.
curlopt-cookiesession
New cookie session option.
curlopt-cookielist
Cookie manipulation option.
curlopt-postredir
POST on redirect behavior option.
curlopt-xferinfofunction
Progress callback (modern) option.
curlopt-debugfunction
Debug callback option.
curlopt-seekfunction
Seek callback option.
curlopt-sockoptfunction
Socket option callback option.
curlopt-opensocketfunction
Open socket callback option.
curlopt-closesocketfunction
Close socket callback option.
curlopt-ssl-ctx-function
SSL context callback option.
curlopt-prereqfunction
Pre-request callback option.
curlopt-trailerfunction
HTTP trailer callback option.
curlopt-xferinfodata
Progress callback data option.
curlopt-debugdata
Debug callback data option.
curlopt-seekdata
Seek callback data option.
curlopt-sockoptdata
Socket option callback data option.
curlopt-opensocketdata
Open socket callback data option.
curlopt-closesocketdata
Close socket callback data option.
curlopt-ssl-ctx-data
SSL context callback data option.
curlopt-prereqdata
Pre-request callback data option.
curlopt-trailerdata
Trailer callback data option.
curlopt-private
Private user data option.
curlopt-errorbuffer
Error message buffer option.
curlopt-stderr
Stderr replacement option.
curlopt-share
Share handle option.
curlopt-curlu
CURLU handle for URL option.
curlopt-resolve
DNS resolve overrides option.
curlopt-filetime
Get remote file time option.
curlopt-timecondition
Time condition option.
curlopt-timevalue
Time condition value option.
curlopt-timevalue-large
Time condition value (off_t) option.
curlopt-crlf
CRLF conversion option.
curlopt-dirlistonly
List directory only option.
curlopt-append
Append to remote file option.
curlopt-transfertext
ASCII transfer mode option.
curlopt-keep-sending-on-error
Keep sending on error option.
curlopt-suppress-connect-headers
Suppress CONNECT response headers option.
curlopt-disallow-username-in-url
Reject embedded credentials in URL option.
curlopt-haproxyprotocol
HAProxy protocol option.
curlopt-haproxy-client-ip
HAProxy client IP option.
curlopt-quick-exit
Quick exit option.
curlopt-protocols-str
Allowed protocols (string) option.
curlopt-redir-protocols-str
Redirect protocols (string) option.
curlopt-default-protocol
Default protocol option.
curlopt-server-response-timeout
Server response timeout option.
curlopt-server-response-timeout-ms
Server response timeout in milliseconds option.
curlopt-mime-options
MIME options option.
curlopt-ws-options
WebSocket options option.
curlopt-ca-cache-timeout
CA cache timeout option.
curlopt-ech
Encrypted Client Hello option.
curlopt-altsvc
Alt-Svc cache file option.
curlopt-altsvc-ctrl
Alt-Svc control option.
curlopt-hsts
HSTS cache file option.
curlopt-hsts-ctrl
HSTS control option.
curlopt-ftpport
FTP PORT command option.
curlopt-ftp-use-epsv
Use EPSV option.
curlopt-ftp-use-eprt
Use EPRT option.
curlopt-ftp-create-missing-dirs
Create missing directories option.
curlopt-ftp-skip-pasv-ip
Skip PASV IP option.
curlopt-ftp-filemethod
FTP file navigation method option.
curlopt-ftp-ssl-ccc
FTP SSL CCC option.
curlopt-ftp-account
FTP account option.
curlopt-ftp-alternative-to-user
FTP alternative to USER option.
curlopt-ftpsslauth
FTP SSL auth type option.
curlopt-quote
FTP pre-transfer commands option.
curlopt-postquote
FTP post-transfer commands option.
curlopt-prequote
FTP pre-command commands option.
curlopt-ssh-auth-types
SSH auth types option.
curlopt-ssh-public-keyfile
SSH public key file option.
curlopt-ssh-private-keyfile
SSH private key file option.
curlopt-ssh-host-public-key-md5
SSH host key MD5 option.
curlopt-ssh-host-public-key-sha256
SSH host key SHA256 option.
curlopt-ssh-knownhosts
SSH known hosts file option.
curlopt-ssh-compression
SSH compression option.
curlopt-rtsp-request
RTSP request type option.
curlopt-rtsp-session-id
RTSP session ID option.
curlopt-rtsp-stream-uri
RTSP stream URI option.
curlopt-rtsp-transport
RTSP transport option.
curlopt-mail-from
SMTP sender option.
curlopt-mail-rcpt
SMTP recipients option.
curlopt-mail-rcpt-allowfails
Allow RCPT failures option.
curlopt-tftp-blksize
TFTP block size option.
curlopt-tftp-no-options
TFTP no options option.
curlopt-telnetoptions
Telnet options option.
curlopt-unix-socket-path
Unix socket path option.
curlopt-abstract-unix-socket
Abstract Unix socket option.
curlinfo-effective-url
Final URL after redirects info constant.
curlinfo-redirect-url
Redirect destination URL info constant.
curlinfo-primary-ip
Remote IP address info constant.
curlinfo-local-ip
Local IP address info constant.
curlinfo-scheme
URL scheme info constant.
curlinfo-effective-method
HTTP method used info constant.
curlinfo-referer
Referer used info constant.
curlinfo-cainfo
CA info path info constant.
curlinfo-capath
CA path info constant.
curlinfo-ftp-entry-path
FTP entry path info constant.
curlinfo-rtsp-session-id
RTSP session ID info constant.
curlinfo-header-size
Header size info constant.
curlinfo-request-size
Request size info constant.
curlinfo-http-connectcode
CONNECT response code info constant.
curlinfo-httpauth-avail
Available auth methods info constant.
curlinfo-proxyauth-avail
Proxy auth available info constant.
curlinfo-os-errno
OS error number info constant.
curlinfo-num-connects
Connection count info constant.
curlinfo-ssl-verifyresult
SSL verify result info constant.
curlinfo-proxy-ssl-verifyresult
Proxy SSL verify result info constant.
curlinfo-http-version
HTTP version used info constant.
curlinfo-filetime
Remote file time info constant.
curlinfo-local-port
Local port info constant.
curlinfo-primary-port
Remote port info constant.
curlinfo-condition-unmet
Time condition unmet info constant.
curlinfo-used-proxy
Proxy used info constant.
curlinfo-conn-id
Connection ID info constant.
curlinfo-xfer-id
Transfer ID info constant.
curlinfo-appconnect-time
TLS handshake time info constant.
curlinfo-pretransfer-time
Pre-transfer time info constant.
curlinfo-starttransfer-time
First byte time info constant.
curlinfo-redirect-time
Redirect time info constant.
curlinfo-size-download
Downloaded bytes info constant.
curlinfo-size-upload
Uploaded bytes info constant.
curlinfo-speed-download
Download speed info constant.
curlinfo-speed-upload
Upload speed info constant.
curlinfo-content-length-upload
Content length upload info constant.
curlinfo-total-time-t
Total time in microseconds info constant.
curlinfo-namelookup-time-t
DNS time in microseconds info constant.
curlinfo-connect-time-t
Connect time in microseconds info constant.
curlinfo-appconnect-time-t
TLS time in microseconds info constant.
curlinfo-pretransfer-time-t
Pre-transfer time in microseconds info constant.
curlinfo-starttransfer-time-t
First byte time in microseconds info constant.
curlinfo-redirect-time-t
Redirect time in microseconds info constant.
curlinfo-size-download-t
Downloaded bytes (off_t) info constant.
curlinfo-size-upload-t
Uploaded bytes (off_t) info constant.
curlinfo-speed-download-t
Download speed (off_t) info constant.
curlinfo-speed-upload-t
Upload speed (off_t) info constant.
curlinfo-content-length-download-t
Content length download (off_t) info constant.
curlinfo-content-length-upload-t
Content length upload (off_t) info constant.
curlinfo-filetime-t
File time (off_t) info constant.
curlinfo-queue-time-t
Queue time in microseconds info constant.
curlinfo-retry-after
Retry-After value info constant.
curle-not-built-in
Not built in error code.
curle-couldnt-resolve-proxy
Could not resolve proxy error code.
curle-weird-server-reply
Weird server reply error code.
curle-remote-access-denied
Remote access denied error code.
curle-ftp-accept-failed
FTP accept failed error code.
curle-ftp-weird-pass-reply
FTP weird PASS reply error code.
curle-ftp-accept-timeout
FTP accept timeout error code.
curle-ftp-weird-pasv-reply
FTP weird PASV reply error code.
curle-ftp-weird-227-format
FTP weird 227 format error code.
curle-ftp-cant-get-host
FTP can't get host error code.
curle-http2
HTTP/2 error code.
curle-ftp-couldnt-set-type
FTP couldn't set type error code.
curle-partial-file
Partial file error code.
curle-ftp-couldnt-retr-file
FTP couldn't retrieve file error code.
curle-quote-error
Quote error code.
curle-http-returned-error
HTTP returned error code.
curle-write-error
Write error code.
curle-upload-failed
Upload failed error code.
curle-read-error
Read error code.
curle-out-of-memory
Out of memory error code.
curle-ftp-port-failed
FTP PORT failed error code.
curle-ftp-couldnt-use-rest
FTP couldn't use REST error code.
curle-range-error
Range error code.
curle-bad-download-resume
Bad download resume error code.
curle-file-couldnt-read-file
File couldn't read file error code.
curle-ldap-cannot-bind
LDAP cannot bind error code.
curle-ldap-search-failed
LDAP search failed error code.
curle-aborted-by-callback
Aborted by callback error code.
curle-bad-function-argument
Bad function argument error code.
curle-interface-failed
Interface failed error code.
curle-too-many-redirects
Too many redirects error code.
curle-unknown-option
Unknown option error code.
curle-setopt-option-syntax
Setopt option syntax error code.
curle-got-nothing
Got nothing error code.
curle-ssl-engine-notfound
SSL engine not found error code.
curle-ssl-engine-setfailed
SSL engine set failed error code.
curle-send-error
Send error code.
curle-recv-error
Receive error code.
curle-ssl-certproblem
SSL certificate problem error code.
curle-ssl-cipher
SSL cipher error code.
curle-peer-failed-verification
Peer failed verification error code.
curle-bad-content-encoding
Bad content encoding error code.
curle-filesize-exceeded
File size exceeded error code.
curle-use-ssl-failed
Use SSL failed error code.
curle-send-fail-rewind
Send fail rewind error code.
curle-ssl-engine-initfailed
SSL engine init failed error code.
curle-login-denied
Login denied error code.
curle-tftp-notfound
TFTP not found error code.
curle-tftp-perm
TFTP permission error code.
curle-remote-disk-full
Remote disk full error code.
curle-tftp-illegal
TFTP illegal error code.
curle-tftp-unknownid
TFTP unknown ID error code.
curle-remote-file-exists
Remote file exists error code.
curle-tftp-nosuchuser
TFTP no such user error code.
curle-ssl-cacert-badfile
SSL CA cert bad file error code.
curle-remote-file-not-found
Remote file not found error code.
curle-ssh
SSH error code.
curle-ssl-shutdown-failed
SSL shutdown failed error code.
curle-again
Again (retry) error code.
curle-ssl-crl-badfile
SSL CRL bad file error code.
curle-ssl-issuer-error
SSL issuer error code.
curle-ftp-pret-failed
FTP PRET failed error code.
curle-rtsp-cseq-error
RTSP CSeq error code.
curle-rtsp-session-error
RTSP session error code.
curle-ftp-bad-file-list
FTP bad file list error code.
curle-chunk-failed
Chunk failed error code.
curle-no-connection-available
No connection available error code.
curle-ssl-pinnedpubkeynotmatch
SSL pinned public key not match error code.
curle-ssl-invalidcertstatus
SSL invalid cert status error code.
curle-http2-stream
HTTP/2 stream error code.
curle-recursive-api-call
Recursive API call error code.
curle-auth-error
Auth error code.
curle-http3
HTTP/3 error code.
curle-quic-connect-error
QUIC connect error code.
curle-proxy
Proxy error code.
curle-ssl-clientcert
SSL client cert error code.
curle-unrecoverable-poll
Unrecoverable poll error code.
curle-too-large
Too large error code.
curle-ech-required
ECH required error code.
curl-http-version-none
No specific HTTP version.
curl-http-version-1-0
HTTP/1.0.
curl-http-version-1-1
HTTP/1.1.
curl-http-version-2-0
HTTP/2.0.
curl-http-version-2tls
HTTP/2 over TLS only.
curl-http-version-2-prior-knowledge
HTTP/2 with prior knowledge.
curl-http-version-3
HTTP/3.
curl-http-version-3only
HTTP/3 only.
curlproxy-http
HTTP proxy.
curlproxy-http-1-0
HTTP/1.0 proxy.
curlproxy-https
HTTPS proxy.
curlproxy-https2
HTTPS/2 proxy.
curlproxy-socks4
SOCKS4 proxy.
curlproxy-socks5
SOCKS5 proxy.
curlproxy-socks4a
SOCKS4a proxy.
curlproxy-socks5-hostname
SOCKS5 hostname proxy.
curlauth-none
No authentication.
curlauth-negotiate
Negotiate authentication.
curlauth-ntlm
NTLM authentication.
curlauth-digest-ie
Digest IE authentication.
curlauth-aws-sigv4
AWS Signature V4 authentication.
curl-sslversion-default
Default SSL version.
curl-sslversion-tlsv1
TLS v1.x.
curl-sslversion-tlsv1-0
TLS v1.0.
curl-sslversion-tlsv1-1
TLS v1.1.
curl-sslversion-tlsv1-2
TLS v1.2.
curl-sslversion-tlsv1-3
TLS v1.3.
curlsslopt-allow-beast
Allow BEAST attack.
curlsslopt-no-revoke
No revocation check.
curlsslopt-no-partialchain
No partial chain.
curlsslopt-revoke-best-effort
Best effort revocation.
curlsslopt-native-ca
Use native CA store.
curlsslopt-auto-client-cert
Auto client cert.
curlsslopt-earlydata
Allow early data.
curl-ipresolve-whatever
Resolve to any IP version.
curl-ipresolve-v4
Resolve to IPv4 only.
curl-ipresolve-v6
Resolve to IPv6 only.
curlusessl-none
No SSL.
curlusessl-try
Try SSL.
curlusessl-control
SSL for control connection.
curlusessl-all
SSL for all connections.
curl-netrc-ignored
Ignore netrc.
curl-netrc-optional
Netrc optional.
curl-netrc-required
Netrc required.
curl-timecond-none
No time condition.
curl-timecond-ifmodsince
If modified since.
curl-timecond-ifunmodsince
If unmodified since.
curl-timecond-lastmod
Last modification.
curl-redir-post-301
POST on 301 redirect.
curl-redir-post-302
POST on 302 redirect.
curl-redir-post-303
POST on 303 redirect.
curl-redir-post-all
POST on all redirects.
curl-sslversion-max-default
Max SSL version: default.
curl-sslversion-max-tlsv1-0
Max SSL version: TLS 1.0.
curl-sslversion-max-tlsv1-1
Max SSL version: TLS 1.1.
curl-sslversion-max-tlsv1-2
Max SSL version: TLS 1.2.
curl-sslversion-max-tlsv1-3
Max SSL version: TLS 1.3.
curlauth-only
Auth: only use specified type.
curlauth-any
Auth: any method.
curlauth-anysafe
Auth: any safe method (no Basic).
curlftpmethod-default
FTP method: default.
curlftpmethod-multicwd
FTP method: multi CWD.
curlftpmethod-nocwd
FTP method: no CWD.
curlftpmethod-singlecwd
FTP method: single CWD.
curlftpauth-default
FTP auth: default.
curlftpauth-ssl
FTP auth: SSL.
curlftpauth-tls
FTP auth: TLS.
curlssh-auth-publickey
SSH auth: public key.
curlssh-auth-password
SSH auth: password.
curlssh-auth-host
SSH auth: host.
curlssh-auth-keyboard
SSH auth: keyboard interactive.
curlssh-auth-agent
SSH auth: agent.
curlssh-auth-gssapi
SSH auth: GSSAPI.
curlssh-auth-default
SSH auth: default (all types).
curl-rtspreq-options
RTSP request: OPTIONS.
curl-rtspreq-describe
RTSP request: DESCRIBE.
curl-rtspreq-announce
RTSP request: ANNOUNCE.
curl-rtspreq-setup
RTSP request: SETUP.
curl-rtspreq-play
RTSP request: PLAY.
curl-rtspreq-pause
RTSP request: PAUSE.
curl-rtspreq-teardown
RTSP request: TEARDOWN.
curl-rtspreq-record
RTSP request: RECORD.
curl-rtspreq-receive
RTSP request: RECEIVE.
curl-rtspreq-get-parameter
RTSP request: GET_PARAMETER.
curl-rtspreq-set-parameter
RTSP request: SET_PARAMETER.
curlaltsvc-readonlyfile
Alt-Svc: read-only file.
curlaltsvc-h1
Alt-Svc: HTTP/1.1.
curlaltsvc-h2
Alt-Svc: HTTP/2.
curlaltsvc-h3
Alt-Svc: HTTP/3.
curlhsts-enable
HSTS: enable.
curlhsts-readonlyfile
HSTS: read-only file.
curlmopt-maxconnects
Multi: connection cache size.
curlmopt-max-host-connections
Multi: per-host connection limit.
curlmopt-max-total-connections
Multi: total connection limit.
curlmopt-max-concurrent-streams
Multi: HTTP/2 stream limit.
curlmopt-pipelining
Multi: HTTP multiplexing.
curlm-ok
Multi: success.
curlm-bad-handle
Multi: bad handle.
curlm-bad-easy-handle
Multi: bad easy handle.
curlm-out-of-memory
Multi: out of memory.
curlm-internal-error
Multi: internal error.
curlm-bad-socket
Multi: bad socket.
curlm-unknown-option
Multi: unknown option.
curlm-added-already
Multi: already added.
curlm-recursive-api-call
Multi: recursive API call.
curlm-wakeup-failure
Multi: wakeup failure.
curlm-bad-function-argument
Multi: bad function argument.
curlm-aborted-by-callback
Multi: aborted by callback.
curlm-unrecoverable-poll
Multi: unrecoverable poll.
curlupart-url
URL part: complete URL.
curlupart-scheme
URL part: scheme (e.g., "https").
curlupart-user
URL part: user.
curlupart-password
URL part: password.
curlupart-options
URL part: options (IMAP-style).
curlupart-host
URL part: hostname.
curlupart-port
URL part: port number (as string).
curlupart-path
URL part: path.
curlupart-query
URL part: query string.
curlupart-fragment
URL part: fragment (after #).
curlupart-zoneid
URL part: zone ID (IPv6).
curlue-ok
URL: success.
curlue-bad-handle
URL: bad handle.
curlue-bad-partpointer
URL: bad part name.
curlue-malformed-input
URL: malformed input.
curlue-bad-port-number
URL: bad port number.
curlue-unsupported-scheme
URL: unsupported scheme.
curlue-urldecode
URL: URL decode error.
curlue-out-of-memory
URL: out of memory.
curlue-user-not-allowed
URL: user not allowed.
curlue-unknown-part
URL: unknown part.
curlue-no-scheme
URL: no scheme.
curlue-no-user
URL: no user.
curlue-no-password
URL: no password.
curlue-no-options
URL: no options.
curlue-no-host
URL: no host.
curlue-no-port
URL: no port.
curlue-no-query
URL: no query.
curlue-no-fragment
URL: no fragment.
curlue-no-zoneid
URL: no zone ID.
curlue-bad-file-url
URL: bad file URL.
curlue-bad-fragment
URL: bad fragment.
curlue-bad-hostname
URL: bad hostname.
curlue-bad-ipv6
URL: bad IPv6.
curlue-bad-login
URL: bad login.
curlue-bad-password
URL: bad password.
curlue-bad-path
URL: bad path.
curlue-bad-query
URL: bad query.
curlue-bad-scheme
URL: bad scheme.
curlue-bad-slashes
URL: bad slashes.
curlue-bad-user
URL: bad user.
curlue-lacks-idn
URL: lacks IDN support.
curlue-too-large
URL: too large.
curlu-default-scheme
URL flag: default (no flags).
curlu-non-support-scheme
URL flag: non-support scheme.
curlu-path-as-is
URL flag: decode path.
curlu-disallow-user
URL flag: disallow user.
curlu-urldecode
URL flag: URL decode.
curlu-urlencode
URL flag: URL encode.
curlu-appendquery
URL flag: append query.
curlu-guess-scheme
URL flag: guess scheme.
curlu-no-default-port
URL flag: no default port.
curlu-default-port
URL flag: default port.
curlu-no-authority
URL flag: no authority.
curlu-allow-space
URL flag: allow space.
curlu-punycode
URL flag: punycode.
curlu-puny2idn
URL flag: puny2idn.
curlshopt-share
Share option: data to share.
curlshopt-unshare
Share option: data to stop sharing.
curlshopt-lockfunc
Share option: lock callback function.
curlshopt-unlockfunc
Share option: unlock callback function.
curlshopt-userdata
Share option: callback user data.
curl-lock-data-cookie
Share data: cookies.
curl-lock-data-dns
Share data: DNS cache.
curl-lock-data-ssl-session
Share data: SSL sessions.
curl-lock-data-connect
Share data: connection pool.
curl-lock-data-psl
Share data: Public Suffix List.
curl-lock-data-hsts
Share data: HSTS cache.
curlshe-ok
Share: success.
curlshe-bad-option
Share: bad option.
curlshe-in-use
Share: in use.
curlshe-invalid
Share: invalid.
curlshe-nomem
Share: no memory.
curlshe-not-built-in
Share: feature not built in.
curlws-text
WebSocket: text frame.
curlws-binary
WebSocket: binary frame.
curlws-cont
WebSocket: continuation frame.
curlws-close
WebSocket: close frame.
curlws-ping
WebSocket: ping frame.
curlws-pong
WebSocket: pong frame.
curlws-offset
WebSocket: offset in frame.
curlws-raw-mode
WebSocket: raw mode option.
curlh-header
Header origin: plain server header.
curlh-trailer
Header origin: trailers.
curlh-connect
Header origin: CONNECT headers.
curlh-1xx
Header origin: 1xx informational headers.
curlh-pseudo
Header origin: pseudo headers.
curlhe-ok
Header: success.
curlhe-badindex
Header: header exists but not with this index.
curlhe-missing
Header: no such header exists.
curlhe-noheaders
Header: no headers at all exist yet.
curlhe-norequest
Header: no request with this number was used.
curlhe-out-of-memory
Header: out of memory.
curlhe-bad-argument
Header: bad function argument.
curlhe-not-built-in
Header: API not built in.
curl-version-ipv6
Feature: IPv6 support.
curl-version-kerberos4
Feature: Kerberos V4 auth.
curl-version-ssl
Feature: SSL/TLS support.
curl-version-libz
Feature: libz compression.
curl-version-ntlm
Feature: NTLM auth.
curl-version-gssnegotiate
Feature: GSS-Negotiate auth.
curl-version-asynchdns
Feature: asynchronous DNS.
curl-version-spnego
Feature: SPNEGO auth.
curl-version-largefile
Feature: large file support.
curl-version-idn
Feature: IDN support.
curl-version-sspi
Feature: SSPI support.
curl-version-http2
Feature: HTTP/2 support.
curl-version-gssapi
Feature: GSSAPI support.
curl-version-kerberos5
Feature: Kerberos V5 auth.
curl-version-unix-sockets
Feature: Unix domain sockets.
curl-version-psl
Feature: PSL (Public Suffix List).
curl-version-https-proxy
Feature: HTTPS proxy support.
curl-version-multi-ssl
Feature: multi-SSL backend support.
curl-version-brotli
Feature: Brotli compression.
curl-version-altsvc
Feature: Alt-Svc support.
curl-version-http3
Feature: HTTP/3 support.
curl-version-zstd
Feature: Zstd compression.
curl-version-unicode
Feature: unicode support.
curl-version-hsts
Feature: HSTS support.
curl-version-gsasl
Feature: gsasl support.
curlot-long
Option type: long.
curlot-values
Option type: object pointer (void*).
curlot-off-t
Option type: offset (curl_off_t).
curlot-blob
Option type: blob.
curlot-string
Option type: string.
curlot-slist
Option type: slist.
curlot-cbptr
Option type: callback pointer.
curlot-function
Option type: function pointer.
get
Note: This module uses Kit's standard Result type (Ok a | Err String).
Performs a simple HTTP GET request.
Sends an HTTP GET request to the specified URL with default settings (30 second timeout, follows redirects automatically).
Parameters:
Returns:
NonEmptyString -> Result String String
result = Curl.get "https://api.github.com/users/octocat"
match result
| Success _ -> print "Data retrieved successfully"
| Error msg -> print "Failed: ${msg}"post
Performs a simple HTTP POST request with data.
Sends an HTTP POST request to the specified URL with the provided data (30 second timeout, follows redirects automatically).
Parameters:
Returns:
NonEmptyString -> String -> Result String String
payload = "name=John&email=john@example.com"
result = Curl.post "https://api.example.com/users" payload
match result
| Success _ -> print "User created successfully"
| Error msg -> print "Failed: ${msg}"put
Performs an HTTP PUT request with data.
Sends an HTTP PUT request to the specified URL with the provided data (30 second timeout, follows redirects automatically).
Parameters:
Returns:
NonEmptyString -> String -> Result String String
payload = "{\"name\":\"John Doe\",\"email\":\"john@example.com\"}"
result = Curl.put "https://api.example.com/users/123" payload
match result
| Success _ -> print "User updated successfully"
| Error msg -> print "Failed: ${msg}"delete
Performs an HTTP DELETE request.
Sends an HTTP DELETE request to the specified URL (30 second timeout, follows redirects automatically).
Parameters:
Returns:
NonEmptyString -> Result String String
result = Curl.delete "https://api.example.com/users/123"
match result
| Success _ -> print "User deleted successfully"
| Error msg -> print "Failed: ${msg}"head-request
Performs an HTTP HEAD request (headers only).
Sends an HTTP HEAD request to the specified URL, which retrieves only the response headers without the body (30 second timeout, follows redirects).
Parameters:
Returns:
NonEmptyString -> Result String String
result = Curl.head-request "https://api.example.com/users/123"
match result
| Success _ -> print "Resource exists"
| Error msg -> print "Failed: ${msg}"url-encode
URL-encodes a string for use in URLs.
Converts a string to URL-encoded format, replacing special characters with percent-encoded sequences (e.g., space becomes %20).
Parameters:
Returns:
String -> String
encoded = Curl.url-encode "hello world"
# Returns: "hello%20world"
query = "search=${Curl.url-encode user-input}"url-decode
URL-decodes a string from URL encoding.
String -> String
is-reachable?
Checks if a URL is reachable.
NonEmptyString -> Bool
error-message
Returns human-readable error message for a curl error code.
Int -> String
fetch
Performs an HTTP GET request and returns the response body and status code.
Unlike get, this function captures the full response body. Follows redirects automatically with a 30 second timeout.
Parameters:
Returns:
NonEmptyString -> Result {status: Int, body: String} String
match Curl.fetch "https://api.example.com/data"
| Ok response -> println "Body: ${response.body}"
| Err e -> println "Failed: ${e}"fetch-with-headers
Performs an HTTP GET request and returns the response body, status code, and headers.
Like fetch, but also captures response headers. Headers are returned as a newline-separated string containing all response headers.
Parameters:
Returns:
NonEmptyString -> Result {status: Int, body: String, headers: String} String
match Curl.fetch-with-headers "https://api.example.com/data"
| Ok response -> println "Headers: ${response.headers}"
| Err e -> println "Failed: ${e}"post-json
Performs an HTTP POST request with JSON data and returns the response.
Sends an HTTP POST request with Content-Type: application/json header. Follows redirects automatically with a 30 second timeout.
Parameters:
Returns:
NonEmptyString -> String -> Result {status: Int, body: String} String
match Curl.post-json "https://api.example.com/data" "{\"key\": \"value\"}"
| Ok resp -> println "Status: ${Int.to-string resp.status}"
| Err e -> println "Failed: ${e}"post-form
Performs a multipart form POST using the MIME API.
Sends a multipart/form-data POST with the given form fields. Each field is a record with name and value keys. Follows redirects automatically with a 30 second timeout.
Parameters:
Returns:
NonEmptyString -> List {name: String, value: String} -> Result {status: Int, body: String} String
fields = [{name: "username", value: "john"}, {name: "email", value: "john@example.com"}]
match Curl.post-form "https://api.example.com/form" fields
| Ok resp -> println "Status: ${Int.to-string resp.status}"
| Err e -> println "Failed: ${e}"upload-file
Uploads a file via multipart form POST.
Sends a multipart/form-data POST with a file attachment. The file is read from the local filesystem.
Parameters:
Returns:
NonEmptyString -> NonEmptyString -> NonEmptyString -> Result {status: Int, body: String} String
match Curl.upload-file "https://api.example.com/upload" "file" "/path/to/image.png"
| Ok resp -> println "Uploaded! Status: ${Int.to-string resp.status}"
| Err e -> println "Failed: ${e}"fetch-all
Fetches multiple URLs sequentially and returns a list of results.
Performs HTTP GET requests for all URLs and returns a list of results (Ok body or Err message) in the same order as the input URLs.
Parameters:
Returns:
List String -> List (Result String String)
results = Curl.fetch-all ["https://api.example.com/a", "https://api.example.com/b"]
List.map (fn(r) => match r | Ok body -> println body | Err e -> println e) resultsfetch-race
Fetches multiple URLs and returns the first successful result.
Tries each URL in order and returns the first Ok result. If all URLs fail, returns the last error.
Parameters:
Returns:
List String -> Result String String
match Curl.fetch-race ["https://primary.example.com", "https://fallback.example.com"]
| Ok body -> println body
| Err e -> println "All failed: ${e}"version-info
Returns detailed version information about the libcurl library.
Returns a record with version details, supported protocols, and feature flags.
{version: String, host: String, ssl: String, libz: String, protocols: String, protocol-count: Int, features: Int}
info = Curl.version-info
println "Version: ${info.version}"
println "SSL: ${info.ssl}"
println "Protocols: ${info.protocols}"has-feature?
Check if a specific feature is supported by the libcurl build.
Uses the CURL_VERSION_* feature flags to check for specific capabilities.
Parameters:
Returns:
Int -> Bool
if Curl.has-feature? Curl.curl-version-http2 then
println "HTTP/2 is supported"option-info
Look up a curl option by name and return its metadata.
Note: Names are stored without the "CURLOPT_" prefix (e.g., "URL" not "CURLOPT_URL").
Parameters:
Returns:
String -> Result {name: String, id: Int, option-type: Int} String
match Curl.option-info "URL"
| Ok info -> println "ID: ${Int.to-string info.id}"
| Err e -> println eoption-info-by-id
Look up a curl option by ID and return its metadata.
Parameters:
Returns:
Int -> Result {name: String, id: Int, option-type: Int} String
match Curl.option-info-by-id 10002
| Ok info -> println "Name: ${info.name}"
| Err e -> println e