un-nest curl

This commit is contained in:
2025-08-16 11:22:44 -04:00
parent 77186c88dd
commit 58cabadc44
5586 changed files with 310 additions and 310 deletions

View File

@@ -0,0 +1,37 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
# Get man_MANS variable
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
curl_add_manual_pages(man_MANS)
add_custom_target(curl-opts-man DEPENDS ${man_MANS})
add_dependencies(curl-man curl-opts-man)
if(NOT CURL_DISABLE_INSTALL)
set(_src "")
foreach(_file IN LISTS man_MANS)
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
endforeach()
install(FILES ${_src} DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
endif()

View File

@@ -0,0 +1,66 @@
.\" generated by cd2nroff 0.1 from CURLINFO_ACTIVESOCKET.md
.TH CURLINFO_ACTIVESOCKET 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_ACTIVESOCKET \- get the active socket
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_ACTIVESOCKET,
curl_socket_t *socket);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_socket_t to receive the most recently active socket
used for the transfer connection by this curl session. If the socket is no
longer valid, \fICURL_SOCKET_BAD\fP is returned. When you are finished working
with the socket, you must call \fIcurl_easy_cleanup(3)\fP as usual on the easy
handle and let libcurl close the socket and cleanup other resources associated
with the handle. This option returns the active socket only after the transfer
is complete, and is typically used in combination with
\fICURLOPT_CONNECT_ONLY(3)\fP, which skips the transfer phase.
\fICURLINFO_ACTIVESOCKET(3)\fP was added as a replacement for
\fICURLINFO_LASTSOCKET(3)\fP since that one is not working on all platforms.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_socket_t sockfd;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
printf("Error: %s\\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
/* Extract the socket from the curl handle */
res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
if(!res && sockfd != CURL_SOCKET_BAD) {
/* operate on sockfd */
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.45.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_LASTSOCKET (3),
.BR CURLOPT_CONNECT_ONLY (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,84 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_ACTIVESOCKET
Section: 3
Source: libcurl
See-also:
- CURLINFO_LASTSOCKET (3)
- CURLOPT_CONNECT_ONLY (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.45.0
---
# NAME
CURLINFO_ACTIVESOCKET - get the active socket
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_ACTIVESOCKET,
curl_socket_t *socket);
~~~
# DESCRIPTION
Pass a pointer to a curl_socket_t to receive the most recently active socket
used for the transfer connection by this curl session. If the socket is no
longer valid, *CURL_SOCKET_BAD* is returned. When you are finished working
with the socket, you must call curl_easy_cleanup(3) as usual on the easy
handle and let libcurl close the socket and cleanup other resources associated
with the handle. This option returns the active socket only after the transfer
is complete, and is typically used in combination with
CURLOPT_CONNECT_ONLY(3), which skips the transfer phase.
CURLINFO_ACTIVESOCKET(3) was added as a replacement for
CURLINFO_LASTSOCKET(3) since that one is not working on all platforms.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_socket_t sockfd;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
printf("Error: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
/* Extract the socket from the curl handle */
res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
if(!res && sockfd != CURL_SOCKET_BAD) {
/* operate on sockfd */
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,55 @@
.\" generated by cd2nroff 0.1 from CURLINFO_APPCONNECT_TIME.md
.TH CURLINFO_APPCONNECT_TIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_APPCONNECT_TIME \- get the time until the SSL/SSH handshake is completed
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME,
double *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the SSL/SSH connect/handshake to the remote host was completed.
This time is most often close to the \fICURLINFO_PRETRANSFER_TIME(3)\fP time, except
for cases such as HTTP multiplexing where the pretransfer time can be delayed
due to waits in line for the stream and more.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
if(CURLE_OK == res) {
printf("Time: %.1f", connect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.19.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_APPCONNECT_TIME_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,73 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_APPCONNECT_TIME
Section: 3
Source: libcurl
See-also:
- CURLINFO_APPCONNECT_TIME_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.19.0
---
# NAME
CURLINFO_APPCONNECT_TIME - get the time until the SSL/SSH handshake is completed
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME,
double *timep);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the SSL/SSH connect/handshake to the remote host was completed.
This time is most often close to the CURLINFO_PRETRANSFER_TIME(3) time, except
for cases such as HTTP multiplexing where the pretransfer time can be delayed
due to waits in line for the stream and more.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
if(CURLE_OK == res) {
printf("Time: %.1f", connect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_APPCONNECT_TIME_T.md
.TH CURLINFO_APPCONNECT_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_APPCONNECT_TIME_T \- time until the SSL/SSH handshake completed
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, it took
from the start until the SSL/SSH connect/handshake to the remote host was
completed. This time is most often close to the \fICURLINFO_PRETRANSFER_TIME_T(3)\fP
time, except for cases such as HTTP multiplexing where the pretransfer time
can be delayed due to waits in line for the stream and more.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
(long)(connect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.61.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_APPCONNECT_TIME (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,74 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_APPCONNECT_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_APPCONNECT_TIME (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.61.0
---
# NAME
CURLINFO_APPCONNECT_TIME_T - time until the SSL/SSH handshake completed
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, it took
from the start until the SSL/SSH connect/handshake to the remote host was
completed. This time is most often close to the CURLINFO_PRETRANSFER_TIME_T(3)
time, except for cases such as HTTP multiplexing where the pretransfer time
can be delayed due to waits in line for the stream and more.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
(long)(connect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,52 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CAINFO.md
.TH CURLINFO_CAINFO 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CAINFO \- get the default built\-in CA certificate path
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null\-terminated
string holding the default built\-in path used for the \fICURLOPT_CAINFO(3)\fP
option unless set by the user.
Note that in a situation where libcurl has been built to support multiple TLS
libraries, this option might return a string even if the specific TLS library
currently set to be used does not support \fICURLOPT_CAINFO(3)\fP.
This is a path identifying a single file containing CA certificates.
The \fBpath\fP pointer is set to NULL if there is no default path.
.SH PROTOCOLS
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
All TLS backends support this option.
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
char *cainfo = NULL;
curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
if(cainfo) {
printf("default ca info path: %s\\n", cainfo);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.84.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CAPATH (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,70 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CAINFO
Section: 3
Source: libcurl
See-also:
- CURLINFO_CAPATH (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TLS
TLS-backend:
- All
Added-in: 7.84.0
---
# NAME
CURLINFO_CAINFO - get the default built-in CA certificate path
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null-terminated
string holding the default built-in path used for the CURLOPT_CAINFO(3)
option unless set by the user.
Note that in a situation where libcurl has been built to support multiple TLS
libraries, this option might return a string even if the specific TLS library
currently set to be used does not support CURLOPT_CAINFO(3).
This is a path identifying a single file containing CA certificates.
The **path** pointer is set to NULL if there is no default path.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
char *cainfo = NULL;
curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
if(cainfo) {
printf("default ca info path: %s\n", cainfo);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,53 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CAPATH.md
.TH CURLINFO_CAPATH 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CAPATH \- get the default built\-in CA path string
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAPATH, char **path);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null\-terminated
string holding the default built\-in path used for the \fICURLOPT_CAPATH(3)\fP
option unless set by the user.
Note that in a situation where libcurl has been built to support multiple TLS
libraries, this option might return a string even if the specific TLS library
currently set to be used does not support \fICURLOPT_CAPATH(3)\fP.
This is a path identifying a directory.
The \fBpath\fP pointer is set to NULL if there is no default path.
.SH PROTOCOLS
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
This option works only with the following TLS backends:
GnuTLS, OpenSSL, mbedTLS and wolfSSL
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
char *capath = NULL;
curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath);
if(capath) {
printf("default ca path: %s\\n", capath);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.84.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CAINFO (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,73 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CAPATH
Section: 3
Source: libcurl
See-also:
- CURLINFO_CAINFO (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TLS
TLS-backend:
- OpenSSL
- GnuTLS
- mbedTLS
- wolfSSL
Added-in: 7.84.0
---
# NAME
CURLINFO_CAPATH - get the default built-in CA path string
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAPATH, char **path);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null-terminated
string holding the default built-in path used for the CURLOPT_CAPATH(3)
option unless set by the user.
Note that in a situation where libcurl has been built to support multiple TLS
libraries, this option might return a string even if the specific TLS library
currently set to be used does not support CURLOPT_CAPATH(3).
This is a path identifying a directory.
The **path** pointer is set to NULL if there is no default path.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
char *capath = NULL;
curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath);
if(capath) {
printf("default ca path: %s\n", capath);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,87 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CERTINFO.md
.TH CURLINFO_CERTINFO 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CERTINFO \- get the TLS certificate chain
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CERTINFO,
struct curl_certinfo **chainp);
.fi
.SH DESCRIPTION
Pass a pointer to a \fIstruct curl_certinfo \fP* and it is set to point to a
struct that holds info about the server\(aqs certificate chain, assuming you had
\fICURLOPT_CERTINFO(3)\fP enabled when the request was made.
.nf
struct curl_certinfo {
int num_of_certs;
struct curl_slist **certinfo;
};
.fi
The \fIcertinfo\fP struct member is an array of linked lists of certificate
information. The \fInum_of_certs\fP struct member is the number of certificates
which is the number of elements in the array. Each certificate\(aqs list has
items with textual information in the format "name:content" such as
\&"Subject:Foo", "Issuer:Bar", etc. The items in each list varies depending on
the SSL backend and the certificate.
.SH PROTOCOLS
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
This option works only with the following TLS backends:
GnuTLS, OpenSSL, Schannel and rustls
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
/* connect to any HTTPS site, trusted or not */
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
res = curl_easy_perform(curl);
if(!res) {
int i;
struct curl_certinfo *ci;
res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
if(!res) {
printf("%d certs!\\n", ci->num_of_certs);
for(i = 0; i < ci->num_of_certs; i++) {
struct curl_slist *slist;
for(slist = ci->certinfo[i]; slist; slist = slist->next)
printf("%s\\n", slist->data);
}
}
}
curl_easy_cleanup(curl);
}
}
.fi
See also the \fIcertinfo.c\fP example.
.SH HISTORY
GnuTLS support added in 7.42.0. Schannel support added in 7.50.0. mbedTLS
support added in 8.9.0.
.SH AVAILABILITY
Added in curl 7.19.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CAPATH (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,109 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CERTINFO
Section: 3
Source: libcurl
See-also:
- CURLINFO_CAPATH (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TLS
TLS-backend:
- OpenSSL
- GnuTLS
- Schannel
- rustls
Added-in: 7.19.1
---
# NAME
CURLINFO_CERTINFO - get the TLS certificate chain
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CERTINFO,
struct curl_certinfo **chainp);
~~~
# DESCRIPTION
Pass a pointer to a *struct curl_certinfo ** and it is set to point to a
struct that holds info about the server's certificate chain, assuming you had
CURLOPT_CERTINFO(3) enabled when the request was made.
~~~c
struct curl_certinfo {
int num_of_certs;
struct curl_slist **certinfo;
};
~~~
The *certinfo* struct member is an array of linked lists of certificate
information. The *num_of_certs* struct member is the number of certificates
which is the number of elements in the array. Each certificate's list has
items with textual information in the format "name:content" such as
"Subject:Foo", "Issuer:Bar", etc. The items in each list varies depending on
the SSL backend and the certificate.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
/* connect to any HTTPS site, trusted or not */
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
res = curl_easy_perform(curl);
if(!res) {
int i;
struct curl_certinfo *ci;
res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
if(!res) {
printf("%d certs!\n", ci->num_of_certs);
for(i = 0; i < ci->num_of_certs; i++) {
struct curl_slist *slist;
for(slist = ci->certinfo[i]; slist; slist = slist->next)
printf("%s\n", slist->data);
}
}
}
curl_easy_cleanup(curl);
}
}
~~~
See also the *certinfo.c* example.
# HISTORY
GnuTLS support added in 7.42.0. Schannel support added in 7.50.0. mbedTLS
support added in 8.9.0.
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,64 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONDITION_UNMET.md
.TH CURLINFO_CONDITION_UNMET 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONDITION_UNMET \- get info on unmet time conditional or 304 HTTP response.
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET,
long *unmet);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the number 1 if the condition provided in
the previous request did not match (see \fICURLOPT_TIMECONDITION(3)\fP). Alas,
if this returns a 1 you know that the reason you did not get data in return is
because it did not fulfill the condition. The long this argument points to
gets a zero stored if the condition instead was met. This can also return 1 if
the server responded with a 304 HTTP status code, for example after sending a
custom "If\-Match\-*" header.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* January 1, 2020 is 1577833200 */
curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
/* If-Modified-Since the above time stamp */
curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
(long)CURL_TIMECOND_IFMODSINCE);
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the time condition */
long unmet;
res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
if(!res) {
printf("The time condition was %sfulfilled\\n", unmet?"NOT":"");
}
}
}
}
.fi
.SH AVAILABILITY
Added in curl 7.19.4
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_TIMECONDITION (3),
.BR CURLOPT_TIMEVALUE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,82 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONDITION_UNMET
Section: 3
Source: libcurl
See-also:
- CURLOPT_TIMECONDITION (3)
- CURLOPT_TIMEVALUE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.19.4
---
# NAME
CURLINFO_CONDITION_UNMET - get info on unmet time conditional or 304 HTTP response.
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET,
long *unmet);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the number 1 if the condition provided in
the previous request did not match (see CURLOPT_TIMECONDITION(3)). Alas,
if this returns a 1 you know that the reason you did not get data in return is
because it did not fulfill the condition. The long this argument points to
gets a zero stored if the condition instead was met. This can also return 1 if
the server responded with a 304 HTTP status code, for example after sending a
custom "If-Match-*" header.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* January 1, 2020 is 1577833200 */
curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
/* If-Modified-Since the above time stamp */
curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
(long)CURL_TIMECOND_IFMODSINCE);
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the time condition */
long unmet;
res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
if(!res) {
printf("The time condition was %sfulfilled\n", unmet?"NOT":"");
}
}
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,51 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONNECT_TIME.md
.TH CURLINFO_CONNECT_TIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONNECT_TIME \- get the time until connect
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the total time in seconds from the start
until the connection to the remote host (or proxy) was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
if(CURLE_OK == res) {
printf("Time: %.1f", connect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.4.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONNECT_TIME_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,69 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONNECT_TIME
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONNECT_TIME_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.4.1
---
# NAME
CURLINFO_CONNECT_TIME - get the time until connect
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double *timep);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the total time in seconds from the start
until the connection to the remote host (or proxy) was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
if(CURLE_OK == res) {
printf("Time: %.1f", connect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,54 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONNECT_TIME_T.md
.TH CURLINFO_CONNECT_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONNECT_TIME_T \- get the time until connect
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time in microseconds from
the start until the connection to the remote host (or proxy) was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
(long)(connect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.61.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONNECT_TIME (3),
.BR CURLOPT_CONNECTTIMEOUT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,72 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONNECT_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONNECT_TIME (3)
- CURLOPT_CONNECTTIMEOUT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.61.0
---
# NAME
CURLINFO_CONNECT_TIME_T - get the time until connect
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time in microseconds from
the start until the connection to the remote host (or proxy) was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
(long)(connect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,54 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONN_ID.md
.TH CURLINFO_CONN_ID 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONN_ID \- get the ID of the last connection used by the handle
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONN_ID,
curl_off_t *conn_id);
.fi
.SH DESCRIPTION
Pass a pointer to a \fIcurl_off_t\fP to receive the connection identifier last
used by the handle. Stores \-1 if there was no connection used.
The connection id is unique among all connections using the same
connection cache. This is implicitly the case for all connections in the
same multi handle.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
curl_off_t conn_id;
res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id);
if(!res) {
printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\\n", conn_id);
}
}
}
}
.fi
.SH AVAILABILITY
Added in curl 8.2.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_XFER_ID (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,72 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONN_ID
Section: 3
Source: libcurl
See-also:
- CURLINFO_XFER_ID (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 8.2.0
---
# NAME
CURLINFO_CONN_ID - get the ID of the last connection used by the handle
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONN_ID,
curl_off_t *conn_id);
~~~
# DESCRIPTION
Pass a pointer to a *curl_off_t* to receive the connection identifier last
used by the handle. Stores -1 if there was no connection used.
The connection id is unique among all connections using the same
connection cache. This is implicitly the case for all connections in the
same multi handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
curl_off_t conn_id;
res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id);
if(!res) {
printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\n", conn_id);
}
}
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_LENGTH_DOWNLOAD.md
.TH CURLINFO_CONTENT_LENGTH_DOWNLOAD 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONTENT_LENGTH_DOWNLOAD \- get content\-length of download
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
double *content_length);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the content\-length of the download. This
is the value read from the Content\-Length: field. Since 7.19.4, this returns
-1 if the size is not known.
\fICURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)\fP is a newer replacement that returns a more
sensible variable type.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
double cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
if(!res) {
printf("Size: %.0f\\n", cl);
}
}
}
}
.fi
.SH DEPRECATED
Deprecated since 7.55.0.
.SH AVAILABILITY
Added in curl 7.6.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONTENT_LENGTH_UPLOAD (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,76 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONTENT_LENGTH_DOWNLOAD
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONTENT_LENGTH_UPLOAD (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.6.1
---
# NAME
CURLINFO_CONTENT_LENGTH_DOWNLOAD - get content-length of download
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
double *content_length);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the content-length of the download. This
is the value read from the Content-Length: field. Since 7.19.4, this returns
-1 if the size is not known.
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3) is a newer replacement that returns a more
sensible variable type.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
double cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
if(!res) {
printf("Size: %.0f\n", cl);
}
}
}
}
~~~
# DEPRECATED
Deprecated since 7.55.0.
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,51 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md
.TH CURLINFO_CONTENT_LENGTH_DOWNLOAD_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T \- get content\-length of download
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
curl_off_t *content_length);
.fi
.SH DESCRIPTION
Pass a pointer to a \fIcurl_off_t\fP to receive the content\-length of the
download. This is the value read from the Content\-Length: field. Stores \-1 if
the size is not known.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
curl_off_t cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
if(!res) {
printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
}
}
}
}
.fi
.SH AVAILABILITY
Added in curl 7.55.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONTENT_LENGTH_UPLOAD_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,69 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONTENT_LENGTH_UPLOAD_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.55.0
---
# NAME
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T - get content-length of download
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
curl_off_t *content_length);
~~~
# DESCRIPTION
Pass a pointer to a *curl_off_t* to receive the content-length of the
download. This is the value read from the Content-Length: field. Stores -1 if
the size is not known.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
curl_off_t cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
if(!res) {
printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
}
}
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,55 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_LENGTH_UPLOAD.md
.TH CURLINFO_CONTENT_LENGTH_UPLOAD 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONTENT_LENGTH_UPLOAD \- get the specified size of the upload
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD,
double *content_length);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the specified size of the upload. Since
7.19.4, this returns \-1 if the size is not known.
\fICURLINFO_CONTENT_LENGTH_UPLOAD_T(3)\fP is a newer replacement that returns a
more sensible variable type.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the upload */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
double cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
if(!res) {
printf("Size: %.0f\\n", cl);
}
}
}
}
.fi
.SH DEPRECATED
Deprecated since 7.55.0.
.SH AVAILABILITY
Added in curl 7.6.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,75 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONTENT_LENGTH_UPLOAD
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.6.1
---
# NAME
CURLINFO_CONTENT_LENGTH_UPLOAD - get the specified size of the upload
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD,
double *content_length);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the specified size of the upload. Since
7.19.4, this returns -1 if the size is not known.
CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) is a newer replacement that returns a
more sensible variable type.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the upload */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
double cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
if(!res) {
printf("Size: %.0f\n", cl);
}
}
}
}
~~~
# DEPRECATED
Deprecated since 7.55.0.
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,50 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_LENGTH_UPLOAD_T.md
.TH CURLINFO_CONTENT_LENGTH_UPLOAD_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONTENT_LENGTH_UPLOAD_T \- get the specified size of the upload
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD_T,
curl_off_t *content_length);
.fi
.SH DESCRIPTION
Pass a pointer to a \fIcurl_off_t\fP to receive the specified size of the
upload. Stores \-1 if the size is not known.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the upload */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
curl_off_t cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl);
if(!res) {
printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
}
}
}
}
.fi
.SH AVAILABILITY
Added in curl 7.55.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,68 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONTENT_LENGTH_UPLOAD_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.55.0
---
# NAME
CURLINFO_CONTENT_LENGTH_UPLOAD_T - get the specified size of the upload
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD_T,
curl_off_t *content_length);
~~~
# DESCRIPTION
Pass a pointer to a *curl_off_t* to receive the specified size of the
upload. Stores -1 if the size is not known.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the upload */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
curl_off_t cl;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl);
if(!res) {
printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
}
}
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,59 @@
.\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_TYPE.md
.TH CURLINFO_CONTENT_TYPE 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_CONTENT_TYPE \- get Content\-Type
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_TYPE, char **ct);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the content\-type of the downloaded
object. This is the value read from the Content\-Type: field. If you get NULL,
it means that the server did not send a valid Content\-Type header or that the
protocol used does not support this.
The \fBct\fP pointer is set to NULL or pointing to private memory. You MUST
NOT free it \- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the
corresponding curl handle.
The modern way to get this header from a response is to instead use the
\fIcurl_easy_header(3)\fP function.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the content-type */
char *ct = NULL;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if(!res && ct) {
printf("Content-Type: %s\\n", ct);
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.9.4
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_HEADERFUNCTION (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_header (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,77 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_CONTENT_TYPE
Section: 3
Source: libcurl
See-also:
- CURLOPT_HEADERFUNCTION (3)
- curl_easy_getinfo (3)
- curl_easy_header (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.9.4
---
# NAME
CURLINFO_CONTENT_TYPE - get Content-Type
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_TYPE, char **ct);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the content-type of the downloaded
object. This is the value read from the Content-Type: field. If you get NULL,
it means that the server did not send a valid Content-Type header or that the
protocol used does not support this.
The **ct** pointer is set to NULL or pointing to private memory. You MUST
NOT free it - it gets freed when you call curl_easy_cleanup(3) on the
corresponding curl handle.
The modern way to get this header from a response is to instead use the
curl_easy_header(3) function.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the content-type */
char *ct = NULL;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if(!res && ct) {
printf("Content-Type: %s\n", ct);
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,66 @@
.\" generated by cd2nroff 0.1 from CURLINFO_COOKIELIST.md
.TH CURLINFO_COOKIELIST 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_COOKIELIST \- get all known cookies
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_COOKIELIST,
struct curl_slist **cookies);
.fi
.SH DESCRIPTION
Pass a pointer to a \(aqstruct curl_slist *\(aq to receive a linked\-list of all
cookies curl knows (expired ones, too). Do not forget to call
\fIcurl_slist_free_all(3)\fP on the list after it has been used. If there are no
cookies (cookies for the handle have not been enabled or simply none have been
received) the \(aqstruct curl_slist *\(aq is made a NULL pointer.
Since 7.43.0 cookies that were imported in the Set\-Cookie format without a
domain name are not exported by this option.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* enable the cookie engine */
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
res = curl_easy_perform(curl);
if(!res) {
/* extract all known cookies */
struct curl_slist *cookies = NULL;
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if(!res && cookies) {
/* a linked list of cookies in cookie file format */
struct curl_slist *each = cookies;
while(each) {
printf("%s\\n", each->data);
each = each->next;
}
/* we must free these cookies when we are done */
curl_slist_free_all(cookies);
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.14.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_COOKIELIST (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,84 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_COOKIELIST
Section: 3
Source: libcurl
See-also:
- CURLOPT_COOKIELIST (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.14.1
---
# NAME
CURLINFO_COOKIELIST - get all known cookies
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_COOKIELIST,
struct curl_slist **cookies);
~~~
# DESCRIPTION
Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all
cookies curl knows (expired ones, too). Do not forget to call
curl_slist_free_all(3) on the list after it has been used. If there are no
cookies (cookies for the handle have not been enabled or simply none have been
received) the 'struct curl_slist *' is made a NULL pointer.
Since 7.43.0 cookies that were imported in the Set-Cookie format without a
domain name are not exported by this option.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* enable the cookie engine */
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
res = curl_easy_perform(curl);
if(!res) {
/* extract all known cookies */
struct curl_slist *cookies = NULL;
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if(!res && cookies) {
/* a linked list of cookies in cookie file format */
struct curl_slist *each = cookies;
while(each) {
printf("%s\n", each->data);
each = each->next;
}
/* we must free these cookies when we are done */
curl_slist_free_all(cookies);
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,61 @@
.\" generated by cd2nroff 0.1 from CURLINFO_EARLYDATA_SENT_T.md
.TH CURLINFO_EARLYDATA_SENT_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_EARLYDATA_SENT_T \- get the number of bytes sent as TLS early data
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EARLYDATA_SENT_T,
curl_off_t *amount);
.fi
.SH DESCRIPTION
Pass a pointer to an \fIcurl_off_t\fP to receive the total amount of bytes that
were sent to the server as TLSv1.3 early data. When no TLS early
data is used, this reports 0.
TLS early data is only attempted when CURLSSLOPT_EARLYDATA is set for the
transfer. In addition, it is only used by libcurl when a TLS session exists
that announces support.
The amount is \fBnegative\fP when the sent data was rejected
by the server. TLS allows a server that announces support for early data to
reject any attempt to use it at its own discretion. When for example 127
bytes had been sent, but were rejected, it reports \-127 as the amount "sent".
.SH PROTOCOLS
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
This option works only with the following TLS backends:
GnuTLS
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
curl_off_t amount;
res = curl_easy_getinfo(curl, CURLINFO_EARLYDATA_SENT_T, &amount);
if(!res) {
printf("TLS earlydata: %" CURL_FORMAT_CURL_OFF_T " bytes\\n", amount);
}
}
}
}
.fi
.SH AVAILABILITY
Added in curl 8.11.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,78 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_EARLYDATA_SENT_T
Section: 3
Source: libcurl
See-also:
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TLS
TLS-backend:
- GnuTLS
Added-in: 8.11.0
---
# NAME
CURLINFO_EARLYDATA_SENT_T - get the number of bytes sent as TLS early data
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EARLYDATA_SENT_T,
curl_off_t *amount);
~~~
# DESCRIPTION
Pass a pointer to an *curl_off_t* to receive the total amount of bytes that
were sent to the server as TLSv1.3 early data. When no TLS early
data is used, this reports 0.
TLS early data is only attempted when CURLSSLOPT_EARLYDATA is set for the
transfer. In addition, it is only used by libcurl when a TLS session exists
that announces support.
The amount is **negative** when the sent data was rejected
by the server. TLS allows a server that announces support for early data to
reject any attempt to use it at its own discretion. When for example 127
bytes had been sent, but were rejected, it reports -127 as the amount "sent".
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
curl_off_t amount;
res = curl_easy_getinfo(curl, CURLINFO_EARLYDATA_SENT_T, &amount);
if(!res) {
printf("TLS earlydata: %" CURL_FORMAT_CURL_OFF_T " bytes\n", amount);
}
}
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_EFFECTIVE_METHOD.md
.TH CURLINFO_EFFECTIVE_METHOD 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_EFFECTIVE_METHOD \- get the last used HTTP method
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_METHOD,
char **methodp);
.fi
.SH DESCRIPTION
Pass in a pointer to a char pointer and get the last used effective HTTP
method.
In cases when you have asked libcurl to follow redirects, the method may not be
the same method the first request would use.
The \fBmethodp\fP pointer is NULL or points to private memory. You MUST NOT
free \- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the
corresponding curl handle.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *method = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
if(method)
printf("Redirected to method: %s\\n", method);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.72.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_CUSTOMREQUEST (3),
.BR CURLOPT_FOLLOWLOCATION (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,74 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_EFFECTIVE_METHOD
Section: 3
Source: libcurl
See-also:
- CURLOPT_CUSTOMREQUEST (3)
- CURLOPT_FOLLOWLOCATION (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.72.0
---
# NAME
CURLINFO_EFFECTIVE_METHOD - get the last used HTTP method
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_METHOD,
char **methodp);
~~~
# DESCRIPTION
Pass in a pointer to a char pointer and get the last used effective HTTP
method.
In cases when you have asked libcurl to follow redirects, the method may not be
the same method the first request would use.
The **methodp** pointer is NULL or points to private memory. You MUST NOT
free - it gets freed when you call curl_easy_cleanup(3) on the
corresponding curl handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *method = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
if(method)
printf("Redirected to method: %s\n", method);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,52 @@
.\" generated by cd2nroff 0.1 from CURLINFO_EFFECTIVE_URL.md
.TH CURLINFO_EFFECTIVE_URL 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_EFFECTIVE_URL \- get the last used URL
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_URL, char **urlp);
.fi
.SH DESCRIPTION
Pass in a pointer to a char pointer and get the last used effective URL.
In cases when you have asked libcurl to follow redirects, it may not be the same
value you set with \fICURLOPT_URL(3)\fP.
The \fBurlp\fP pointer is NULL or points to private memory. You MUST NOT free
- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding curl
handle.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *url = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
if(url)
printf("Redirect to: %s\\n", url);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.4
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_FOLLOWLOCATION (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,70 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_EFFECTIVE_URL
Section: 3
Source: libcurl
See-also:
- CURLOPT_FOLLOWLOCATION (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.4
---
# NAME
CURLINFO_EFFECTIVE_URL - get the last used URL
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_URL, char **urlp);
~~~
# DESCRIPTION
Pass in a pointer to a char pointer and get the last used effective URL.
In cases when you have asked libcurl to follow redirects, it may not be the same
value you set with CURLOPT_URL(3).
The **urlp** pointer is NULL or points to private memory. You MUST NOT free
- it gets freed when you call curl_easy_cleanup(3) on the corresponding curl
handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *url = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
if(url)
printf("Redirect to: %s\n", url);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,59 @@
.\" generated by cd2nroff 0.1 from CURLINFO_FILETIME.md
.TH CURLINFO_FILETIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_FILETIME \- get the remote time of the retrieved document
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the remote time of the retrieved document
in number of seconds since January 1 1970 in the GMT/UTC time zone. If you get
-1, it can be because of many reasons (it might be unknown, the server might
hide it or the server does not support the command that tells document time
etc) and the time of the document is unknown.
You must ask libcurl to collect this information before the transfer is made,
by using the \fICURLOPT_FILETIME(3)\fP option or you unconditionally get a \-1 back.
Consider \fICURLINFO_FILETIME_T(3)\fP instead to be able to extract dates beyond the
year 2038 on systems using 32\-bit longs (Windows).
.SH PROTOCOLS
This functionality affects ftp, http and sftp
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
long filetime = 0;
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
if((CURLE_OK == res) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.5
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_FILETIME (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,79 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_FILETIME
Section: 3
Source: libcurl
See-also:
- CURLOPT_FILETIME (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
- FTP
- SFTP
Added-in: 7.5
---
# NAME
CURLINFO_FILETIME - get the remote time of the retrieved document
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the remote time of the retrieved document
in number of seconds since January 1 1970 in the GMT/UTC time zone. If you get
-1, it can be because of many reasons (it might be unknown, the server might
hide it or the server does not support the command that tells document time
etc) and the time of the document is unknown.
You must ask libcurl to collect this information before the transfer is made,
by using the CURLOPT_FILETIME(3) option or you unconditionally get a -1 back.
Consider CURLINFO_FILETIME_T(3) instead to be able to extract dates beyond the
year 2038 on systems using 32-bit longs (Windows).
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
long filetime = 0;
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
if((CURLE_OK == res) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,60 @@
.\" generated by cd2nroff 0.1 from CURLINFO_FILETIME_T.md
.TH CURLINFO_FILETIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_FILETIME_T \- get the remote time of the retrieved document
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the remote time of the retrieved
document in number of seconds since January 1 1970 in the GMT/UTC time zone.
If you get \-1, it can be because of many reasons (it might be unknown, the
server might hide it or the server does not support the command that tells
document time etc) and the time of the document is unknown.
You must ask libcurl to collect this information before the transfer is made,
by using the \fICURLOPT_FILETIME(3)\fP option or you unconditionally get a \-1 back.
This option is an alternative to \fICURLINFO_FILETIME(3)\fP to allow systems with 32
bit long variables to extract dates outside of the 32\-bit timestamp range.
.SH PROTOCOLS
This functionality affects ftp, http and sftp
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
curl_off_t filetime;
res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
if((CURLE_OK == res) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.59.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_FILETIME (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,80 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_FILETIME_T
Section: 3
Source: libcurl
See-also:
- CURLOPT_FILETIME (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
- FTP
- SFTP
Added-in: 7.59.0
---
# NAME
CURLINFO_FILETIME_T - get the remote time of the retrieved document
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the remote time of the retrieved
document in number of seconds since January 1 1970 in the GMT/UTC time zone.
If you get -1, it can be because of many reasons (it might be unknown, the
server might hide it or the server does not support the command that tells
document time etc) and the time of the document is unknown.
You must ask libcurl to collect this information before the transfer is made,
by using the CURLOPT_FILETIME(3) option or you unconditionally get a -1 back.
This option is an alternative to CURLINFO_FILETIME(3) to allow systems with 32
bit long variables to extract dates outside of the 32-bit timestamp range.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
curl_off_t filetime;
res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
if((CURLE_OK == res) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_FTP_ENTRY_PATH.md
.TH CURLINFO_FTP_ENTRY_PATH 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_FTP_ENTRY_PATH \- get entry path in FTP server
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive a pointer to a string holding the
path of the entry path. That is the initial path libcurl ended up in when
logging on to the remote FTP server. This stores a NULL as pointer if
something is wrong.
The \fBpath\fP pointer is NULL or points to private memory. You MUST NOT free
- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding curl
handle.
.SH PROTOCOLS
This functionality affects ftp only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the entry path */
char *ep = NULL;
res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep);
if(!res && ep) {
printf("Entry path was: %s\\n", ep);
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH HISTORY
Works for SFTP since 7.21.4
.SH AVAILABILITY
Added in curl 7.15.4
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,76 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_FTP_ENTRY_PATH
Section: 3
Source: libcurl
See-also:
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- FTP
Added-in: 7.15.4
---
# NAME
CURLINFO_FTP_ENTRY_PATH - get entry path in FTP server
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive a pointer to a string holding the
path of the entry path. That is the initial path libcurl ended up in when
logging on to the remote FTP server. This stores a NULL as pointer if
something is wrong.
The **path** pointer is NULL or points to private memory. You MUST NOT free
- it gets freed when you call curl_easy_cleanup(3) on the corresponding curl
handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the entry path */
char *ep = NULL;
res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep);
if(!res && ep) {
printf("Entry path was: %s\n", ep);
}
}
curl_easy_cleanup(curl);
}
}
~~~
# HISTORY
Works for SFTP since 7.21.4
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,49 @@
.\" generated by cd2nroff 0.1 from CURLINFO_HEADER_SIZE.md
.TH CURLINFO_HEADER_SIZE 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_HEADER_SIZE \- get size of retrieved headers
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the total size of all the headers
received. Measured in number of bytes.
The total includes the size of any received headers suppressed by
\fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long size;
res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
if(!res)
printf("Header size: %ld bytes\\n", size);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.4.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_REQUEST_SIZE (3),
.BR CURLINFO_SIZE_DOWNLOAD (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,67 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_HEADER_SIZE
Section: 3
Source: libcurl
See-also:
- CURLINFO_REQUEST_SIZE (3)
- CURLINFO_SIZE_DOWNLOAD (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.4.1
---
# NAME
CURLINFO_HEADER_SIZE - get size of retrieved headers
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the total size of all the headers
received. Measured in number of bytes.
The total includes the size of any received headers suppressed by
CURLOPT_SUPPRESS_CONNECT_HEADERS(3).
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long size;
res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
if(!res)
printf("Header size: %ld bytes\n", size);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,59 @@
.\" generated by cd2nroff 0.1 from CURLINFO_HTTPAUTH_AVAIL.md
.TH CURLINFO_HTTPAUTH_AVAIL 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_HTTPAUTH_AVAIL \- get available HTTP authentication methods
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long *authp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method(s) available according to the previous response. The meaning of the
bits is explained in the \fICURLOPT_HTTPAUTH(3)\fP option for \fIcurl_easy_setopt(3)\fP.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res) {
if(!auth)
printf("No auth available, perhaps no 401?\\n");
else {
printf("%s%s%s%s\\n",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.10.8
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_PROXYAUTH_AVAIL (3),
.BR CURLOPT_HTTPAUTH (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,77 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_HTTPAUTH_AVAIL
Section: 3
Source: libcurl
See-also:
- CURLINFO_PROXYAUTH_AVAIL (3)
- CURLOPT_HTTPAUTH (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.10.8
---
# NAME
CURLINFO_HTTPAUTH_AVAIL - get available HTTP authentication methods
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long *authp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method(s) available according to the previous response. The meaning of the
bits is explained in the CURLOPT_HTTPAUTH(3) option for curl_easy_setopt(3).
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(!res) {
/* extract the available authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res) {
if(!auth)
printf("No auth available, perhaps no 401?\n");
else {
printf("%s%s%s%s\n",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,61 @@
.\" generated by cd2nroff 0.1 from CURLINFO_HTTPAUTH_USED.md
.TH CURLINFO_HTTPAUTH_USED 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_HTTPAUTH_USED \- get used HTTP authentication method
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_USED, long *authp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method that was used in the previous HTTP request. The meaning of the possible
bits is explained in the \fICURLOPT_HTTPAUTH(3)\fP option for \fIcurl_easy_setopt(3)\fP.
The returned value has zero or one bit set.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERNAME, "shrek");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "swamp");
res = curl_easy_perform(curl);
if(!res) {
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_USED, &auth);
if(!res) {
if(!auth)
printf("No auth used\\n");
else {
if(auth == CURLAUTH_DIGEST)
printf("Used Digest authentication\\n");
else
printf("Used Basic authentication\\n");
}
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 8.12.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_HTTPAUTH_AVAIL (3),
.BR CURLINFO_PROXYAUTH_USED (3),
.BR CURLOPT_HTTPAUTH (3)

View File

@@ -0,0 +1,79 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_HTTPAUTH_USED
Section: 3
Source: libcurl
See-also:
- CURLINFO_PROXYAUTH_USED (3)
- CURLINFO_HTTPAUTH_AVAIL (3)
- CURLOPT_HTTPAUTH (3)
Protocol:
- HTTP
Added-in: 8.12.0
---
# NAME
CURLINFO_HTTPAUTH_USED - get used HTTP authentication method
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_USED, long *authp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method that was used in the previous HTTP request. The meaning of the possible
bits is explained in the CURLOPT_HTTPAUTH(3) option for curl_easy_setopt(3).
The returned value has zero or one bit set.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_USERNAME, "shrek");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "swamp");
res = curl_easy_perform(curl);
if(!res) {
long auth;
res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_USED, &auth);
if(!res) {
if(!auth)
printf("No auth used\n");
else {
if(auth == CURLAUTH_DIGEST)
printf("Used Digest authentication\n");
else
printf("Used Basic authentication\n");
}
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,49 @@
.\" generated by cd2nroff 0.1 from CURLINFO_HTTP_CONNECTCODE.md
.TH CURLINFO_HTTP_CONNECTCODE 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_HTTP_CONNECTCODE \- get the CONNECT response code
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the last received HTTP proxy response code
to a CONNECT request. The returned value is zero if no such response code was
available.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* typically CONNECT is used to do HTTPS over HTTP proxies */
curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long code;
res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
if(!res && code)
printf("The CONNECT response code: %03ld\\n", code);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.10.7
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_RESPONSE_CODE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,67 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_HTTP_CONNECTCODE
Section: 3
Source: libcurl
See-also:
- CURLINFO_RESPONSE_CODE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.10.7
---
# NAME
CURLINFO_HTTP_CONNECTCODE - get the CONNECT response code
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the last received HTTP proxy response code
to a CONNECT request. The returned value is zero if no such response code was
available.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* typically CONNECT is used to do HTTPS over HTTP proxies */
curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long code;
res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
if(!res && code)
printf("The CONNECT response code: %03ld\n", code);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,45 @@
.\" generated by cd2nroff 0.1 from CURLINFO_HTTP_VERSION.md
.TH CURLINFO_HTTP_VERSION 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_HTTP_VERSION \- get the http version used in the connection
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the version used in the last http
connection done using this handle. The returned value is
CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0,
CURL_HTTP_VERSION_3 or 0 if the version cannot be determined.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long http_version;
curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.50.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_RESPONSE_CODE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,63 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_HTTP_VERSION
Section: 3
Source: libcurl
See-also:
- CURLINFO_RESPONSE_CODE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.50.0
---
# NAME
CURLINFO_HTTP_VERSION - get the http version used in the connection
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the version used in the last http
connection done using this handle. The returned value is
CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0,
CURL_HTTP_VERSION_3 or 0 if the version cannot be determined.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long http_version;
curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,66 @@
.\" generated by cd2nroff 0.1 from CURLINFO_LASTSOCKET.md
.TH CURLINFO_LASTSOCKET 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_LASTSOCKET \- get the last socket used
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LASTSOCKET, long *socket);
.fi
.SH DESCRIPTION
Deprecated since 7.45.0. Use \fICURLINFO_ACTIVESOCKET(3)\fP instead.
Pass a pointer to a long to receive the last socket used by this curl
session. If the socket is no longer valid, \-1 is returned. When you finish
working with the socket, you must call \fIcurl_easy_cleanup(3)\fP as usual and
let libcurl close the socket and cleanup other resources associated with the
handle. This is typically used in combination with
\fICURLOPT_CONNECT_ONLY(3)\fP.
NOTE: this API is deprecated since it is not working on win64 where the SOCKET
type is 64 bits large while its \(aqlong\(aq is 32 bits. Use the
\fICURLINFO_ACTIVESOCKET(3)\fP instead, if possible.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
long sockfd; /* does not work on win64 */
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
printf("Error: %s\\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
/* Extract the socket from the curl handle */
res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
if(!res && sockfd != -1) {
/* operate on sockfd */
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.15.2
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_ACTIVESOCKET (3),
.BR CURLOPT_CONNECT_ONLY (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,84 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_LASTSOCKET
Section: 3
Source: libcurl
See-also:
- CURLINFO_ACTIVESOCKET (3)
- CURLOPT_CONNECT_ONLY (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.15.2
---
# NAME
CURLINFO_LASTSOCKET - get the last socket used
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LASTSOCKET, long *socket);
~~~
# DESCRIPTION
Deprecated since 7.45.0. Use CURLINFO_ACTIVESOCKET(3) instead.
Pass a pointer to a long to receive the last socket used by this curl
session. If the socket is no longer valid, -1 is returned. When you finish
working with the socket, you must call curl_easy_cleanup(3) as usual and
let libcurl close the socket and cleanup other resources associated with the
handle. This is typically used in combination with
CURLOPT_CONNECT_ONLY(3).
NOTE: this API is deprecated since it is not working on win64 where the SOCKET
type is 64 bits large while its 'long' is 32 bits. Use the
CURLINFO_ACTIVESOCKET(3) instead, if possible.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
long sockfd; /* does not work on win64 */
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
printf("Error: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
/* Extract the socket from the curl handle */
res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
if(!res && sockfd != -1) {
/* operate on sockfd */
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_LOCAL_IP.md
.TH CURLINFO_LOCAL_IP 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_LOCAL_IP \- get local IP address of last connection
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_IP, char **ip);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null\-terminated
string holding the IP address of the local end of most recent connection done
with this \fBcurl\fP handle. This string may be IPv6 when that is enabled. Note
that you get a pointer to a memory area that is reused at next request so you
need to copy the string if you want to keep the information.
The \fBip\fP pointer is NULL or points to private memory. You MUST NOT free \- it
gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding CURL
handle.
.SH PROTOCOLS
This functionality affects quic and tcp
.SH EXAMPLE
.nf
int main(void)
{
char *ip;
CURLcode res;
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the transfer */
res = curl_easy_perform(curl);
/* Check for errors */
if((res == CURLE_OK) &&
!curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) {
printf("Local IP: %s\\n", ip);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in curl 7.21.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_LOCAL_PORT (3),
.BR CURLINFO_PRIMARY_IP (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,75 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_LOCAL_IP
Section: 3
Source: libcurl
See-also:
- CURLINFO_LOCAL_PORT (3)
- CURLINFO_PRIMARY_IP (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TCP
- QUIC
Added-in: 7.21.0
---
# NAME
CURLINFO_LOCAL_IP - get local IP address of last connection
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_IP, char **ip);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null-terminated
string holding the IP address of the local end of most recent connection done
with this **curl** handle. This string may be IPv6 when that is enabled. Note
that you get a pointer to a memory area that is reused at next request so you
need to copy the string if you want to keep the information.
The **ip** pointer is NULL or points to private memory. You MUST NOT free - it
gets freed when you call curl_easy_cleanup(3) on the corresponding CURL
handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
char *ip;
CURLcode res;
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the transfer */
res = curl_easy_perform(curl);
/* Check for errors */
if((res == CURLE_OK) &&
!curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) {
printf("Local IP: %s\n", ip);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,55 @@
.\" generated by cd2nroff 0.1 from CURLINFO_LOCAL_PORT.md
.TH CURLINFO_LOCAL_PORT 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_LOCAL_PORT \- get the latest local port number
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_PORT, long *portp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the local port number of the most recent
connection done with this \fBcurl\fP handle.
If the connection was done using QUIC, the port number is a UDP port number,
otherwise it is a TCP port number.
.SH PROTOCOLS
This functionality affects quic and tcp
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
long port;
res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port);
if(CURLE_OK == res) {
printf("We used local port: %ld\\n", port);
}
}
curl_easy_cleanup(curl);
}
return 0;
}
.fi
.SH AVAILABILITY
Added in curl 7.21.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_LOCAL_IP (3),
.BR CURLINFO_PRIMARY_PORT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,74 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_LOCAL_PORT
Section: 3
Source: libcurl
Protocol:
- TCP
- QUIC
See-also:
- CURLINFO_LOCAL_IP (3)
- CURLINFO_PRIMARY_PORT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Added-in: 7.21.0
---
# NAME
CURLINFO_LOCAL_PORT - get the latest local port number
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_PORT, long *portp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the local port number of the most recent
connection done with this **curl** handle.
If the connection was done using QUIC, the port number is a UDP port number,
otherwise it is a TCP port number.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
long port;
res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port);
if(CURLE_OK == res) {
printf("We used local port: %ld\n", port);
}
}
curl_easy_cleanup(curl);
}
return 0;
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,52 @@
.\" generated by cd2nroff 0.1 from CURLINFO_NAMELOOKUP_TIME.md
.TH CURLINFO_NAMELOOKUP_TIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_NAMELOOKUP_TIME \- get the name lookup time
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME,
double *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the total time in seconds from the start
until the name resolving was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double namelookup;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
if(CURLE_OK == res) {
printf("Time: %.1f", namelookup);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.4.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_NAMELOOKUP_TIME_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,70 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_NAMELOOKUP_TIME
Section: 3
Source: libcurl
See-also:
- CURLINFO_NAMELOOKUP_TIME_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.4.1
---
# NAME
CURLINFO_NAMELOOKUP_TIME - get the name lookup time
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME,
double *timep);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the total time in seconds from the start
until the name resolving was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double namelookup;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
if(CURLE_OK == res) {
printf("Time: %.1f", namelookup);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,53 @@
.\" generated by cd2nroff 0.1 from CURLINFO_NAMELOOKUP_TIME_T.md
.TH CURLINFO_NAMELOOKUP_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_NAMELOOKUP_TIME_T \- get the name lookup time in microseconds
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time in microseconds
from the start until the name resolving was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t namelookup;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
(long)(namelookup % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.61.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_NAMELOOKUP_TIME (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,71 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_NAMELOOKUP_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_NAMELOOKUP_TIME (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.61.0
---
# NAME
CURLINFO_NAMELOOKUP_TIME_T - get the name lookup time in microseconds
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time in microseconds
from the start until the name resolving was completed.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t namelookup;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
(long)(namelookup % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,49 @@
.\" generated by cd2nroff 0.1 from CURLINFO_NUM_CONNECTS.md
.TH CURLINFO_NUM_CONNECTS 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_NUM_CONNECTS \- get number of created connections
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NUM_CONNECTS, long *nump);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive how many new connections libcurl had to
create to achieve the previous transfer (only the successful connects are
counted). Combined with \fICURLINFO_REDIRECT_COUNT(3)\fP you are able to know how
many times libcurl successfully reused existing connection(s) or not. See the
connection options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries to make
persistent connections to save time.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long connects;
res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects);
if(!res)
printf("It needed %ld connects\\n", connects);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.12.3
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,67 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_NUM_CONNECTS
Section: 3
Source: libcurl
See-also:
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.12.3
---
# NAME
CURLINFO_NUM_CONNECTS - get number of created connections
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NUM_CONNECTS, long *nump);
~~~
# DESCRIPTION
Pass a pointer to a long to receive how many new connections libcurl had to
create to achieve the previous transfer (only the successful connects are
counted). Combined with CURLINFO_REDIRECT_COUNT(3) you are able to know how
many times libcurl successfully reused existing connection(s) or not. See the
connection options of curl_easy_setopt(3) to see how libcurl tries to make
persistent connections to save time.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long connects;
res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects);
if(!res)
printf("It needed %ld connects\n", connects);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,54 @@
.\" generated by cd2nroff 0.1 from CURLINFO_OS_ERRNO.md
.TH CURLINFO_OS_ERRNO 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_OS_ERRNO \- get errno number from last connect failure
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *errnop);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the errno variable from a connect failure.
Note that the value is only set on failure, it is not reset upon a successful
operation. The number is OS and system specific.
libcurl network\-related errors that may have a saved errno are:
CURLE_COULDNT_CONNECT, CURLE_FAILED_INIT, CURLE_INTERFACE_FAILED,
CURLE_OPERATION_TIMEDOUT, CURLE_RECV_ERROR, CURLE_SEND_ERROR.
Since 8.8.0 libcurl clears the easy handle\(aqs saved errno before performing the
transfer. Prior versions did not clear the saved errno, which means if a saved
errno is retrieved it could be from a previous transfer on the same handle.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
long error;
res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
if(!res && error) {
printf("Errno: %ld\\n", error);
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.12.2
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,72 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_OS_ERRNO
Section: 3
Source: libcurl
See-also:
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.12.2
---
# NAME
CURLINFO_OS_ERRNO - get errno number from last connect failure
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *errnop);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the errno variable from a connect failure.
Note that the value is only set on failure, it is not reset upon a successful
operation. The number is OS and system specific.
libcurl network-related errors that may have a saved errno are:
CURLE_COULDNT_CONNECT, CURLE_FAILED_INIT, CURLE_INTERFACE_FAILED,
CURLE_OPERATION_TIMEDOUT, CURLE_RECV_ERROR, CURLE_SEND_ERROR.
Since 8.8.0 libcurl clears the easy handle's saved errno before performing the
transfer. Prior versions did not clear the saved errno, which means if a saved
errno is retrieved it could be from a previous transfer on the same handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
long error;
res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
if(!res && error) {
printf("Errno: %ld\n", error);
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,55 @@
.\" generated by cd2nroff 0.1 from CURLINFO_POSTTRANSFER_TIME_T.md
.TH CURLINFO_POSTTRANSFER_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_POSTTRANSFER_TIME_T \- get the time until the last byte is sent
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_POSTTRANSFER_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds,
it took from the start until the last byte is sent by libcurl.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
curl_off_t posttransfer;
res = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T,
&posttransfer);
if(CURLE_OK == res) {
printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld us",
posttransfer / 1000000, (long)(posttransfer % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 8.10.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_PRETRANSFER_TIME_T (3),
.BR CURLOPT_TIMEOUT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,73 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_POSTTRANSFER_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_PRETRANSFER_TIME_T (3)
- CURLOPT_TIMEOUT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 8.10.0
---
# NAME
CURLINFO_POSTTRANSFER_TIME_T - get the time until the last byte is sent
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_POSTTRANSFER_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds,
it took from the start until the last byte is sent by libcurl.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
curl_off_t posttransfer;
res = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T,
&posttransfer);
if(CURLE_OK == res) {
printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld us",
posttransfer / 1000000, (long)(posttransfer % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,57 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PRETRANSFER_TIME.md
.TH CURLINFO_PRETRANSFER_TIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PRETRANSFER_TIME \- get the time until the file transfer start
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME,
double *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the file transfer is just about to begin.
This time\-stamp includes all pre\-transfer commands and negotiations that are
specific to the particular protocol(s) involved. It includes the sending of
the protocol\-specific instructions that trigger a transfer.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double pretransfer;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
if(CURLE_OK == res) {
printf("Time: %.1f", pretransfer);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.4.1
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONNECT_TIME_T (3),
.BR CURLINFO_PRETRANSFER_TIME_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,75 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PRETRANSFER_TIME
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONNECT_TIME_T (3)
- CURLINFO_PRETRANSFER_TIME_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.4.1
---
# NAME
CURLINFO_PRETRANSFER_TIME - get the time until the file transfer start
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME,
double *timep);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the file transfer is just about to begin.
This time-stamp includes all pre-transfer commands and negotiations that are
specific to the particular protocol(s) involved. It includes the sending of
the protocol-specific instructions that trigger a transfer.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double pretransfer;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
if(CURLE_OK == res) {
printf("Time: %.1f", pretransfer);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,59 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PRETRANSFER_TIME_T.md
.TH CURLINFO_PRETRANSFER_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PRETRANSFER_TIME_T \- get the time until the file transfer start
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, it took
from the start until the file transfer is just about to begin.
This time\-stamp includes all pre\-transfer commands and negotiations that are
specific to the particular protocol(s) involved. It includes the sending of
the protocol\-specific instructions that trigger a transfer.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t pretransfer;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\\n",
pretransfer / 1000000,
(long)(pretransfer % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.61.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_CONNECT_TIME (3),
.BR CURLINFO_PRETRANSFER_TIME_T (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,77 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PRETRANSFER_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_CONNECT_TIME (3)
- CURLINFO_PRETRANSFER_TIME_T (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.61.0
---
# NAME
CURLINFO_PRETRANSFER_TIME_T - get the time until the file transfer start
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, it took
from the start until the file transfer is just about to begin.
This time-stamp includes all pre-transfer commands and negotiations that are
specific to the particular protocol(s) involved. It includes the sending of
the protocol-specific instructions that trigger a transfer.
When a redirect is followed, the time from each request is added together.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t pretransfer;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
pretransfer / 1000000,
(long)(pretransfer % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,57 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PRIMARY_IP.md
.TH CURLINFO_PRIMARY_IP 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PRIMARY_IP \- get IP address of last connection
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_IP, char **ip);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null\-terminated
string holding the IP address of the most recent connection done with this
\fBcurl\fP handle. This string may be IPv6 when that is enabled. Note that you
get a pointer to a memory area that is reused at next request so you need to
copy the string if you want to keep the information.
The \fBip\fP pointer is NULL or points to private memory. You MUST NOT free \- it
gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding curl
handle.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
char *ip;
CURLcode res;
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the transfer */
res = curl_easy_perform(curl);
/* Check for errors */
if((res == CURLE_OK) &&
!curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip) && ip) {
printf("IP: %s\\n", ip);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in curl 7.19.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_LOCAL_IP (3),
.BR CURLINFO_LOCAL_PORT (3),
.BR CURLINFO_PRIMARY_PORT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,75 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PRIMARY_IP
Section: 3
Source: libcurl
See-also:
- CURLINFO_LOCAL_IP (3)
- CURLINFO_LOCAL_PORT (3)
- CURLINFO_PRIMARY_PORT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.19.0
---
# NAME
CURLINFO_PRIMARY_IP - get IP address of last connection
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_IP, char **ip);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to a null-terminated
string holding the IP address of the most recent connection done with this
**curl** handle. This string may be IPv6 when that is enabled. Note that you
get a pointer to a memory area that is reused at next request so you need to
copy the string if you want to keep the information.
The **ip** pointer is NULL or points to private memory. You MUST NOT free - it
gets freed when you call curl_easy_cleanup(3) on the corresponding curl
handle.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
char *ip;
CURLcode res;
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the transfer */
res = curl_easy_perform(curl);
/* Check for errors */
if((res == CURLE_OK) &&
!curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip) && ip) {
printf("IP: %s\n", ip);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,51 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PRIMARY_PORT.md
.TH CURLINFO_PRIMARY_PORT 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PRIMARY_PORT \- get the latest destination port number
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_PORT, long *portp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the destination port of the most recent
connection done with this \fBcurl\fP handle.
This is the destination port of the actual TCP or UDP connection libcurl used.
If a proxy was used for the most recent transfer, this is the port number of
the proxy, if no proxy was used it is the port number of the most recently
accessed URL.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long port;
res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
if(!res)
printf("Connected to remote port: %ld\\n", port);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.21.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_LOCAL_PORT (3),
.BR CURLINFO_PRIMARY_IP (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,69 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PRIMARY_PORT
Section: 3
Source: libcurl
See-also:
- CURLINFO_LOCAL_PORT (3)
- CURLINFO_PRIMARY_IP (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.21.0
---
# NAME
CURLINFO_PRIMARY_PORT - get the latest destination port number
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_PORT, long *portp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the destination port of the most recent
connection done with this **curl** handle.
This is the destination port of the actual TCP or UDP connection libcurl used.
If a proxy was used for the most recent transfer, this is the port number of
the proxy, if no proxy was used it is the port number of the most recently
accessed URL.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long port;
res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
if(!res)
printf("Connected to remote port: %ld\n", port);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,52 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PRIVATE.md
.TH CURLINFO_PRIVATE 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PRIVATE \- get the private pointer
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to the private data
associated with the curl handle (set with the \fICURLOPT_PRIVATE(3)\fP).
Please note that for internal reasons, the value is returned as a char
pointer, although effectively being a \(aqvoid *\(aq.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
void *pointer = (void *)0x2345454;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
/* set the private pointer */
curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
res = curl_easy_perform(curl);
/* extract the private pointer again */
res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
if(res)
printf("error: %s\\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.10.3
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLOPT_PRIVATE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,70 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PRIVATE
Section: 3
Source: libcurl
See-also:
- CURLOPT_PRIVATE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.10.3
---
# NAME
CURLINFO_PRIVATE - get the private pointer
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private);
~~~
# DESCRIPTION
Pass a pointer to a char pointer to receive the pointer to the private data
associated with the curl handle (set with the CURLOPT_PRIVATE(3)).
Please note that for internal reasons, the value is returned as a char
pointer, although effectively being a 'void *'.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
void *pointer = (void *)0x2345454;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
/* set the private pointer */
curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
res = curl_easy_perform(curl);
/* extract the private pointer again */
res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
if(res)
printf("error: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,59 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PROTOCOL.md
.TH CURLINFO_PROTOCOL 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PROTOCOL \- get the protocol used in the connection
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
.fi
.SH DESCRIPTION
This option is deprecated. We strongly recommend using
\fICURLINFO_SCHEME(3)\fP instead, because this option cannot return all
possible protocols.
Pass a pointer to a long to receive the version used in the last http
connection. The returned value is set to one of these values:
.nf
CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
.fi
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long protocol;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH DEPRECATED
Deprecated since 7.85.0.
.SH AVAILABILITY
Added in curl 7.52.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_RESPONSE_CODE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,79 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PROTOCOL
Section: 3
Source: libcurl
See-also:
- CURLINFO_RESPONSE_CODE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.52.0
---
# NAME
CURLINFO_PROTOCOL - get the protocol used in the connection
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p);
~~~
# DESCRIPTION
This option is deprecated. We strongly recommend using
CURLINFO_SCHEME(3) instead, because this option cannot return all
possible protocols.
Pass a pointer to a long to receive the version used in the last http
connection. The returned value is set to one of these values:
~~~c
CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,
CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP,
CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3,
CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS,
CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP,
CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP,
CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
~~~
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long protocol;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
}
curl_easy_cleanup(curl);
}
}
~~~
# DEPRECATED
Deprecated since 7.85.0.
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,60 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PROXYAUTH_AVAIL.md
.TH CURLINFO_PROXYAUTH_AVAIL 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PROXYAUTH_AVAIL \- get available HTTP proxy authentication methods
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_AVAIL,
long *authp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method(s) available according to the previous response. The meaning of the
bits is explained in the \fICURLOPT_PROXYAUTH(3)\fP option for \fIcurl_easy_setopt(3)\fP.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
res = curl_easy_perform(curl);
if(!res) {
/* extract the available proxy authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth);
if(!res) {
if(!auth)
printf("No proxy auth available, perhaps no 407?\\n");
else {
printf("%s%s%s%s\\n",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.10.8
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_HTTPAUTH_AVAIL (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,78 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PROXYAUTH_AVAIL
Section: 3
Source: libcurl
See-also:
- CURLINFO_HTTPAUTH_AVAIL (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.10.8
---
# NAME
CURLINFO_PROXYAUTH_AVAIL - get available HTTP proxy authentication methods
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_AVAIL,
long *authp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method(s) available according to the previous response. The meaning of the
bits is explained in the CURLOPT_PROXYAUTH(3) option for curl_easy_setopt(3).
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
res = curl_easy_perform(curl);
if(!res) {
/* extract the available proxy authentication types */
long auth;
res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth);
if(!res) {
if(!auth)
printf("No proxy auth available, perhaps no 407?\n");
else {
printf("%s%s%s%s\n",
auth & CURLAUTH_BASIC ? "Basic ":"",
auth & CURLAUTH_DIGEST ? "Digest ":"",
auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
auth % CURLAUTH_NTLM ? "NTLM ":"");
}
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,64 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PROXYAUTH_USED.md
.TH CURLINFO_PROXYAUTH_USED 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PROXYAUTH_USED \- get used HTTP proxy authentication method
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_USED, long *authp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method that was used in the previous request done over an HTTP proxy. The
meaning of the possible bits is explained in the \fICURLOPT_HTTPAUTH(3)\fP option
for \fIcurl_easy_setopt(3)\fP.
The returned value has zero or one bit set.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com");
curl_easy_setopt(curl, CURLOPT_PROXYAUTH,
CURLAUTH_BASIC | CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "shrek");
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "swamp");
res = curl_easy_perform(curl);
if(!res) {
long auth;
res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_USED, &auth);
if(!res) {
if(!auth)
printf("No auth used\\n");
else {
if(auth == CURLAUTH_DIGEST)
printf("Used Digest proxy authentication\\n");
else
printf("Used Basic proxy authentication\\n");
}
}
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 8.12.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_HTTPAUTH_USED (3),
.BR CURLINFO_PROXYAUTH_AVAIL (3),
.BR CURLOPT_HTTPAUTH (3)

View File

@@ -0,0 +1,82 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PROXYAUTH_USED
Section: 3
Source: libcurl
See-also:
- CURLINFO_HTTPAUTH_USED (3)
- CURLINFO_PROXYAUTH_AVAIL (3)
- CURLOPT_HTTPAUTH (3)
Protocol:
- HTTP
Added-in: 8.12.0
---
# NAME
CURLINFO_PROXYAUTH_USED - get used HTTP proxy authentication method
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_USED, long *authp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive a bitmask indicating the authentication
method that was used in the previous request done over an HTTP proxy. The
meaning of the possible bits is explained in the CURLOPT_HTTPAUTH(3) option
for curl_easy_setopt(3).
The returned value has zero or one bit set.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com");
curl_easy_setopt(curl, CURLOPT_PROXYAUTH,
CURLAUTH_BASIC | CURLAUTH_DIGEST);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "shrek");
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "swamp");
res = curl_easy_perform(curl);
if(!res) {
long auth;
res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_USED, &auth);
if(!res) {
if(!auth)
printf("No auth used\n");
else {
if(auth == CURLAUTH_DIGEST)
printf("Used Digest proxy authentication\n");
else
printf("Used Basic proxy authentication\n");
}
}
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,89 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PROXY_ERROR.md
.TH CURLINFO_PROXY_ERROR 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PROXY_ERROR \- get the detailed (SOCKS) proxy error
.SH SYNOPSIS
.nf
#include <curl/curl.h>
typedef enum {
CURLPX_OK,
CURLPX_BAD_ADDRESS_TYPE,
CURLPX_BAD_VERSION,
CURLPX_CLOSED,
CURLPX_GSSAPI,
CURLPX_GSSAPI_PERMSG,
CURLPX_GSSAPI_PROTECTION,
CURLPX_IDENTD,
CURLPX_IDENTD_DIFFER,
CURLPX_LONG_HOSTNAME,
CURLPX_LONG_PASSWD,
CURLPX_LONG_USER,
CURLPX_NO_AUTH,
CURLPX_RECV_ADDRESS,
CURLPX_RECV_AUTH,
CURLPX_RECV_CONNECT,
CURLPX_RECV_REQACK,
CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
CURLPX_REPLY_CONNECTION_REFUSED,
CURLPX_REPLY_GENERAL_SERVER_FAILURE,
CURLPX_REPLY_HOST_UNREACHABLE,
CURLPX_REPLY_NETWORK_UNREACHABLE,
CURLPX_REPLY_NOT_ALLOWED,
CURLPX_REPLY_TTL_EXPIRED,
CURLPX_REPLY_UNASSIGNED,
CURLPX_REQUEST_FAILED,
CURLPX_RESOLVE_HOST,
CURLPX_SEND_AUTH,
CURLPX_SEND_CONNECT,
CURLPX_SEND_REQUEST,
CURLPX_UNKNOWN_FAIL,
CURLPX_UNKNOWN_MODE,
CURLPX_USER_REJECTED,
CURLPX_LAST /* never use */
} CURLproxycode;
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_ERROR, long *detail);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive a detailed error code when the most recent
transfer returned a \fBCURLE_PROXY\fP error. That error code matches the
\fBCURLproxycode\fP set.
The error code is zero (\fBCURLPX_OK\fP) if no response code was available.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1");
res = curl_easy_perform(curl);
if(res == CURLE_PROXY) {
long proxycode;
res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode);
if(!res && proxycode)
printf("The detailed proxy error: %ld\\n", proxycode);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.73.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_RESPONSE_CODE (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3),
.BR libcurl-errors (3)

View File

@@ -0,0 +1,107 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PROXY_ERROR
Section: 3
Source: libcurl
See-also:
- CURLINFO_RESPONSE_CODE (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
- libcurl-errors (3)
Protocol:
- All
Added-in: 7.73.0
---
# NAME
CURLINFO_PROXY_ERROR - get the detailed (SOCKS) proxy error
# SYNOPSIS
~~~c
#include <curl/curl.h>
typedef enum {
CURLPX_OK,
CURLPX_BAD_ADDRESS_TYPE,
CURLPX_BAD_VERSION,
CURLPX_CLOSED,
CURLPX_GSSAPI,
CURLPX_GSSAPI_PERMSG,
CURLPX_GSSAPI_PROTECTION,
CURLPX_IDENTD,
CURLPX_IDENTD_DIFFER,
CURLPX_LONG_HOSTNAME,
CURLPX_LONG_PASSWD,
CURLPX_LONG_USER,
CURLPX_NO_AUTH,
CURLPX_RECV_ADDRESS,
CURLPX_RECV_AUTH,
CURLPX_RECV_CONNECT,
CURLPX_RECV_REQACK,
CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
CURLPX_REPLY_CONNECTION_REFUSED,
CURLPX_REPLY_GENERAL_SERVER_FAILURE,
CURLPX_REPLY_HOST_UNREACHABLE,
CURLPX_REPLY_NETWORK_UNREACHABLE,
CURLPX_REPLY_NOT_ALLOWED,
CURLPX_REPLY_TTL_EXPIRED,
CURLPX_REPLY_UNASSIGNED,
CURLPX_REQUEST_FAILED,
CURLPX_RESOLVE_HOST,
CURLPX_SEND_AUTH,
CURLPX_SEND_CONNECT,
CURLPX_SEND_REQUEST,
CURLPX_UNKNOWN_FAIL,
CURLPX_UNKNOWN_MODE,
CURLPX_USER_REJECTED,
CURLPX_LAST /* never use */
} CURLproxycode;
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_ERROR, long *detail);
~~~
# DESCRIPTION
Pass a pointer to a long to receive a detailed error code when the most recent
transfer returned a **CURLE_PROXY** error. That error code matches the
**CURLproxycode** set.
The error code is zero (**CURLPX_OK**) if no response code was available.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1");
res = curl_easy_perform(curl);
if(res == CURLE_PROXY) {
long proxycode;
res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode);
if(!res && proxycode)
printf("The detailed proxy error: %ld\n", proxycode);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,62 @@
.\" generated by cd2nroff 0.1 from CURLINFO_PROXY_SSL_VERIFYRESULT.md
.TH CURLINFO_PROXY_SSL_VERIFYRESULT 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_PROXY_SSL_VERIFYRESULT \- get the result of the proxy certificate verification
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_SSL_VERIFYRESULT,
long *result);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the result of the certificate verification
that was requested (using the \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP
option. This is only used for HTTPS proxies.
0 is a positive result. Non\-zero is an error.
.SH PROTOCOLS
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
This option works only with the following TLS backends:
GnuTLS and OpenSSL
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
long verifyresult;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
res = curl_easy_perform(curl);
if(res) {
printf("error: %s\\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
res = curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT,
&verifyresult);
if(!res) {
printf("The peer verification said %s\\n",
(verifyresult ? "bad" : "fine"));
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.52.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_SSL_VERIFYRESULT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,80 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_PROXY_SSL_VERIFYRESULT
Section: 3
Source: libcurl
See-also:
- CURLINFO_SSL_VERIFYRESULT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- TLS
TLS-backend:
- OpenSSL
- GnuTLS
Added-in: 7.52.0
---
# NAME
CURLINFO_PROXY_SSL_VERIFYRESULT - get the result of the proxy certificate verification
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_SSL_VERIFYRESULT,
long *result);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the result of the certificate verification
that was requested (using the CURLOPT_PROXY_SSL_VERIFYPEER(3)
option. This is only used for HTTPS proxies.
0 is a positive result. Non-zero is an error.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
long verifyresult;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
res = curl_easy_perform(curl);
if(res) {
printf("error: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
return 1;
}
res = curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT,
&verifyresult);
if(!res) {
printf("The peer verification said %s\n",
(verifyresult ? "bad" : "fine"));
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,54 @@
.\" generated by cd2nroff 0.1 from CURLINFO_QUEUE_TIME_T.md
.TH CURLINFO_QUEUE_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_QUEUE_TIME_T \- time this transfer was queued
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_QUEUE_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, this
transfer was held in a waiting queue before it started "for real". A transfer
might be put in a queue if after getting started, it cannot create a new
connection etc due to set conditions and limits imposed by the application.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t queue;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_QUEUE_TIME_T, &queue);
if(CURLE_OK == res) {
printf("Queued: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", queue / 1000000,
(long)(queue % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 8.6.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_STARTTRANSFER_TIME_T (3),
.BR CURLOPT_TIMEOUT (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,72 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_QUEUE_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_STARTTRANSFER_TIME_T (3)
- CURLOPT_TIMEOUT (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 8.6.0
---
# NAME
CURLINFO_QUEUE_TIME_T - time this transfer was queued
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_QUEUE_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the time, in microseconds, this
transfer was held in a waiting queue before it started "for real". A transfer
might be put in a queue if after getting started, it cannot create a new
connection etc due to set conditions and limits imposed by the application.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t queue;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_QUEUE_TIME_T, &queue);
if(CURLE_OK == res) {
printf("Queued: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", queue / 1000000,
(long)(queue % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,46 @@
.\" generated by cd2nroff 0.1 from CURLINFO_REDIRECT_COUNT.md
.TH CURLINFO_REDIRECT_COUNT 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_REDIRECT_COUNT \- get the number of redirects
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT,
long *countp);
.fi
.SH DESCRIPTION
Pass a pointer to a long to receive the total number of redirections that were
actually followed.
.SH PROTOCOLS
This functionality affects all supported protocols
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long redirects;
curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.9.7
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_REDIRECT_URL (3),
.BR CURLOPT_FOLLOWLOCATION (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,64 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_REDIRECT_COUNT
Section: 3
Source: libcurl
See-also:
- CURLINFO_REDIRECT_URL (3)
- CURLOPT_FOLLOWLOCATION (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- All
Added-in: 7.9.7
---
# NAME
CURLINFO_REDIRECT_COUNT - get the number of redirects
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT,
long *countp);
~~~
# DESCRIPTION
Pass a pointer to a long to receive the total number of redirections that were
actually followed.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long redirects;
curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
}
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,54 @@
.\" generated by cd2nroff 0.1 from CURLINFO_REDIRECT_TIME.md
.TH CURLINFO_REDIRECT_TIME 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_REDIRECT_TIME \- get the time for all redirection steps
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME,
double *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a double to receive the total time, in seconds, it took for
all redirection steps include name lookup, connect, pretransfer and transfer
before final transaction was started. \fICURLINFO_REDIRECT_TIME(3)\fP contains
the complete execution time for multiple redirections.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double redirect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
if(CURLE_OK == res) {
printf("Time: %.1f", redirect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.9.7
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_REDIRECT_COUNT (3),
.BR CURLINFO_REDIRECT_TIME_T (3),
.BR CURLINFO_REDIRECT_URL (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,72 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_REDIRECT_TIME
Section: 3
Source: libcurl
See-also:
- CURLINFO_REDIRECT_COUNT (3)
- CURLINFO_REDIRECT_TIME_T (3)
- CURLINFO_REDIRECT_URL (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.9.7
---
# NAME
CURLINFO_REDIRECT_TIME - get the time for all redirection steps
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME,
double *timep);
~~~
# DESCRIPTION
Pass a pointer to a double to receive the total time, in seconds, it took for
all redirection steps include name lookup, connect, pretransfer and transfer
before final transaction was started. CURLINFO_REDIRECT_TIME(3) contains
the complete execution time for multiple redirections.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
double redirect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
if(CURLE_OK == res) {
printf("Time: %.1f", redirect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,56 @@
.\" generated by cd2nroff 0.1 from CURLINFO_REDIRECT_TIME_T.md
.TH CURLINFO_REDIRECT_TIME_T 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_REDIRECT_TIME_T \- get the time for all redirection steps
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T,
curl_off_t *timep);
.fi
.SH DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time, in microseconds, it
took for all redirection steps include name lookup, connect, pretransfer and
transfer before final transaction was started.
\fICURLINFO_REDIRECT_TIME_T(3)\fP holds the complete execution time for
multiple redirections.
See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t redirect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
(long)(redirect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.61.0
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_REDIRECT_COUNT (3),
.BR CURLINFO_REDIRECT_TIME (3),
.BR CURLINFO_REDIRECT_URL (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

View File

@@ -0,0 +1,74 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: CURLINFO_REDIRECT_TIME_T
Section: 3
Source: libcurl
See-also:
- CURLINFO_REDIRECT_COUNT (3)
- CURLINFO_REDIRECT_TIME (3)
- CURLINFO_REDIRECT_URL (3)
- curl_easy_getinfo (3)
- curl_easy_setopt (3)
Protocol:
- HTTP
Added-in: 7.61.0
---
# NAME
CURLINFO_REDIRECT_TIME_T - get the time for all redirection steps
# SYNOPSIS
~~~c
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T,
curl_off_t *timep);
~~~
# DESCRIPTION
Pass a pointer to a curl_off_t to receive the total time, in microseconds, it
took for all redirection steps include name lookup, connect, pretransfer and
transfer before final transaction was started.
CURLINFO_REDIRECT_TIME_T(3) holds the complete execution time for
multiple redirections.
See also the TIMES overview in the curl_easy_getinfo(3) man page.
# %PROTOCOLS%
# EXAMPLE
~~~c
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_off_t redirect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
(long)(redirect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
~~~
# %AVAILABILITY%
# RETURN VALUE
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
libcurl-errors(3).

View File

@@ -0,0 +1,53 @@
.\" generated by cd2nroff 0.1 from CURLINFO_REDIRECT_URL.md
.TH CURLINFO_REDIRECT_URL 3 "2025-08-14" libcurl
.SH NAME
CURLINFO_REDIRECT_URL \- get the URL a redirect would go to
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_URL, char **urlp);
.fi
.SH DESCRIPTION
Pass a pointer to a char pointer to receive the URL a redirect \fIwould\fP take
you to if you would enable \fICURLOPT_FOLLOWLOCATION(3)\fP. This can come handy if
you think using the built\-in libcurl redirect logic is not good enough for you
but you would still prefer to avoid implementing all the magic of figuring out
the new URL.
This URL is also set if the \fICURLOPT_MAXREDIRS(3)\fP limit prevented a redirect to
happen (since 7.54.1).
.SH PROTOCOLS
This functionality affects http only
.SH EXAMPLE
.nf
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
char *url = NULL;
curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &url);
if(url)
printf("Redirect to: %s\\n", url);
}
curl_easy_cleanup(curl);
}
}
.fi
.SH AVAILABILITY
Added in curl 7.18.2
.SH RETURN VALUE
\fIcurl_easy_getinfo(3)\fP returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see
\fIlibcurl\-errors(3)\fP.
.SH SEE ALSO
.BR CURLINFO_REDIRECT_COUNT (3),
.BR CURLINFO_REDIRECT_TIME_T (3),
.BR CURLOPT_FOLLOWLOCATION (3),
.BR curl_easy_getinfo (3),
.BR curl_easy_setopt (3)

Some files were not shown because too many files have changed in this diff Show More