curl_easy_setopt(3)
๐ NAME ๐
okay so bestie, welcome to curl_easy_setopt(3) from the Library Functions Manual โ the iconic function for setting options for a curl easy handle. ๐
๐ฆ SYNOPSIS ๐ฆ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
๐ธ DESCRIPTION ๐ธ
curl_easy_setopt(3) is literally how you tell libcurl how to behave. โจ By setting the appropriate options, the application can change libcurl's behavior. All options are set with an option followed by a parameter. That parameter can be a long, a function pointer, an object pointer or a curl_off_t, depending on what the specific option expects.
โ ๏ธ bestie, read this manual carefully โ bad input values may cause libcurl to behave badly. ๐ญ
You can only set one option in each function call. A typical application uses many curl_easy_setopt(3) calls in the setup phase.
The handle argument is the return code from a curl_easy_init(3) or curl_easy_duphandle(3) call.
Options set with this function call are sticky. They remain set for all forthcoming transfers performed using this handle. The options are not in any way reset between transfers, so if you want subsequent transfers with different options, you must change them between the transfers. You can optionally reset all options back to internal default with curl_easy_reset(3).
The order in which the options are set does not matter. periodt. ๐
๐ STRINGS ๐
Strings passed to libcurl as 'char *' arguments are copied by the library; the string storage associated to the pointer argument may be discarded or reused after curl_easy_setopt(3) returns. The only exception to this rule is really CURLOPT_POSTFIELDS(3), but the alternative that copies the string CURLOPT_COPYPOSTFIELDS(3) has some usage characteristics you need to read up on. ๐
This function does not accept input strings longer than CURL_MAX_INPUT_LENGTH (8 MB).
libcurl does little to no verification of the contents of provided strings. Passing in "creative octets" like newlines where they are not expected might trigger unexpected results. ๐
Before version 7.17.0, strings were not copied. Instead the user was forced keep them available until libcurl no longer needed them.
โจ OPTIONS โจ
CURLOPT_ABSTRACT_UNIX_SOCKETโ path to an abstract Unix domain socket. SeeCURLOPT_ABSTRACT_UNIX_SOCKET(3)CURLOPT_ACCEPTTIMEOUT_MSโ timeout for waiting for the server's connect back to be accepted. SeeCURLOPT_ACCEPTTIMEOUT_MS(3)CURLOPT_ACCEPT_ENCODINGโAccept-Encodingand automatic decompressing data. SeeCURLOPT_ACCEPT_ENCODING(3)CURLOPT_ADDRESS_SCOPEโ IPv6 scope for local addresses. SeeCURLOPT_ADDRESS_SCOPE(3)CURLOPT_ALTSVCโ specify theAlt-Svc:cache filename. SeeCURLOPT_ALTSVC(3)CURLOPT_ALTSVC_CTRLโ enable and configureAlt-Svc:treatment. SeeCURLOPT_ALTSVC_CTRL(3)CURLOPT_APPENDโ append to remote file. SeeCURLOPT_APPEND(3)CURLOPT_AUTOREFERERโ automatically setReferer:header. SeeCURLOPT_AUTOREFERER(3)CURLOPT_AWS_SIGV4โ AWS HTTP V4 Signature. SeeCURLOPT_AWS_SIGV4(3)CURLOPT_BUFFERSIZEโ ask for alternate buffer size. SeeCURLOPT_BUFFERSIZE(3)CURLOPT_CAINFOโ CA cert bundle. SeeCURLOPT_CAINFO(3)CURLOPT_CAINFO_BLOBโ CA cert bundle memory buffer. SeeCURLOPT_CAINFO_BLOB(3)CURLOPT_CAPATHโ path to CA cert bundle. SeeCURLOPT_CAPATH(3)CURLOPT_CA_CACHE_TIMEOUTโ timeout for CA cache. SeeCURLOPT_CA_CACHE_TIMEOUT(3)CURLOPT_CERTINFOโ extract certificate info. SeeCURLOPT_CERTINFO(3)CURLOPT_CHUNK_BGN_FUNCTIONโ callback for wildcard download start of chunk. SeeCURLOPT_CHUNK_BGN_FUNCTION(3)CURLOPT_CHUNK_DATAโ data pointer to pass to the chunk callbacks. SeeCURLOPT_CHUNK_DATA(3)CURLOPT_CHUNK_END_FUNCTIONโ callback for wildcard download end of chunk. SeeCURLOPT_CHUNK_END_FUNCTION(3)CURLOPT_CLOSESOCKETDATAโ data pointer to pass to the close socket callback. SeeCURLOPT_CLOSESOCKETDATA(3)CURLOPT_CLOSESOCKETFUNCTIONโ callback for closing socket. SeeCURLOPT_CLOSESOCKETFUNCTION(3)CURLOPT_CONNECTTIMEOUTโ timeout for the connection phase. SeeCURLOPT_CONNECTTIMEOUT(3)CURLOPT_CONNECTTIMEOUT_MSโ millisecond timeout for the connection phase. SeeCURLOPT_CONNECTTIMEOUT_MS(3)CURLOPT_CONNECT_ONLYโ only connect, nothing else. SeeCURLOPT_CONNECT_ONLY(3)CURLOPT_CONNECT_TOโ connect to a specific host and port. SeeCURLOPT_CONNECT_TO(3)CURLOPT_CONV_FROM_NETWORK_FUNCTIONโ OBSOLETE callback for code base conversion. SeeCURLOPT_CONV_FROM_NETWORK_FUNCTION(3)CURLOPT_CONV_FROM_UTF8_FUNCTIONโ OBSOLETE callback for code base conversion. SeeCURLOPT_CONV_FROM_UTF8_FUNCTION(3)CURLOPT_CONV_TO_NETWORK_FUNCTIONโ OBSOLETE callback for code base conversion. SeeCURLOPT_CONV_TO_NETWORK_FUNCTION(3)CURLOPT_COOKIEโ cookie(s) to send. SeeCURLOPT_COOKIE(3)CURLOPT_COOKIEFILEโ file to read cookies from. SeeCURLOPT_COOKIEFILE(3)CURLOPT_COOKIEJARโ file to write cookies to. SeeCURLOPT_COOKIEJAR(3)CURLOPT_COOKIELISTโ add or control cookies. SeeCURLOPT_COOKIELIST(3)CURLOPT_COOKIESESSIONโ start a new cookie session. SeeCURLOPT_COOKIESESSION(3)CURLOPT_COPYPOSTFIELDSโ send a POST with this data - and copy it. SeeCURLOPT_COPYPOSTFIELDS(3)CURLOPT_CRLFโ convert newlines. SeeCURLOPT_CRLF(3)CURLOPT_CRLFILEโ Certificate Revocation List. SeeCURLOPT_CRLFILE(3)CURLOPT_CURLUโ set URL to work on with a URL handle. SeeCURLOPT_CURLU(3)CURLOPT_CUSTOMREQUESTโ custom request/method. SeeCURLOPT_CUSTOMREQUEST(3)CURLOPT_DEBUGDATAโ data pointer to pass to the debug callback. SeeCURLOPT_DEBUGDATA(3)CURLOPT_DEBUGFUNCTIONโ callback for debug information. SeeCURLOPT_DEBUGFUNCTION(3)CURLOPT_DEFAULT_PROTOCOLโ default protocol. SeeCURLOPT_DEFAULT_PROTOCOL(3)CURLOPT_DIRLISTONLYโ list only. SeeCURLOPT_DIRLISTONLY(3)CURLOPT_DISALLOW_USERNAME_IN_URLโ do not allow username in URL. SeeCURLOPT_DISALLOW_USERNAME_IN_URL(3)CURLOPT_DNS_CACHE_TIMEOUTโ timeout for DNS cache. SeeCURLOPT_DNS_CACHE_TIMEOUT(3)CURLOPT_DNS_INTERFACEโ bind name resolves to this interface. SeeCURLOPT_DNS_INTERFACE(3)CURLOPT_DNS_LOCAL_IP4โ bind name resolves to this IP4 address. SeeCURLOPT_DNS_LOCAL_IP4(3)CURLOPT_DNS_LOCAL_IP6โ bind name resolves to this IP6 address. SeeCURLOPT_DNS_LOCAL_IP6(3)CURLOPT_DNS_SERVERSโ preferred DNS servers. SeeCURLOPT_DNS_SERVERS(3)CURLOPT_DNS_SHUFFLE_ADDRESSESโ shuffle addresses before use. SeeCURLOPT_DNS_SHUFFLE_ADDRESSES(3)CURLOPT_DNS_USE_GLOBAL_CACHEโ OBSOLETE enable global DNS cache. SeeCURLOPT_DNS_USE_GLOBAL_CACHE(3)CURLOPT_DOH_SSL_VERIFYHOSTโ verify the hostname in the DoH (DNS-over-HTTPS) SSL certificate. SeeCURLOPT_DOH_SSL_VERIFYHOST(3)CURLOPT_DOH_SSL_VERIFYPEERโ verify the DoH (DNS-over-HTTPS) SSL certificate. SeeCURLOPT_DOH_SSL_VERIFYPEER(3)CURLOPT_DOH_SSL_VERIFYSTATUSโ verify the DoH (DNS-over-HTTPS) SSL certificate's status. SeeCURLOPT_DOH_SSL_VERIFYSTATUS(3)CURLOPT_DOH_URLโ use this DoH server for name resolves. SeeCURLOPT_DOH_URL(3)CURLOPT_ECHโ set the configuration for ECH. SeeCURLOPT_ECH(3)CURLOPT_EGDSOCKETโ OBSOLETE identify EGD socket for entropy. SeeCURLOPT_EGDSOCKET(3)CURLOPT_ERRORBUFFERโ error message buffer. SeeCURLOPT_ERRORBUFFER(3)CURLOPT_EXPECT_100_TIMEOUT_MSโ 100-continue timeout. SeeCURLOPT_EXPECT_100_TIMEOUT_MS(3)CURLOPT_FAILONERRORโ fail on HTTP 4xx errors.CURLOPT_FAILONERROR(3)CURLOPT_FILETIMEโ request file modification date and time. SeeCURLOPT_FILETIME(3)CURLOPT_FNMATCH_DATAโ data pointer to pass to the wildcard matching callback. SeeCURLOPT_FNMATCH_DATA(3)CURLOPT_FNMATCH_FUNCTIONโ callback for wildcard matching. SeeCURLOPT_FNMATCH_FUNCTION(3)CURLOPT_FOLLOWLOCATIONโ follow HTTP redirects. SeeCURLOPT_FOLLOWLOCATION(3)CURLOPT_FORBID_REUSEโ prevent subsequent connections from reusing this. SeeCURLOPT_FORBID_REUSE(3)CURLOPT_FRESH_CONNECTโ use a new connection.CURLOPT_FRESH_CONNECT(3)CURLOPT_FTPPORTโ use active FTP. SeeCURLOPT_FTPPORT(3)CURLOPT_FTPSSLAUTHโ control how to do TLS. SeeCURLOPT_FTPSSLAUTH(3)CURLOPT_FTP_ACCOUNTโ sendACCTcommand. SeeCURLOPT_FTP_ACCOUNT(3)CURLOPT_FTP_ALTERNATIVE_TO_USERโ alternative toUSER. SeeCURLOPT_FTP_ALTERNATIVE_TO_USER(3)CURLOPT_FTP_CREATE_MISSING_DIRSโ create missing directories on the remote server. SeeCURLOPT_FTP_CREATE_MISSING_DIRS(3)CURLOPT_FTP_FILEMETHODโ specify how to reach files. SeeCURLOPT_FTP_FILEMETHOD(3)CURLOPT_FTP_SKIP_PASV_IPโ ignore the IP address in thePASVresponse. SeeCURLOPT_FTP_SKIP_PASV_IP(3)CURLOPT_FTP_SSL_CCCโ back to non-TLS again after authentication. SeeCURLOPT_FTP_SSL_CCC(3)CURLOPT_FTP_USE_EPRTโ useEPRT. SeeCURLOPT_FTP_USE_EPRT(3)CURLOPT_FTP_USE_EPSVโ useEPSV. SeeCURLOPT_FTP_USE_EPSV(3)CURLOPT_FTP_USE_PRETโ usePRET. SeeCURLOPT_FTP_USE_PRET(3)CURLOPT_GSSAPI_DELEGATIONโ disable GSS-API delegation. SeeCURLOPT_GSSAPI_DELEGATION(3)CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MSโ timeout for happy eyeballs. SeeCURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3)CURLOPT_HAPROXYPROTOCOLโ send an HAProxy PROXY protocol v1 header. SeeCURLOPT_HAPROXYPROTOCOL(3)CURLOPT_HAPROXY_CLIENT_IPโ spoof the client IP in an HAProxy PROXY protocol v1 header. SeeCURLOPT_HAPROXY_CLIENT_IP(3)CURLOPT_HEADERโ include the header in the body output. SeeCURLOPT_HEADER(3)CURLOPT_HEADERDATAโ data pointer to pass to the header callback. SeeCURLOPT_HEADERDATA(3)CURLOPT_HEADERFUNCTIONโ callback for writing received headers. SeeCURLOPT_HEADERFUNCTION(3)CURLOPT_HEADEROPTโ control custom headers. SeeCURLOPT_HEADEROPT(3)CURLOPT_HSTSโ set HSTS cache file. SeeCURLOPT_HSTS(3)CURLOPT_HSTSREADDATAโ pass pointer to the HSTS read callback. SeeCURLOPT_HSTSREADDATA(3)
okay continuing the list, bestie โ we're in the H's now and it keeps going forever, but that's literally the point ๐
CURLOPT_HSTSREADFUNCTIONโ Sets the HSTS read callback. It's the little friend that hands curl your stored HSTS entries. SeeCURLOPT_HSTSREADFUNCTION(3)โจCURLOPT_HSTSWRITEDATAโ Passes the pointer that gets handed to the HSTS write callback. SeeCURLOPT_HSTSWRITEDATA(3)๐CURLOPT_HSTSWRITEFUNCTIONโ Sets the HSTS write callback so curl can hand you entries to save. SeeCURLOPT_HSTSWRITEFUNCTION(3)๐CURLOPT_HSTS_CTRLโ Turns HSTS on, periodt. SeeCURLOPT_HSTS_CTRL(3)๐CURLOPT_HTTP09_ALLOWEDโ Allows HTTP/0.9 responses, yes that ancient one.CURLOPT_HTTP09_ALLOWED(3)๐CURLOPT_HTTP200ALIASESโ Alternative versions of200 OK. SeeCURLOPT_HTTP200ALIASES(3)๐ฆCURLOPT_HTTPAUTHโ HTTP server authentication methods, pick your fighter. SeeCURLOPT_HTTPAUTH(3)๐ธCURLOPT_HTTPGETโ Do an HTTP GET request. SeeCURLOPT_HTTPGET(3)โญCURLOPT_HTTPHEADERโ Custom HTTP headers, your own little header squad. SeeCURLOPT_HTTPHEADER(3)๐CURLOPT_HTTPPOSTโ Deprecated option, multipart formpost HTTP POST. SeeCURLOPT_HTTPPOST(3)๐ซถCURLOPT_HTTPPROXYTUNNELโ Tunnel through the HTTP proxy.CURLOPT_HTTPPROXYTUNNEL(3)๐งCURLOPT_HTTP_CONTENT_DECODINGโ Disable Content decoding. SeeCURLOPT_HTTP_CONTENT_DECODING(3)๐ฅCURLOPT_HTTP_TRANSFER_DECODINGโ Disable Transfer decoding. SeeCURLOPT_HTTP_TRANSFER_DECODING(3)๐CURLOPT_HTTP_VERSIONโ HTTP version to use.CURLOPT_HTTP_VERSION(3)โจCURLOPT_IGNORE_CONTENT_LENGTHโ IgnoreContent-Length. SeeCURLOPT_IGNORE_CONTENT_LENGTH(3)๐CURLOPT_INFILESIZEโ Size of file to send.CURLOPT_INFILESIZE(3)๐CURLOPT_INFILESIZE_LARGEโ Size of file to send, the big boy version.CURLOPT_INFILESIZE_LARGE(3)๐ชCURLOPT_INTERFACEโ Bind the connection locally to this. SeeCURLOPT_INTERFACE(3)๐ธCURLOPT_INTERLEAVEDATAโ Data pointer to pass to the RTSP interleave callback. SeeCURLOPT_INTERLEAVEDATA(3)๐CURLOPT_INTERLEAVEFUNCTIONโ Callback for RTSP interleaved data. SeeCURLOPT_INTERLEAVEFUNCTION(3)๐CURLOPT_IOCTLDATAโ Deprecated option, data pointer to pass to the I/O callback. SeeCURLOPT_IOCTLDATA(3)๐CURLOPT_IOCTLFUNCTIONโ Deprecated option, callback for I/O operations. SeeCURLOPT_IOCTLFUNCTION(3)๐CURLOPT_IPRESOLVEโ IP version to use. SeeCURLOPT_IPRESOLVE(3)โญCURLOPT_ISSUERCERTโ Issuer certificate. SeeCURLOPT_ISSUERCERT(3)๐CURLOPT_ISSUERCERT_BLOBโ Issuer certificate memory buffer. SeeCURLOPT_ISSUERCERT_BLOB(3)๐ฆCURLOPT_KEEP_SENDING_ON_ERRORโ Keep sending on HTTP>= 300errors.CURLOPT_KEEP_SENDING_ON_ERROR(3)๐ฅCURLOPT_KEYPASSWDโ Client key password. SeeCURLOPT_KEYPASSWD(3)๐ (iykyk, don't leak it)CURLOPT_KRBLEVELโ OBSOLETE. Kerberos security level. SeeCURLOPT_KRBLEVEL(3)๐CURLOPT_LOCALPORTโ Bind the connection locally to this port. SeeCURLOPT_LOCALPORT(3)๐CURLOPT_LOCALPORTRANGEโ Bind the connection locally to a port range. SeeCURLOPT_LOCALPORTRANGE(3)๐CURLOPT_LOGIN_OPTIONSโ Login options. SeeCURLOPT_LOGIN_OPTIONS(3)โจCURLOPT_LOW_SPEED_LIMITโ Low speed limit to abort transfer. SeeCURLOPT_LOW_SPEED_LIMIT(3)๐ขCURLOPT_LOW_SPEED_TIMEโ Time to be below the speed to trigger low speed abort. SeeCURLOPT_LOW_SPEED_TIME(3)โฐCURLOPT_MAIL_AUTHโ Authentication address. SeeCURLOPT_MAIL_AUTH(3)๐งCURLOPT_MAIL_FROMโ Address of the sender. SeeCURLOPT_MAIL_FROM(3)๐CURLOPT_MAIL_RCPTโ Address of the recipients. SeeCURLOPT_MAIL_RCPT(3)๐ซถCURLOPT_MAIL_RCPT_ALLOWFAILSโ AllowRCPT TOcommand to fail for some recipients. SeeCURLOPT_MAIL_RCPT_ALLOWFAILS(3)๐CURLOPT_MAXAGE_CONNโ Limit the age (idle time) of connections for reuse. SeeCURLOPT_MAXAGE_CONN(3)๐ฐ๏ธCURLOPT_MAXCONNECTSโ Maximum number of connections in the connection pool. SeeCURLOPT_MAXCONNECTS(3)๐CURLOPT_MAXFILESIZEโ Maximum file size to get. SeeCURLOPT_MAXFILESIZE(3)๐CURLOPT_MAXFILESIZE_LARGEโ Maximum file size to get, large edition. SeeCURLOPT_MAXFILESIZE_LARGE(3)๐ชCURLOPT_MAXLIFETIME_CONNโ Limit the age (since creation) of connections for reuse. SeeCURLOPT_MAXLIFETIME_CONN(3)โณCURLOPT_MAXREDIRSโ Maximum number of redirects to follow. SeeCURLOPT_MAXREDIRS(3)๐CURLOPT_MAX_RECV_SPEED_LARGEโ Cap the download speed to this. SeeCURLOPT_MAX_RECV_SPEED_LARGE(3)๐CURLOPT_MAX_SEND_SPEED_LARGEโ Cap the upload speed to this. SeeCURLOPT_MAX_SEND_SPEED_LARGE(3)๐CURLOPT_MIMEPOSTโ Post/send MIME data. SeeCURLOPT_MIMEPOST(3)๐CURLOPT_MIME_OPTIONSโ Set MIME option flags. SeeCURLOPT_MIME_OPTIONS(3)โจCURLOPT_NETRCโ Enable.netrcparsing. SeeCURLOPT_NETRC(3)๐CURLOPT_NETRC_FILEโ.netrcfilename. SeeCURLOPT_NETRC_FILE(3)๐๏ธCURLOPT_NEW_DIRECTORY_PERMSโ Mode for creating new remote directories. SeeCURLOPT_NEW_DIRECTORY_PERMS(3)๐CURLOPT_NEW_FILE_PERMSโ Mode for creating new remote files. SeeCURLOPT_NEW_FILE_PERMS(3)๐CURLOPT_NOBODYโ Do not get the body contents. SeeCURLOPT_NOBODY(3)๐ โโ๏ธCURLOPT_NOPROGRESSโ Shut off the progress meter. SeeCURLOPT_NOPROGRESS(3)๐คซCURLOPT_NOPROXYโ Filter out hosts from proxy use.CURLOPT_NOPROXY(3)๐ซCURLOPT_NOSIGNALโ Do not install signal handlers. SeeCURLOPT_NOSIGNAL(3)๐CURLOPT_OPENSOCKETDATAโ Data pointer to pass to the open socket callback. SeeCURLOPT_OPENSOCKETDATA(3)๐CURLOPT_OPENSOCKETFUNCTIONโ Callback for socket creation. SeeCURLOPT_OPENSOCKETFUNCTION(3)๐งCURLOPT_PASSWORDโ Password. SeeCURLOPT_PASSWORD(3)๐CURLOPT_PATH_AS_ISโ Disable squashing/../and/./sequences in the path. SeeCURLOPT_PATH_AS_IS(3)๐ค๏ธCURLOPT_PINNEDPUBLICKEYโ Set pinned SSL public key . SeeCURLOPT_PINNEDPUBLICKEY(3)๐CURLOPT_PIPEWAITโ Wait on connection to pipeline on it. SeeCURLOPT_PIPEWAIT(3)โณCURLOPT_PORTโ Port number to connect to. SeeCURLOPT_PORT(3)๐ชCURLOPT_POSTโ Make an HTTP POST. SeeCURLOPT_POST(3)๐ฎCURLOPT_POSTFIELDSโ Send a POST with this data - does not copy it. SeeCURLOPT_POSTFIELDS(3)โ ๏ธ (no copy, bestie โ keep that buffer alive)CURLOPT_POSTFIELDSIZEโ The POST data is this big. SeeCURLOPT_POSTFIELDSIZE(3)๐CURLOPT_POSTFIELDSIZE_LARGEโ The POST data is this big, large edition. SeeCURLOPT_POSTFIELDSIZE_LARGE(3)๐CURLOPT_POSTQUOTEโ Commands to run after transfer. SeeCURLOPT_POSTQUOTE(3)๐CURLOPT_POSTREDIRโ How to act on redirects after POST. SeeCURLOPT_POSTREDIR(3)๐CURLOPT_PREQUOTEโ Commands to run just before transfer. SeeCURLOPT_PREQUOTE(3)๐ฌCURLOPT_PREREQDATAโ Data pointer to pass to theCURLOPT_PREREQFUNCTIONcallback. SeeCURLOPT_PREREQDATA(3)๐CURLOPT_PREREQFUNCTIONโ Callback to be called after a connection is established but before a request is made on that connection. SeeCURLOPT_PREREQFUNCTION(3)๐ซถCURLOPT_PRE_PROXYโ Socks proxy to use. SeeCURLOPT_PRE_PROXY(3)๐งฆCURLOPT_PRIVATEโ Private pointer to store. SeeCURLOPT_PRIVATE(3)๐คซCURLOPT_PROGRESSDATAโ Data pointer to pass to the progress meter callback. SeeCURLOPT_PROGRESSDATA(3)๐CURLOPT_PROGRESSFUNCTIONโ OBSOLETE callback for progress meter. SeeCURLOPT_PROGRESSFUNCTION(3)๐CURLOPT_PROTOCOLSโ Deprecated option, allowed protocols. SeeCURLOPT_PROTOCOLS(3)๐CURLOPT_PROTOCOLS_STRโ Allowed protocols, the string way. SeeCURLOPT_PROTOCOLS_STR(3)โCURLOPT_PROXYโ Proxy to use. SeeCURLOPT_PROXY(3)๐ฐ๏ธCURLOPT_PROXYAUTHโ HTTP proxy authentication methods. SeeCURLOPT_PROXYAUTH(3)๐CURLOPT_PROXYHEADERโ Custom HTTP headers sent to proxy. SeeCURLOPT_PROXYHEADER(3)๐CURLOPT_PROXYPASSWORDโ Proxy password. SeeCURLOPT_PROXYPASSWORD(3)๐CURLOPT_PROXYPORTโ Proxy port to use. SeeCURLOPT_PROXYPORT(3)๐ชCURLOPT_PROXYTYPEโ Proxy type. SeeCURLOPT_PROXYTYPE(3)๐ท๏ธCURLOPT_PROXYUSERNAMEโ Proxy username. SeeCURLOPT_PROXYUSERNAME(3)๐คCURLOPT_PROXYUSERPWDโ Proxy username and password. SeeCURLOPT_PROXYUSERPWD(3)๐CURLOPT_PROXY_CAINFOโ Proxy CA cert bundle. SeeCURLOPT_PROXY_CAINFO(3)๐ฆCURLOPT_PROXY_CAINFO_BLOBโ Proxy CA cert bundle memory buffer. SeeCURLOPT_PROXY_CAINFO_BLOB(3)๐งCURLOPT_PROXY_CAPATHโ Path to proxy CA cert bundle. SeeCURLOPT_PROXY_CAPATH(3)๐บ๏ธCURLOPT_PROXY_CRLFILEโ Proxy Certificate Revocation List. SeeCURLOPT_PROXY_CRLFILE(3)๐CURLOPT_PROXY_ISSUERCERTโ Proxy issuer certificate. SeeCURLOPT_PROXY_ISSUERCERT(3)๐CURLOPT_PROXY_ISSUERCERT_BLOBโ Proxy issuer certificate memory buffer. SeeCURLOPT_PROXY_ISSUERCERT_BLOB(3)๐งCURLOPT_PROXY_KEYPASSWDโ Proxy client key password. SeeCURLOPT_PROXY_KEYPASSWD(3)๐CURLOPT_PROXY_PINNEDPUBLICKEYโ Set the proxy's pinned SSL public key. SeeCURLOPT_PROXY_PINNEDPUBLICKEY(3)๐CURLOPT_PROXY_SERVICE_NAMEโ Proxy authentication service name.CURLOPT_PROXY_SERVICE_NAME(3)๐ท๏ธCURLOPT_PROXY_SSLCERTโ Proxy client cert. SeeCURLOPT_PROXY_SSLCERT(3)๐CURLOPT_PROXY_SSLCERTTYPEโ Proxy client cert type. SeeCURLOPT_PROXY_SSLCERTTYPE(3)๐ท๏ธCURLOPT_PROXY_SSLCERT_BLOBโ Proxy client cert memory buffer. SeeCURLOPT_PROXY_SSLCERT_BLOB(3)๐งCURLOPT_PROXY_SSLKEYโ Proxy client key. SeeCURLOPT_PROXY_SSLKEY(3)๐CURLOPT_PROXY_SSLKEYTYPEโ Proxy client key type. SeeCURLOPT_PROXY_SSLKEYTYPE(3)๐ท๏ธCURLOPT_PROXY_SSLKEY_BLOBโ Proxy client key. SeeCURLOPT_PROXY_SSLKEY_BLOB(3)๐งCURLOPT_PROXY_SSLVERSIONโ Proxy SSL version to use. SeeCURLOPT_PROXY_SSLVERSION(3)โญCURLOPT_PROXY_SSL_CIPHER_LISTโ Proxy ciphers to use. SeeCURLOPT_PROXY_SSL_CIPHER_LIST(3)๐งฉCURLOPT_PROXY_SSL_OPTIONSโ Control proxy SSL behavior. SeeCURLOPT_PROXY_SSL_OPTIONS(3)๐๏ธCURLOPT_PROXY_SSL_VERIFYHOSTโ Verify the hostname in the proxy SSL certificate. SeeCURLOPT_PROXY_SSL_VERIFYHOST(3)๐CURLOPT_PROXY_SSL_VERIFYPEERโ Verify the proxy SSL certificate. SeeCURLOPT_PROXY_SSL_VERIFYPEER(3)๐CURLOPT_PROXY_TLS13_CIPHERSโ Proxy TLS 1.3 cipher suites to use. SeeCURLOPT_PROXY_TLS13_CIPHERS(3)๐งฉCURLOPT_PROXY_TLSAUTH_PASSWORDโ Proxy TLS authentication password. SeeCURLOPT_PROXY_TLSAUTH_PASSWORD(3)๐CURLOPT_PROXY_TLSAUTH_TYPEโ Proxy TLS authentication methods. SeeCURLOPT_PROXY_TLSAUTH_TYPE(3)๐ท๏ธCURLOPT_PROXY_TLSAUTH_USERNAMEโ Proxy TLS authentication username. SeeCURLOPT_PROXY_TLSAUTH_USERNAME(3)๐ค
and likeโฆ we're not even done yet, there's more list coming, don't go anywhere ๐ซถโจ
CURLOPT_PROXY_TRANSFER_MODEโ sticks a transfer mode onto the URL when you're going through a proxy. deets inCURLOPT_PROXY_TRANSFER_MODE(3)๐ซถCURLOPT_PUTโ issues an HTTP PUT request. deprecated though bestie, so maybe don't build your whole personality on it.CURLOPT_PUT(3)has the lore.CURLOPT_QUICK_EXITโ this one's for top-level tools likecurlthemselves, to skip all the lengthy cleanup when they're literally about to callexit()anyway. no point tidying a room you're moving out of fr.CURLOPT_QUICK_EXIT(3)โจCURLOPT_QUOTEโ the commands to run before the transfer happens. pregame rituals.CURLOPT_QUOTE(3)CURLOPT_RANDOM_FILEโ OBSOLETE, ok? it used to provide a source for entropy random data. retired icon.CURLOPT_RANDOM_FILE(3)๐CURLOPT_RANGEโ range requests, aka "bestie can I have just this slice".CURLOPT_RANGE(3)CURLOPT_READDATAโ the data pointer you hand off to the read callback.CURLOPT_READDATA(3)CURLOPT_READFUNCTIONโ the actual callback for reading data.CURLOPT_READFUNCTION(3)๐ธCURLOPT_REDIR_PROTOCOLSโ protocols you allow redirects to go to. deprecated!! use the_STRone below,CURLOPT_REDIR_PROTOCOLS(3)CURLOPT_REDIR_PROTOCOLS_STRโ same vibe, protocols to allow redirects to, but the cool non-deprecated version.CURLOPT_REDIR_PROTOCOLS_STR(3)๐CURLOPT_REFERERโ sets theReferer:header. yes it's spelled wrong, no we're not fixing it, it's canon.CURLOPT_REFERER(3)CURLOPT_REQUEST_TARGETโ sets the request target.CURLOPT_REQUEST_TARGET(3)CURLOPT_RESOLVEโ gives you fixed/fake name resolves, so you can be like "trust me, this host lives here".CURLOPT_RESOLVE(3)CURLOPT_RESOLVER_START_DATAโ data pointer passed to the resolver start callback.CURLOPT_RESOLVER_START_DATA(3)CURLOPT_RESOLVER_START_FUNCTIONโ callback that fires before a brand new resolve request kicks off.CURLOPT_RESOLVER_START_FUNCTION(3)๐ฆCURLOPT_RESUME_FROMโ resume a transfer where it left off.CURLOPT_RESUME_FROM(3)CURLOPT_RESUME_FROM_LARGEโ same resume energy, the_LARGEcut.CURLOPT_RESUME_FROM_LARGE(3)CURLOPT_RTSP_CLIENT_CSEQโ the client CSEQ number.CURLOPT_RTSP_CLIENT_CSEQ(3)CURLOPT_RTSP_REQUESTโ the RTSP request itself.CURLOPT_RTSP_REQUEST(3)CURLOPT_RTSP_SERVER_CSEQโ CSEQ number for RTSP Server->Client requests.CURLOPT_RTSP_SERVER_CSEQ(3)CURLOPT_RTSP_SESSION_IDโ the RTSP session-id.CURLOPT_RTSP_SESSION_ID(3)CURLOPT_RTSP_STREAM_URIโ the RTSP stream URI.CURLOPT_RTSP_STREAM_URI(3)CURLOPT_RTSP_TRANSPORTโ theTransport:header for RTSP.CURLOPT_RTSP_TRANSPORT(3)๐CURLOPT_SASL_AUTHZIDโ the SASL authorization identity, i.e. the identity you're acting as. playing a role, main character style.CURLOPT_SASL_AUTHZID(3)CURLOPT_SASL_IRโ enables the SASL initial response.CURLOPT_SASL_IR(3)CURLOPT_SEEKDATAโ data pointer passed to the seek callback.CURLOPT_SEEKDATA(3)CURLOPT_SEEKFUNCTIONโ the callback for seek operations.CURLOPT_SEEKFUNCTION(3)CURLOPT_SERVER_RESPONSE_TIMEOUTโ timeout for server responses.CURLOPT_SERVER_RESPONSE_TIMEOUT(3)CURLOPT_SERVER_RESPONSE_TIMEOUT_MSโ the same timeout for server responses, but in milliseconds.CURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3)โญCURLOPT_SERVICE_NAMEโ the authentication service name.CURLOPT_SERVICE_NAME(3)CURLOPT_SHAREโ the share object to use. sharing is caring.CURLOPT_SHARE(3)CURLOPT_SOCKOPTDATAโ data pointer passed to the sockopt callback.CURLOPT_SOCKOPTDATA(3)CURLOPT_SOCKOPTFUNCTIONโ callback for sockopt operations.CURLOPT_SOCKOPTFUNCTION(3)CURLOPT_SOCKS5_AUTHโ the Socks5 authentication methods.CURLOPT_SOCKS5_AUTH(3)CURLOPT_SOCKS5_GSSAPI_NECโ Socks5 GSSAPI NEC mode.CURLOPT_SOCKS5_GSSAPI_NEC(3)CURLOPT_SOCKS5_GSSAPI_SERVICEโ the Socks5 GSSAPI service name. deprecated babe, heads up.CURLOPT_SOCKS5_GSSAPI_SERVICE(3)๐CURLOPT_SSH_AUTH_TYPESโ which SSH authentication types to use.CURLOPT_SSH_AUTH_TYPES(3)CURLOPT_SSH_COMPRESSIONโ turns SSH compression on.CURLOPT_SSH_COMPRESSION(3)CURLOPT_SSH_HOSTKEYDATAโ custom pointer passed to the ssh host key callback.CURLOPT_SSH_HOSTKEYDATA(3)CURLOPT_SSH_HOSTKEYFUNCTIONโ callback for checking host key handling.CURLOPT_SSH_HOSTKEYFUNCTION(3)CURLOPT_SSH_HOST_PUBLIC_KEY_MD5โ the MD5 of the host's public key.CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256โ the SHA256 of the host's public key. glow-up from MD5 honestly.CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3)๐ฅCURLOPT_SSH_KEYDATAโ custom pointer passed to the ssh key callback.CURLOPT_SSH_KEYDATA(3)CURLOPT_SSH_KEYFUNCTIONโ callback for known hosts handling.CURLOPT_SSH_KEYFUNCTION(3)CURLOPT_SSH_KNOWNHOSTSโ filename with the known hosts in it.CURLOPT_SSH_KNOWNHOSTS(3)CURLOPT_SSH_PRIVATE_KEYFILEโ filename of the private key. keep it secret, keep it safe.CURLOPT_SSH_PRIVATE_KEYFILE(3)CURLOPT_SSH_PUBLIC_KEYFILEโ filename of the public key.CURLOPT_SSH_PUBLIC_KEYFILE(3)
CURLOPT_SSLCERTโ the client cert.CURLOPT_SSLCERT(3)๐CURLOPT_SSLCERTTYPEโ what type that client cert is.CURLOPT_SSLCERTTYPE(3)CURLOPT_SSLCERT_BLOBโ the client cert, but as a memory buffer instead of a file.CURLOPT_SSLCERT_BLOB(3)CURLOPT_SSLENGINEโ use this identifier with the SSL engine.CURLOPT_SSLENGINE(3)CURLOPT_SSLENGINE_DEFAULTโ picks the default SSL engine.CURLOPT_SSLENGINE_DEFAULT(3)CURLOPT_SSLKEYโ the client key.CURLOPT_SSLKEY(3)CURLOPT_SSLKEYTYPEโ the client key type.CURLOPT_SSLKEYTYPE(3)CURLOPT_SSLKEY_BLOBโ client key as a memory buffer.CURLOPT_SSLKEY_BLOB(3)๐งCURLOPT_SSLVERSIONโ which SSL version to use.CURLOPT_SSLVERSION(3)CURLOPT_SSL_CIPHER_LISTโ the ciphers to use.CURLOPT_SSL_CIPHER_LIST(3)CURLOPT_SSL_CTX_DATAโ data pointer passed to the SSL context callback.CURLOPT_SSL_CTX_DATA(3)CURLOPT_SSL_CTX_FUNCTIONโ callback for SSL context logic.CURLOPT_SSL_CTX_FUNCTION(3)CURLOPT_SSL_EC_CURVESโ sets the key exchange curves.CURLOPT_SSL_EC_CURVES(3)CURLOPT_SSL_ENABLE_ALPNโ enables ALPN.CURLOPT_SSL_ENABLE_ALPN(3)CURLOPT_SSL_ENABLE_NPNโ OBSOLETE โ used to enable NPN. it's giving legacy.CURLOPT_SSL_ENABLE_NPN(3)๐CURLOPT_SSL_FALSESTARTโ enables TLS False Start. deprecated option, so don't get attached.CURLOPT_SSL_FALSESTART(3)CURLOPT_SSL_OPTIONSโ controls SSL behavior.CURLOPT_SSL_OPTIONS(3)CURLOPT_SSL_SESSIONID_CACHEโ disables the SSL session-id cache. yes, disables โ read it twice.CURLOPT_SSL_SESSIONID_CACHE(3)CURLOPT_SSL_SIGNATURE_ALGORITHMSโ the TLS signature algorithms to use.CURLOPT_SSL_SIGNATURE_ALGORITHMS(3)๐CURLOPT_SSL_VERIFYHOSTโ verifies the hostname in the SSL certificate.CURLOPT_SSL_VERIFYHOST(3)CURLOPT_SSL_VERIFYPEERโ verifies the SSL certificate itself. don't turn this off casually, that's not the move.CURLOPT_SSL_VERIFYPEER(3)CURLOPT_SSL_VERIFYSTATUSโ verifies the SSL certificate's status.CURLOPT_SSL_VERIFYSTATUS(3)CURLOPT_STDERRโ redirects stderr to another stream.CURLOPT_STDERR(3)๐CURLOPT_STREAM_DEPENDSโ makes this HTTP/2 stream depend on another one. deprecated option, noted.CURLOPT_STREAM_DEPENDS(3)CURLOPT_STREAM_DEPENDS_Eโ same, but this HTTP/2 stream depends on another exclusively. also deprecated.CURLOPT_STREAM_DEPENDS_E(3)CURLOPT_STREAM_WEIGHTโ sets this HTTP/2 stream's weight.CURLOPT_STREAM_WEIGHT(3)CURLOPT_SUPPRESS_CONNECT_HEADERSโ hides proxy CONNECT response headers from your user callbacks.CURLOPT_SUPPRESS_CONNECT_HEADERS(3)
CURLOPT_TCP_FASTOPENโ enables TCP Fast Open. fast, as advertised.CURLOPT_TCP_FASTOPEN(3)โกCURLOPT_TCP_KEEPALIVEโ enables TCP keep-alive.CURLOPT_TCP_KEEPALIVE(3)CURLOPT_TCP_KEEPCNTโ the maximum number of keep-alive probes.CURLOPT_TCP_KEEPCNT(3)CURLOPT_TCP_KEEPIDLEโ how long it sits idle before sending keep-alive.CURLOPT_TCP_KEEPIDLE(3)CURLOPT_TCP_KEEPINTVLโ the interval between keep-alive probes.CURLOPT_TCP_KEEPINTVL(3)CURLOPT_TCP_NODELAYโ disables the Nagle algorithm.CURLOPT_TCP_NODELAY(3)CURLOPT_TELNETOPTIONSโ TELNET options.CURLOPT_TELNETOPTIONS(3)CURLOPT_TFTP_BLKSIZEโ the TFTP block size.CURLOPT_TFTP_BLKSIZE(3)CURLOPT_TFTP_NO_OPTIONSโ do not send TFTP options requests.CURLOPT_TFTP_NO_OPTIONS(3)CURLOPT_TIMECONDITIONโ makes a time conditional request.CURLOPT_TIMECONDITION(3)CURLOPT_TIMEOUTโ the timeout for the entire request. the whole thing.CURLOPT_TIMEOUT(3)๐ซถCURLOPT_TIMEOUT_MSโ the timeout for the entire request, but in milliseconds.CURLOPT_TIMEOUT_MS(3)CURLOPT_TIMEVALUEโ the time value used for that time conditional request.CURLOPT_TIMEVALUE(3)CURLOPT_TIMEVALUE_LARGEโ the time value for the time conditional request, the_LARGEedition.CURLOPT_TIMEVALUE_LARGE(3)CURLOPT_TLS13_CIPHERSโ the TLS 1.3 cipher suites to use.CURLOPT_TLS13_CIPHERS(3)CURLOPT_TLSAUTH_PASSWORDโ the TLS authentication password.CURLOPT_TLSAUTH_PASSWORD(3)CURLOPT_TLSAUTH_TYPEโ the TLS authentication methods.CURLOPT_TLSAUTH_TYPE(3)CURLOPT_TLSAUTH_USERNAMEโ the TLS authentication username.CURLOPT_TLSAUTH_USERNAME(3)๐CURLOPT_TRAILERDATAโ custom pointer passed to the trailing headers callback.CURLOPT_TRAILERDATA(3)CURLOPT_TRAILERFUNCTIONโ sets the callback for sending trailing headers.CURLOPT_TRAILERFUNCTION(3)CURLOPT_TRANSFERTEXTโ use text transfer.CURLOPT_TRANSFERTEXT(3)CURLOPT_TRANSFER_ENCODINGโ requestsTransfer-Encoding.CURLOPT_TRANSFER_ENCODING(3)
CURLOPT_UNIX_SOCKET_PATHโ path to a Unix domain socket.CURLOPT_UNIX_SOCKET_PATH(3)CURLOPT_UNRESTRICTED_AUTHโ stops restricting authentication to the original host.CURLOPT_UNRESTRICTED_AUTH(3)CURLOPT_UPKEEP_INTERVAL_MSโ sets the interval at which connection upkeep happens.CURLOPT_UPKEEP_INTERVAL_MS(3)CURLOPT_UPLOADโ upload data.CURLOPT_UPLOAD(3)๐ฆCURLOPT_UPLOAD_BUFFERSIZEโ sets the upload buffer size.CURLOPT_UPLOAD_BUFFERSIZE(3)CURLOPT_UPLOAD_FLAGSโ sets the upload flags.CURLOPT_UPLOAD_FLAGS(3)CURLOPT_URLโ the URL to work on. the whole point, honestly.CURLOPT_URL(3)๐CURLOPT_USERAGENTโ theUser-Agent:header.CURLOPT_USERAGENT(3)CURLOPT_USERNAMEโ the username.CURLOPT_USERNAME(3)CURLOPT_USERPWDโ username and password together.CURLOPT_USERPWD(3)CURLOPT_USE_SSLโ use TLS/SSL.CURLOPT_USE_SSL(3)CURLOPT_VERBOSEโ displays verbose information. the "tell me EVERYTHING" switch.CURLOPT_VERBOSE(3)โจCURLOPT_WILDCARDMATCHโจ โ grab a whole bunch of files by matching a filename pattern, like a little glob gremlin. Details live inCURLOPT_WILDCARDMATCH(3), go read it bestie.CURLOPT_WRITEDATA๐ซถ โ the data pointer you hand off to the write callback. SeeCURLOPT_WRITEDATA(3).CURLOPT_WRITEFUNCTION๐ โ the actual callback that writes your data out. SeeCURLOPT_WRITEFUNCTION(3).CURLOPT_WS_OPTIONS๐ฆ โ set your WebSocket options. SeeCURLOPT_WS_OPTIONS(3).CURLOPT_XFERINFODATA๐ โ data pointer that gets passed to the progress meter callback. SeeCURLOPT_XFERINFODATA(3).CURLOPT_XFERINFOFUNCTIONโญ โ the progress meter callback itself. SeeCURLOPT_XFERINFOFUNCTION(3).CURLOPT_XOAUTH2_BEARER๐ โ your OAuth2 bearer token, slay. SeeCURLOPT_XOAUTH2_BEARER(3).
๐ PROTOCOLS ๐
Okay so this functionality? It affects all supported protocols. Every single one. No gatekeeping. ๐
๐ป EXAMPLE ๐ป
Like, here's the tiniest possible main character program ever:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
๐ฐ๏ธ AVAILABILITY ๐ฐ๏ธ
Added in curl 7.1 โ like, ancient. A true elder. Respect her. ๐ง
๐ฆ RETURN VALUE ๐ฆ
This function hands you back a CURLcode that tells you whether it ate or flopped. ๐
CURLE_OK (0) means everything was literally fine. Anything non-zero means an error happened โ check libcurl-errors(3) for the full tea. And ngl, if you set CURLOPT_ERRORBUFFER(3) with curl_easy_setopt(3), there can be an error message chilling in that error buffer when a non-zero comes back. Bestie, that buffer is your friend. ๐ญ
Strings you pass to libcurl must be shorter than8000000bytes, otherwisecurl_easy_setopt(3)returnsCURLE_BAD_FUNCTION_ARGUMENT(added in 7.65.0). No cap, it will not just vibe through that.
CURLE_BAD_FUNCTION_ARGUMENT also shows up when the argument to an option is invalid โ like, say, out of range. Invalid looks bad on you, so don't do it. ๐
And if you try to set an option that libcurl straight up does not know about โ maybe the library is too old to support it, or maybe the option got removed in a recent version โ this function returns CURLE_UNKNOWN_OPTION. If support for the option was disabled at compile-time, you get CURLE_NOT_BUILT_IN instead. Two different moods, two different codes. ๐
๐ซถ SEE ALSO ๐ซถ
curl_easy_cleanup(3)curl_easy_getinfo(3)curl_easy_init(3)curl_easy_option_by_id(3)curl_easy_option_by_name(3)curl_easy_option_next(3)curl_easy_reset(3)curl_multi_setopt(3)
โจ And that's the whole page, bestie! This one came from the libcurl source, version date 2026-10-12, and it's the manual page for curl_easy_setopt(3). Go forth and set some options. Mwah. ๐๐๐
๐ฆ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 ยท curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 ยท curl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms