easy:SetOpt -- set options for a curl easy handle
easy:SetOpt(option, parameter)
easy:SetOpt() is used to 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 number, a string, a table, or a function reference, depending on what the specific option expects. Read this manual carefully as bad input values may cause libcurl to behave badly!

Options set with this function call are valid 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 easy:Reset().

easy:SetOpt() can be used in two different ways: You can either set a single option by passing the option and parameter arguments or you can set multiple options at once by passing a table argument to easy:SetOpt(). See below for an example.

The order in which the options are set does not matter.

The following option types are currently supported:

Path to an abstract Unix domain socket. See easy:SetOpt_Abstract_Unix_Socket for details.
Accept-Encoding and automatic decompressing data. See easy:SetOpt_Accept_Encoding for details.
Timeout for waiting for the server's connect back to be accepted. See easy:SetOpt_AcceptTimeout_MS for details.
IPv6 scope for local addresses. See easy:SetOpt_Address_Scope for details.
Append to remote file. See easy:SetOpt_Append for details.
Automatically set Referer: header. See easy:SetOpt_AutoReferer for details.
Ask for alternate buffer size. See easy:SetOpt_BufferSize for details.
CA cert bundle. See easy:SetOpt_CAInfo for details.
Path to CA cert bundle. See easy:SetOpt_CAPath for details.
Extract certificate info. See easy:SetOpt_CertInfo for details.
Callback for wildcard download start of chunk. See easy:SetOpt_Chunk_BGN_Function for details.
Callback for wildcard download end of chunk. See easy:SetOpt_Chunk_End_Function for details.
Only connect, nothing else. See easy:SetOpt_Connect_Only for details.
Connect to a specific host and port. See easy:SetOpt_Connect_To for details.
Timeout for the connection phase. See easy:SetOpt_ConnectTimeout for details.
Millisecond timeout for the connection phase. See easy:SetOpt_ConnectTimeout_MS for details.
Cookie(s) to send. See easy:SetOpt_Cookie for details.
File to read cookies from. See easy:SetOpt_CookieFile for details.
File to write cookies to. See easy:SetOpt_CookieJar for details.
Add or control cookies. See easy:SetOpt_CookieList for details.
Start a new cookie session. See easy:SetOpt_CookieSession for details.
Convert newlines. See easy:SetOpt_CRLF for details.
Certificate Revocation List. See easy:SetOpt_CRLFile for details.
Custom request/method. See easy:SetOpt_CustomRequest for details.
Callback for debug information. See easy:SetOpt_DebugFunction for details.
Default protocol. See easy:SetOpt_Default_Protocol for details.
List only. See easy:SetOpt_DirListOnly for details.
Timeout for DNS cache. See easy:SetOpt_DNS_Cache_Timeout for details.
Bind name resolves to this interface. See easy:SetOpt_DNS_Interface for details.
Bind name resolves to this IP4 address. See easy:SetOpt_DNS_Local_IP4 for details.
Bind name resolves to this IP6 address. See easy:SetOpt_DNS_Local_IP6 for details.
Preferred DNS servers. See easy:SetOpt_DNS_Servers for details.
OBSOLETE Enable global DNS cache. See easy:SetOpt_DNS_Use_Global_Cache for details.
Identify EGD socket for entropy. See easy:SetOpt_EGDSocket for details.
100-continue timeout. See easy:SetOpt_Expect_100_Timeout_MS for details.
Fail on HTTP 4xx errors. See easy:SetOpt_FailOnError for details.
Request file modification date and time. See easy:SetOpt_FileTime for details.
Callback for wildcard matching. See easy:SetOpt_FNMatch_Function for details.
Follow HTTP redirects. See easy:SetOpt_FollowLocation for details.
Prevent subsequent connections from re-using this. See easy:SetOpt_Forbid_Reuse for details.
Use a new connection. See easy:SetOpt_Fresh_Connect for details.
Send ACCT command. See easy:SetOpt_FTP_Account for details.
Alternative to USER. See easy:SetOpt_FTP_Alternative_To_User for details.
Create missing directories on the remote server. See easy:SetOpt_FTP_Create_Missing_Dirs for details.
Specify how to reach files. See easy:SetOpt_FTP_FileMethod for details.
Timeout for FTP responses. See easy:SetOpt_FTP_Response_Timeout for details.
Ignore the IP address in the PASV response. See easy:SetOpt_FTP_Skip_PASV_IP for details.
Back to non-TLS again after authentication. See easy:SetOpt_FTP_SSL_CCC for details.
Use EPTR. See easy:SetOpt_FTP_Use_Eprt for details.
Use EPSV. See easy:SetOpt_FTP_Use_Epsv for details.
Use PRET. See easy:SetOpt_FTP_Use_Pret for details.
Use active FTP. See easy:SetOpt_FTPPort for details.
Control how to do TLS. See easy:SetOpt_FTPSSLAuth for details.
Disable GSS-API delegation. See easy:SetOpt_GSSAPI_Delegation for details.
Include the header in the body output. See easy:SetOpt_Header for details.
Callback for writing received headers. See easy:SetOpt_HeaderFunction for details.
Control custom headers. See easy:SetOpt_HeaderOpt for details.
Alternative versions of 200 OK. See easy:SetOpt_HTTP200Aliases for details.
Disable Content decoding. See easy:SetOpt_HTTP_Content_Decoding for details.
Disable Transfer decoding. See easy:SetOpt_HTTP_Transfer_Decoding for details.
HTTP version to use. See easy:SetOpt_HTTP_Version for details.
HTTP server authentication methods. See easy:SetOpt_HTTPAuth for details.
Do an HTTP GET request. See easy:SetOpt_HTTPGet for details.
Custom HTTP headers. See easy:SetOpt_HTTPHeader for details.
Multipart formpost HTTP POST. See easy:SetOpt_HTTPPost for details.
Tunnel through the HTTP proxy. See easy:SetOpt_HTTPProxyTunnel for details.
Ignore Content-Length. See easy:SetOpt_Ignore_Content_Length for details.
Size of file to send. See easy:SetOpt_InFileSize for details.
Size of file to send. See easy:SetOpt_InFileSize_Large for details.
Bind connection locally to this. See easy:SetOpt_Interface for details.
IP version to resolve to. See easy:SetOpt_IPResolve for details.
Issuer certificate. See easy:SetOpt_IssuerCert for details.
Keep sending on HTTP >= 300 errors. See easy:SetOpt_Keep_Sending_On_Error for details.
Client key password. See easy:SetOpt_KeyPasswd for details.
Kerberos security level. See easy:SetOpt_KRBLevel for details.
Bind connection locally to this port. See easy:SetOpt_LocalPort for details.
Bind connection locally to port range. See easy:SetOpt_LocalPortRange for details.
Login options. See easy:SetOpt_Login_Options for details.
Low speed limit to abort transfer. See easy:SetOpt_Low_Speed_Limit for details.
Time to be below the speed to trigger low speed abort. See easy:SetOpt_Low_Speed_Time for details.
Authentication address. See easy:SetOpt_Mail_Auth for details.
Address of the sender. See easy:SetOpt_Mail_From for details.
Address of the recipients. See easy:SetOpt_Mail_RCPT for details.
Cap the download speed to this. See easy:SetOpt_Max_Recv_Speed_Large for details.
Cap the upload speed to this. See easy:SetOpt_Max_Send_Speed_Large for details.
Maximum number of connections in the connection pool. See easy:SetOpt_MaxConnects for details.
Maximum file size to get. See easy:SetOpt_MaxFileSize for details.
Maximum file size to get. See easy:SetOpt_MaxFileSize_Large for details.
Maximum number of redirects to follow. See easy:SetOpt_MaxRedirs for details.
Enable .netrc parsing. See easy:SetOpt_Netrc for details.
.netrc file name. See easy:SetOpt_Netrc_File for details.
Mode for creating new remote directories. See easy:SetOpt_New_Directory_Perms for details.
Mode for creating new remote files. See easy:SetOpt_New_File_Perms for details.
Do not get the body contents. See easy:SetOpt_Nobody for details.
Shut off the progress meter. See easy:SetOpt_NoProgress for details.
Filter out hosts from proxy use. See easy:SetOpt_NoProxy for details.
Do not install signal handlers. See easy:SetOpt_NoSignal for details.
Password. See easy:SetOpt_Password for details.
Disable squashing /. See easy:SetOpt_Path_As_Is for details.
Set pinned SSL public key . See easy:SetOpt_PinnedPublicKey for details.
Wait on connection to pipeline on it. See easy:SetOpt_PipeWait for details.
Port number to connect to. See easy:SetOpt_Port for details.
How to act on redirects after POST. See easy:SetOpt_Post for details.
Send a POST with this data. See easy:SetOpt_PostFields for details.
Commands to run after transfer. See easy:SetOpt_PostQuote for details.
How to act on redirects after POST. See easy:SetOpt_PostRedir for details.
Socks proxy to use. See easy:SetOpt_Pre_Proxy for details.
Commands to run just before transfer. See easy:SetOpt_Prequote for details.
Callback for progress meter. See easy:SetOpt_ProgressFunction for details.
Allowed protocols. See easy:SetOpt_Protocols for details.
Proxy to use. See easy:SetOpt_Proxy for details.
Proxy CA cert bundle. See easy:SetOpt_Proxy_CAInfo for details.
Path to proxy CA cert bundle. See easy:SetOpt_Proxy_CAPath for details.
Proxy Certificate Revocation List. See easy:SetOpt_Proxy_CRLFile for details.
Proxy client key password. See easy:SetOpt_Proxy_KeyPasswd for details.
Set the proxy's pinned SSL public key. See easy:SetOpt_Proxy_PinnedPublicKey for details.
Proxy authentication service name. See easy:SetOpt_Proxy_Service_Name for details.
Proxy ciphers to use. See easy:SetOpt_Proxy_SSL_Cipher_List for details.
Control proxy SSL behavior. See easy:SetOpt_Proxy_SSL_Options for details.
Verify the host name in the proxy SSL certificate. See easy:SetOpt_Proxy_SSL_VerifyHost for details.
Verify the proxy SSL certificate. See easy:SetOpt_Proxy_SSL_VerifyPeer for details.
Proxy client cert. See easy:SetOpt_Proxy_SSLCert for details.
Proxy client cert type. See easy:SetOpt_Proxy_SSLCertType for details.
Proxy client key. See easy:SetOpt_Proxy_SSLKey for details.
Proxy client key type. See easy:SetOpt_Proxy_SSLKeyType for details.
Proxy SSL version to use. See easy:SetOpt_Proxy_SSLVersion for details.
Proxy TLS authentication password. See easy:SetOpt_Proxy_TLSAuth_Password for details.
Proxy TLS authentication methods. See easy:SetOpt_Proxy_TLSAuth_Type for details.
Proxy TLS authentication user name. See easy:SetOpt_Proxy_TLSAuth_UserName for details.
Add transfer mode to URL over proxy. See easy:SetOpt_Proxy_Transfer_Mode for details.
HTTP proxy authentication methods. See easy:SetOpt_ProxyAuth for details.
Custom HTTP headers sent to proxy. See easy:SetOpt_ProxyHeader for details.
Proxy password. See easy:SetOpt_ProxyPassword for details.
Proxy port to use. See easy:SetOpt_ProxyPort for details.
Proxy type. See easy:SetOpt_ProxyType for details.
Proxy user name. See easy:SetOpt_ProxyUserName for details.
Proxy user name and password. See easy:SetOpt_ProxyUserPwd for details.
Issue an HTTP PUT request. See easy:SetOpt_Put for details.
Commands to run before transfer. See easy:SetOpt_Quote for details.
Provide source for entropy random data. See easy:SetOpt_Random_File for details.
Range requests. See easy:SetOpt_Range for details.
Callback for reading data. See easy:SetOpt_ReadFunction for details.
Protocols to allow redirects to. See easy:SetOpt_Redir_Protocols for details.
Referer: header. See easy:SetOpt_Referer for details.
Set the request target. See easy:SetOpt_Request_Target for details.
Callback to be called before a new resolve request is started. See easy:SetOpt_Resolve for details.
Resume a transfer. See easy:SetOpt_Resume_From for details.
Resume a transfer. See easy:SetOpt_Resume_From_Large for details.
Client CSEQ number. See easy:SetOpt_RTSP_Client_CSeq for details.
RTSP request. See easy:SetOpt_RTSP_Request for details.
CSEQ number for RTSP Server->Client request. See easy:SetOpt_RTSP_Server_CSeq for details.
RTSP session-id. See easy:SetOpt_RTSP_Session_ID for details.
RTSP stream URI. See easy:SetOpt_RTSP_Stream_URI for details.
RTSP Transport: header. See easy:SetOpt_RTSP_Transport for details.
Enable SASL initial response. See easy:SetOpt_SASL_IR for details.
Callback for seek operations. See easy:SetOpt_SeekFunction for details.
Authentication service name. See easy:SetOpt_Service_Name for details.
Share object to use. See easy:SetOpt_Share for details.
Socks5 authentication methods. See easy:SetOpt_Socks5_Auth for details.
Socks5 GSSAPI NEC mode. See easy:SetOpt_Socks5_GSSAPI_NEC for details.
Socks5 GSSAPI service name. See easy:SetOpt_Socks5_GSSAPI_Service for details.
SSH authentication types. See easy:SetOpt_SSH_Auth_Types for details.
MD5 of host's public key. See easy:SetOpt_SSH_Host_Public_Key_MD5 for details.
File name with known hosts. See easy:SetOpt_SSH_KnownHosts for details.
File name of private key. See easy:SetOpt_SSH_Private_KeyFile for details.
File name of public key. See easy:SetOpt_SSH_Public_KeyFile for details.
Ciphers to use. See easy:SetOpt_SSL_Cipher_List for details.
Enable use of ALPN. See easy:SetOpt_SSL_Enable_Alpn for details.
Enable use of NPN. See easy:SetOpt_SSL_Enable_Npn for details.
Enable TLS False Start. See easy:SetOpt_SSL_FalseStart for details.
Control SSL behavior. See easy:SetOpt_SSL_Options for details.
Disable SSL session-id cache. See easy:SetOpt_SSL_SessionID_Cache for details.
Verify the host name in the SSL certificate. See easy:SetOpt_SSL_VerifyHost for details.
Verify the SSL certificate. See easy:SetOpt_SSL_VerifyPeer for details.
Verify the SSL certificate's status. See easy:SetOpt_SSL_VerifyStatus for details.
Client cert. See easy:SetOpt_SSLCert for details.
Client cert type. See easy:SetOpt_SSLCertType for details.
Use identifier with SSL engine. See easy:SetOpt_SSLEngine for details.
Default SSL engine. See easy:SetOpt_SSLEngine_Default for details.
Client key. See easy:SetOpt_SSLKey for details.
Client key type. See easy:SetOpt_SSLKeyType for details.
SSL version to use. See easy:SetOpt_SSLVersion for details.
This HTTP/2 stream depends on another. See easy:SetOpt_Stream_Depends for details.
This HTTP/2 stream depends on another exclusively. See easy:SetOpt_Stream_Depends_e for details.
Set this HTTP/2 stream's weight. See easy:SetOpt_Stream_Weight for details.
Suppress proxy CONNECT response headers from user callbacks. See easy:SetOpt_Suppress_Connect_Headers for details.
Enable TFO, TCP Fast Open. See easy:SetOpt_TCP_FastOpen for details.
Enable TCP keep-alive. See easy:SetOpt_TCP_KeepAlive for details.
Idle time before sending keep-alive. See easy:SetOpt_TCP_KeepIdle for details.
Interval between keep-alive probes. See easy:SetOpt_TCP_KeepIntvl for details.
Disable the Nagle algorithm. See easy:SetOpt_TCP_NoDelay for details.
TELNET options. See easy:SetOpt_TelnetOptions for details.
TFTP block size. See easy:SetOpt_TFTP_BlkSize for details.
Do not send TFTP options requests. See easy:SetOpt_TFTP_No_Options for details.
Make a time conditional request. See easy:SetOpt_TimeCondition for details.
Timeout for the entire request. See easy:SetOpt_Timeout for details.
Millisecond timeout for the entire request. See easy:SetOpt_Timeout_MS for details.
Time value for the time conditional request. See easy:SetOpt_TimeValue for details.
TLS authentication password. See easy:SetOpt_TLSAuth_Password for details.
TLS authentication methods. See easy:SetOpt_TLSAuth_Type for details.
TLS authentication user name. See easy:SetOpt_TLSAuth_UserName for details.
Request Transfer-Encoding. See easy:SetOpt_Transfer_Encoding for details.
Use text transfer. See easy:SetOpt_TransferText for details.
Path to a Unix domain socket. See easy:SetOpt_Unix_Socket_Path for details.
Do not restrict authentication to original host. See easy:SetOpt_Unrestricted_Auth for details.
Upload data. See easy:SetOpt_Upload for details.
URL to work on. See easy:SetOpt_URL for details.
Use TLS/SSL. See easy:SetOpt_Use_SSL for details.
User-Agent: header. See easy:SetOpt_UserAgent for details.
User name. See easy:SetOpt_UserName for details.
User name and password. See easy:SetOpt_UserPwd for details.
Display verbose information. See easy:SetOpt_Verbose for details.
Transfer multiple files according to a file name pattern. See easy:SetOpt_WildcardMatch for details.
Callback for writing data. See easy:SetOpt_WriteFunction for details.
OAuth2 bearer token. See easy:SetOpt_XOAuth2_Bearer for details.

option type to set
value to set option to
e:SetOpt(#CURLOPT_URL, "")
The code above sets some options on an easy handle.

e:SetOpt({URL = "",
    Verbose = True, FollowLocation = True})
The code above does the same as the first code snippet but instead of setting the options consecutively, it sets them all at once. The effect is the same because the order in which options are set doesn't matter.

Show TOC