curl_easy_cleanup(3) libcurl Manual curl_easy_cleanup(3)NAME
curl_easy_cleanup - End a libcurl easy handle
SYNOPSIS
#include <curl/curl.h>
void curl_easy_cleanup(CURL *handle);
DESCRIPTION
This function must be the last function to call for an easy session. It is the opposite of the curl_easy_init(3) function and must be
called with the same handle as input that a curl_easy_init(3) call returned.
This might close all connections this handle has used and possibly has kept open until now - unless it was attached to a multi handle while
doing the transfers. Don't call this function if you intend to transfer more files, re-using handles is a key to good performance with
libcurl.
Occasionally you may get your progress callback or header callback called from within curl_easy_cleanup(3) (if previously set for the han-
dle using curl_easy_setopt(3)). Like if libcurl decides to shut down the connection and the protocol is of a kind that requires a com-
mand/response sequence before disconnect. Examples of such protocols are FTP, POP3 and IMAP.
Any use of the handle after this function has been called and have returned, is illegal. curl_easy_cleanup(3) kills the handle and all mem-
ory associated with it!
For libcurl versions before 7.17,: after you've called this function, you can safely remove all the strings you've previously told libcurl
to use, as it won't use them anymore now.
RETURN VALUE
None
EXAMPLE
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 curl_easy_init(3), curl_easy_duphandle(3), curl_easy_reset(3), curl_multi_cleanup(3), curl_multi_remove_handle(3)libcurl 7.54.0 February 03, 2016 curl_easy_cleanup(3)
Check Out this Related Man Page
CURLOPT_DEFAULT_PROTOCOL(3) curl_easy_setopt options CURLOPT_DEFAULT_PROTOCOL(3)NAME
CURLOPT_DEFAULT_PROTOCOL - default protocol to use if the URL is missing a scheme name
SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEFAULT_PROTOCOL, char *protocol);
DESCRIPTION
This option tells libcurl to use protocol if the URL is missing a scheme name.
Use one of these protocol (scheme) names:
dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
An unknown or unsupported protocol causes error CURLE_UNSUPPORTED_PROTOCOL when libcurl parses a schemeless URL. Parsing happens when
curl_easy_perform(3) or curl_multi_perform(3) is called. The protocols supported by libcurl will vary depending on how it was built. Use
curl_version_info(3) if you need a list of protocol names supported by the build of libcurl that you are using.
This option does not change the default proxy protocol (http).
Without this option libcurl would make a guess based on the host, see CURLOPT_URL(3) for details.
The application does not have to keep the string around after setting this option.
DEFAULT
NULL (make a guess based on the host)
PROTOCOLS
All
EXAMPLE
curl = curl_easy_init();
if(curl) {
/* set a URL without a scheme */
curl_easy_setopt(curl, CURLOPT_URL, "example.com");
/* set the default protocol (scheme) for schemeless URLs */
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
/* Perform the request */
curl_easy_perform(curl);
}
AVAILABILITY
Added in 7.45.0
RETURN VALUE
CURLE_OK if the option is supported.
CURLE_OUT_OF_MEMORY if there was insufficient heap space.
CURLE_UNKNOWN_OPTION if the option is not supported.
SEE ALSO CURLOPT_URL(3),
libcurl 7.54.0 December 21, 2016 CURLOPT_DEFAULT_PROTOCOL(3)