gnurl_easy_setopt(3)
๐ gnurl_easy_setopt(3) โ libgnurl Manual ๐
okay bestie, buckle up โ this is the function. everything you're about to read lives in the libgnurl Manual, and it's a long one, so hydrate first ๐
โจ NAME โจ
curl_easy_setopt โ the one that sets options for a curl easy handle ๐ซถ
โจ SYNOPSIS โจ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
๐ DESCRIPTION ๐
so curl_easy_setopt(3) is literally the way you tell libcurl how to behave. set the right options and your app gets to change libcurl's whole behavior, no cap. every option gets set with an option followed by a parameter โ and that parameter can be a long, a function pointer, an object pointer, or a curl_off_t, depending on what that specific option expects. so likeโฆ read this manual carefully, fr fr, because 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. many. like, a lot. it's giving character development.
options you set with this function call are valid for all forthcoming transfers performed using this handle. and here's the thing โ the options are not in any way reset between transfers, so if you want subsequent transfers with different options, you gotta change them between the transfers. you can optionally reset all options back to internal default with curl_easy_reset(3) though, iconic of it โจ
strings passed to libcurl as 'char *' arguments are copied by the library ๐ so the string storage associated to the pointer argument may be overwritten 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 ๐ (iykyk).
the order in which the options are set does not matter. periodt. ๐
okay history lesson: before version 7.17.0, strings were not copied. instead the user was forced keep them available until libcurl no longer needed them. so yeah, if you're in your time-travel era, watch out ๐ฐ๏ธ
and the handle โ that's the return code from a curl_easy_init(3) or curl_easy_duphandle(3) call. that's your main character. ๐
๐ธ BEHAVIOR OPTIONS ๐ธ
CURLOPT_VERBOSEโ display verbose information โจ seeCURLOPT_VERBOSE(3)CURLOPT_HEADERโ include the header in the body output ๐ seeCURLOPT_HEADER(3)CURLOPT_NOPROGRESSโ shut off the progress meter ๐ seeCURLOPT_NOPROGRESS(3)CURLOPT_NOSIGNALโ do not install signal handlers ๐ซ seeCURLOPT_NOSIGNAL(3)CURLOPT_WILDCARDMATCHโ transfer multiple files according to a file name pattern ๐ฆ seeCURLOPT_WILDCARDMATCH(3)
๐ CALLBACK OPTIONS ๐
like, this is the callback era and we're all just living in it ๐ซถ
CURLOPT_WRITEFUNCTIONโ callback for writing data โ๏ธ seeCURLOPT_WRITEFUNCTION(3)CURLOPT_WRITEDATAโ data pointer to pass to the write callback ๐ seeCURLOPT_WRITEDATA(3)CURLOPT_READFUNCTIONโ callback for reading data ๐ seeCURLOPT_READFUNCTION(3)CURLOPT_READDATAโ data pointer to pass to the read callback ๐ธ seeCURLOPT_READDATA(3)CURLOPT_IOCTLFUNCTIONโ callback for I/O operations โ๏ธ seeCURLOPT_IOCTLFUNCTION(3)CURLOPT_IOCTLDATAโ data pointer to pass to the I/O callback ๐ seeCURLOPT_IOCTLDATA(3)CURLOPT_SEEKFUNCTIONโ callback for seek operations ๐ seeCURLOPT_SEEKFUNCTION(3)CURLOPT_SEEKDATAโ data pointer to pass to the seek callback ๐ฆ seeCURLOPT_SEEKDATA(3)CURLOPT_SOCKOPTFUNCTIONโ callback for sockopt operations ๐งฆ seeCURLOPT_SOCKOPTFUNCTION(3)CURLOPT_SOCKOPTDATAโ data pointer to pass to the sockopt callback ๐ seeCURLOPT_SOCKOPTDATA(3)CURLOPT_OPENSOCKETFUNCTIONโ callback for socket creation ๐ seeCURLOPT_OPENSOCKETFUNCTION(3)CURLOPT_OPENSOCKETDATAโ data pointer to pass to the open socket callback โจ seeCURLOPT_OPENSOCKETDATA(3)CURLOPT_CLOSESOCKETFUNCTIONโ callback for closing socket ๐ช seeCURLOPT_CLOSESOCKETFUNCTION(3)CURLOPT_CLOSESOCKETDATAโ data pointer to pass to the close socket callback ๐ seeCURLOPT_CLOSESOCKETDATA(3)CURLOPT_PROGRESSFUNCTIONโ OBSOLETE callback for progress meter ๐ seeCURLOPT_PROGRESSFUNCTION(3)CURLOPT_PROGRESSDATAโ data pointer to pass to the progress meter callback ๐ seeCURLOPT_PROGRESSDATA(3)CURLOPT_XFERINFOFUNCTIONโ callback for progress meter ๐ฅ seeCURLOPT_XFERINFOFUNCTION(3)CURLOPT_XFERINFODATAโ data pointer to pass to the progress meter callback ๐ seeCURLOPT_XFERINFODATA(3)CURLOPT_HEADERFUNCTIONโ callback for writing received headers ๐จ seeCURLOPT_HEADERFUNCTION(3)CURLOPT_HEADERDATAโ data pointer to pass to the header callback ๐ seeCURLOPT_HEADERDATA(3)CURLOPT_DEBUGFUNCTIONโ callback for debug information ๐ seeCURLOPT_DEBUGFUNCTION(3)CURLOPT_DEBUGDATAโ data pointer to pass to the debug callback ๐ฌ seeCURLOPT_DEBUGDATA(3)CURLOPT_SSL_CTX_FUNCTIONโ callback for SSL context logic ๐ seeCURLOPT_SSL_CTX_FUNCTION(3)CURLOPT_SSL_CTX_DATAโ data pointer to pass to the SSL context callback ๐๏ธ seeCURLOPT_SSL_CTX_DATA(3)CURLOPT_CONV_TO_NETWORK_FUNCTIONโ callback for code base conversion ๐ seeCURLOPT_CONV_TO_NETWORK_FUNCTION(3)CURLOPT_CONV_FROM_NETWORK_FUNCTIONโ callback for code base conversion ๐ seeCURLOPT_CONV_FROM_NETWORK_FUNCTION(3)CURLOPT_CONV_FROM_UTF8_FUNCTIONโ callback for code base conversion ๐บ seeCURLOPT_CONV_FROM_UTF8_FUNCTION(3)CURLOPT_INTERLEAVEFUNCTIONโ callback for RTSP interleaved data ๐ฌ seeCURLOPT_INTERLEAVEFUNCTION(3)CURLOPT_INTERLEAVEDATAโ data pointer to pass to the RTSP interleave callback ๐ฟ seeCURLOPT_INTERLEAVEDATA(3)CURLOPT_CHUNK_BGN_FUNCTIONโ callback for wildcard download start of chunk ๐งฉ seeCURLOPT_CHUNK_BGN_FUNCTION(3)CURLOPT_CHUNK_END_FUNCTIONโ callback for wildcard download end of chunk ๐ seeCURLOPT_CHUNK_END_FUNCTION(3)CURLOPT_CHUNK_DATAโ data pointer to pass to the chunk callbacks ๐ seeCURLOPT_CHUNK_DATA(3)CURLOPT_FNMATCH_FUNCTIONโ callback for wildcard matching ๐ seeCURLOPT_FNMATCH_FUNCTION(3)CURLOPT_FNMATCH_DATAโ data pointer to pass to the wildcard matching callback ๐ธ seeCURLOPT_FNMATCH_DATA(3)CURLOPT_SUPPRESS_CONNECT_HEADERSโ suppress proxyCONNECTresponse headers from user callbacks ๐คซ seeCURLOPT_SUPPRESS_CONNECT_HEADERS(3)CURLOPT_RESOLVER_START_FUNCTIONโ callback to be called before a new resolve request is started ๐ฆ seeCURLOPT_RESOLVER_START_FUNCTION(3)CURLOPT_RESOLVER_START_DATAโ data pointer to pass to resolver start callback ๐ seeCURLOPT_RESOLVER_START_DATA(3)
๐ญ ERROR OPTIONS ๐ญ
CURLOPT_ERRORBUFFERโ error message buffer ๐ seeCURLOPT_ERRORBUFFER(3)CURLOPT_STDERRโstderrreplacement stream ๐ฅ๏ธ seeCURLOPT_STDERR(3)CURLOPT_FAILONERRORโ fail on HTTP 4xx errors ๐CURLOPT_FAILONERROR(3)CURLOPT_KEEP_SENDING_ON_ERRORโ keep sending on HTTP >= 300 errors ๐CURLOPT_KEEP_SENDING_ON_ERROR(3)
๐ NETWORK OPTIONS ๐
CURLOPT_URLโ URL to work on ๐ seeCURLOPT_URL(3)CURLOPT_PATH_AS_ISโ disable squashing/../and/./sequences in the path ๐ฃ๏ธ seeCURLOPT_PATH_AS_IS(3)CURLOPT_PROTOCOLSโ allowed protocols โ seeCURLOPT_PROTOCOLS(3)CURLOPT_REDIR_PROTOCOLSโ protocols to allow redirects to โฉ๏ธ seeCURLOPT_REDIR_PROTOCOLS(3)CURLOPT_DEFAULT_PROTOCOLโ default protocol ๐ฏ seeCURLOPT_DEFAULT_PROTOCOL(3)CURLOPT_PROXYโ proxy to use ๐ต๏ธ seeCURLOPT_PROXY(3)CURLOPT_PRE_PROXYโ Socks proxy to use ๐งฆ seeCURLOPT_PRE_PROXY(3)CURLOPT_PROXYPORTโ proxy port to use ๐ข seeCURLOPT_PROXYPORT(3)CURLOPT_PROXYTYPEโ proxy type ๐ท๏ธ seeCURLOPT_PROXYTYPE(3)CURLOPT_NOPROXYโ filter out hosts from proxy use ๐ซCURLOPT_NOPROXY(3)CURLOPT_HTTPPROXYTUNNELโ tunnel through the HTTP proxy ๐CURLOPT_HTTPPROXYTUNNEL(3)CURLOPT_CONNECT_TOโ connect to a specific host and port ๐ seeCURLOPT_CONNECT_TO(3)CURLOPT_SOCKS5_AUTHโ Socks5 authentication methods ๐ seeCURLOPT_SOCKS5_AUTH(3)CURLOPT_SOCKS5_GSSAPI_SERVICEโ Socks5 GSSAPI service name ๐CURLOPT_SOCKS5_GSSAPI_SERVICE(3)CURLOPT_SOCKS5_GSSAPI_NECโ Socks5 GSSAPI NEC mode ๐ง seeCURLOPT_SOCKS5_GSSAPI_NEC(3)CURLOPT_PROXY_SERVICE_NAMEโ proxy authentication service name ๐ชชCURLOPT_PROXY_SERVICE_NAME(3)CURLOPT_HAPROXYPROTOCOLโ send an HAProxy PROXY protocol v1 header ๐ฎ seeCURLOPT_HAPROXYPROTOCOL(3)CURLOPT_SERVICE_NAMEโ authentication service name ๐ท๏ธCURLOPT_SERVICE_NAME(3)CURLOPT_INTERFACEโ bind connection locally to this ๐ชข seeCURLOPT_INTERFACE(3)CURLOPT_LOCALPORTโ bind connection locally to this port ๐ seeCURLOPT_LOCALPORT(3)CURLOPT_LOCALPORTRANGEโ bind connection locally to port range ๐ถ seeCURLOPT_LOCALPORTRANGE(3)CURLOPT_DNS_CACHE_TIMEOUTโ timeout for DNS cache โณ seeCURLOPT_DNS_CACHE_TIMEOUT(3)CURLOPT_DNS_USE_GLOBAL_CACHEโ OBSOLETE enable global DNS cache ๐ seeCURLOPT_DNS_USE_GLOBAL_CACHE(3)CURLOPT_DOH_URLโ use this DOH server for name resolves ๐งญ seeCURLOPT_DOH_URL(3)CURLOPT_BUFFERSIZEโ ask for alternate buffer size ๐ฆ seeCURLOPT_BUFFERSIZE(3)CURLOPT_PORTโ port number to connect to ๐ข seeCURLOPT_PORT(3)CURLOPT_TCP_FASTOPENโ enable TFO, TCP Fast Open โก seeCURLOPT_TCP_FASTOPEN(3)CURLOPT_TCP_NODELAYโ disable the Nagle algorithm ๐ seeCURLOPT_TCP_NODELAY(3)CURLOPT_ADDRESS_SCOPEโ IPv6 scope for local addresses ๐ seeCURLOPT_ADDRESS_SCOPE(3)CURLOPT_TCP_KEEPALIVEโ enable TCP keep-alive ๐ seeCURLOPT_TCP_KEEPALIVE(3)CURLOPT_TCP_KEEPIDLEโ idle time before sending keep-alive ๐ด seeCURLOPT_TCP_KEEPIDLE(3)CURLOPT_TCP_KEEPINTVLโ interval between keep-alive probes โฑ๏ธ seeCURLOPT_TCP_KEEPINTVL(3)CURLOPT_UNIX_SOCKET_PATHโ path to a Unix domain socket ๐งต seeCURLOPT_UNIX_SOCKET_PATH(3)CURLOPT_ABSTRACT_UNIX_SOCKETโ path to an abstract Unix domain socket ๐ seeCURLOPT_ABSTRACT_UNIX_SOCKET(3)
okay that's this chunk done and there is so more coming ๐ don't go anywhere bestie ๐ซถ
โจ NAMES and PASSWORDS OPTIONS (Authentication) โจ
okay bestie, this whole cluster is about who you are when you knock on the server's door ๐ โ usernames, passwords, tokens, the works. Every single one links off to its own page, so go deep whenever you need.
CURLOPT_NETRCโ turns on.netrcparsing. SeeCURLOPT_NETRC(3)CURLOPT_NETRC_FILEโ picks which.netrcfile name to use. SeeCURLOPT_NETRC_FILE(3)CURLOPT_USERPWDโ your user name and password. SeeCURLOPT_USERPWD(3)CURLOPT_PROXYUSERPWDโ the proxy's user name and password. SeeCURLOPT_PROXYUSERPWD(3)CURLOPT_USERNAMEโ just the user name, no password energy. SeeCURLOPT_USERNAME(3)CURLOPT_PASSWORDโ just the password. SeeCURLOPT_PASSWORD(3)CURLOPT_LOGIN_OPTIONSโ login options. SeeCURLOPT_LOGIN_OPTIONS(3)CURLOPT_PROXYUSERNAMEโ proxy user name. SeeCURLOPT_PROXYUSERNAME(3)CURLOPT_PROXYPASSWORDโ proxy password. SeeCURLOPT_PROXYPASSWORD(3)CURLOPT_HTTPAUTHโ which HTTP server authentication methods you're willing to do. SeeCURLOPT_HTTPAUTH(3)CURLOPT_TLSAUTH_USERNAMEโ TLS authentication user name. SeeCURLOPT_TLSAUTH_USERNAME(3)CURLOPT_PROXY_TLSAUTH_USERNAMEโ proxy TLS authentication user name. SeeCURLOPT_PROXY_TLSAUTH_USERNAME(3)CURLOPT_TLSAUTH_PASSWORDโ TLS authentication password. SeeCURLOPT_TLSAUTH_PASSWORD(3)CURLOPT_PROXY_TLSAUTH_PASSWORDโ proxy TLS authentication password. SeeCURLOPT_PROXY_TLSAUTH_PASSWORD(3)CURLOPT_TLSAUTH_TYPEโ TLS authentication methods. SeeCURLOPT_TLSAUTH_TYPE(3)CURLOPT_PROXY_TLSAUTH_TYPEโ proxy TLS authentication methods. SeeCURLOPT_PROXY_TLSAUTH_TYPE(3)CURLOPT_PROXYAUTHโ HTTP proxy authentication methods. SeeCURLOPT_PROXYAUTH(3)CURLOPT_SASL_AUTHZIDโ the SASL authorisation identity, aka the identity you want to act as. SeeCURLOPT_SASL_AUTHZID(3)CURLOPT_SASL_IRโ enables SASL initial response. SeeCURLOPT_SASL_IR(3)CURLOPT_XOAUTH2_BEARERโ your OAuth2 bearer token ๐๏ธ. SeeCURLOPT_XOAUTH2_BEARER(3)CURLOPT_DISALLOW_USERNAME_IN_URLโ nope, no username allowed in the URL. SeeCURLOPT_DISALLOW_USERNAME_IN_URL(3)
๐ HTTP OPTIONS
this is the big one, the main character section ๐ โ headers, redirects, cookies, HTTP/2 streams, all of it. Settle in.
CURLOPT_AUTOREFERERโ automatically sets theReferer:header. SeeCURLOPT_AUTOREFERER(3)CURLOPT_ACCEPT_ENCODINGโ setsAccept-Encodingand decompresses the data for you automatically. SeeCURLOPT_ACCEPT_ENCODING(3)CURLOPT_TRANSFER_ENCODINGโ asks forTransfer-Encoding. SeeCURLOPT_TRANSFER_ENCODING(3)CURLOPT_FOLLOWLOCATIONโ follows those HTTP redirects like the loyal bestie it is. SeeCURLOPT_FOLLOWLOCATION(3)CURLOPT_UNRESTRICTED_AUTHโ stops restricting authentication to the original host. SeeCURLOPT_UNRESTRICTED_AUTH(3)CURLOPT_MAXREDIRSโ the max number of redirects to follow before it says "enough". SeeCURLOPT_MAXREDIRS(3)CURLOPT_POSTREDIRโ how to act on redirects after a POST. SeeCURLOPT_POSTREDIR(3)CURLOPT_PUTโ issues an HTTPPUTrequest. SeeCURLOPT_PUT(3)CURLOPT_POSTโ issues an HTTPPOSTrequest. SeeCURLOPT_POST(3)CURLOPT_POSTFIELDSโ sends a POST with this data. SeeCURLOPT_POSTFIELDS(3)CURLOPT_POSTFIELDSIZEโ tells it the POST data is this big. SeeCURLOPT_POSTFIELDSIZE(3)CURLOPT_POSTFIELDSIZE_LARGEโ same vibe, also tells it the POST data is this big. SeeCURLOPT_POSTFIELDSIZE_LARGE(3)CURLOPT_COPYPOSTFIELDSโ sends a POST with this data and copies it. SeeCURLOPT_COPYPOSTFIELDS(3)CURLOPT_HTTPPOSTโ multipart formpost HTTP POST. SeeCURLOPT_HTTPPOST(3)CURLOPT_REFERERโ theReferer:header. SeeCURLOPT_REFERER(3)CURLOPT_USERAGENTโ theUser-Agent:header. SeeCURLOPT_USERAGENT(3)CURLOPT_HTTPHEADERโ your own custom HTTP headers ๐. SeeCURLOPT_HTTPHEADER(3)CURLOPT_HEADEROPTโ controls those custom headers. SeeCURLOPT_HEADEROPT(3)CURLOPT_PROXYHEADERโ custom HTTP headers sent to the proxy. SeeCURLOPT_PROXYHEADER(3)CURLOPT_HTTP200ALIASESโ alternative versions of200 OK. SeeCURLOPT_HTTP200ALIASES(3)CURLOPT_COOKIEโ the cookie(s) to send ๐ช. SeeCURLOPT_COOKIE(3)CURLOPT_COOKIEFILEโ the file to read cookies from. SeeCURLOPT_COOKIEFILE(3)CURLOPT_COOKIEJARโ the file to write cookies to. SeeCURLOPT_COOKIEJAR(3)CURLOPT_COOKIESESSIONโ starts a brand new cookie session. SeeCURLOPT_COOKIESESSION(3)CURLOPT_COOKIELISTโ adds or controls cookies. SeeCURLOPT_COOKIELIST(3)CURLOPT_ALTSVCโ specifies theAlt-Svc:cache file name. SeeCURLOPT_ALTSVC(3)CURLOPT_ALTSVC_CTRLโ enables and configuresAlt-Svc:treatment. SeeCURLOPT_ALTSVC_CTRL(3)CURLOPT_HTTPGETโ does an HTTPGETrequest. SeeCURLOPT_HTTPGET(3)CURLOPT_REQUEST_TARGETโ sets the request target. SeeCURLOPT_REQUEST_TARGET(3)CURLOPT_HTTP_VERSIONโ which HTTP version to use. SeeCURLOPT_HTTP_VERSION(3)CURLOPT_HTTP09_ALLOWEDโ allows HTTP/0.9 responses (yes, that fossil). SeeCURLOPT_HTTP09_ALLOWED(3)CURLOPT_IGNORE_CONTENT_LENGTHโ ignoresContent-Length. SeeCURLOPT_IGNORE_CONTENT_LENGTH(3)CURLOPT_HTTP_CONTENT_DECODINGโ disables Content decoding. SeeCURLOPT_HTTP_CONTENT_DECODING(3)CURLOPT_HTTP_TRANSFER_DECODINGโ disables Transfer decoding. SeeCURLOPT_HTTP_TRANSFER_DECODING(3)CURLOPT_EXPECT_100_TIMEOUT_MSโ the 100-continue timeout. SeeCURLOPT_EXPECT_100_TIMEOUT_MS(3)CURLOPT_TRAILERFUNCTIONโ sets the callback for sending trailing headers. SeeCURLOPT_TRAILERFUNCTION(3)CURLOPT_TRAILERDATAโ a custom pointer passed to that trailing headers callback. SeeCURLOPT_TRAILERDATA(3)CURLOPT_PIPEWAITโ waits on the connection so it can pipeline on it. SeeCURLOPT_PIPEWAIT(3)CURLOPT_STREAM_DEPENDSโ this HTTP/2 stream depends on another one. SeeCURLOPT_STREAM_DEPENDS(3)CURLOPT_STREAM_DEPENDS_Eโ this HTTP/2 stream depends on another one exclusively. SeeCURLOPT_STREAM_DEPENDS_E(3)CURLOPT_STREAM_WEIGHTโ sets this HTTP/2 stream's weight โ๏ธ. SeeCURLOPT_STREAM_WEIGHT(3)
๐ง SMTP OPTIONS
mail girlies rise ๐ซถ โ who's sending, who's receiving, and who's authenticating.
CURLOPT_MAIL_FROMโ the address of the sender. SeeCURLOPT_MAIL_FROM(3)CURLOPT_MAIL_RCPTโ the address(es) of the recipients. SeeCURLOPT_MAIL_RCPT(3)CURLOPT_MAIL_AUTHโ the authentication address. SeeCURLOPT_MAIL_AUTH(3)CURLOPT_MAIL_RCPT_ALLLOWFAILSโ allows theRCPT TOcommand to fail for some recipients. SeeCURLOPT_MAIL_RCPT_ALLLOWFAILS(3)
๐ just so you know, that triple-L spelling (ALLLOWFAILS) is literally how it's spelled in the option name. not a typo of mine, bestie โ copy it exactly.
๐ฆ TFTP OPTIONS
tiny but mighty, two options, both iconic in their own lowkey way.
CURLOPT_TFTP_BLKSIZEโ the TFTP block size. SeeCURLOPT_TFTP_BLKSIZE(3)CURLOPT_TFTP_NO_OPTIONSโ does not send TFTP options requests. SeeCURLOPT_TFTP_NO_OPTIONS(3)
๐๏ธ FTP OPTIONS
the vintage queen of protocols and honestly she still serves ๐. Here's every knob.
CURLOPT_FTPPORTโ use active FTP. SeeCURLOPT_FTPPORT(3)CURLOPT_QUOTEโ commands to run before transfer. SeeCURLOPT_QUOTE(3)CURLOPT_POSTQUOTEโ commands to run after transfer. SeeCURLOPT_POSTQUOTE(3)CURLOPT_PREQUOTEโ commands to run just before transfer. SeeCURLOPT_PREQUOTE(3)CURLOPT_APPENDโ appends to the remote file. SeeCURLOPT_APPEND(3)CURLOPT_FTP_USE_EPRTโ use EPTR. SeeCURLOPT_FTP_USE_EPRT(3)CURLOPT_FTP_USE_EPSVโ use EPSV. SeeCURLOPT_FTP_USE_EPSV(3)CURLOPT_FTP_USE_PRETโ use PRET. SeeCURLOPT_FTP_USE_PRET(3)CURLOPT_FTP_CREATE_MISSING_DIRSโ creates missing directories on the remote server. SeeCURLOPT_FTP_CREATE_MISSING_DIRS(3)CURLOPT_FTP_RESPONSE_TIMEOUTโ the timeout for FTP responses. SeeCURLOPT_FTP_RESPONSE_TIMEOUT(3)CURLOPT_FTP_ALTERNATIVE_TO_USERโ an alternative toUSER. SeeCURLOPT_FTP_ALTERNATIVE_TO_USER(3)CURLOPT_FTP_SKIP_PASV_IPโ ignores the IP address in the PASV response. SeeCURLOPT_FTP_SKIP_PASV_IP(3)CURLOPT_FTPSSLAUTHโ controls how to do TLS. SeeCURLOPT_FTPSSLAUTH(3)CURLOPT_FTP_SSL_CCCโ goes back to non-TLS again after authentication. SeeCURLOPT_FTP_SSL_CCC(3)CURLOPT_FTP_ACCOUNTโ sends theACCTcommand. SeeCURLOPT_FTP_ACCOUNT(3)CURLOPT_FTP_FILEMETHODโ specifies how to reach files. SeeCURLOPT_FTP_FILEMETHOD(3)
๐ฌ RTSP OPTIONS
streaming protocol hours ๐ โ sessions, sequence numbers, and transport headers.
CURLOPT_RTSP_REQUESTโ the RTSP request. SeeCURLOPT_RTSP_REQUEST(3)CURLOPT_RTSP_SESSION_IDโ the RTSP session-id. SeeCURLOPT_RTSP_SESSION_ID(3)CURLOPT_RTSP_STREAM_URIโ the RTSP stream URI. SeeCURLOPT_RTSP_STREAM_URI(3)CURLOPT_RTSP_TRANSPORTโ the RTSPTransport:header. SeeCURLOPT_RTSP_TRANSPORT(3)CURLOPT_RTSP_CLIENT_CSEQโ the client CSEQ number. SeeCURLOPT_RTSP_CLIENT_CSEQ(3)CURLOPT_RTSP_SERVER_CSEQโ the CSEQ number for RTSP Server->Client request. SeeCURLOPT_RTSP_SERVER_CSEQ(3)
๐ง PROTOCOL OPTIONS
the general-purpose toolbox โ stuff that works across protocols and doesn't want to be boxed in. very main character energy, honestly.
CURLOPT_TRANSFERTEXTโ uses text transfer. SeeCURLOPT_TRANSFERTEXT(3)CURLOPT_PROXY_TRANSFER_MODEโ adds the transfer mode to the URL over a proxy. SeeCURLOPT_PROXY_TRANSFER_MODE(3)CURLOPT_CRLFโ converts newlines. SeeCURLOPT_CRLF(3)CURLOPT_RANGEโ range requests, for when you only want part of the thing. SeeCURLOPT_RANGE(3)CURLOPT_RESUME_FROMโ resumes a transfer. SeeCURLOPT_RESUME_FROM(3)CURLOPT_RESUME_FROM_LARGEโ also resumes a transfer. SeeCURLOPT_RESUME_FROM_LARGE(3)CURLOPT_CURLUโ sets the URL to work on withCURLU *. SeeCURLOPT_CURLU(3)CURLOPT_CUSTOMREQUESTโ a custom request/method. SeeCURLOPT_CUSTOMREQUEST(3)CURLOPT_FILETIMEโ requests the file modification date and time ๐ฐ๏ธ. SeeCURLOPT_FILETIME(3)CURLOPT_DIRLISTONLYโ list only. SeeCURLOPT_DIRLISTONLY(3)CURLOPT_NOBODYโ do not get the body contents. SeeCURLOPT_NOBODY(3)CURLOPT_INFILESIZEโ the size of the file to send. SeeCURLOPT_INFILESIZE(3)CURLOPT_INFILESIZE_LARGEโ the size of the file to send. SeeCURLOPT_INFILESIZE_LARGE(3)CURLOPT_UPLOADโ uploads data. SeeCURLOPT_UPLOAD(3)CURLOPT_UPLOAD_BUFFERSIZEโ sets the upload buffer size. SeeCURLOPT_UPLOAD_BUFFERSIZE(3)CURLOPT_MIMEPOSTโ posts/sends MIME data. SeeCURLOPT_MIMEPOST(3)CURLOPT_MAXFILESIZEโ the maximum file size to get. SeeCURLOPT_MAXFILESIZE(3)CURLOPT_MAXFILESIZE_LARGEโ the maximum file size to get. SeeCURLOPT_MAXFILESIZE_LARGE(3)CURLOPT_TIMECONDITIONโ makes a time conditional request. SeeCURLOPT_TIMECONDITION(3)CURLOPT_TIMEVALUEโ the time value for that time conditional request. SeeCURLOPT_TIMEVALUE(3)CURLOPT_TIMEVALUE_LARGEโ the time value for that time conditional request. SeeCURLOPT_TIMEVALUE_LARGE(3)
๐ CONNECTION OPTIONS ๐
okay so these are the ones that decide like, how your little client actually reaches out and touches the server. connection era ๐
CURLOPT_TIMEOUTโ how long the entire request is allowed to take, start to finish. SeeCURLOPT_TIMEOUT(3)CURLOPT_TIMEOUT_MSโ same energy, but measured in milliseconds. SeeCURLOPT_TIMEOUT_MS(3)CURLOPT_LOW_SPEED_LIMITโ the low-speed threshold that'll abort a transfer if it's crawling. SeeCURLOPT_LOW_SPEED_LIMIT(3)CURLOPT_LOW_SPEED_TIMEโ how long you're willing to stay below that speed before the abort kicks in. SeeCURLOPT_LOW_SPEED_TIME(3)CURLOPT_MAX_SEND_SPEED_LARGEโ caps your upload speed right there. SeeCURLOPT_MAX_SEND_SPEED_LARGE(3)CURLOPT_MAX_RECV_SPEED_LARGEโ caps your download speed, same deal. SeeCURLOPT_MAX_RECV_SPEED_LARGE(3)CURLOPT_MAXCONNECTSโ the max number of connections chilling in the connection pool. SeeCURLOPT_MAXCONNECTS(3)CURLOPT_FRESH_CONNECTโ bestie, get a brand new connection, don't recycle.CURLOPT_FRESH_CONNECT(3)CURLOPT_FORBID_REUSEโ blocks any later connections from re-using this one. SeeCURLOPT_FORBID_REUSE(3)CURLOPT_MAXAGE_CONNโ puts an age limit on connections that are eligible for reuse. SeeCURLOPT_MAXAGE_CONN(3)CURLOPT_CONNECTTIMEOUTโ timeout for just the connection phase, not the whole thing. SeeCURLOPT_CONNECTTIMEOUT(3)CURLOPT_CONNECTTIMEOUT_MSโ connection phase timeout, but in milliseconds obviously. SeeCURLOPT_CONNECTTIMEOUT_MS(3)CURLOPT_IPRESOLVEโ which IP version to resolve to. SeeCURLOPT_IPRESOLVE(3)CURLOPT_CONNECT_ONLYโ connect and that's it, nothing else happens. SeeCURLOPT_CONNECT_ONLY(3)CURLOPT_USE_SSLโ turns on TLS/SSL. SeeCURLOPT_USE_SSL(3)CURLOPT_RESOLVEโ hand it fixed/fake name resolves, your own little DNS fantasy. SeeCURLOPT_RESOLVE(3)CURLOPT_DNS_INTERFACEโ binds name resolves to this interface. SeeCURLOPT_DNS_INTERFACE(3)CURLOPT_DNS_LOCAL_IP4โ binds name resolves to this IP4 address. SeeCURLOPT_DNS_LOCAL_IP4(3)CURLOPT_DNS_LOCAL_IP6โ binds name resolves to this IP6 address. SeeCURLOPT_DNS_LOCAL_IP6(3)CURLOPT_DNS_SERVERSโ your preferred DNS servers, like a fave list. SeeCURLOPT_DNS_SERVERS(3)CURLOPT_DNS_SHUFFLE_ADDRESSESโ shuffles the addresses before using them ๐ฒ SeeCURLOPT_DNS_SHUFFLE_ADDRESSES(3)CURLOPT_ACCEPTTIMEOUT_MSโ how long you'll wait for the server's connect-back to be accepted. SeeCURLOPT_ACCEPTTIMEOUT_MS(3)CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MSโ the timeout for happy eyeballs ๐ฅบ๐ SeeCURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3)CURLOPT_UPKEEP_INTERVAL_MSโ sets the interval at which connection upkeep gets performed. SeeCURLOPT_UPKEEP_INTERVAL_MS(3)
๐ SSL and SECURITY OPTIONS ๐
this whole section is the certified-locked-down-girl era. certs, keys, ciphers, the works โจ
CURLOPT_SSLCERTโ the client cert. SeeCURLOPT_SSLCERT(3)CURLOPT_SSLCERT_BLOBโ client cert, but as a memory buffer. SeeCURLOPT_SSLCERT_BLOB(3)CURLOPT_PROXY_SSLCERTโ the proxy's client cert. SeeCURLOPT_PROXY_SSLCERT(3)CURLOPT_PROXY_SSLCERT_BLOBโ proxy client cert as a memory buffer. SeeCURLOPT_PROXY_SSLCERT_BLOB(3)CURLOPT_SSLCERTTYPEโ tells it the client cert type. SeeCURLOPT_SSLCERTTYPE(3)CURLOPT_PROXY_SSLCERTTYPEโ the proxy client cert type. SeeCURLOPT_PROXY_SSLCERTTYPE(3)CURLOPT_SSLKEYโ the client key. SeeCURLOPT_SSLKEY(3)CURLOPT_SSLKEY_BLOBโ client key, memory-buffer style. SeeCURLOPT_SSLKEY_BLOB(3)CURLOPT_PROXY_SSLKEYโ the proxy client key. SeeCURLOPT_PROXY_SSLKEY(3)CURLOPT_PROXY_SSLKEY_BLOBโ proxy client key (yes, the man page literally just says that again ๐ญ). SeeCURLOPT_PROXY_SSLKEY_BLOB(3)CURLOPT_SSLKEYTYPEโ client key type. SeeCURLOPT_SSLKEYTYPE(3)CURLOPT_PROXY_SSLKEYTYPEโ proxy client key type. SeeCURLOPT_PROXY_SSLKEYTYPE(3)CURLOPT_KEYPASSWDโ the password for the client key ๐คซ SeeCURLOPT_KEYPASSWD(3)CURLOPT_PROXY_KEYPASSWDโ password for the proxy's client key. SeeCURLOPT_PROXY_KEYPASSWD(3)CURLOPT_SSL_ENABLE_ALPNโ lets it use ALPN. SeeCURLOPT_SSL_ENABLE_ALPN(3)CURLOPT_SSL_ENABLE_NPNโ lets it use NPN. SeeCURLOPT_SSL_ENABLE_NPN(3)CURLOPT_SSLENGINEโ uses this identifier with the SSL engine. SeeCURLOPT_SSLENGINE(3)CURLOPT_SSLENGINE_DEFAULTโ the default SSL engine, no identifier needed. SeeCURLOPT_SSLENGINE_DEFAULT(3)CURLOPT_SSL_FALSESTARTโ turns on TLS False Start. SeeCURLOPT_SSL_FALSESTART(3)CURLOPT_SSLVERSIONโ which SSL version to use. SeeCURLOPT_SSLVERSION(3)CURLOPT_PROXY_SSLVERSIONโ which SSL version to use for the proxy. SeeCURLOPT_PROXY_SSLVERSION(3)CURLOPT_SSL_VERIFYHOSTโ checks the host name inside the SSL certificate. SeeCURLOPT_SSL_VERIFYHOST(3)CURLOPT_PROXY_SSL_VERIFYHOSTโ checks the host name in the proxy's SSL certificate. SeeCURLOPT_PROXY_SSL_VERIFYHOST(3)CURLOPT_SSL_VERIFYPEERโ verifies the SSL certificate itself. SeeCURLOPT_SSL_VERIFYPEER(3)CURLOPT_PROXY_SSL_VERIFYPEERโ verifies the proxy's SSL certificate. SeeCURLOPT_PROXY_SSL_VERIFYPEER(3)CURLOPT_SSL_VERIFYSTATUSโ verifies the status of the SSL certificate. SeeCURLOPT_SSL_VERIFYSTATUS(3)CURLOPT_CAINFOโ the CA cert bundle. SeeCURLOPT_CAINFO(3)CURLOPT_PROXY_CAINFOโ the CA cert bundle for the proxy. SeeCURLOPT_PROXY_CAINFO(3)CURLOPT_ISSUERCERTโ the issuer certificate. SeeCURLOPT_ISSUERCERT(3)CURLOPT_ISSUERCERT_BLOBโ issuer certificate as a memory buffer. SeeCURLOPT_ISSUERCERT_BLOB(3)CURLOPT_PROXY_ISSUERCERTโ the proxy's issuer certificate. SeeCURLOPT_PROXY_ISSUERCERT(3)CURLOPT_PROXY_ISSUERCERT_BLOBโ proxy issuer certificate as a memory buffer. SeeCURLOPT_PROXY_ISSUERCERT_BLOB(3)CURLOPT_CAPATHโ the path to the CA cert bundle. SeeCURLOPT_CAPATH(3)CURLOPT_PROXY_CAPATHโ the path to the proxy's CA cert bundle. SeeCURLOPT_PROXY_CAPATH(3)CURLOPT_CRLFILEโ the Certificate Revocation List. SeeCURLOPT_CRLFILE(3)CURLOPT_PROXY_CRLFILEโ the proxy's Certificate Revocation List. SeeCURLOPT_PROXY_CRLFILE(3)CURLOPT_CERTINFOโ extracts certificate info. SeeCURLOPT_CERTINFO(3)CURLOPT_PINNEDPUBLICKEYโ sets the pinned SSL public key. SeeCURLOPT_PINNEDPUBLICKEY(3)CURLOPT_PROXY_PINNEDPUBLICKEYโ sets the proxy's pinned SSL public key. SeeCURLOPT_PROXY_PINNEDPUBLICKEY(3)CURLOPT_RANDOM_FILEโ gives it a source for entropy random data. SeeCURLOPT_RANDOM_FILE(3)CURLOPT_EGDSOCKETโ points out the EGD socket for entropy. SeeCURLOPT_EGDSOCKET(3)CURLOPT_SSL_CIPHER_LISTโ which ciphers to use. SeeCURLOPT_SSL_CIPHER_LIST(3)CURLOPT_PROXY_SSL_CIPHER_LISTโ which ciphers to use for the proxy. SeeCURLOPT_PROXY_SSL_CIPHER_LIST(3)CURLOPT_TLS13_CIPHERSโ which TLS 1.3 cipher suites to use. SeeCURLOPT_TLS13_CIPHERS(3)CURLOPT_PROXY_TLS13_CIPHERSโ which TLS 1.3 cipher suites to use for the proxy. SeeCURLOPT_PROXY_TLS13_CIPHERS(3)CURLOPT_SSL_SESSIONID_CACHEโ disables the SSL session-id cache. SeeCURLOPT_SSL_SESSIONID_CACHE(3)CURLOPT_SSL_OPTIONSโ controls SSL behavior. SeeCURLOPT_SSL_OPTIONS(3)CURLOPT_PROXY_SSL_OPTIONSโ controls proxy SSL behavior. SeeCURLOPT_PROXY_SSL_OPTIONS(3)CURLOPT_KRBLEVELโ the Kerberos security level. SeeCURLOPT_KRBLEVEL(3)CURLOPT_GSSAPI_DELEGATIONโ disables GSS-API delegation. SeeCURLOPT_GSSAPI_DELEGATION(3)
๐ SSH OPTIONS ๐
for when you're doing the secure-shell thing. keys and known hosts and all that good stuff ๐๏ธ
CURLOPT_SSH_AUTH_TYPESโ which SSH authentication types to allow. SeeCURLOPT_SSH_AUTH_TYPES(3)CURLOPT_SSH_COMPRESSIONโ turns SSH compression on. SeeCURLOPT_SSH_COMPRESSION(3)CURLOPT_SSH_HOST_PUBLIC_KEY_MD5โ the MD5 of the host's public key. SeeCURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)CURLOPT_SSH_PUBLIC_KEYFILEโ file name of the public key. SeeCURLOPT_SSH_PUBLIC_KEYFILE(3)CURLOPT_SSH_PRIVATE_KEYFILEโ file name of the private key (protect her ๐ซถ). SeeCURLOPT_SSH_PRIVATE_KEYFILE(3)CURLOPT_SSH_KNOWNHOSTSโ file name that holds the known hosts. SeeCURLOPT_SSH_KNOWNHOSTS(3)CURLOPT_SSH_KEYFUNCTIONโ the callback for known-hosts handling. SeeCURLOPT_SSH_KEYFUNCTION(3)CURLOPT_SSH_KEYDATAโ a custom pointer to pass along to the ssh key callback. SeeCURLOPT_SSH_KEYDATA(3)
๐ OTHER OPTIONS ๐
the little grab-bag section, love her ๐
CURLOPT_PRIVATEโ a private pointer for you to store stuff in. SeeCURLOPT_PRIVATE(3)CURLOPT_SHAREโ the share object to use. SeeCURLOPT_SHARE(3)CURLOPT_NEW_FILE_PERMSโ the mode used when creating new remote files. SeeCURLOPT_NEW_FILE_PERMS(3)CURLOPT_NEW_DIRECTORY_PERMSโ the mode used when creating new remote directories. SeeCURLOPT_NEW_DIRECTORY_PERMS(3)
๐ TELNET OPTIONS ๐
one singular option. she's lowkey iconic for standing alone ๐
CURLOPT_TELNETOPTIONSโ the TELNET options. SeeCURLOPT_TELNETOPTIONS(3)
๐ RETURN VALUE ๐
CURLE_OK (which is zero) means the option was set properly ๐. Anything non-zero means an error happened, exactly as <gnurl/curl.h> defines it. Want the full list with descriptions? Go read libcurl-errors(3), it's all laid out there.
๐จ Important bestie PSA: any strings you pass in to libcurl must be shorter than 8000000 bytes. If they're not,curl_easy_setopt(3)returnsCURLE_BAD_FUNCTION_ARGUMENT(this was added in7.65.0, so don't come for older versions about it).
If you try to set an option libcurl genuinely doesn't know about โ maybe your library is too old to support it, or the option got removed in a recent version โ the function returns CURLE_UNKNOWN_OPTION. And if support for that option was disabled at compile-time, it returns CURLE_NOT_BUILT_IN. No cap, those are two different errors ๐ญ
โจ EXAMPLE โจ
the little hello-world of curl, we love to see it:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
๐ SEE ALSO ๐
go read these next, iykyk:
curl_easy_init(3), curl_easy_cleanup(3), curl_easy_reset(3), curl_easy_getinfo(3), curl_multi_setopt(3)
and that's the whole page, bestie!! ๐ you just read the entire gnurl_easy_setopt(3) man page โ every last option, every last "See ...(3)". this gorgeous thing ships as libcurl 7.38.0, dated 25 Jun 2014, and it lives at gnurl_easy_setopt(3). go forth and set some options ๐
โจ
๐ฆ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms