Update networking layer w/ CURL and emscripten impl
This commit is contained in:
+68
@@ -0,0 +1,68 @@
|
||||
<!--
|
||||
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
|
||||
SPDX-License-Identifier: curl
|
||||
-->
|
||||
|
||||
ABI - Application Binary Interface
|
||||
==================================
|
||||
|
||||
"ABI" describes the low-level interface between an application program and a
|
||||
library. Calling conventions, function arguments, return values, struct
|
||||
sizes/defines and more.
|
||||
|
||||
[Wikipedia has a longer description](https://en.wikipedia.org/wiki/Application_binary_interface)
|
||||
|
||||
## Upgrades
|
||||
|
||||
A libcurl upgrade does not break the ABI or change established and documented
|
||||
behavior. Your application can remain using libcurl just as before, only with
|
||||
fewer bugs and possibly with added new features.
|
||||
|
||||
## Version Numbers
|
||||
|
||||
In libcurl land, you cannot tell by the libcurl version number if that
|
||||
libcurl is binary compatible or not with another libcurl version. As a rule,
|
||||
we do not break the ABI so you can *always* upgrade to a later version without
|
||||
any loss or change in functionality.
|
||||
|
||||
## SONAME Bumps
|
||||
|
||||
Whenever there are changes done to the library that causes an ABI breakage,
|
||||
that may require your application to get attention or possibly be changed to
|
||||
adhere to new things, we bump the SONAME. Then the library gets a different
|
||||
output name and thus can in fact be installed in parallel with an older
|
||||
installed lib (on most systems). Thus, old applications built against the
|
||||
previous ABI version remains working and using the older lib, while newer
|
||||
applications build and use the newer one.
|
||||
|
||||
During the first seven years of libcurl releases, there have only been four
|
||||
ABI breakages.
|
||||
|
||||
We are determined to bump the SONAME as rarely as possible. Ideally, we never
|
||||
do it again.
|
||||
|
||||
## Downgrades
|
||||
|
||||
Going to an older libcurl version from one you are currently using can be a
|
||||
tricky thing. Mostly we add features and options to newer libcurls as that
|
||||
does not break ABI or hamper existing applications. This has the implication
|
||||
that going backwards may get you in a situation where you pick a libcurl that
|
||||
does not support the options your application needs. Or possibly you even
|
||||
downgrade so far so you cross an ABI break border and thus a different
|
||||
SONAME, and then your application may need to adapt to the modified ABI.
|
||||
|
||||
## History
|
||||
|
||||
The previous major library SONAME number bumps (breaking backwards
|
||||
compatibility) happened the following times:
|
||||
|
||||
0 - libcurl 7.1, August 2000
|
||||
|
||||
1 - libcurl 7.5 December 2000
|
||||
|
||||
2 - libcurl 7.7 March 2001
|
||||
|
||||
3 - libcurl 7.12.0 June 2004
|
||||
|
||||
4 - libcurl 7.16.0 October 2006
|
||||
@@ -0,0 +1,87 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# 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")
|
||||
|
||||
# Generate man pages
|
||||
function(curl_add_manual_pages _listname)
|
||||
# Maximum number of files per command to stay within shell/OS limits
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(_files_per_batch 10000)
|
||||
else() # e.g. Windows with cmd.exe and other obsolete/unidentified shells
|
||||
set(_files_per_batch 200)
|
||||
endif()
|
||||
set(_file_count 0)
|
||||
set(_rofffiles "")
|
||||
set(_mdfiles "")
|
||||
set(_eol "_EOL_")
|
||||
foreach(_file IN LISTS ${_listname} _eol)
|
||||
math(EXPR _file_count "${_file_count} + 1")
|
||||
if(_file_count GREATER_EQUAL _files_per_batch OR _file STREQUAL "_EOL_")
|
||||
add_custom_command(OUTPUT ${_rofffiles}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/cd2nroff" -k -d "${CMAKE_CURRENT_BINARY_DIR}" ${_mdfiles}
|
||||
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/cd2nroff" ${_mdfiles}
|
||||
VERBATIM
|
||||
)
|
||||
set(_file_count 0)
|
||||
set(_rofffiles "")
|
||||
set(_mdfiles "")
|
||||
endif()
|
||||
|
||||
list(APPEND _rofffiles "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
|
||||
string(REPLACE ".3" ".md" _mdfile "${_file}")
|
||||
if(_file STREQUAL "libcurl-symbols.3") # Special case for auto-generated file
|
||||
set(_mdfile "${CMAKE_CURRENT_BINARY_DIR}/${_mdfile}")
|
||||
endif()
|
||||
list(APPEND _mdfiles "${_mdfile}")
|
||||
endforeach()
|
||||
unset(_rofffiles)
|
||||
unset(_mdfiles)
|
||||
endfunction()
|
||||
|
||||
add_custom_command(OUTPUT "libcurl-symbols.md"
|
||||
COMMAND
|
||||
"${PERL_EXECUTABLE}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > "libcurl-symbols.md"
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
curl_add_manual_pages(man_MANS)
|
||||
add_custom_target(curl-man ALL DEPENDS ${man_MANS})
|
||||
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")
|
||||
unset(_src)
|
||||
endif()
|
||||
|
||||
add_subdirectory(opts)
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# 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
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
SUBDIRS = opts
|
||||
|
||||
if BUILD_DOCS
|
||||
# Get man_MANS variable
|
||||
include Makefile.inc
|
||||
|
||||
CURLPAGES = $(man_MANS:.3=.md)
|
||||
endif
|
||||
|
||||
m4macrodir = $(datadir)/aclocal
|
||||
dist_m4macro_DATA = libcurl.m4
|
||||
|
||||
CLEANFILES = $(man_MANS) libcurl-symbols.md
|
||||
|
||||
EXTRA_DIST = $(CURLPAGES) ABI.md symbols-in-versions symbols.pl \
|
||||
mksymbolsmanpage.pl CMakeLists.txt
|
||||
|
||||
if BUILD_DOCS
|
||||
|
||||
CD2NROFF = $(top_srcdir)/scripts/cd2nroff $< >$@
|
||||
CD2 = $(CD2_$(V))
|
||||
CD2_0 = @echo " RENDER " $@;
|
||||
CD2_1 =
|
||||
CD2_ = $(CD2_0)
|
||||
|
||||
SUFFIXES = .3 .md
|
||||
|
||||
libcurl-symbols.md: $(srcdir)/symbols-in-versions $(srcdir)/mksymbolsmanpage.pl
|
||||
$(CD2)perl $(srcdir)/mksymbolsmanpage.pl < $(srcdir)/symbols-in-versions > $@
|
||||
|
||||
.md.3:
|
||||
$(CD2)$(CD2NROFF)
|
||||
|
||||
endif
|
||||
+971
@@ -0,0 +1,971 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# 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
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# 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
|
||||
#
|
||||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = docs/libcurl
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
|
||||
$(top_srcdir)/m4/curl-apple-sectrust.m4 \
|
||||
$(top_srcdir)/m4/curl-compilers.m4 \
|
||||
$(top_srcdir)/m4/curl-confopts.m4 \
|
||||
$(top_srcdir)/m4/curl-functions.m4 \
|
||||
$(top_srcdir)/m4/curl-gnutls.m4 \
|
||||
$(top_srcdir)/m4/curl-mbedtls.m4 \
|
||||
$(top_srcdir)/m4/curl-openssl.m4 \
|
||||
$(top_srcdir)/m4/curl-override.m4 \
|
||||
$(top_srcdir)/m4/curl-reentrant.m4 \
|
||||
$(top_srcdir)/m4/curl-rustls.m4 \
|
||||
$(top_srcdir)/m4/curl-schannel.m4 \
|
||||
$(top_srcdir)/m4/curl-sysconfig.m4 \
|
||||
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/xc-am-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-cc-check.m4 \
|
||||
$(top_srcdir)/m4/xc-lt-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-val-flgs.m4 \
|
||||
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(dist_m4macro_DATA) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
man3dir = $(mandir)/man3
|
||||
am__installdirs = "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(m4macrodir)"
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DATA = $(dist_m4macro_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
distdir distdir-am
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
APXS = @APXS@
|
||||
AR = @AR@
|
||||
AR_FLAGS = @AR_FLAGS@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@
|
||||
CADDY = @CADDY@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
|
||||
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CURLVERSION = @CURLVERSION@
|
||||
CURL_CA_BUNDLE = @CURL_CA_BUNDLE@
|
||||
CURL_CA_EMBED = @CURL_CA_EMBED@
|
||||
CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@
|
||||
CURL_CPP = @CURL_CPP@
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX = @CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX@
|
||||
CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME = @CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME@
|
||||
CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DANTED = @DANTED@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
ENABLE_STATIC = @ENABLE_STATIC@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||
GCOV = @GCOV@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBZ = @HAVE_LIBZ@
|
||||
HTTPD = @HTTPD@
|
||||
HTTPD_NGHTTPX = @HTTPD_NGHTTPX@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LCOV = @LCOV@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCURL_PC_CFLAGS = @LIBCURL_PC_CFLAGS@
|
||||
LIBCURL_PC_CFLAGS_PRIVATE = @LIBCURL_PC_CFLAGS_PRIVATE@
|
||||
LIBCURL_PC_LDFLAGS_PRIVATE = @LIBCURL_PC_LDFLAGS_PRIVATE@
|
||||
LIBCURL_PC_LIBS = @LIBCURL_PC_LIBS@
|
||||
LIBCURL_PC_LIBS_PRIVATE = @LIBCURL_PC_LIBS_PRIVATE@
|
||||
LIBCURL_PC_REQUIRES = @LIBCURL_PC_REQUIRES@
|
||||
LIBCURL_PC_REQUIRES_PRIVATE = @LIBCURL_PC_REQUIRES_PRIVATE@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKGCONFIG = @PKGCONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_BACKENDS = @SSL_BACKENDS@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT_FEATURES = @SUPPORT_FEATURES@
|
||||
SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@
|
||||
TEST_NGHTTPX = @TEST_NGHTTPX@
|
||||
VERSION = @VERSION@
|
||||
VERSIONNUM = @VERSIONNUM@
|
||||
VSFTPD = @VSFTPD@
|
||||
ZLIB_LIBS = @ZLIB_LIBS@
|
||||
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libext = @libext@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
SUBDIRS = opts
|
||||
@BUILD_DOCS_TRUE@man_MANS = \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_cleanup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_duphandle.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_escape.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_getinfo.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_header.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_init.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_nextheader.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_option_by_id.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_option_by_name.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_option_next.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_pause.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_perform.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_recv.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_reset.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_send.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_setopt.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_ssls_export.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_ssls_import.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_strerror.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_unescape.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_easy_upkeep.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_escape.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_formadd.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_formfree.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_formget.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_free.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_getdate.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_getenv.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_global_cleanup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_global_init.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_global_init_mem.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_global_sslset.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_global_trace.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_addpart.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_data.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_data_cb.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_encoder.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_filedata.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_filename.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_free.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_headers.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_init.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_name.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_subparts.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mime_type.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_mprintf.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_add_handle.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_assign.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_cleanup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_fdset.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_get_handles.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_get_offt.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_info_read.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_init.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_notify_disable.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_notify_enable.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_perform.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_poll.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_remove_handle.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_setopt.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_socket.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_socket_action.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_socket_all.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_strerror.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_timeout.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_wait.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_waitfds.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_multi_wakeup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_pushheader_byname.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_pushheader_bynum.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_share_cleanup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_share_init.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_share_setopt.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_share_strerror.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_slist_append.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_slist_free_all.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_strequal.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_strnequal.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_unescape.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url_cleanup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url_dup.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url_get.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url_set.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_url_strerror.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_version.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_version_info.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_ws_meta.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_ws_recv.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_ws_send.3 \
|
||||
@BUILD_DOCS_TRUE@ curl_ws_start_frame.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-easy.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-env-dbg.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-env.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-errors.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-multi.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-security.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-share.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-symbols.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-thread.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-tutorial.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-url.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl-ws.3 \
|
||||
@BUILD_DOCS_TRUE@ libcurl.3
|
||||
|
||||
|
||||
# Get man_MANS variable
|
||||
@BUILD_DOCS_TRUE@CURLPAGES = $(man_MANS:.3=.md)
|
||||
m4macrodir = $(datadir)/aclocal
|
||||
dist_m4macro_DATA = libcurl.m4
|
||||
CLEANFILES = $(man_MANS) libcurl-symbols.md
|
||||
EXTRA_DIST = $(CURLPAGES) ABI.md symbols-in-versions symbols.pl \
|
||||
mksymbolsmanpage.pl CMakeLists.txt
|
||||
|
||||
@BUILD_DOCS_TRUE@CD2NROFF = $(top_srcdir)/scripts/cd2nroff $< >$@
|
||||
@BUILD_DOCS_TRUE@CD2 = $(CD2_$(V))
|
||||
@BUILD_DOCS_TRUE@CD2_0 = @echo " RENDER " $@;
|
||||
@BUILD_DOCS_TRUE@CD2_1 =
|
||||
@BUILD_DOCS_TRUE@CD2_ = $(CD2_0)
|
||||
@BUILD_DOCS_TRUE@SUFFIXES = .3 .md
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .3 .md
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/libcurl/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign docs/libcurl/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
$(srcdir)/Makefile.inc $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man3: $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(man_MANS)'; \
|
||||
test -n "$(man3dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.3[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man3:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man3dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.3[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
|
||||
install-dist_m4macroDATA: $(dist_m4macro_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(dist_m4macro_DATA)'; test -n "$(m4macrodir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(m4macrodir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(m4macrodir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4macrodir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(m4macrodir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-dist_m4macroDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(dist_m4macro_DATA)'; test -n "$(m4macrodir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(m4macrodir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(MANS) $(DATA)
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(m4macrodir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-dist_m4macroDATA install-man
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man3
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-dist_m4macroDATA uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man3
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
|
||||
check-am clean clean-generic clean-libtool cscopelist-am ctags \
|
||||
ctags-am distclean distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-dist_m4macroDATA install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-man3 \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-dist_m4macroDATA uninstall-man uninstall-man3
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
@BUILD_DOCS_TRUE@libcurl-symbols.md: $(srcdir)/symbols-in-versions $(srcdir)/mksymbolsmanpage.pl
|
||||
@BUILD_DOCS_TRUE@ $(CD2)perl $(srcdir)/mksymbolsmanpage.pl < $(srcdir)/symbols-in-versions > $@
|
||||
|
||||
@BUILD_DOCS_TRUE@.md.3:
|
||||
@BUILD_DOCS_TRUE@ $(CD2)$(CD2NROFF)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# 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
|
||||
#
|
||||
###########################################################################
|
||||
# Shared between CMakeLists.txt and Makefile.am
|
||||
|
||||
man_MANS = \
|
||||
curl_easy_cleanup.3 \
|
||||
curl_easy_duphandle.3 \
|
||||
curl_easy_escape.3 \
|
||||
curl_easy_getinfo.3 \
|
||||
curl_easy_header.3 \
|
||||
curl_easy_init.3 \
|
||||
curl_easy_nextheader.3 \
|
||||
curl_easy_option_by_id.3 \
|
||||
curl_easy_option_by_name.3 \
|
||||
curl_easy_option_next.3 \
|
||||
curl_easy_pause.3 \
|
||||
curl_easy_perform.3 \
|
||||
curl_easy_recv.3 \
|
||||
curl_easy_reset.3 \
|
||||
curl_easy_send.3 \
|
||||
curl_easy_setopt.3 \
|
||||
curl_easy_ssls_export.3 \
|
||||
curl_easy_ssls_import.3 \
|
||||
curl_easy_strerror.3 \
|
||||
curl_easy_unescape.3 \
|
||||
curl_easy_upkeep.3 \
|
||||
curl_escape.3 \
|
||||
curl_formadd.3 \
|
||||
curl_formfree.3 \
|
||||
curl_formget.3 \
|
||||
curl_free.3 \
|
||||
curl_getdate.3 \
|
||||
curl_getenv.3 \
|
||||
curl_global_cleanup.3 \
|
||||
curl_global_init.3 \
|
||||
curl_global_init_mem.3 \
|
||||
curl_global_sslset.3 \
|
||||
curl_global_trace.3 \
|
||||
curl_mime_addpart.3 \
|
||||
curl_mime_data.3 \
|
||||
curl_mime_data_cb.3 \
|
||||
curl_mime_encoder.3 \
|
||||
curl_mime_filedata.3 \
|
||||
curl_mime_filename.3 \
|
||||
curl_mime_free.3 \
|
||||
curl_mime_headers.3 \
|
||||
curl_mime_init.3 \
|
||||
curl_mime_name.3 \
|
||||
curl_mime_subparts.3 \
|
||||
curl_mime_type.3 \
|
||||
curl_mprintf.3 \
|
||||
curl_multi_add_handle.3 \
|
||||
curl_multi_assign.3 \
|
||||
curl_multi_cleanup.3 \
|
||||
curl_multi_fdset.3 \
|
||||
curl_multi_get_handles.3 \
|
||||
curl_multi_get_offt.3 \
|
||||
curl_multi_info_read.3 \
|
||||
curl_multi_init.3 \
|
||||
curl_multi_notify_disable.3 \
|
||||
curl_multi_notify_enable.3 \
|
||||
curl_multi_perform.3 \
|
||||
curl_multi_poll.3 \
|
||||
curl_multi_remove_handle.3 \
|
||||
curl_multi_setopt.3 \
|
||||
curl_multi_socket.3 \
|
||||
curl_multi_socket_action.3 \
|
||||
curl_multi_socket_all.3 \
|
||||
curl_multi_strerror.3 \
|
||||
curl_multi_timeout.3 \
|
||||
curl_multi_wait.3 \
|
||||
curl_multi_waitfds.3 \
|
||||
curl_multi_wakeup.3 \
|
||||
curl_pushheader_byname.3 \
|
||||
curl_pushheader_bynum.3 \
|
||||
curl_share_cleanup.3 \
|
||||
curl_share_init.3 \
|
||||
curl_share_setopt.3 \
|
||||
curl_share_strerror.3 \
|
||||
curl_slist_append.3 \
|
||||
curl_slist_free_all.3 \
|
||||
curl_strequal.3 \
|
||||
curl_strnequal.3 \
|
||||
curl_unescape.3 \
|
||||
curl_url.3 \
|
||||
curl_url_cleanup.3 \
|
||||
curl_url_dup.3 \
|
||||
curl_url_get.3 \
|
||||
curl_url_set.3 \
|
||||
curl_url_strerror.3 \
|
||||
curl_version.3 \
|
||||
curl_version_info.3 \
|
||||
curl_ws_meta.3 \
|
||||
curl_ws_recv.3 \
|
||||
curl_ws_send.3 \
|
||||
curl_ws_start_frame.3 \
|
||||
libcurl-easy.3 \
|
||||
libcurl-env-dbg.3 \
|
||||
libcurl-env.3 \
|
||||
libcurl-errors.3 \
|
||||
libcurl-multi.3 \
|
||||
libcurl-security.3 \
|
||||
libcurl-share.3 \
|
||||
libcurl-symbols.3 \
|
||||
libcurl-thread.3 \
|
||||
libcurl-tutorial.3 \
|
||||
libcurl-url.3 \
|
||||
libcurl-ws.3 \
|
||||
libcurl.3
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_cleanup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_duphandle (3)
|
||||
- curl_easy_init (3)
|
||||
- curl_easy_reset (3)
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_remove_handle (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_cleanup - free an easy handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_easy_cleanup(CURL *handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is the opposite of curl_easy_init(3). It closes down and frees
|
||||
all resources previously associated with this easy handle.
|
||||
|
||||
This call closes all connections this handle has used and possibly has kept
|
||||
open until now unless the easy handle was attached to a multi handle while
|
||||
doing the transfers. Do not call this function if you intend to transfer more
|
||||
files, reusing handles is a key to good performance with libcurl.
|
||||
|
||||
Occasionally you may get your progress callback or header callback called from
|
||||
within curl_easy_cleanup(3) (if previously set for the handle using
|
||||
curl_easy_setopt(3)). Like if libcurl decides to shut down the connection and
|
||||
the protocol is of a kind that requires a command/response sequence before
|
||||
disconnect. Examples of such protocols are FTP, POP3 and IMAP.
|
||||
|
||||
Any use of the easy **handle** after this function has been called and have
|
||||
returned, is illegal.
|
||||
|
||||
To close an easy handle that has been used with the multi interface, make sure
|
||||
to first call curl_multi_remove_handle(3) to remove it from the multi handle
|
||||
before it is closed.
|
||||
|
||||
Passing in a NULL pointer in *handle* makes this function return immediately
|
||||
with no action.
|
||||
|
||||
# %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)
|
||||
printf("error: %s\n", curl_easy_strerror(res));
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
None
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_duphandle
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_init (3)
|
||||
- curl_easy_reset (3)
|
||||
- curl_global_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_duphandle - clone an easy handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURL *curl_easy_duphandle(CURL *handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a new curl handle, a duplicate, using all the options
|
||||
previously set in the input curl *handle*. Both handles can subsequently be
|
||||
used independently and they must both be freed with curl_easy_cleanup(3).
|
||||
|
||||
Any options that the input handle has been told to point to (as opposed to
|
||||
copy) with previous calls to curl_easy_setopt(3), are pointed to by the new
|
||||
handle as well. You must therefore make sure to keep the data around until
|
||||
both handles have been cleaned up.
|
||||
|
||||
The new handle does **not** inherit any state information, no connections, no
|
||||
SSL sessions and no cookies. It also does not inherit any share object states
|
||||
or options (created as if CURLOPT_SHARE(3) was set to NULL).
|
||||
|
||||
If the source handle has HSTS or alt-svc enabled, the duplicate gets data read
|
||||
data from the main filename to populate the cache.
|
||||
|
||||
In multi-threaded programs, this function must be called in a synchronous way,
|
||||
the input handle may not be in use when cloned.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLcode res;
|
||||
CURL *nother;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
nother = curl_easy_duphandle(curl);
|
||||
res = curl_easy_perform(nother);
|
||||
curl_easy_cleanup(nother);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns NULL, something went wrong and no valid handle was
|
||||
returned.
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_escape
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_unescape (3)
|
||||
- curl_url_set (3)
|
||||
- curl_url_get (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_escape - URL encode a string
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_easy_escape(CURL *curl, const char *string, int length);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function converts the given input *string* to a URL encoded string and
|
||||
returns that as a new allocated string. All input characters that are not a-z,
|
||||
A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version
|
||||
(**%NN** where **NN** is a two-digit hexadecimal number).
|
||||
|
||||
If *length* is set to 0 (zero), curl_easy_escape(3) uses strlen() on the input
|
||||
*string* to find out the size. This function does not accept input strings
|
||||
longer than **CURL_MAX_INPUT_LENGTH** (8 MB).
|
||||
|
||||
You must curl_free(3) the returned string when you are done with it.
|
||||
|
||||
# ENCODING
|
||||
|
||||
libcurl is typically not aware of, nor does it care about, character
|
||||
encodings. curl_easy_escape(3) encodes the data byte-by-byte into the
|
||||
URL encoded version without knowledge or care for what particular character
|
||||
encoding the application or the receiving server may assume that the data
|
||||
uses.
|
||||
|
||||
The caller of curl_easy_escape(3) must make sure that the data passed in
|
||||
to the function is encoded correctly.
|
||||
|
||||
# URLs
|
||||
|
||||
URLs are by definition *URL encoded*. To create a proper URL from a set of
|
||||
components that may not be URL encoded already, you cannot just URL encode the
|
||||
entire URL string with curl_easy_escape(3), because it then also converts
|
||||
colons, slashes and other symbols that you probably want untouched.
|
||||
|
||||
To create a proper URL from strings that are not already URL encoded, we
|
||||
recommend using libcurl's URL API: set the pieces with curl_url_set(3) and get
|
||||
the final correct URL with curl_url_get(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
char *output = curl_easy_escape(curl, "data to convert", 15);
|
||||
if(output) {
|
||||
printf("Encoded: %s\n", output);
|
||||
curl_free(output);
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# HISTORY
|
||||
|
||||
Since 7.82.0, the **curl** parameter is ignored. Prior to that there was
|
||||
per-handle character conversion support for some old operating systems such as
|
||||
TPF, but it was otherwise ignored.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string or NULL if it failed.
|
||||
@@ -0,0 +1,445 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_getinfo
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.4.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_getinfo - extract information from a curl handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Get the *info* kept in the *curl* handle. The third argument **MUST** be
|
||||
pointing to the specific type of the used option which is documented in each
|
||||
man page of the *info* option. The data is stored accordingly and can be
|
||||
relied upon only if this function returns CURLE_OK. Use this function after a
|
||||
performed transfer if you want to get transfer related data.
|
||||
|
||||
You should not free the memory returned by this function unless it is
|
||||
explicitly mentioned below.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
The following information can be extracted:
|
||||
|
||||
## CURLINFO_ACTIVESOCKET
|
||||
|
||||
The session's active socket. See CURLINFO_ACTIVESOCKET(3)
|
||||
|
||||
## CURLINFO_APPCONNECT_TIME
|
||||
|
||||
The time it took from the start until the SSL connect/handshake with the
|
||||
remote host was completed as a double in number of seconds.
|
||||
|
||||
## CURLINFO_APPCONNECT_TIME_T
|
||||
|
||||
The time it took from the start until the SSL connect/handshake with the
|
||||
remote host was completed in number of microseconds. (Added in 7.60.0) See
|
||||
CURLINFO_APPCONNECT_TIME_T(3)
|
||||
|
||||
## CURLINFO_CAINFO
|
||||
|
||||
Get the default value for CURLOPT_CAINFO(3). See CURLINFO_CAINFO(3)
|
||||
|
||||
## CURLINFO_CAPATH
|
||||
|
||||
Get the default value for CURLOPT_CAPATH(3). See CURLINFO_CAPATH(3)
|
||||
|
||||
## CURLINFO_CERTINFO
|
||||
|
||||
Certificate chain. See CURLINFO_CERTINFO(3)
|
||||
|
||||
## CURLINFO_CONDITION_UNMET
|
||||
|
||||
Whether or not a time conditional was met or 304 HTTP response.
|
||||
See CURLINFO_CONDITION_UNMET(3)
|
||||
|
||||
## CURLINFO_CONNECT_TIME
|
||||
|
||||
The time it took from the start until the connect to the remote host (or
|
||||
proxy) was completed. As a double. See CURLINFO_CONNECT_TIME(3)
|
||||
|
||||
## CURLINFO_CONNECT_TIME_T
|
||||
|
||||
The time it took from the start until the connect to the remote host (or
|
||||
proxy) was completed. In microseconds. See CURLINFO_CONNECT_TIME_T(3).
|
||||
|
||||
## CURLINFO_CONN_ID
|
||||
|
||||
The ID of the last connection used by the transfer. (Added in 8.2.0)
|
||||
See CURLINFO_CONN_ID(3)
|
||||
|
||||
## CURLINFO_CONTENT_LENGTH_DOWNLOAD
|
||||
|
||||
(**Deprecated**) Content length from the Content-Length header.
|
||||
See CURLINFO_CONTENT_LENGTH_DOWNLOAD(3)
|
||||
|
||||
## CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
|
||||
|
||||
Content length from the Content-Length header.
|
||||
See CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)
|
||||
|
||||
## CURLINFO_CONTENT_LENGTH_UPLOAD
|
||||
|
||||
(**Deprecated**) Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD(3)
|
||||
|
||||
## CURLINFO_CONTENT_LENGTH_UPLOAD_T
|
||||
|
||||
Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD_T(3)
|
||||
|
||||
## CURLINFO_CONTENT_TYPE
|
||||
|
||||
Content type from the `Content-Type:` header. We recommend using
|
||||
curl_easy_header(3) instead. See CURLINFO_CONTENT_TYPE(3)
|
||||
|
||||
## CURLINFO_COOKIELIST
|
||||
|
||||
List of all known cookies. See CURLINFO_COOKIELIST(3)
|
||||
|
||||
## CURLINFO_EARLYDATA_SENT_T
|
||||
|
||||
Amount of TLS early data sent (in number of bytes) when
|
||||
CURLSSLOPT_EARLYDATA is enabled.
|
||||
|
||||
## CURLINFO_EFFECTIVE_METHOD
|
||||
|
||||
Last used HTTP method. See CURLINFO_EFFECTIVE_METHOD(3)
|
||||
|
||||
## CURLINFO_EFFECTIVE_URL
|
||||
|
||||
Last used URL. See CURLINFO_EFFECTIVE_URL(3)
|
||||
|
||||
## CURLINFO_FILETIME
|
||||
|
||||
Remote time of the retrieved document. See CURLINFO_FILETIME(3)
|
||||
|
||||
## CURLINFO_FILETIME_T
|
||||
|
||||
Remote time of the retrieved document. See CURLINFO_FILETIME_T(3)
|
||||
|
||||
## CURLINFO_FTP_ENTRY_PATH
|
||||
|
||||
The entry path after logging in to an FTP server. See
|
||||
CURLINFO_FTP_ENTRY_PATH(3)
|
||||
|
||||
## CURLINFO_HEADER_SIZE
|
||||
|
||||
Number of bytes of all headers received. See CURLINFO_HEADER_SIZE(3)
|
||||
|
||||
## CURLINFO_HTTPAUTH_AVAIL
|
||||
|
||||
Available HTTP authentication methods. See CURLINFO_HTTPAUTH_AVAIL(3)
|
||||
|
||||
## CURLINFO_HTTPAUTH_USED
|
||||
|
||||
Used HTTP authentication method. See CURLINFO_HTTPAUTH_USED(3)
|
||||
|
||||
## CURLINFO_HTTP_CONNECTCODE
|
||||
|
||||
Last proxy CONNECT response code. See CURLINFO_HTTP_CONNECTCODE(3)
|
||||
|
||||
## CURLINFO_HTTP_VERSION
|
||||
|
||||
The http version used in the connection. See CURLINFO_HTTP_VERSION(3)
|
||||
|
||||
## CURLINFO_LASTSOCKET
|
||||
|
||||
(**Deprecated**) Last socket used. See CURLINFO_LASTSOCKET(3)
|
||||
|
||||
## CURLINFO_LOCAL_IP
|
||||
|
||||
Source IP address of the last connection. See CURLINFO_LOCAL_IP(3)
|
||||
|
||||
## CURLINFO_LOCAL_PORT
|
||||
|
||||
Source port number of the last connection. See CURLINFO_LOCAL_PORT(3)
|
||||
|
||||
## CURLINFO_NAMELOOKUP_TIME
|
||||
|
||||
Time from start until name resolving completed as a double. See
|
||||
CURLINFO_NAMELOOKUP_TIME(3)
|
||||
|
||||
## CURLINFO_NAMELOOKUP_TIME_T
|
||||
|
||||
Time from start until name resolving completed in number of microseconds. See
|
||||
CURLINFO_NAMELOOKUP_TIME_T(3)
|
||||
|
||||
## CURLINFO_NUM_CONNECTS
|
||||
|
||||
Number of new successful connections used for previous transfer.
|
||||
See CURLINFO_NUM_CONNECTS(3)
|
||||
|
||||
## CURLINFO_OS_ERRNO
|
||||
|
||||
The errno from the last failure to connect. See CURLINFO_OS_ERRNO(3)
|
||||
|
||||
## CURLINFO_POSTTRANSFER_TIME_T
|
||||
|
||||
The time it took from the start until the last byte is sent by libcurl.
|
||||
In microseconds. (Added in 8.10.0) See CURLINFO_POSTTRANSFER_TIME_T(3)
|
||||
|
||||
## CURLINFO_PRETRANSFER_TIME
|
||||
|
||||
The time it took from the start until the file transfer is just about to
|
||||
begin. This includes all pre-transfer commands and negotiations that are
|
||||
specific to the particular protocol(s) involved. See
|
||||
CURLINFO_PRETRANSFER_TIME(3)
|
||||
|
||||
## CURLINFO_PRETRANSFER_TIME_T
|
||||
|
||||
The time it took from the start until the file transfer is just about to
|
||||
begin. This includes all pre-transfer commands and negotiations that are
|
||||
specific to the particular protocol(s) involved. In microseconds. See
|
||||
CURLINFO_PRETRANSFER_TIME_T(3)
|
||||
|
||||
## CURLINFO_PRIMARY_IP
|
||||
|
||||
Destination IP address of the last connection. See CURLINFO_PRIMARY_IP(3)
|
||||
|
||||
## CURLINFO_PRIMARY_PORT
|
||||
|
||||
Destination port of the last connection. See CURLINFO_PRIMARY_PORT(3)
|
||||
|
||||
## CURLINFO_PRIVATE
|
||||
|
||||
User's private data pointer. See CURLINFO_PRIVATE(3)
|
||||
|
||||
## CURLINFO_PROTOCOL
|
||||
|
||||
(**Deprecated**) The protocol used for the connection. See
|
||||
CURLINFO_PROTOCOL(3)
|
||||
|
||||
## CURLINFO_PROXYAUTH_AVAIL
|
||||
|
||||
Available HTTP proxy authentication methods. See CURLINFO_PROXYAUTH_AVAIL(3)
|
||||
|
||||
## CURLINFO_PROXYAUTH_USED
|
||||
|
||||
Used HTTP proxy authentication methods. See CURLINFO_PROXYAUTH_USED(3)
|
||||
|
||||
## CURLINFO_PROXY_ERROR
|
||||
|
||||
Detailed proxy error. See CURLINFO_PROXY_ERROR(3)
|
||||
|
||||
## CURLINFO_PROXY_SSL_VERIFYRESULT
|
||||
|
||||
Proxy certificate verification result. See CURLINFO_PROXY_SSL_VERIFYRESULT(3)
|
||||
|
||||
## CURLINFO_QUEUE_TIME_T
|
||||
|
||||
The time during which the transfer was held in a waiting queue before it could
|
||||
start for real in number of microseconds. (Added in 8.6.0) See
|
||||
CURLINFO_QUEUE_TIME_T(3)
|
||||
|
||||
## CURLINFO_REDIRECT_COUNT
|
||||
|
||||
Total number of redirects that were followed. See CURLINFO_REDIRECT_COUNT(3)
|
||||
|
||||
## CURLINFO_REDIRECT_TIME
|
||||
|
||||
The time it took for all redirection steps include name lookup, connect,
|
||||
pretransfer and transfer before final transaction was started. So, this is
|
||||
zero if no redirection took place. As a double. See CURLINFO_REDIRECT_TIME(3)
|
||||
|
||||
## CURLINFO_REDIRECT_TIME_T
|
||||
|
||||
The time it took for all redirection steps include name lookup, connect,
|
||||
pretransfer and transfer before final transaction was started. So, this is
|
||||
zero if no redirection took place. In number of microseconds. See
|
||||
CURLINFO_REDIRECT_TIME_T(3)
|
||||
|
||||
## CURLINFO_REDIRECT_URL
|
||||
|
||||
URL a redirect would take you to, had you enabled redirects. See
|
||||
CURLINFO_REDIRECT_URL(3)
|
||||
|
||||
## CURLINFO_REFERER
|
||||
|
||||
Referrer header. See CURLINFO_REFERER(3)
|
||||
|
||||
## CURLINFO_REQUEST_SIZE
|
||||
|
||||
Number of bytes sent in the issued HTTP requests. See CURLINFO_REQUEST_SIZE(3)
|
||||
|
||||
## CURLINFO_RESPONSE_CODE
|
||||
|
||||
Last received response code. See CURLINFO_RESPONSE_CODE(3)
|
||||
|
||||
## CURLINFO_RETRY_AFTER
|
||||
|
||||
The value from the Retry-After header. See CURLINFO_RETRY_AFTER(3)
|
||||
|
||||
## CURLINFO_RTSP_CLIENT_CSEQ
|
||||
|
||||
The RTSP client CSeq that is expected next. See CURLINFO_RTSP_CLIENT_CSEQ(3)
|
||||
|
||||
## CURLINFO_RTSP_CSEQ_RECV
|
||||
|
||||
RTSP CSeq last received. See CURLINFO_RTSP_CSEQ_RECV(3)
|
||||
|
||||
## CURLINFO_RTSP_SERVER_CSEQ
|
||||
|
||||
The RTSP server CSeq that is expected next. See CURLINFO_RTSP_SERVER_CSEQ(3)
|
||||
|
||||
## CURLINFO_RTSP_SESSION_ID
|
||||
|
||||
RTSP session ID. See CURLINFO_RTSP_SESSION_ID(3)
|
||||
|
||||
## CURLINFO_SCHEME
|
||||
|
||||
The scheme used for the connection. See CURLINFO_SCHEME(3)
|
||||
|
||||
## CURLINFO_SIZE_DOWNLOAD
|
||||
|
||||
(**Deprecated**) Number of bytes downloaded. See CURLINFO_SIZE_DOWNLOAD(3)
|
||||
|
||||
## CURLINFO_SIZE_DOWNLOAD_T
|
||||
|
||||
Number of bytes downloaded. See CURLINFO_SIZE_DOWNLOAD_T(3)
|
||||
|
||||
## CURLINFO_SIZE_UPLOAD
|
||||
|
||||
(**Deprecated**) Number of bytes uploaded. See CURLINFO_SIZE_UPLOAD(3)
|
||||
|
||||
## CURLINFO_SIZE_UPLOAD_T
|
||||
|
||||
Number of bytes uploaded. See CURLINFO_SIZE_UPLOAD_T(3)
|
||||
|
||||
## CURLINFO_SPEED_DOWNLOAD
|
||||
|
||||
(**Deprecated**) Average download speed. See CURLINFO_SPEED_DOWNLOAD(3)
|
||||
|
||||
## CURLINFO_SPEED_DOWNLOAD_T
|
||||
|
||||
Average download speed. See CURLINFO_SPEED_DOWNLOAD_T(3)
|
||||
|
||||
## CURLINFO_SPEED_UPLOAD
|
||||
|
||||
(**Deprecated**) Average upload speed. See CURLINFO_SPEED_UPLOAD(3)
|
||||
|
||||
## CURLINFO_SPEED_UPLOAD_T
|
||||
|
||||
Average upload speed in number of bytes per second. See
|
||||
CURLINFO_SPEED_UPLOAD_T(3)
|
||||
|
||||
## CURLINFO_SSL_ENGINES
|
||||
|
||||
A list of OpenSSL crypto engines. See CURLINFO_SSL_ENGINES(3)
|
||||
|
||||
## CURLINFO_SSL_VERIFYRESULT
|
||||
|
||||
Certificate verification result. See CURLINFO_SSL_VERIFYRESULT(3)
|
||||
|
||||
## CURLINFO_STARTTRANSFER_TIME
|
||||
|
||||
The time it took from the start until the first byte is received by libcurl.
|
||||
As a double. See CURLINFO_STARTTRANSFER_TIME(3)
|
||||
|
||||
## CURLINFO_STARTTRANSFER_TIME_T
|
||||
|
||||
The time it took from the start until the first byte is received by libcurl.
|
||||
In microseconds. See CURLINFO_STARTTRANSFER_TIME_T(3)
|
||||
|
||||
## CURLINFO_TLS_SESSION
|
||||
|
||||
(**Deprecated**) TLS session info that can be used for further processing. See
|
||||
CURLINFO_TLS_SESSION(3). Use CURLINFO_TLS_SSL_PTR(3) instead.
|
||||
|
||||
## CURLINFO_TLS_SSL_PTR
|
||||
|
||||
TLS session info that can be used for further processing. See
|
||||
CURLINFO_TLS_SSL_PTR(3)
|
||||
|
||||
## CURLINFO_TOTAL_TIME
|
||||
|
||||
Total time of previous transfer. See CURLINFO_TOTAL_TIME(3)
|
||||
|
||||
## CURLINFO_TOTAL_TIME_T
|
||||
|
||||
Total time of previous transfer. See CURLINFO_TOTAL_TIME_T(3)
|
||||
|
||||
## CURLINFO_USED_PROXY
|
||||
|
||||
Whether the proxy was used (Added in 8.7.0). See CURLINFO_USED_PROXY(3)
|
||||
|
||||
## CURLINFO_XFER_ID
|
||||
|
||||
The ID of the transfer. (Added in 8.2.0) See CURLINFO_XFER_ID(3)
|
||||
|
||||
# TIMES
|
||||
|
||||
An overview of the time values available from curl_easy_getinfo(3)
|
||||
|
||||
curl_easy_perform()
|
||||
|
|
||||
|--QUEUE
|
||||
|--|--NAMELOOKUP
|
||||
|--|--|--CONNECT
|
||||
|--|--|--|--APPCONNECT
|
||||
|--|--|--|--|--PRETRANSFER
|
||||
|--|--|--|--|--|--POSTTRANSFER
|
||||
|--|--|--|--|--|--|--STARTTRANSFER
|
||||
|--|--|--|--|--|--|--|--TOTAL
|
||||
|--|--|--|--|--|--|--|--REDIRECT
|
||||
|
||||
|
||||
CURLINFO_QUEUE_TIME_T(3), CURLINFO_NAMELOOKUP_TIME_T(3),
|
||||
CURLINFO_CONNECT_TIME_T(3), CURLINFO_APPCONNECT_TIME_T(3),
|
||||
CURLINFO_PRETRANSFER_TIME_T(3), CURLINFO_POSTTRANSFER_TIME_T(3),
|
||||
CURLINFO_STARTTRANSFER_TIME_T(3), CURLINFO_TOTAL_TIME_T(3),
|
||||
CURLINFO_REDIRECT_TIME_T(3)
|
||||
|
||||
# %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/");
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == res) {
|
||||
char *ct;
|
||||
/* ask for the content-type */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
|
||||
|
||||
if((CURLE_OK == res) && ct)
|
||||
printf("We received Content-Type: %s\n", ct);
|
||||
}
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,165 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_header
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLINFO_CONTENT_TYPE (3)
|
||||
- CURLOPT_HEADERFUNCTION (3)
|
||||
- curl_easy_nextheader (3)
|
||||
- curl_easy_perform (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.83.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_header - get an HTTP header
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLHcode curl_easy_header(CURL *easy,
|
||||
const char *name,
|
||||
size_t index,
|
||||
unsigned int origin,
|
||||
int request,
|
||||
struct curl_header **hout);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_easy_header(3) returns a pointer to a "curl_header" struct in **hout**
|
||||
with data for the HTTP response header *name*. The case insensitive
|
||||
null-terminated header name should be specified without colon.
|
||||
|
||||
*index* 0 means asking for the first instance of the header. If the returned
|
||||
header struct has **amount** set larger than 1, it means there are more
|
||||
instances of the same header name available to get. Asking for a too big index
|
||||
makes **CURLHE_BADINDEX** get returned.
|
||||
|
||||
The *origin* argument is for specifying which headers to receive, as a single
|
||||
HTTP transfer might provide headers from several different places and they may
|
||||
then have different importance to the user and headers using the same name
|
||||
might be used. The *origin* is a bitmask for what header sources you want. See
|
||||
the descriptions below.
|
||||
|
||||
The *request* argument tells libcurl from which request you want headers
|
||||
from. A single transfer might consist of a series of HTTP requests and this
|
||||
argument lets you specify which particular individual request you want the
|
||||
headers from. 0 being the first request and then the number increases for
|
||||
further redirects or when multi-state authentication is used. Passing in -1 is
|
||||
a shortcut to "the last" request in the series, independently of the actual
|
||||
amount of requests used.
|
||||
|
||||
libcurl stores and provides the actually used "correct" headers. If for
|
||||
example two headers with the same name arrive and the latter overrides the
|
||||
former, then only the latter is provided. If the first header survives the
|
||||
second, then only the first one is provided. An application using this API
|
||||
does not have to bother about multiple headers used wrongly.
|
||||
|
||||
The memory for the returned struct is associated with the easy handle and
|
||||
subsequent calls to curl_easy_header(3) clobber the struct used in the
|
||||
previous calls for the same easy handle. The application needs to copy the data if
|
||||
it wants to keep it around. The memory used for the struct gets freed with
|
||||
calling curl_easy_cleanup(3) of the easy handle.
|
||||
|
||||
The first line in an HTTP response is called the status line. It is not
|
||||
considered a header by this function. Headers are the "name: value" lines
|
||||
following the status.
|
||||
|
||||
This function can be used before (all) headers have been received and is fine
|
||||
to call from within libcurl callbacks. It returns the state of the headers at
|
||||
the time it is called.
|
||||
|
||||
# The header struct
|
||||
|
||||
~~~c
|
||||
struct curl_header {
|
||||
char *name;
|
||||
char *value;
|
||||
size_t amount;
|
||||
size_t index;
|
||||
unsigned int origin;
|
||||
void *anchor;
|
||||
};
|
||||
~~~
|
||||
|
||||
The data **name** field points to, is the same as the requested name, but
|
||||
might have a different case.
|
||||
|
||||
The data **value** field points to, comes exactly as delivered over the
|
||||
network but with leading and trailing whitespace and newlines stripped
|
||||
off. The `value` data is null-terminated. For legacy HTTP/1 "folded headers",
|
||||
this API provides the full single value in an unfolded manner with a single
|
||||
whitespace between the lines.
|
||||
|
||||
**amount** is how many headers using this name that exist, within the origin
|
||||
and request scope asked for.
|
||||
|
||||
**index** is the zero based entry number of this particular header, which in
|
||||
case this header was used more than once in the requested scope can be larger
|
||||
than 0 but is always less than **amount**.
|
||||
|
||||
The **origin** field in the "curl_header" struct has one of the origin bits
|
||||
set, indicating where from the header originates. At the time of this writing,
|
||||
there are 5 bits with defined use. The undocumented 27 remaining bits are
|
||||
reserved for future use and must not be assumed to have any particular value.
|
||||
|
||||
**anchor** is a private handle used by libcurl internals. Do not modify.
|
||||
|
||||
# ORIGINS
|
||||
|
||||
## CURLH_HEADER
|
||||
|
||||
The header arrived as a header from the server.
|
||||
|
||||
## CURLH_TRAILER
|
||||
|
||||
The header arrived as a trailer. A header that arrives after the body.
|
||||
|
||||
## CURLH_CONNECT
|
||||
|
||||
The header arrived in a CONNECT response. A CONNECT request is being done to
|
||||
setup a transfer "through" an HTTP(S) proxy.
|
||||
|
||||
## CURLH_1XX
|
||||
|
||||
The header arrived in an HTTP 1xx response. A 1xx response is an "intermediate"
|
||||
response that might happen before the "real" response.
|
||||
|
||||
## CURLH_PSEUDO
|
||||
|
||||
The header is an HTTP/2 or HTTP/3 pseudo header
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
struct curl_header *type;
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLHcode h;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
curl_easy_perform(curl);
|
||||
h = curl_easy_header(curl, "Content-Type", 0, CURLH_HEADER, -1, &type);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLHcode indicating success or error. CURLHE_OK (0)
|
||||
means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_init
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_duphandle (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_reset (3)
|
||||
- curl_global_init (3)
|
||||
- curl_multi_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_init - create an easy handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURL *curl_easy_init();
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function allocates and returns an easy handle. Such a handle is used as
|
||||
input to other functions in the easy interface. This call must have a
|
||||
corresponding call to curl_easy_cleanup(3) when the operation is complete.
|
||||
|
||||
The easy handle is used to hold and control a single network transfer. It is
|
||||
encouraged to reuse easy handles for repeated transfers.
|
||||
|
||||
An alternative way to get a new easy handle is to duplicate an already
|
||||
existing one with curl_easy_duphandle(3), which has the upside that it gets
|
||||
all the options that were set in the source handle set in the new copy as
|
||||
well.
|
||||
|
||||
If you did not already call curl_global_init(3) before calling this function,
|
||||
curl_easy_init(3) does it automatically. This can be lethal in multi-threaded
|
||||
cases for platforms where curl_global_init(3) is not thread-safe, and it may
|
||||
then result in resource problems because there is no corresponding cleanup.
|
||||
|
||||
You are strongly advised to not allow this automatic behavior, by calling
|
||||
curl_global_init(3) yourself properly. See the description in libcurl(3) of
|
||||
global environment requirements for details of how to use this 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);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns NULL, something went wrong and you cannot use the
|
||||
other curl functions.
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_nextheader
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_header (3)
|
||||
- curl_easy_perform (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.83.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_nextheader - get the next HTTP header
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
struct curl_header *curl_easy_nextheader(CURL *easy,
|
||||
unsigned int origin,
|
||||
int request,
|
||||
struct curl_header *prev);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function lets an application iterate over all previously received HTTP
|
||||
headers.
|
||||
|
||||
The *origin* argument is for specifying which headers to receive, as a single
|
||||
HTTP transfer might provide headers from several different places and they may
|
||||
then have different importance to the user and headers using the same name
|
||||
might be used. The *origin* is a bitmask for what header sources you want. See
|
||||
the curl_easy_header(3) man page for the origin descriptions.
|
||||
|
||||
The *request* argument tells libcurl from which request you want headers
|
||||
from. A single transfer might consist of a series of HTTP requests and this
|
||||
argument lets you specify which particular individual request you want the
|
||||
headers from. 0 being the first request and then the number increases for
|
||||
further redirects or when multi-state authentication is used. Passing in -1 is
|
||||
a shortcut to "the last" request in the series, independently of the actual
|
||||
amount of requests used.
|
||||
|
||||
It is suggested that you pass in the same **origin** and **request** when
|
||||
iterating over a range of headers as changing the value mid-loop might give
|
||||
you unexpected results.
|
||||
|
||||
If *prev* is NULL, this function returns a pointer to the first header stored
|
||||
within the given scope (origin + request).
|
||||
|
||||
If *prev* is a pointer to a previously returned header struct,
|
||||
curl_easy_nextheader(3) returns a pointer the next header stored within the
|
||||
given scope. This way, an application can iterate over all available headers.
|
||||
|
||||
The memory for the struct this points to, is owned and managed by libcurl and
|
||||
is associated with the easy handle. Applications must copy the data if they
|
||||
want it to survive subsequent API calls or the life-time of the easy handle.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
struct curl_header *prev = NULL;
|
||||
struct curl_header *h;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* extract the normal headers from the first request */
|
||||
while((h = curl_easy_nextheader(curl, CURLH_HEADER, 0, prev))) {
|
||||
printf("%s: %s\n", h->name, h->value);
|
||||
prev = h;
|
||||
}
|
||||
|
||||
/* extract the normal headers + 1xx + trailers from the last request */
|
||||
unsigned int origin = CURLH_HEADER| CURLH_1XX | CURLH_TRAILER;
|
||||
while((h = curl_easy_nextheader(curl, origin, -1, prev))) {
|
||||
printf("%s: %s\n", h->name, h->value);
|
||||
prev = h;
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns the next header, or NULL when there are no more
|
||||
(matching) headers or an error occurred.
|
||||
|
||||
If this function returns NULL when *prev* was set to NULL, then there are no
|
||||
headers available within the scope to return.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_option_by_id
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_option_by_name (3)
|
||||
- curl_easy_option_next (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.73.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_option_by_id - find an easy setopt option by id
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const struct curl_easyoption *curl_easy_option_by_id(CURLoption id);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Given a *CURLoption* **id**, this function returns a pointer to the
|
||||
*curl_easyoption* struct, holding information about the curl_easy_setopt(3)
|
||||
option using that id. The option id is the `CURLOPT_` prefixed ones provided
|
||||
in the standard curl/curl.h header file. This function returns the non-alias
|
||||
version of the cases where there is an alias function as well.
|
||||
|
||||
If libcurl has no option with the given id, this function returns NULL.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
const struct curl_easyoption *opt = curl_easy_option_by_id(CURLOPT_URL);
|
||||
if(opt) {
|
||||
printf("This option wants type %x\n", opt->type);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to the *curl_easyoption* struct for the option or NULL.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_option_by_name
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_option_by_id (3)
|
||||
- curl_easy_option_next (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.73.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_option_by_name - find an easy setopt option by name
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const struct curl_easyoption *curl_easy_option_by_name(const char *name);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Given a **name**, this function returns a pointer to the *curl_easyoption*
|
||||
struct, holding information about the curl_easy_setopt(3) option using that
|
||||
name. The name should be specified without the `CURLOPT_` prefix and the name
|
||||
comparison is made case insensitive.
|
||||
|
||||
If libcurl has no option with the given name, this function returns NULL.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
const struct curl_easyoption *opt = curl_easy_option_by_name("URL");
|
||||
if(opt) {
|
||||
printf("This option wants CURLoption %x\n", (int)opt->id);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to the *curl_easyoption* struct for the option or NULL.
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_option_next
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_option_by_id (3)
|
||||
- curl_easy_option_by_name (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.73.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_option_next - iterate over easy setopt options
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const struct curl_easyoption *
|
||||
curl_easy_option_next(const struct curl_easyoption *prev);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a pointer to the first or the next *curl_easyoption*
|
||||
struct, providing an ability to iterate over all known options for
|
||||
curl_easy_setopt(3) in this instance of libcurl.
|
||||
|
||||
Pass a **NULL** argument as **prev** to get the first option returned, or
|
||||
pass in the current option to get the next one returned. If there is no more
|
||||
option to return, curl_easy_option_next(3) returns NULL.
|
||||
|
||||
The options returned by this functions are the ones known to this libcurl and
|
||||
information about what argument type they want.
|
||||
|
||||
If the **CURLOT_FLAG_ALIAS** bit is set in the flags field, it means the
|
||||
name is provided for backwards compatibility as an alias.
|
||||
|
||||
# struct
|
||||
|
||||
~~~c
|
||||
typedef enum {
|
||||
CURLOT_LONG, /* long (a range of values) */
|
||||
CURLOT_VALUES, /* (a defined set or bitmask) */
|
||||
CURLOT_OFF_T, /* curl_off_t (a range of values) */
|
||||
CURLOT_OBJECT, /* pointer (void *) */
|
||||
CURLOT_STRING, /* (char * to null-terminated buffer) */
|
||||
CURLOT_SLIST, /* (struct curl_slist *) */
|
||||
CURLOT_CBPTR, /* (void * passed as-is to a callback) */
|
||||
CURLOT_BLOB, /* blob (struct curl_blob *) */
|
||||
CURLOT_FUNCTION /* function pointer */
|
||||
} curl_easytype;
|
||||
|
||||
/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
|
||||
to use for curl_easy_setopt() for the given id */
|
||||
struct curl_easyoption {
|
||||
const char *name;
|
||||
CURLoption id;
|
||||
curl_easytype type;
|
||||
unsigned int flags;
|
||||
};
|
||||
~~~
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* iterate over all available options */
|
||||
const struct curl_easyoption *opt;
|
||||
opt = curl_easy_option_next(NULL);
|
||||
while(opt) {
|
||||
printf("Name: %s\n", opt->name);
|
||||
opt = curl_easy_option_next(opt);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to the *curl_easyoption* struct for the next option or NULL if
|
||||
no more options.
|
||||
@@ -0,0 +1,146 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_pause
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_reset (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.18.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_pause - pause and unpause a connection
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_pause(CURL *handle, int bitmask );
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Using this function, you can explicitly mark a running connection to get
|
||||
paused, and you can unpause a connection that was previously paused. Unlike
|
||||
most other libcurl functions, curl_easy_pause(3) can be used from within
|
||||
callbacks.
|
||||
|
||||
A connection can be paused by using this function or by letting the read or
|
||||
the write callbacks return the proper magic return code
|
||||
(*CURL_READFUNC_PAUSE* and *CURL_WRITEFUNC_PAUSE*). A write callback
|
||||
that returns pause signals to the library that it could not take care of any
|
||||
data at all, and that data is then delivered again to the callback when the
|
||||
transfer is unpaused.
|
||||
|
||||
While it may feel tempting, take care and notice that you cannot call this
|
||||
function from another thread. To unpause, you may for example call it from the
|
||||
progress callback (CURLOPT_PROGRESSFUNCTION(3)).
|
||||
|
||||
When this function is called to unpause receiving, the write callback might
|
||||
get called before this function returns to deliver cached content. When
|
||||
libcurl delivers such cached data to the write callback, it is delivered as
|
||||
fast as possible, which may overstep the boundary set in
|
||||
CURLOPT_MAX_RECV_SPEED_LARGE(3) etc.
|
||||
|
||||
The **handle** argument identifies the transfer you want to pause or
|
||||
unpause.
|
||||
|
||||
A paused transfer is excluded from low speed cancels via the
|
||||
CURLOPT_LOW_SPEED_LIMIT(3) option and unpausing a transfer resets the
|
||||
time period required for the low speed limit to be met.
|
||||
|
||||
The **bitmask** argument is a set of bits that sets the new state of the
|
||||
connection. The following bits can be used:
|
||||
|
||||
## CURLPAUSE_RECV
|
||||
|
||||
Pause receiving data. There is no data received on this connection until this
|
||||
function is called again without this bit set. Thus, the write callback
|
||||
(CURLOPT_WRITEFUNCTION(3)) is not called.
|
||||
|
||||
## CURLPAUSE_SEND
|
||||
|
||||
Pause sending data. There is no data sent on this connection until this
|
||||
function is called again without this bit set. Thus, the read callback
|
||||
(CURLOPT_READFUNCTION(3)) is not called.
|
||||
|
||||
## CURLPAUSE_ALL
|
||||
|
||||
Convenience define that pauses both directions.
|
||||
|
||||
## CURLPAUSE_CONT
|
||||
|
||||
Convenience define that unpauses both directions.
|
||||
|
||||
# LIMITATIONS
|
||||
|
||||
The pausing of transfers does not work with protocols that work without
|
||||
network connectivity, like FILE://. Trying to pause such a transfer, in any
|
||||
direction, might cause problems or error.
|
||||
|
||||
# MULTIPLEXED
|
||||
|
||||
When a connection is used multiplexed, like for HTTP/2, and one of the
|
||||
transfers over the connection is paused and the others continue flowing,
|
||||
libcurl might end up buffering contents for the paused transfer. It has to do
|
||||
this because it needs to drain the socket for the other transfers and the
|
||||
already announced window size for the paused transfer allows the server to
|
||||
continue sending data up to that window size amount. By default, libcurl
|
||||
announces a 32 megabyte window size, which thus can make libcurl end up
|
||||
buffering 32 megabyte of data for a paused stream.
|
||||
|
||||
When such a paused stream is unpaused again, any buffered data is delivered
|
||||
first.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* pause a transfer in both directions */
|
||||
curl_easy_pause(curl, CURLPAUSE_RECV | CURLPAUSE_SEND);
|
||||
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# MEMORY USE
|
||||
|
||||
When pausing a download transfer by returning the magic return code from a
|
||||
write callback, the read data is already in libcurl's internal buffers so it
|
||||
has to keep it in an allocated buffer until the receiving is again unpaused
|
||||
using this function.
|
||||
|
||||
If the downloaded data is compressed and is asked to get uncompressed
|
||||
automatically on download, libcurl continues to uncompress the entire
|
||||
downloaded chunk and it caches the data uncompressed. This has the side-
|
||||
effect that if you download something that is compressed a lot, it can result
|
||||
in a large data amount needing to be allocated to save the data during the
|
||||
pause. Consider not using paused receiving if you allow libcurl to uncompress
|
||||
data automatically.
|
||||
|
||||
If the download is done with HTTP/2 or HTTP/3, there is up to a stream window
|
||||
size worth of data that curl cannot stop but instead needs to cache while the
|
||||
transfer is paused. This means that if a window size of 64 MB is used, libcurl
|
||||
might end up having to cache 64 MB of data.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_perform
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_init (3)
|
||||
- curl_easy_setopt (3)
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_perform (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_perform - perform a blocking network transfer
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_perform(CURL *easy_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_easy_perform(3) performs a network transfer in a blocking manner and
|
||||
returns when done, or earlier if it fails. For non-blocking behavior, see
|
||||
curl_multi_perform(3).
|
||||
|
||||
Invoke this function after curl_easy_init(3) and all the curl_easy_setopt(3)
|
||||
calls are made, and it performs the transfer as described in the options. It
|
||||
must be called with the same **easy_handle** as input as the curl_easy_init(3)
|
||||
call returned.
|
||||
|
||||
You can do any amount of calls to curl_easy_perform(3) while using the same
|
||||
**easy_handle**. If you intend to transfer more than one file, you are even
|
||||
encouraged to do so. libcurl attempts to reuse existing connections for the
|
||||
following transfers, thus making the operations faster, less CPU intense and
|
||||
using less network resources. You probably want to use curl_easy_setopt(3)
|
||||
between the invokes to set options for the following curl_easy_perform(3)
|
||||
call.
|
||||
|
||||
You must never call this function simultaneously from two places using the
|
||||
same **easy_handle**. Let the function return first before invoking it another
|
||||
time. If you want parallel transfers, you must use several curl easy_handles.
|
||||
|
||||
A network transfer moves data to a peer or from a peer. An application tells
|
||||
libcurl how to receive data by setting the CURLOPT_WRITEFUNCTION(3) and
|
||||
CURLOPT_WRITEDATA(3) options. To tell libcurl what data to send, there are a
|
||||
few more alternatives but two common ones are CURLOPT_READFUNCTION(3) and
|
||||
CURLOPT_POSTFIELDS(3).
|
||||
|
||||
While the **easy_handle** is added to a multi handle, it cannot be used by
|
||||
curl_easy_perform(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);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_recv
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_send (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.18.2
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_recv - receives raw data on an "easy" connection
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function receives raw data from the established connection. You may use
|
||||
it together with curl_easy_send(3) to implement custom protocols using
|
||||
libcurl. This functionality can be particularly useful if you use proxies
|
||||
and/or SSL encryption: libcurl takes care of proxy negotiation and connection
|
||||
setup.
|
||||
|
||||
**buffer** is a pointer to your buffer memory that gets populated by the
|
||||
received data. **buflen** is the maximum amount of data you can get in that
|
||||
buffer. The variable **n** points to receives the number of received bytes.
|
||||
|
||||
To establish the connection, set CURLOPT_CONNECT_ONLY(3) option before
|
||||
calling curl_easy_perform(3) or curl_multi_perform(3). Note that
|
||||
curl_easy_recv(3) does not work on connections that were created without
|
||||
this option.
|
||||
|
||||
The call returns **CURLE_AGAIN** if there is no data to read - the socket is
|
||||
used in non-blocking mode internally. When **CURLE_AGAIN** is returned, use
|
||||
your operating system facilities like *select(2)* to wait for data. The
|
||||
socket may be obtained using curl_easy_getinfo(3) with
|
||||
CURLINFO_ACTIVESOCKET(3).
|
||||
|
||||
Wait on the socket only if curl_easy_recv(3) returns **CURLE_AGAIN**.
|
||||
The reason for this is libcurl or the SSL library may internally cache some
|
||||
data, therefore you should call curl_easy_recv(3) until all data is
|
||||
read which would include any cached data.
|
||||
|
||||
Furthermore if you wait on the socket and it tells you there is data to read,
|
||||
curl_easy_recv(3) may return **CURLE_AGAIN** if the only data that was
|
||||
read was for internal SSL processing, and no other data is 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");
|
||||
/* 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) {
|
||||
char buf[256];
|
||||
size_t nread;
|
||||
curl_socket_t sockfd;
|
||||
|
||||
/* Extract the socket from the curl handle - we need it for waiting. */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
|
||||
|
||||
/* read data */
|
||||
res = curl_easy_recv(curl, buf, sizeof(buf), &nread);
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
On success, returns **CURLE_OK**, stores the received data into
|
||||
**buffer**, and the number of bytes it actually read into ***n**.
|
||||
|
||||
On failure, returns the appropriate error code.
|
||||
|
||||
The function may return **CURLE_AGAIN**. In this case, use your operating
|
||||
system facilities to wait until data can be read, and retry.
|
||||
|
||||
Reading exactly 0 bytes indicates a closed connection.
|
||||
|
||||
If there is no socket available to use from the previous transfer, this
|
||||
function returns **CURLE_UNSUPPORTED_PROTOCOL**.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_reset
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_duphandle (3)
|
||||
- curl_easy_init (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.12.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_reset - reset all options of a libcurl session handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_easy_reset(CURL *handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Re-initializes all options previously set on a specified curl handle to the
|
||||
default values. This puts back the handle to the same state as it was in when
|
||||
it was just created with curl_easy_init(3).
|
||||
|
||||
It does not change the following information kept in the handle: live
|
||||
connections, the Session ID cache, the DNS cache, the cookies, the shares or
|
||||
the alt-svc cache.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
||||
/* ... the handle is used and options are set ... */
|
||||
curl_easy_reset(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Nothing
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_send
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_recv (3)
|
||||
- curl_easy_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.18.2
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_send - sends raw data over an "easy" connection
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_send(CURL *curl, const void *buffer,
|
||||
size_t buflen, size_t *n);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function sends arbitrary data over the established connection. You may
|
||||
use it together with curl_easy_recv(3) to implement custom protocols
|
||||
using libcurl. This functionality can be particularly useful if you use
|
||||
proxies and/or SSL encryption: libcurl takes care of proxy negotiation and
|
||||
connection setup.
|
||||
|
||||
**buffer** is a pointer to the data of length **buflen** that you want
|
||||
sent. The variable **n** points to receives the number of sent bytes.
|
||||
|
||||
To establish the connection, set CURLOPT_CONNECT_ONLY(3) option before
|
||||
calling curl_easy_perform(3) or curl_multi_perform(3). Note that
|
||||
curl_easy_send(3) does not work on connections that were created without
|
||||
this option.
|
||||
|
||||
The call returns **CURLE_AGAIN** if it is not possible to send data right now
|
||||
- the socket is used in non-blocking mode internally. When **CURLE_AGAIN**
|
||||
is returned, use your operating system facilities like *select(2)* to wait
|
||||
until the socket is writable. The socket may be obtained using
|
||||
curl_easy_getinfo(3) with CURLINFO_ACTIVESOCKET(3).
|
||||
|
||||
Furthermore if you wait on the socket and it tells you it is writable,
|
||||
curl_easy_send(3) may return **CURLE_AGAIN** if the only data that was sent
|
||||
was for internal SSL processing, and no other data could be 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");
|
||||
/* 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) {
|
||||
curl_socket_t sockfd;
|
||||
size_t sent;
|
||||
/* Extract the socket from the curl handle - we need it for waiting. */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
|
||||
|
||||
/* send data */
|
||||
res = curl_easy_send(curl, "hello", 5, &sent);
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
On success, returns **CURLE_OK** and stores the number of bytes actually
|
||||
sent into ***n**. Note that this may be less than the amount you wanted to
|
||||
send.
|
||||
|
||||
On failure, returns the appropriate error code.
|
||||
|
||||
This function may return **CURLE_AGAIN**. In this case, use your operating
|
||||
system facilities to wait until the socket is writable, and retry.
|
||||
|
||||
If there is no socket available to use from the previous transfer, this
|
||||
function returns **CURLE_UNSUPPORTED_PROTOCOL**.
|
||||
+1387
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,177 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_ssls_export
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_SHARE (3)
|
||||
- curl_share_setopt (3)
|
||||
- curl_easy_ssls_import (3)
|
||||
Protocol:
|
||||
- TLS
|
||||
TLS-backend:
|
||||
- GnuTLS
|
||||
- OpenSSL
|
||||
- wolfSSL
|
||||
- mbedTLS
|
||||
Added-in: 8.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_ssls_export - export SSL sessions
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
typedef CURLcode curl_ssls_export_function(CURL *handle,
|
||||
void *userptr,
|
||||
const char *session_key,
|
||||
const unsigned char *shmac,
|
||||
size_t shmac_len,
|
||||
const unsigned char *sdata,
|
||||
size_t sdata_len,
|
||||
curl_off_t valid_until,
|
||||
int ietf_tls_id,
|
||||
const char *alpn,
|
||||
size_t earlydata_max);
|
||||
|
||||
CURLcode curl_easy_ssls_export(CURL *handle,
|
||||
curl_ssls_export_function *export_fn,
|
||||
void *userptr);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function iterates over all SSL session tickets that belong to the
|
||||
easy handle and invokes the **export_fn** callback on each of them, as
|
||||
long as the callback returns **CURLE_OK**.
|
||||
|
||||
The callback may then store this information and use curl_easy_ssls_import(3)
|
||||
in another libcurl instance to add SSL session tickets again. Reuse of
|
||||
SSL session tickets may result in faster handshakes and some connections
|
||||
might be able to send request data in the initial packets (0-RTT).
|
||||
|
||||
From all the parameters passed to the **export_fn** only two need to be
|
||||
persisted: either **session_key** or **shamc** and always **sdata**. All
|
||||
other parameters are informative, e.g. allow the callback to act only
|
||||
on specific session tickets.
|
||||
|
||||
Note that SSL sessions that involve a client certificate or SRP
|
||||
username/password are not exported.
|
||||
|
||||
# Export Function Parameter
|
||||
|
||||
## Session Key
|
||||
|
||||
This is a printable, null-terminated string that starts with **hostname:port**
|
||||
the session ticket is originating from and also contains all relevant SSL
|
||||
parameters used in the connection. The key also carries the name and version
|
||||
number of the TLS backend used.
|
||||
|
||||
It is recommended to only persist **session_key** when it can be protected
|
||||
from outside access. Since the hostname appears in plain text, it would
|
||||
allow any third party to see how curl has been used for.
|
||||
|
||||
## Salted Hash
|
||||
|
||||
A binary blob of **shmac_len** bytes that contains a random salt and
|
||||
a cryptographic hash of the salt and **session_key**. The salt is generated
|
||||
for every session individually. Storing **shmac** is recommended when
|
||||
placing session tickets in a file, for example.
|
||||
|
||||
A third party may brute-force known hostnames, but cannot just "grep" for
|
||||
them.
|
||||
|
||||
## Session Data
|
||||
|
||||
A binary blob of **sdata_len** bytes, **sdata** contains all relevant
|
||||
SSL session ticket information for a later import - apart from **session_key**
|
||||
and **shmac**.
|
||||
|
||||
## valid_until
|
||||
|
||||
Seconds since EPOCH (1970-01-01) until the session ticket is considered
|
||||
valid.
|
||||
|
||||
## TLS Version
|
||||
|
||||
The IETF assigned number for the TLS version the session ticket originates
|
||||
from. This is **0x0304** for TLSv1.3, **0x0303** for 1.2, etc. Session
|
||||
tickets from version 1.3 have better security properties, so an export
|
||||
might store only those.
|
||||
|
||||
## ALPN
|
||||
|
||||
The ALPN protocol that had been negotiated with the host. This may be
|
||||
**NULL** if negotiation gave no result or had not been attempted.
|
||||
|
||||
## Early Data
|
||||
|
||||
The maximum amount of bytes the server supports to receive in early data
|
||||
(0-RTT). This is 0 unless the server explicitly indicates support.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
CURLcode my_export_cb(CURL *handle,
|
||||
void *userptr,
|
||||
const char *session_key,
|
||||
const unsigned char *shmac,
|
||||
size_t shmac_len,
|
||||
const unsigned char *sdata,
|
||||
size_t sdata_len,
|
||||
curl_off_t valid_until,
|
||||
int ietf_tls_id,
|
||||
const char *alpn,
|
||||
size_t earlydata_max)
|
||||
{
|
||||
/* persist sdata */
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
CURLcode rc;
|
||||
CURL *curl;
|
||||
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||
if(sh)
|
||||
printf("Error: %s\n", curl_share_strerror(sh));
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_SHARE, share);
|
||||
|
||||
/* run a transfer, all TLS sessions received will be added
|
||||
* to the share. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* export the TLS sessions collected in the share */
|
||||
rc = curl_easy_ssls_export(curl, my_export_cb, NULL);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
curl_share_cleanup(share);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_ssls_import
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_SHARE (3)
|
||||
- curl_share_setopt (3)
|
||||
- curl_easy_ssls_export (3)
|
||||
Protocol:
|
||||
- TLS
|
||||
TLS-backend:
|
||||
- GnuTLS
|
||||
- OpenSSL
|
||||
- wolfSSL
|
||||
- mbedTLS
|
||||
Added-in: 8.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_ssls_import - import SSL sessions
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_ssls_import(CURL *handle,
|
||||
const char *session_key,
|
||||
const unsigned char *shmac, size_t shmac_len,
|
||||
const unsigned char *sdata, size_t sdata_len);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function imports a previously exported SSL session ticket. **sdata** and
|
||||
**sdata_len** must always be provided. If **session_key** is **NULL**, then
|
||||
**shmac** and **shmac_len** must be given as received during the export.
|
||||
See curl_easy_ssls_export(3) for a description of those.
|
||||
|
||||
Import of session tickets from other curl versions may fail due to changes
|
||||
in the handling of **shmac** or **sdata**. A session ticket which has
|
||||
already expired is silently discarded.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
CURLcode rc;
|
||||
CURL *curl;
|
||||
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||
if(sh)
|
||||
printf("Error: %s\n", curl_share_strerror(sh));
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
extern unsigned char *shmac, *sdata;
|
||||
size_t hlen = 4, slen = 5;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_SHARE, share);
|
||||
|
||||
/* read shmac and sdata from storage */
|
||||
rc = curl_easy_ssls_import(curl, NULL, shmac, hlen, sdata, slen);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
curl_share_cleanup(share);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_strerror
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_strerror (3)
|
||||
- curl_share_strerror (3)
|
||||
- curl_url_strerror (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_strerror - return string describing error code
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const char *curl_easy_strerror(CURLcode errornum);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The curl_easy_strerror(3) function returns a string describing the
|
||||
CURLcode error code passed in the argument *errornum*.
|
||||
|
||||
Typically applications also appreciate CURLOPT_ERRORBUFFER(3) for more
|
||||
specific error descriptions generated at runtime.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLcode res;
|
||||
/* set options */
|
||||
/* Perform the entire transfer */
|
||||
res = curl_easy_perform(curl);
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string.
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_unescape
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_escape (3)
|
||||
- curl_url_get (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_unescape - URL decode a string
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_easy_unescape(CURL *curl, const char *input,
|
||||
int inlength, int *outlength);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function converts the URL encoded string **input** to a "plain string"
|
||||
and returns that in an allocated memory area. All input characters that are URL
|
||||
encoded (%XX where XX is a two-digit hexadecimal number) are converted to their
|
||||
binary versions.
|
||||
|
||||
If the **length** argument is set to 0 (zero), curl_easy_unescape(3)
|
||||
uses strlen() on **input** to find out the size.
|
||||
|
||||
If **outlength** is non-NULL, the function writes the length of the returned
|
||||
string in the integer it points to. This allows proper handling even for
|
||||
strings containing %00. Since this is a pointer to an *int* type, it can
|
||||
only return a value up to *INT_MAX* so no longer string can be returned in
|
||||
this parameter.
|
||||
|
||||
Since 7.82.0, the **curl** parameter is ignored. Prior to that there was
|
||||
per-handle character conversion support for some old operating systems such as
|
||||
TPF, but it was otherwise ignored.
|
||||
|
||||
You must curl_free(3) the returned string when you are done with it.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
int decodelen;
|
||||
char *decoded = curl_easy_unescape(curl, "%63%75%72%6c", 12, &decodelen);
|
||||
if(decoded) {
|
||||
/* do not assume printf() works on the decoded data */
|
||||
printf("Decoded: ");
|
||||
/* ... */
|
||||
curl_free(decoded);
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string or NULL if it failed.
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_easy_upkeep
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_TCP_KEEPALIVE (3)
|
||||
- CURLOPT_TCP_KEEPIDLE (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_easy_upkeep - keep existing connections alive
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_easy_upkeep(CURL *handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Some protocols have "connection upkeep" mechanisms. These mechanisms usually
|
||||
send some traffic on existing connections in order to keep them alive; this
|
||||
can prevent connections from being closed due to overzealous firewalls, for
|
||||
example.
|
||||
|
||||
For HTTP/2 we have an upkeep mechanism: when
|
||||
the connection upkeep interval is exceeded and curl_easy_upkeep(3)
|
||||
is called, an HTTP/2 PING frame is sent on the connection.
|
||||
|
||||
For MQTT the upkeep interval defines when to send ping requests to prevent the
|
||||
server from disconnecting.
|
||||
|
||||
This function must be explicitly called in order to perform the upkeep work.
|
||||
The connection upkeep interval is set with
|
||||
CURLOPT_UPKEEP_INTERVAL_MS(3).
|
||||
|
||||
If you call this function on an easy handle that uses a shared connection cache
|
||||
then upkeep is performed on the connections in that cache, even if those
|
||||
connections were never used by the easy handle. (Added in 8.10.0)
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Make a connection to an HTTP/2 server. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
|
||||
/* Set the interval to 30000ms / 30s */
|
||||
curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* Perform more work here. */
|
||||
|
||||
/* While the connection is being held open, curl_easy_upkeep() can be
|
||||
called. If curl_easy_upkeep() is called and the time since the last
|
||||
upkeep exceeds the interval, then an HTTP/2 PING is sent. */
|
||||
curl_easy_upkeep(curl);
|
||||
|
||||
/* Perform more work here. */
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_escape
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_free (3)
|
||||
- curl_unescape (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_escape - URL encode a string
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_escape(const char *string, int length);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Obsolete function. Use curl_easy_escape(3) instead.
|
||||
|
||||
This function converts the given input **string** to a URL encoded string
|
||||
and return that as a new allocated string. All input characters that are not
|
||||
a-z, A-Z or 0-9 are converted to their "URL escaped" version (**%NN** where
|
||||
**NN** is a two-digit hexadecimal number).
|
||||
|
||||
If the **length** argument is set to 0, curl_escape(3) uses strlen()
|
||||
on **string** to find out the size.
|
||||
|
||||
You must curl_free(3) the returned string when you are done with it.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
char *output = curl_escape("data to convert", 15);
|
||||
if(output) {
|
||||
printf("Encoded: %s\n", output);
|
||||
curl_free(output);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# HISTORY
|
||||
|
||||
Since 7.15.4, curl_easy_escape(3) should be used. This function might be
|
||||
removed in a future release.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string or NULL if it failed.
|
||||
+316
@@ -0,0 +1,316 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_formadd
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_setopt (3)
|
||||
- curl_formfree (3)
|
||||
- curl_mime_init (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_formadd - add a section to a multipart form POST
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLFORMcode curl_formadd(struct curl_httppost **firstitem,
|
||||
struct curl_httppost **lastitem, ...);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
**This function is deprecated.** Use curl_mime_init(3) instead.
|
||||
|
||||
curl_formadd() is used to append sections when building a multipart form
|
||||
post. Append one section at a time until you have added all the sections you
|
||||
want included and then you pass the *firstitem* pointer as parameter to
|
||||
CURLOPT_HTTPPOST(3). *lastitem* is set after each curl_formadd(3) call and
|
||||
on repeated invokes it should be left as set to allow repeated invokes to find
|
||||
the end of the list faster.
|
||||
|
||||
After the *lastitem* pointer follow the real arguments.
|
||||
|
||||
The pointers *firstitem* and *lastitem* should both be pointing to
|
||||
NULL in the first call to this function. All list-data is allocated by the
|
||||
function itself. You must call curl_formfree(3) on the *firstitem*
|
||||
after the form post has been done to free the resources.
|
||||
|
||||
Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
|
||||
You can disable this header with CURLOPT_HTTPHEADER(3) as usual.
|
||||
|
||||
First, there are some basics you need to understand about multipart form
|
||||
posts. Each part consists of at least a NAME and a CONTENTS part. If the part
|
||||
is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME.
|
||||
Below, we discuss what options you use to set these properties in the parts
|
||||
you want to add to your post.
|
||||
|
||||
The options listed first are for making normal parts. The options from
|
||||
*CURLFORM_FILE* through *CURLFORM_BUFFERLENGTH* are for file upload
|
||||
parts.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
## CURLFORM_COPYNAME
|
||||
|
||||
followed by a string which provides the *name* of this part. libcurl
|
||||
copies the string so your application does not need to keep it around after
|
||||
this function call. If the name is not null-terminated, you must set its
|
||||
length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to
|
||||
contain zero-valued bytes. The copied data is freed by curl_formfree(3).
|
||||
|
||||
## CURLFORM_PTRNAME
|
||||
|
||||
followed by a string which provides the *name* of this part. libcurl uses the
|
||||
pointer and refer to the data in your application, so you must make sure it
|
||||
remains until curl no longer needs it. If the name is not null-terminated, you
|
||||
must set its length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to
|
||||
contain zero-valued bytes.
|
||||
|
||||
## CURLFORM_COPYCONTENTS
|
||||
|
||||
followed by a pointer to the contents of this part, the actual data to send
|
||||
away. libcurl copies the provided data, so your application does not need to
|
||||
keep it around after this function call. If the data is not null-terminated,
|
||||
or if you would like it to contain zero bytes, you must set the length of the
|
||||
name with **CURLFORM_CONTENTSLENGTH**. The copied data is freed by
|
||||
curl_formfree(3).
|
||||
|
||||
## CURLFORM_PTRCONTENTS
|
||||
|
||||
followed by a pointer to the contents of this part, the actual data to send
|
||||
away. libcurl uses the pointer and refer to the data in your application, so
|
||||
you must make sure it remains until curl no longer needs it. If the data is
|
||||
not null-terminated, or if you would like it to contain zero bytes, you must
|
||||
set its length with **CURLFORM_CONTENTSLENGTH**.
|
||||
|
||||
## CURLFORM_CONTENTLEN
|
||||
|
||||
followed by a curl_off_t value giving the length of the contents. Note that
|
||||
for *CURLFORM_STREAM* contents, this option is mandatory.
|
||||
|
||||
If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents
|
||||
to figure out the size. If you really want to send a zero byte content then
|
||||
you must make sure strlen() on the data pointer returns zero.
|
||||
|
||||
## CURLFORM_CONTENTSLENGTH
|
||||
|
||||
(This option is deprecated. Use *CURLFORM_CONTENTLEN* instead.)
|
||||
|
||||
followed by a long giving the length of the contents. Note that for
|
||||
*CURLFORM_STREAM* contents, this option is mandatory.
|
||||
|
||||
If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents
|
||||
to figure out the size. If you really want to send a zero byte content then
|
||||
you must make sure strlen() on the data pointer returns zero.
|
||||
|
||||
## CURLFORM_FILECONTENT
|
||||
|
||||
followed by a filename, causes that file to be read and its contents used
|
||||
as data in this part. This part does *not* automatically become a file
|
||||
upload part simply because its data was read from a file.
|
||||
|
||||
The specified file needs to kept around until the associated transfer is done.
|
||||
|
||||
## CURLFORM_FILE
|
||||
|
||||
followed by a filename, makes this part a file upload part. It sets the
|
||||
*filename* field to the basename of the provided filename, it reads the
|
||||
contents of the file and passes them as data and sets the content-type if the
|
||||
given file match one of the internally known file extensions. For
|
||||
**CURLFORM_FILE** the user may send one or more files in one part by
|
||||
providing multiple **CURLFORM_FILE** arguments each followed by the filename
|
||||
(and each *CURLFORM_FILE* is allowed to have a
|
||||
*CURLFORM_CONTENTTYPE*).
|
||||
|
||||
The given upload file has to exist in its full in the file system already when
|
||||
the upload starts, as libcurl needs to read the correct file size beforehand.
|
||||
|
||||
The specified file needs to kept around until the associated transfer is done.
|
||||
|
||||
## CURLFORM_CONTENTTYPE
|
||||
|
||||
is used in combination with *CURLFORM_FILE*. Followed by a pointer to a
|
||||
string which provides the content-type for this part, possibly instead of an
|
||||
internally chosen one.
|
||||
|
||||
## CURLFORM_FILENAME
|
||||
|
||||
is used in combination with *CURLFORM_FILE*. Followed by a pointer to a
|
||||
string, it tells libcurl to use the given string as the *filename* in the file
|
||||
upload part instead of the actual filename.
|
||||
|
||||
## CURLFORM_BUFFER
|
||||
|
||||
is used for custom file upload parts without use of *CURLFORM_FILE*. It
|
||||
tells libcurl that the file contents are already present in a buffer. The
|
||||
parameter is a string which provides the *filename* field in the content
|
||||
header.
|
||||
|
||||
## CURLFORM_BUFFERPTR
|
||||
|
||||
is used in combination with *CURLFORM_BUFFER*. The parameter is a pointer
|
||||
to the buffer to be uploaded. This buffer must not be freed until after
|
||||
curl_easy_cleanup(3) is called. You must also use
|
||||
*CURLFORM_BUFFERLENGTH* to set the number of bytes in the buffer.
|
||||
|
||||
## CURLFORM_BUFFERLENGTH
|
||||
|
||||
is used in combination with *CURLFORM_BUFFER*. The parameter is a
|
||||
long which gives the length of the buffer.
|
||||
|
||||
## CURLFORM_STREAM
|
||||
|
||||
Tells libcurl to use the CURLOPT_READFUNCTION(3) callback to get data. The
|
||||
parameter you pass to *CURLFORM_STREAM* is the pointer passed on to the read
|
||||
callback's fourth argument. If you want the part to look like a file upload
|
||||
one, set the *CURLFORM_FILENAME* parameter as well. Note that when using
|
||||
*CURLFORM_STREAM*, *CURLFORM_CONTENTSLENGTH* must also be set with the total
|
||||
expected length of the part unless the formpost is sent chunked encoded.
|
||||
|
||||
## CURLFORM_ARRAY
|
||||
|
||||
Another possibility to send options to curl_formadd() is the
|
||||
**CURLFORM_ARRAY** option, that passes a struct curl_forms array pointer as
|
||||
its value. Each curl_forms structure element has a *CURLformoption* and a
|
||||
char pointer. The final element in the array must be a CURLFORM_END. All
|
||||
available options can be used in an array, except the CURLFORM_ARRAY option
|
||||
itself. The last argument in such an array must always be **CURLFORM_END**.
|
||||
|
||||
## CURLFORM_CONTENTHEADER
|
||||
|
||||
specifies extra headers for the form POST section. This takes a curl_slist
|
||||
prepared in the usual way using **curl_slist_append** and appends the list
|
||||
of headers to those libcurl automatically generates. The list must exist while
|
||||
the POST occurs, if you free it before the post completes you may experience
|
||||
problems.
|
||||
|
||||
When you have passed the *struct curl_httppost* pointer to
|
||||
curl_easy_setopt(3) (using the CURLOPT_HTTPPOST(3) option), you
|
||||
must not free the list until after you have called curl_easy_cleanup(3)
|
||||
for the curl handle.
|
||||
|
||||
See example below.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
#include <string.h> /* for strlen */
|
||||
|
||||
static const char record[]="data in a buffer";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_httppost *post = NULL;
|
||||
struct curl_httppost *last = NULL;
|
||||
char namebuffer[] = "name buffer";
|
||||
long namelength = strlen(namebuffer);
|
||||
char buffer[] = "test buffer";
|
||||
char htmlbuffer[] = "<HTML>test buffer</HTML>";
|
||||
long htmlbufferlength = strlen(htmlbuffer);
|
||||
struct curl_forms forms[3];
|
||||
char file1[] = "my-face.jpg";
|
||||
char file2[] = "your-face.jpg";
|
||||
/* add null character into htmlbuffer, to demonstrate that
|
||||
transfers of buffers containing null characters actually work
|
||||
*/
|
||||
htmlbuffer[8] = '\0';
|
||||
|
||||
/* Add simple name/content section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "name",
|
||||
CURLFORM_COPYCONTENTS, "content", CURLFORM_END);
|
||||
|
||||
/* Add simple name/content/contenttype section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode",
|
||||
CURLFORM_COPYCONTENTS, "<HTML></HTML>",
|
||||
CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);
|
||||
|
||||
/* Add name/ptrcontent section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent",
|
||||
CURLFORM_PTRCONTENTS, buffer, CURLFORM_END);
|
||||
|
||||
/* Add ptrname/ptrcontent section */
|
||||
curl_formadd(&post, &last, CURLFORM_PTRNAME, namebuffer,
|
||||
CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH,
|
||||
namelength, CURLFORM_END);
|
||||
|
||||
/* Add name/ptrcontent/contenttype section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "html_code_with_hole",
|
||||
CURLFORM_PTRCONTENTS, htmlbuffer,
|
||||
CURLFORM_CONTENTSLENGTH, htmlbufferlength,
|
||||
CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);
|
||||
|
||||
/* Add simple file section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
|
||||
CURLFORM_FILE, "my-face.jpg", CURLFORM_END);
|
||||
|
||||
/* Add file/contenttype section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
|
||||
CURLFORM_FILE, "my-face.jpg",
|
||||
CURLFORM_CONTENTTYPE, "image/jpeg", CURLFORM_END);
|
||||
|
||||
/* Add two file section */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
|
||||
CURLFORM_FILE, "my-face.jpg",
|
||||
CURLFORM_FILE, "your-face.jpg", CURLFORM_END);
|
||||
|
||||
/* Add two file section using CURLFORM_ARRAY */
|
||||
forms[0].option = CURLFORM_FILE;
|
||||
forms[0].value = file1;
|
||||
forms[1].option = CURLFORM_FILE;
|
||||
forms[1].value = file2;
|
||||
forms[2].option = CURLFORM_END;
|
||||
|
||||
/* Add a buffer to upload */
|
||||
curl_formadd(&post, &last,
|
||||
CURLFORM_COPYNAME, "name",
|
||||
CURLFORM_BUFFER, "data",
|
||||
CURLFORM_BUFFERPTR, record,
|
||||
CURLFORM_BUFFERLENGTH, sizeof(record),
|
||||
CURLFORM_END);
|
||||
|
||||
/* no option needed for the end marker */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
|
||||
CURLFORM_ARRAY, forms, CURLFORM_END);
|
||||
/* Add the content of a file as a normal post text value */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "filecontent",
|
||||
CURLFORM_FILECONTENT, ".bashrc", CURLFORM_END);
|
||||
/* Set the form info */
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
curl_formfree(post);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# DEPRECATED
|
||||
|
||||
Deprecated in 7.56.0. Before this release, field names were allowed to contain
|
||||
zero-valued bytes. The pseudo-filename "-" to read stdin is discouraged
|
||||
although still supported, but data is not read before being actually sent: the
|
||||
effective data size can then not be automatically determined, resulting in a
|
||||
chunked encoding transfer. Backslashes and double quotes in field and
|
||||
filenames are now escaped before transmission.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
0 means everything was OK, non-zero means an error occurred corresponding to a
|
||||
`CURL_FORMADD_*` constant defined in *\<curl/curl.h\>*.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_formfree
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_formadd (3)
|
||||
- curl_mime_free (3)
|
||||
- curl_mime_init (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_formfree - free a previously build multipart form post chain
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_formfree(struct curl_httppost *form);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is deprecated. Do not use. See curl_mime_init(3) instead.
|
||||
|
||||
curl_formfree() is used to clean up data previously built/appended with
|
||||
curl_formadd(3). This must be called when the data has been used, which
|
||||
typically means after curl_easy_perform(3) has been called.
|
||||
|
||||
The pointer to free is the same pointer you passed to the
|
||||
CURLOPT_HTTPPOST(3) option, which is the *firstitem* pointer from
|
||||
the curl_formadd(3) invoke(s).
|
||||
|
||||
**form** is the pointer as returned from a previous call to
|
||||
curl_formadd(3) and may be NULL.
|
||||
|
||||
Passing in a NULL pointer in *form* makes this function return immediately
|
||||
with no action.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_httppost *formpost;
|
||||
struct curl_httppost *lastptr;
|
||||
|
||||
/* Fill in a file upload field */
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "file",
|
||||
CURLFORM_FILE, "nice-image.jpg",
|
||||
CURLFORM_END);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* then cleanup the formpost chain */
|
||||
curl_formfree(formpost);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# DEPRECATED
|
||||
|
||||
Deprecated in 7.56.0.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
None
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_formget
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_formadd (3)
|
||||
- curl_mime_init (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.15.5
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_formget - serialize a multipart form POST chain
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
int curl_formget(struct curl_httppost * form, void *userp,
|
||||
curl_formget_callback append);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The form API (including this function) is deprecated since libcurl 7.56.0.
|
||||
|
||||
curl_formget() serializes data previously built with curl_formadd(3). It
|
||||
accepts a void pointer as second argument named *userp* which is passed as the
|
||||
first argument to the curl_formget_callback function.
|
||||
|
||||
~~~c
|
||||
typedef size_t (*curl_formget_callback)(void *userp, const char *buf,
|
||||
size_t len);"
|
||||
~~~
|
||||
|
||||
The *curl_formget_callback* is invoked for each part of the HTTP POST chain.
|
||||
The character buffer passed to the callback must not be freed. The callback
|
||||
should return the buffer length passed to it on success.
|
||||
|
||||
If the **CURLFORM_STREAM** option is used in the formpost, it prevents
|
||||
curl_formget(3) from working until you have performed the actual HTTP request.
|
||||
This, because first then does libcurl known which actual read callback to use.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
size_t print_httppost_callback(void *arg, const char *buf, size_t len)
|
||||
{
|
||||
fwrite(buf, len, 1, stdout);
|
||||
(*(size_t *) arg) += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t print_httppost(struct curl_httppost *post)
|
||||
{
|
||||
size_t total_size = 0;
|
||||
if(curl_formget(post, &total_size, print_httppost_callback)) {
|
||||
return (size_t) -1;
|
||||
}
|
||||
return total_size;
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
0 means everything was OK, non-zero means an error occurred
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_free
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_escape (3)
|
||||
- curl_easy_unescape (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_free - reclaim memory that has been obtained through a libcurl call
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_free(void *ptr);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_free reclaims memory that has been obtained through a libcurl call. Use
|
||||
curl_free(3) instead of free() to avoid anomalies that can result from
|
||||
differences in memory management between your application and libcurl.
|
||||
|
||||
Passing in a NULL pointer in *ptr* makes this function return immediately
|
||||
with no action.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
char *width = curl_getenv("COLUMNS");
|
||||
if(width) {
|
||||
/* it was set */
|
||||
curl_free(width);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
None
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_getdate
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_TIMECONDITION (3)
|
||||
- CURLOPT_TIMEVALUE (3)
|
||||
- curl_easy_escape (3)
|
||||
- curl_easy_unescape (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_getdate - convert date string to number of seconds
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
time_t curl_getdate(const char *datestring, const time_t *now);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_getdate(3) returns the number of seconds since the Epoch, January
|
||||
1st 1970 00:00:00 in the UTC time zone, for the date and time that the
|
||||
*datestring* parameter specifies. The *now* parameter is not used,
|
||||
pass a NULL there.
|
||||
|
||||
This function works with valid dates and does not always detect and reject
|
||||
wrong dates, such as February 30.
|
||||
|
||||
# PARSING DATES AND TIMES
|
||||
|
||||
A "date" is a string containing several items separated by whitespace. The
|
||||
order of the items is immaterial. A date string may contain many flavors of
|
||||
items:
|
||||
|
||||
## calendar date items
|
||||
|
||||
Can be specified several ways. Month names can only be three-letter English
|
||||
abbreviations, numbers can be zero-prefixed and the year may use 2 or 4
|
||||
digits. Examples: 06 Nov 1994, 06-Nov-94 and Nov-94 6.
|
||||
|
||||
If the year appears to be below 100 (two-digit), any year after 70 is assumed
|
||||
to be 1900 + the given year. All others are 2000 + the given year.
|
||||
|
||||
## time of the day items
|
||||
|
||||
This string specifies the time on a given day. You must specify it with 6
|
||||
digits with two colons: HH:MM:SS. If there is no time given in a provided date
|
||||
string, 00:00:00 is assumed. Example: 18:19:21.
|
||||
|
||||
## time zone items
|
||||
|
||||
Specifies international time zone. There are a few acronyms supported, but in
|
||||
general you should instead use the specific relative time compared to
|
||||
UTC. Supported formats include: -1200, MST, +0100.
|
||||
|
||||
## day of the week items
|
||||
|
||||
Specifies a day of the week. Days of the week may be spelled out in full
|
||||
(using English): 'Sunday', 'Monday', etc or they may be abbreviated to their
|
||||
first three letters. This is usually not info that adds anything.
|
||||
|
||||
## pure numbers
|
||||
|
||||
If a decimal number of the form YYYYMMDD appears, then YYYY is read as the
|
||||
year, MM as the month number and DD as the day of the month, for the specified
|
||||
calendar date.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
time_t t;
|
||||
t = curl_getdate("Sun, 06 Nov 1994 08:49:37 GMT", NULL);
|
||||
t = curl_getdate("Sunday, 06-Nov-94 08:49:37 GMT", NULL);
|
||||
t = curl_getdate("Sun Nov 6 08:49:37 1994", NULL);
|
||||
t = curl_getdate("06 Nov 1994 08:49:37 GMT", NULL);
|
||||
t = curl_getdate("06-Nov-94 08:49:37 GMT", NULL);
|
||||
t = curl_getdate("Nov 6 08:49:37 1994", NULL);
|
||||
t = curl_getdate("06 Nov 1994 08:49:37", NULL);
|
||||
t = curl_getdate("06-Nov-94 08:49:37", NULL);
|
||||
t = curl_getdate("1994 Nov 6 08:49:37", NULL);
|
||||
t = curl_getdate("GMT 08:49:37 06-Nov-94 Sunday", NULL);
|
||||
t = curl_getdate("94 6 Nov 08:49:37", NULL);
|
||||
t = curl_getdate("1994 Nov 6", NULL);
|
||||
t = curl_getdate("06-Nov-94", NULL);
|
||||
t = curl_getdate("Sun Nov 6 94", NULL);
|
||||
t = curl_getdate("1994.Nov.6", NULL);
|
||||
t = curl_getdate("Sun/Nov/6/94/GMT", NULL);
|
||||
t = curl_getdate("Sun, 06 Nov 1994 08:49:37 CET", NULL);
|
||||
t = curl_getdate("06 Nov 1994 08:49:37 EST", NULL);
|
||||
t = curl_getdate("Sun, 12 Sep 2004 15:05:58 -0700", NULL);
|
||||
t = curl_getdate("Sat, 11 Sep 2004 21:32:11 +0200", NULL);
|
||||
t = curl_getdate("20040912 15:05:58 -0700", NULL);
|
||||
t = curl_getdate("20040911 +0200", NULL);
|
||||
}
|
||||
~~~
|
||||
|
||||
# STANDARDS
|
||||
|
||||
This parser handles date formats specified in RFC 822 (including the update in
|
||||
RFC 1123) using time zone name or time zone delta and RFC 850 (obsoleted by
|
||||
RFC 1036) and ANSI C's *asctime()* format.
|
||||
|
||||
These formats are the only ones RFC 7231 says HTTP applications may use.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns -1 when it fails to parse the date string. Otherwise it
|
||||
returns the number of seconds as described.
|
||||
|
||||
On systems with a signed 32-bit time_t: if the year is larger than 2037 or
|
||||
less than 1903, this function returns -1.
|
||||
|
||||
On systems with an unsigned 32-bit time_t: if the year is larger than 2106 or
|
||||
less than 1970, this function returns -1.
|
||||
|
||||
On systems with 64-bit time_t: if the year is less than 1583, this function
|
||||
returns -1. (The Gregorian calendar was first introduced 1582 so no "real"
|
||||
dates in this way of doing dates existed before then.)
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_getenv
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- getenv (3C)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_getenv - return value for environment name
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_getenv(const char *name);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_getenv() is a portable wrapper for the getenv() function, meant to
|
||||
emulate its behavior and provide an identical interface for all operating
|
||||
systems libcurl builds on (including Windows).
|
||||
|
||||
You must curl_free(3) the returned string when you are done with it.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
char *width = curl_getenv("COLUMNS");
|
||||
if(width) {
|
||||
/* it was set */
|
||||
curl_free(width);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string or NULL if it failed to find the
|
||||
specified name.
|
||||
|
||||
# NOTE
|
||||
|
||||
Under Unix operating systems, there is no point in returning an allocated
|
||||
memory, although other systems does not work properly if this is not done. The
|
||||
Unix implementation thus suffers slightly from the drawbacks of other systems.
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_global_cleanup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_global_init (3)
|
||||
- libcurl (3)
|
||||
- libcurl-thread (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.8
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_global_cleanup - global libcurl cleanup
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_global_cleanup(void);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function releases resources acquired by curl_global_init(3).
|
||||
|
||||
You should call curl_global_cleanup(3) once for each call you make to
|
||||
curl_global_init(3), after you are done using libcurl.
|
||||
|
||||
This function is thread-safe since libcurl 7.84.0 if
|
||||
curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set
|
||||
(most platforms).
|
||||
|
||||
If this is not thread-safe, you must not call this function when any other
|
||||
thread in the program (i.e. a thread sharing the same memory) is running.
|
||||
This does not just mean no other thread that is using libcurl. Because
|
||||
curl_global_cleanup(3) calls functions of other libraries that are
|
||||
similarly thread unsafe, it could conflict with any other thread that uses
|
||||
these other libraries.
|
||||
|
||||
See the description in libcurl(3) of global environment requirements for
|
||||
details of how to use this function.
|
||||
|
||||
# CAUTION
|
||||
|
||||
curl_global_cleanup(3) does not block waiting for any libcurl-created
|
||||
threads to terminate (such as threads used for name resolving). If a module
|
||||
containing libcurl is dynamically unloaded while libcurl-created threads are
|
||||
still running then your program may crash or other corruption may occur. We
|
||||
recommend you do not run libcurl from any module that may be unloaded
|
||||
dynamically. This behavior may be addressed in the future.
|
||||
|
||||
libcurl may not be able to fully clean up after multi-threaded OpenSSL
|
||||
depending on how OpenSSL was built and loaded as a library. It is possible in
|
||||
some rare circumstances a memory leak could occur unless you implement your own
|
||||
OpenSSL thread cleanup. Refer to libcurl-thread(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
/* use libcurl, then before exiting... */
|
||||
|
||||
curl_global_cleanup();
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
None
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_global_init
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_init (3)
|
||||
- curl_global_cleanup (3)
|
||||
- curl_global_init_mem (3)
|
||||
- curl_global_sslset (3)
|
||||
- curl_global_trace (3)
|
||||
- libcurl (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.8
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_global_init - global libcurl initialization
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_global_init(long flags);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function sets up the program environment that libcurl needs. Think of it
|
||||
as an extension of the library loader.
|
||||
|
||||
This function must be called at least once within a program (a program is all
|
||||
the code that shares a memory space) before the program calls any other
|
||||
function in libcurl. The environment it sets up is constant for the life of
|
||||
the program and is the same for every program, so multiple calls have the same
|
||||
effect as one call.
|
||||
|
||||
The flags option is a bit pattern that tells libcurl exactly what features to
|
||||
init, as described below. Set the desired bits by ORing the values together.
|
||||
In normal operation, you must specify CURL_GLOBAL_ALL. Do not use any other
|
||||
value unless you are familiar with it and mean to control internal operations
|
||||
of libcurl.
|
||||
|
||||
This function is thread-safe on most platforms. Then curl_version_info(3) has
|
||||
the `threadsafe` feature set (added in 7.84.0).
|
||||
|
||||
If this is not thread-safe (the bit mentioned above is not set), you must not
|
||||
call this function when any other thread in the program (i.e. a thread sharing
|
||||
the same memory) is running. This does not just mean no other thread that is
|
||||
using libcurl. Because curl_global_init(3) calls functions of other libraries
|
||||
that are similarly thread unsafe, it could conflict with any other thread that
|
||||
uses these other libraries.
|
||||
|
||||
If you are initializing libcurl from a Windows DLL you should not initialize
|
||||
it from *DllMain* or a static initializer because Windows holds the loader
|
||||
lock during that time and it could cause a deadlock.
|
||||
|
||||
See the description in libcurl(3) of global environment requirements for
|
||||
details of how to use this function.
|
||||
|
||||
# FLAGS
|
||||
|
||||
## CURL_GLOBAL_ALL
|
||||
|
||||
Initialize everything possible. This sets all known bits except
|
||||
**CURL_GLOBAL_ACK_EINTR**.
|
||||
|
||||
## CURL_GLOBAL_SSL
|
||||
|
||||
(This flag's presence or absence serves no meaning since 7.57.0. The
|
||||
description below is for older libcurl versions.)
|
||||
|
||||
Initialize SSL.
|
||||
|
||||
The implication here is that if this bit is not set, the initialization of the
|
||||
SSL layer needs to be done by the application or at least outside of
|
||||
libcurl. The exact procedure how to do SSL initialization depends on the TLS
|
||||
backend libcurl uses.
|
||||
|
||||
Doing TLS based transfers without having the TLS layer initialized may lead to
|
||||
unexpected behaviors.
|
||||
|
||||
## CURL_GLOBAL_WIN32
|
||||
|
||||
Initialize the Win32 socket libraries.
|
||||
|
||||
The implication here is that if this bit is not set, the initialization of
|
||||
Winsock has to be done by the application or you risk getting undefined
|
||||
behaviors. This option exists for when the initialization is handled outside
|
||||
of libcurl so there is no need for libcurl to do it again.
|
||||
|
||||
## CURL_GLOBAL_NOTHING
|
||||
|
||||
Initialize nothing extra. This sets no bit.
|
||||
|
||||
## CURL_GLOBAL_DEFAULT
|
||||
|
||||
A sensible default. It initializes both SSL and Win32. Right now, this equals
|
||||
the functionality of the **CURL_GLOBAL_ALL** mask.
|
||||
|
||||
## CURL_GLOBAL_ACK_EINTR
|
||||
|
||||
This bit has no point since 7.69.0 but its behavior is instead the default.
|
||||
|
||||
Before 7.69.0: when this flag is set, curl acknowledges EINTR condition when
|
||||
connecting or when waiting for data. Otherwise, curl waits until full timeout
|
||||
elapses.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
/* use libcurl, then before exiting... */
|
||||
|
||||
curl_global_cleanup();
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns non-zero, something went wrong and you cannot use the
|
||||
other curl functions.
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_global_init_mem
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_global_cleanup (3)
|
||||
- curl_global_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_global_init_mem - global libcurl initialization with memory callbacks
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_global_init_mem(long flags,
|
||||
curl_malloc_callback m,
|
||||
curl_free_callback f,
|
||||
curl_realloc_callback r,
|
||||
curl_strdup_callback s,
|
||||
curl_calloc_callback c);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function works exactly as curl_global_init(3) with one addition: it
|
||||
allows the application to set callbacks to replace the otherwise used internal
|
||||
memory functions.
|
||||
|
||||
If you are using libcurl from multiple threads or libcurl was built with the
|
||||
threaded resolver option then the callback functions must be thread safe. The
|
||||
threaded resolver is a common build option to enable (and in some cases the
|
||||
default) so we strongly urge you to make your callback functions thread safe.
|
||||
|
||||
All callback arguments must be set to valid function pointers. The
|
||||
prototypes for the given callbacks must match these:
|
||||
|
||||
## `void *malloc_callback(size_t size);`
|
||||
|
||||
To replace malloc()
|
||||
|
||||
## `void free_callback(void *ptr);`
|
||||
|
||||
To replace free()
|
||||
|
||||
## `void *realloc_callback(void *ptr, size_t size);`
|
||||
|
||||
To replace realloc()
|
||||
|
||||
## `char *strdup_callback(const char *str);`
|
||||
|
||||
To replace strdup()
|
||||
|
||||
## `void *calloc_callback(size_t nmemb, size_t size);`
|
||||
|
||||
To replace calloc()
|
||||
|
||||
This function is otherwise the same as curl_global_init(3), please refer
|
||||
to that man page for documentation.
|
||||
|
||||
# CAUTION
|
||||
|
||||
Manipulating these gives considerable powers to the application to severely
|
||||
screw things up for libcurl. Take care.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
extern void *malloc_cb(size_t);
|
||||
extern void free_cb(void *);
|
||||
extern void *realloc_cb(void *, size_t);
|
||||
extern char *strdup_cb(const char *);
|
||||
extern void *calloc_cb(size_t, size_t);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
curl_global_init_mem(CURL_GLOBAL_DEFAULT, malloc_cb,
|
||||
free_cb, realloc_cb,
|
||||
strdup_cb, calloc_cb);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,141 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_global_sslset
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_global_init (3)
|
||||
- libcurl (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_global_sslset - select SSL backend to use
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLsslset curl_global_sslset(curl_sslbackend id,
|
||||
const char *name,
|
||||
const curl_ssl_backend ***avail);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function configures at runtime which SSL backend to use with
|
||||
libcurl. This function can only be used to select an SSL backend once, and it
|
||||
must be called **before** curl_global_init(3).
|
||||
|
||||
The backend can be identified by the *id*
|
||||
(e.g. **CURLSSLBACKEND_OPENSSL**). The backend can also be specified via the
|
||||
*name* parameter for a case insensitive match (passing
|
||||
**CURLSSLBACKEND_NONE** as *id*). If both *id* and *name* are
|
||||
specified, the *name* is ignored.
|
||||
|
||||
If neither *id* nor *name* are specified, the function fails with
|
||||
**CURLSSLSET_UNKNOWN_BACKEND** and set the *avail* pointer to the
|
||||
NULL-terminated list of available backends. The available backends are those
|
||||
that this particular build of libcurl supports.
|
||||
|
||||
Since libcurl 7.60.0, the *avail* pointer is always set to the list of
|
||||
alternatives if non-NULL.
|
||||
|
||||
Upon success, the function returns **CURLSSLSET_OK**.
|
||||
|
||||
If the specified SSL backend is not available, the function returns
|
||||
**CURLSSLSET_UNKNOWN_BACKEND** and sets the *avail* pointer to a
|
||||
NULL-terminated list of available SSL backends. In this case, you may call the
|
||||
function again to try to select a different backend.
|
||||
|
||||
The SSL backend can be set only once. If it has already been set, a subsequent
|
||||
attempt to change it results in a **CURLSSLSET_TOO_LATE** getting returned.
|
||||
|
||||
This function is thread-safe since libcurl 7.84.0 if
|
||||
curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set
|
||||
(most platforms).
|
||||
|
||||
If this is not thread-safe, you must not call this function when any other
|
||||
thread in the program (i.e. a thread sharing the same memory) is running.
|
||||
This does not just mean no other thread that is using libcurl.
|
||||
|
||||
# Names
|
||||
|
||||
SSL backend names (case-insensitive): GnuTLS, mbedTLS, OpenSSL, Rustls,
|
||||
Schannel, wolfSSL
|
||||
|
||||
The name "OpenSSL" is used for all versions of OpenSSL and its associated
|
||||
forks/flavors in this function. OpenSSL, BoringSSL, LibreSSL, quictls and
|
||||
AmiSSL are all supported by libcurl, but in the eyes of curl_global_sslset(3)
|
||||
they are all just "OpenSSL". They all mostly provide the same API.
|
||||
curl_version_info(3) can return more specific info about the exact OpenSSL
|
||||
flavor and version number in use.
|
||||
|
||||
# struct
|
||||
|
||||
~~~c
|
||||
typedef struct {
|
||||
curl_sslbackend id;
|
||||
const char *name;
|
||||
} curl_ssl_backend;
|
||||
|
||||
typedef enum {
|
||||
CURLSSLBACKEND_NONE = 0,
|
||||
CURLSSLBACKEND_OPENSSL = 1, /* or one of its forks */
|
||||
CURLSSLBACKEND_GNUTLS = 2,
|
||||
CURLSSLBACKEND_NSS = 3,
|
||||
CURLSSLBACKEND_GSKIT = 5, /* deprecated */
|
||||
CURLSSLBACKEND_POLARSSL = 6, /* deprecated */
|
||||
CURLSSLBACKEND_WOLFSSL = 7,
|
||||
CURLSSLBACKEND_SCHANNEL = 8,
|
||||
CURLSSLBACKEND_SECURETRANSPORT = 9, /* deprecated */
|
||||
CURLSSLBACKEND_AXTLS = 10, /* deprecated */
|
||||
CURLSSLBACKEND_MBEDTLS = 11,
|
||||
CURLSSLBACKEND_MESALINK = 12, /* deprecated */
|
||||
CURLSSLBACKEND_BEARSSL = 13, /* deprecated */
|
||||
CURLSSLBACKEND_RUSTLS = 14
|
||||
} curl_sslbackend;
|
||||
~~~
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
/* choose a specific backend */
|
||||
curl_global_sslset(CURLSSLBACKEND_WOLFSSL, NULL, NULL);
|
||||
|
||||
/* list the available ones */
|
||||
const curl_ssl_backend **list;
|
||||
curl_global_sslset(CURLSSLBACKEND_NONE, NULL, &list);
|
||||
|
||||
for(i = 0; list[i]; i++)
|
||||
printf("SSL backend #%d: '%s' (ID: %d)\n",
|
||||
i, list[i]->name, list[i]->id);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns *CURLSSLSET_OK*, the backend was successfully
|
||||
selected.
|
||||
|
||||
If the chosen backend is unknown (or support for the chosen backend has not
|
||||
been compiled into libcurl), the function returns
|
||||
*CURLSSLSET_UNKNOWN_BACKEND*.
|
||||
|
||||
If the backend had been configured previously, or if curl_global_init(3)
|
||||
has already been called, the function returns *CURLSSLSET_TOO_LATE*.
|
||||
|
||||
If this libcurl was built completely without SSL support, with no backends at
|
||||
all, this function returns *CURLSSLSET_NO_BACKENDS*.
|
||||
@@ -0,0 +1,204 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_global_trace
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_global_init (3)
|
||||
- libcurl (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.3.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_global_trace - log configuration
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_global_trace(const char *config);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function configures the logging behavior to make some parts of curl more
|
||||
verbose or silent than others.
|
||||
|
||||
This function may be called during the initialization phase of a program. It
|
||||
does not have to be. It can be called several times even, possibly overwriting
|
||||
settings of previous calls.
|
||||
|
||||
Calling this function after transfers have been started is undefined. On some
|
||||
platforms/architectures it might take effect, on others not.
|
||||
|
||||
This function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has
|
||||
the CURL_VERSION_THREADSAFE feature bit set (most platforms).
|
||||
|
||||
If this is not thread-safe, you must not call this function when any other
|
||||
thread in the program (i.e. a thread sharing the same memory) is running. This
|
||||
does not just mean no other thread that is using libcurl. Because
|
||||
curl_global_init(3) may call functions of other libraries that are similarly
|
||||
thread unsafe, it could conflict with any other thread that uses these other
|
||||
libraries.
|
||||
|
||||
If you are initializing libcurl from a Windows DLL you should not initialize
|
||||
it from *DllMain* or a static initializer because Windows holds the loader
|
||||
lock during that time and it could cause a deadlock.
|
||||
|
||||
The *config* string is a list of comma-separated component names. Names are
|
||||
case-insensitive and unknown names are ignored. The special name "all" applies
|
||||
to all components. Names may be prefixed with '+' or '-' to enable or disable
|
||||
detailed logging for a component.
|
||||
|
||||
The list of component names is not part of curl's public API. Names may be
|
||||
added or disappear in future versions of libcurl. Since unknown names are
|
||||
silently ignored, outdated log configurations does not cause errors when
|
||||
upgrading libcurl. Given that, some names can be expected to be fairly stable
|
||||
and are listed below for easy reference.
|
||||
|
||||
Note that log configuration applies only to transfers where debug logging is
|
||||
enabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control
|
||||
that.
|
||||
|
||||
# TRACE COMPONENTS
|
||||
|
||||
## `tcp`
|
||||
|
||||
Tracing of TCP socket handling: connect, sends, receives.
|
||||
|
||||
## `ssl`
|
||||
|
||||
Tracing of SSL/TLS operations, whichever SSL backend is used in your build.
|
||||
|
||||
## `ftp`
|
||||
|
||||
Tracing of FTP operations when this protocol is enabled in your build.
|
||||
|
||||
## `http/2`
|
||||
|
||||
Details about HTTP/2 handling: frames, events, I/O, etc.
|
||||
|
||||
## `http/3`
|
||||
|
||||
Details about HTTP/3 handling: connect, frames, events, I/O etc.
|
||||
|
||||
## `http-proxy`
|
||||
|
||||
Involved when transfers are tunneled through an HTTP proxy. "h1-proxy" or
|
||||
"h2-proxy" are also involved, depending on the HTTP version negotiated with
|
||||
the proxy.
|
||||
|
||||
In order to find out all components involved in a transfer, run it with "all"
|
||||
configured. You can then see all names involved in your libcurl version in the
|
||||
trace.
|
||||
|
||||
## `dns`
|
||||
|
||||
Tracing of DNS operations to resolve hostnames and HTTPS records.
|
||||
|
||||
## `lib-ids`
|
||||
|
||||
Adds transfer and connection identifiers as prefix to every call to
|
||||
CURLOPT_DEBUGFUNCTION(3). The format is `[n-m]` where `n` is the identifier
|
||||
of the transfer and `m` is the identifier of the connection. A literal `x`
|
||||
is used for internal transfers or when no connection is assigned.
|
||||
|
||||
For example, `[5-x]` is the prefix for transfer 5 that has no
|
||||
connection. The command line tool `curl`uses the same format for its
|
||||
`--trace-ids` option.
|
||||
|
||||
`lib-ids` is intended for libcurl applications that handle multiple
|
||||
transfers but have no own way to identify in trace output which transfer
|
||||
a trace event is connected to.
|
||||
|
||||
## `doh`
|
||||
|
||||
Former name for DNS-over-HTTP operations. Now an alias for `dns`.
|
||||
|
||||
## `multi`
|
||||
|
||||
Traces multi operations managing transfers' state changes and sockets poll
|
||||
states.
|
||||
|
||||
## `read`
|
||||
|
||||
Traces reading of upload data from the application in order to send it to the
|
||||
server.
|
||||
|
||||
## `ssls`
|
||||
|
||||
Tracing of SSL Session handling, e.g. caching/import/export.
|
||||
|
||||
## `smtp`
|
||||
|
||||
Tracing of SMTP operations when this protocol is enabled in your build.
|
||||
|
||||
## `timer`
|
||||
|
||||
Tracing of timers set for transfers.
|
||||
|
||||
## `write`
|
||||
|
||||
Traces writing of download data, received from the server, to the application.
|
||||
|
||||
## `ws`
|
||||
|
||||
Tracing of WebSocket operations when this protocol is enabled in your build.
|
||||
|
||||
# TRACE GROUPS
|
||||
|
||||
Besides the specific component names there are the following group names
|
||||
defined:
|
||||
|
||||
## `all`
|
||||
|
||||
## `network`
|
||||
|
||||
All components involved in bare network I/O, including the SSL layer.
|
||||
|
||||
All components that your libcurl is built with.
|
||||
|
||||
## `protocol`
|
||||
|
||||
All components involved in transfer protocols, such as 'ftp' and 'http/2'.
|
||||
|
||||
## `proxy`
|
||||
|
||||
All components involved in use of proxies.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* log details of HTTP/2 and SSL handling */
|
||||
curl_global_trace("http/2,ssl");
|
||||
|
||||
/* log all details, except SSL handling */
|
||||
curl_global_trace("all,-ssl");
|
||||
}
|
||||
~~~
|
||||
|
||||
Below is a trace sample where "http/2" was configured. The trace output
|
||||
of an enabled component appears at the beginning in brackets.
|
||||
~~~
|
||||
* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
|
||||
...
|
||||
* [HTTP/2] [h2sid=1] FRAME[HEADERS]
|
||||
* [HTTP/2] [h2sid=1] 249 header bytes
|
||||
...
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns non-zero, something went wrong and the configuration
|
||||
may not have any effects or may only been applied partially.
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_addpart
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_data_cb (3)
|
||||
- curl_mime_encoder (3)
|
||||
- curl_mime_filedata (3)
|
||||
- curl_mime_filename (3)
|
||||
- curl_mime_headers (3)
|
||||
- curl_mime_init (3)
|
||||
- curl_mime_name (3)
|
||||
- curl_mime_subparts (3)
|
||||
- curl_mime_type (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_addpart - append a new empty part to a mime structure
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
curl_mimepart *curl_mime_addpart(curl_mime *mime);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_addpart(3) creates and appends a new empty part to the given
|
||||
mime structure and returns a handle to it. The returned part handle can
|
||||
subsequently be populated using functions from the mime API.
|
||||
|
||||
*mime* is the handle of the mime structure in which the new part must be
|
||||
appended.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* continue and set name + data to the part */
|
||||
curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
|
||||
curl_mime_name(part, "data");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A mime part structure handle, or NULL upon failure.
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_data
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data_cb (3)
|
||||
- curl_mime_name (3)
|
||||
- curl_mime_type (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_data - set a mime part's body data from memory
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_data(curl_mimepart *part, const char *data,
|
||||
size_t datasize);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_data(3) sets a mime part's body content from memory data.
|
||||
|
||||
*part* is the mime part to assign contents to, created with
|
||||
curl_mime_addpart(3).
|
||||
|
||||
*data* points to the data that gets copied by this function. The storage
|
||||
may safely be reused after the call.
|
||||
|
||||
*datasize* is the number of bytes *data* points to. It can be set to
|
||||
*CURL_ZERO_TERMINATED* to indicate *data* is a null-terminated
|
||||
character string.
|
||||
|
||||
Setting a part's contents multiple times is valid: only the value set by the
|
||||
last call is retained. It is possible to unassign part's contents by setting
|
||||
*data* to NULL.
|
||||
|
||||
Setting large data is memory consuming: one might consider using
|
||||
curl_mime_data_cb(3) in such a case.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* add data to the part */
|
||||
curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,180 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_data_cb
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_duphandle (3)
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_name (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_data_cb - set a callback-based data source for a mime part's body
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
size_t readfunc(char *buffer, size_t size, size_t nitems, void *arg);
|
||||
|
||||
int seekfunc(void *arg, curl_off_t offset, int origin);
|
||||
|
||||
void freefunc(void *arg);
|
||||
|
||||
CURLcode curl_mime_data_cb(curl_mimepart *part, curl_off_t datasize,
|
||||
curl_read_callback readfunc,
|
||||
curl_seek_callback seekfunc,
|
||||
curl_free_callback freefunc, void *arg);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_data_cb(3) sets the data source of a mime part's body content
|
||||
from a data read callback function.
|
||||
|
||||
*part* is the part's to assign contents to.
|
||||
|
||||
*datasize* is the number of bytes the read callback is expected to provide.
|
||||
|
||||
*readfunc* is a pointer to a data read callback function, with a signature
|
||||
as shown by the above prototype. It may not be set to NULL.
|
||||
|
||||
*seekfunc* is a pointer to a seek callback function, with a signature as
|
||||
shown by the above prototype. This function is used when resending data (i.e.:
|
||||
after a redirect); this pointer may be set to NULL, in which case a resend
|
||||
might not be not possible.
|
||||
|
||||
*freefunc* is a pointer to a user resource freeing callback function, with
|
||||
a signature as shown by the above prototype. If no resource is to be freed, it
|
||||
may safely be set to NULL. This function is called upon mime structure
|
||||
freeing.
|
||||
|
||||
*arg* is a user defined argument to callback functions.
|
||||
|
||||
The read callback function gets called by libcurl as soon as it needs to
|
||||
read data in order to send it to the peer - like if you ask it to upload or
|
||||
post data to the server. The data area pointed at by the pointer *buffer*
|
||||
should be filled up with at most *size* multiplied with *nitems* number
|
||||
of bytes by your function.
|
||||
|
||||
Your read function must then return the actual number of bytes that it stored
|
||||
in that memory area. Returning 0 signals end-of-file to the library and cause
|
||||
it to stop the current transfer.
|
||||
|
||||
If you stop the current transfer by returning 0 "pre-maturely" (i.e. before
|
||||
the server expected it, like when you have said you intend to upload N bytes
|
||||
and yet you upload less than N bytes), you may experience that the server
|
||||
"hangs" waiting for the rest of the data that does not come.
|
||||
|
||||
The read callback may return *CURL_READFUNC_ABORT* to stop the current
|
||||
operation immediately, resulting in a *CURLE_ABORTED_BY_CALLBACK* error
|
||||
code from the transfer.
|
||||
|
||||
The callback can return *CURL_READFUNC_PAUSE* to cause reading from this
|
||||
connection to pause. See curl_easy_pause(3) for further details.
|
||||
|
||||
The seek function gets called by libcurl to rewind input stream data or to
|
||||
seek to a certain position. The function shall work like fseek(3) or lseek(3)
|
||||
and it gets SEEK_SET, SEEK_CUR or SEEK_END as argument for *origin*,
|
||||
although libcurl currently only passes SEEK_SET.
|
||||
|
||||
The callback function must return *CURL_SEEKFUNC_OK* on success,
|
||||
*CURL_SEEKFUNC_FAIL* to cause the upload operation to fail or
|
||||
*CURL_SEEKFUNC_CANTSEEK* to indicate that while the seek failed, libcurl
|
||||
is free to work around the problem if possible. The latter can sometimes be
|
||||
done by instead reading from the input or similar.
|
||||
|
||||
Care must be taken if the part is bound to a curl easy handle that is later
|
||||
duplicated: the *arg* pointer argument is also duplicated, resulting in
|
||||
the pointed item to be shared between the original and the copied handle. In
|
||||
particular, special attention should be given to the *freefunc* procedure
|
||||
code since it then gets called twice with the same argument.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
Sending a huge data string causes the same amount of memory to be allocated:
|
||||
to avoid overhead resources consumption, one might want to use a callback
|
||||
source to avoid data duplication. In this case, original data must be retained
|
||||
until after the transfer terminates.
|
||||
~~~c
|
||||
#include <string.h> /* for memcpy */
|
||||
char hugedata[512000];
|
||||
|
||||
struct ctl {
|
||||
char *buffer;
|
||||
curl_off_t size;
|
||||
curl_off_t position;
|
||||
};
|
||||
|
||||
size_t read_callback(char *buffer, size_t size, size_t nitems, void *arg)
|
||||
{
|
||||
struct ctl *p = (struct ctl *) arg;
|
||||
curl_off_t sz = p->size - p->position;
|
||||
|
||||
nitems *= size;
|
||||
if(sz > nitems)
|
||||
sz = nitems;
|
||||
if(sz)
|
||||
memcpy(buffer, p->buffer + p->position, sz);
|
||||
p->position += sz;
|
||||
return sz;
|
||||
}
|
||||
|
||||
int seek_callback(void *arg, curl_off_t offset, int origin)
|
||||
{
|
||||
struct ctl *p = (struct ctl *) arg;
|
||||
|
||||
switch(origin) {
|
||||
case SEEK_END:
|
||||
offset += p->size;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
offset += p->position;
|
||||
break;
|
||||
}
|
||||
|
||||
if(offset < 0)
|
||||
return CURL_SEEKFUNC_FAIL;
|
||||
p->position = offset;
|
||||
return CURL_SEEKFUNC_OK;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_mime *mime = curl_mime_init(curl);
|
||||
curl_mimepart *part = curl_mime_addpart(mime);
|
||||
struct ctl hugectl;
|
||||
|
||||
hugectl.buffer = hugedata;
|
||||
hugectl.size = sizeof(hugedata);
|
||||
hugectl.position = 0;
|
||||
curl_mime_data_cb(part, hugectl.size, read_callback,
|
||||
seek_callback, NULL, &hugectl);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_encoder
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_headers (3)
|
||||
- curl_mime_subparts (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_encoder - set a mime part's encoder and content transfer encoding
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_encoder(curl_mimepart *part, const char *encoding);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_encoder() requests a mime part's content to be encoded before being
|
||||
transmitted.
|
||||
|
||||
*part* is the part's handle to assign an encoder.
|
||||
*encoding* is a pointer to a null-terminated encoding scheme. It may be
|
||||
set to NULL to disable an encoder previously attached to the part. The encoding
|
||||
scheme storage may safely be reused after this function returns.
|
||||
|
||||
Setting a part's encoder multiple times is valid: only the value set by the
|
||||
last call is retained.
|
||||
|
||||
Upon multipart rendering, the part's content is encoded according to the
|
||||
pertaining scheme and a corresponding *"Content-Transfer-Encoding"* header
|
||||
is added to the part.
|
||||
|
||||
Supported encoding schemes are:
|
||||
|
||||
"*binary*": the data is left unchanged, the header is added.
|
||||
|
||||
"*8bit*": header added, no data change.
|
||||
|
||||
"*7bit*": the data is unchanged, but is each byte is checked
|
||||
to be a 7-bit value; if not, a read error occurs.
|
||||
|
||||
"*base64*": Data is converted to base64 encoding, then split in
|
||||
CRLF-terminated lines of at most 76 characters.
|
||||
|
||||
"*quoted-printable*": data is encoded in quoted printable lines of
|
||||
at most 76 characters. Since the resulting size of the final data cannot be
|
||||
determined prior to reading the original data, it is left as unknown, causing
|
||||
chunked transfer in HTTP. For the same reason, this encoder may not be used
|
||||
with IMAP. This encoder targets text data that is mostly ASCII and should
|
||||
not be used with other types of data.
|
||||
|
||||
If the original data is already encoded in such a scheme, a custom
|
||||
*Content-Transfer-Encoding* header should be added with
|
||||
curl_mime_headers(3) instead of setting a part encoder.
|
||||
|
||||
Encoding should not be applied to multiparts, thus the use of this function on
|
||||
a part with content set with curl_mime_subparts(3) is strongly
|
||||
discouraged.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* send a file */
|
||||
curl_mime_filedata(part, "image.png");
|
||||
|
||||
/* encode file data in base64 for transfer */
|
||||
curl_mime_encoder(part, "base64");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_filedata
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_filename (3)
|
||||
- curl_mime_name (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_filedata - set a mime part's body data from a file contents
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_filedata(curl_mimepart *part,
|
||||
const char *filename);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_filedata(3) sets a mime part's body content from the named
|
||||
file's contents. This is an alternative to curl_mime_data(3) for setting
|
||||
data to a mime part.
|
||||
|
||||
*part* is the part's to assign contents to.
|
||||
|
||||
*filename* points to the null-terminated file's path name. The pointer can
|
||||
be NULL to detach the previous part contents settings. Filename storage can
|
||||
be safely be reused after this call.
|
||||
|
||||
As a side effect, the part's remote filename is set to the base name of the
|
||||
given *filename* if it is a valid named file. This can be undone or
|
||||
overridden by a subsequent call to curl_mime_filename(3).
|
||||
|
||||
The contents of the file is read during the file transfer in a streaming
|
||||
manner to allow huge files to get transferred without using much memory. It
|
||||
therefore requires that the file is kept intact during the entire request.
|
||||
|
||||
If the file size cannot be determined before actually reading it (such as for
|
||||
a character device or named pipe), the whole mime structure containing the
|
||||
part is transferred using chunks by HTTP but is rejected by IMAP.
|
||||
|
||||
Setting a part's contents multiple times is valid: only the value set by the
|
||||
last call is retained.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* send data from this file */
|
||||
curl_mime_filedata(part, "image.png");
|
||||
|
||||
/* set name */
|
||||
curl_mime_name(part, "data");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
|
||||
CURLE_READ_ERROR is only an indication that the file is not yet readable: it
|
||||
can be safely ignored at this time, but the file must be made readable before
|
||||
the pertaining easy handle is performed.
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_filename
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_filedata (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_filename - set a mime part's remote filename
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_filename(curl_mimepart *part,
|
||||
const char *filename);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_filename(3) sets a mime part's remote filename. When remote
|
||||
filename is set, content data is processed as a file, whatever is the part's
|
||||
content source. A part's remote filename is transmitted to the server in the
|
||||
associated Content-Disposition generated header.
|
||||
|
||||
*part* is the part's handle to assign the remote filename to.
|
||||
|
||||
*filename* points to the null-terminated filename string; it may be set
|
||||
to NULL to remove a previously attached remote filename.
|
||||
|
||||
The remote filename string is copied into the part, thus the associated
|
||||
storage may safely be released or reused after call. Setting a part's file
|
||||
name multiple times is valid: only the value set by the last call is retained.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
|
||||
static char imagebuf[]="imagedata";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* send image data from memory */
|
||||
curl_mime_data(part, imagebuf, sizeof(imagebuf));
|
||||
|
||||
/* set a file name to make it look like a file upload */
|
||||
curl_mime_filename(part, "image.png");
|
||||
|
||||
/* set name */
|
||||
curl_mime_name(part, "data");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_free
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_free (3)
|
||||
- curl_mime_init (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_free - free a previously built mime structure
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_mime_free(curl_mime *mime);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_free(3) is used to clean up data previously built/appended
|
||||
with curl_mime_addpart(3) and other mime-handling functions. This must
|
||||
be called when the data has been used, which typically means after
|
||||
curl_easy_perform(3) has been called.
|
||||
|
||||
The handle to free is the one you passed to the CURLOPT_MIMEPOST(3)
|
||||
option: attached sub part mime structures must not be explicitly freed as they
|
||||
are by the top structure freeing.
|
||||
|
||||
**mime** is the handle as returned from a previous call to
|
||||
curl_mime_init(3) and may be NULL.
|
||||
|
||||
Passing in a NULL pointer in *mime* makes this function return immediately
|
||||
with no action.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* Build the mime message. */
|
||||
curl_mime *mime = curl_mime_init(curl);
|
||||
|
||||
/* send off the transfer */
|
||||
|
||||
/* Free multipart message. */
|
||||
curl_mime_free(mime);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
None
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_headers
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_name (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_headers - set a mime part's custom headers
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_headers(curl_mimepart *part,
|
||||
struct curl_slist *headers, int take_ownership);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_headers(3) sets a mime part's custom headers.
|
||||
|
||||
*part* is the part's handle to assign the custom headers list to.
|
||||
|
||||
*headers* is the head of a list of custom headers; it may be set to NULL
|
||||
to remove a previously attached custom header list.
|
||||
|
||||
*take_ownership*: when non-zero, causes the list to be freed upon
|
||||
replacement or mime structure deletion; in this case the list must not be
|
||||
freed explicitly.
|
||||
|
||||
Setting a part's custom headers list multiple times is valid: only the value
|
||||
set by the last call is retained.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
struct curl_slist *headers = NULL;
|
||||
CURL *easy = curl_easy_init();
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
headers = curl_slist_append(headers, "Custom-Header: mooo");
|
||||
|
||||
mime = curl_mime_init(easy);
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* use these headers in the part, takes ownership */
|
||||
curl_mime_headers(part, headers, 1);
|
||||
|
||||
/* pass on this data */
|
||||
curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED);
|
||||
|
||||
/* set name */
|
||||
curl_mime_name(part, "numbers");
|
||||
|
||||
/* Post and send it. */
|
||||
curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
|
||||
curl_easy_setopt(easy, CURLOPT_URL, "https://example.com");
|
||||
curl_easy_perform(easy);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_init
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_MIMEPOST (3)
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_free (3)
|
||||
- curl_mime_subparts (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_init - create a mime handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
curl_mime *curl_mime_init(CURL *easy_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_init(3) creates a handle to a new empty mime structure.
|
||||
This mime structure can be subsequently filled using the mime API, then
|
||||
attached to some easy handle using option CURLOPT_MIMEPOST(3) within
|
||||
a curl_easy_setopt(3) call or added as a multipart in another mime
|
||||
handle's part using curl_mime_subparts(3).
|
||||
|
||||
*easy_handle* is used for part separator randomization and error
|
||||
reporting. Since 7.87.0, it does not need to be the final target handle.
|
||||
|
||||
Using a mime handle is the recommended way to post an HTTP form, format and
|
||||
send a multi-part email with SMTP or upload such an email to an IMAP server.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *easy = curl_easy_init();
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
/* Build an HTTP form with a single field named "data", */
|
||||
mime = curl_mime_init(easy);
|
||||
part = curl_mime_addpart(mime);
|
||||
curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
|
||||
curl_mime_name(part, "data");
|
||||
|
||||
/* Post and send it. */
|
||||
curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
|
||||
curl_easy_setopt(easy, CURLOPT_URL, "https://example.com");
|
||||
curl_easy_perform(easy);
|
||||
|
||||
/* Clean-up. */
|
||||
curl_easy_cleanup(easy);
|
||||
curl_mime_free(mime);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A mime struct handle, or NULL upon failure.
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_name
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_type (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_name - set a mime part's name
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_name(curl_mimepart *part, const char *name);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_name(3) sets a mime part's name. This is the way HTTP form
|
||||
fields are named.
|
||||
|
||||
*part* is the part's handle to assign a name to.
|
||||
|
||||
*name* points to the null-terminated name string.
|
||||
|
||||
The name string is copied into the part, thus the associated storage may
|
||||
safely be released or reused after call. Setting a part's name multiple times
|
||||
is valid: only the value set by the last call is retained. It is possible to
|
||||
reset the name of a part by setting *name* to NULL.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* give the part a name */
|
||||
curl_mime_name(part, "shoe_size");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_subparts
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_init (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_subparts - set sub-parts of a multipart mime part
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_subparts(3) sets a multipart mime part's content from a mime
|
||||
structure.
|
||||
|
||||
*part* is a handle to the multipart part.
|
||||
|
||||
*subparts* is a mime structure handle holding the sub-parts. After
|
||||
curl_mime_subparts(3) succeeds, the mime structure handle belongs to the
|
||||
multipart part and must not be freed explicitly. It may however be updated by
|
||||
subsequent calls to mime API functions.
|
||||
|
||||
Setting a part's contents multiple times is valid: only the value set by the
|
||||
last call is retained. It is possible to unassign previous part's contents by
|
||||
setting *subparts* to NULL.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
|
||||
static char *inline_html = "<title>example</title>";
|
||||
static char *inline_text = "once upon the time";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_slist *slist;
|
||||
|
||||
/* The inline part is an alternative proposing the html and the text
|
||||
versions of the email. */
|
||||
curl_mime *alt = curl_mime_init(curl);
|
||||
curl_mimepart *part;
|
||||
|
||||
/* HTML message. */
|
||||
part = curl_mime_addpart(alt);
|
||||
curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
|
||||
curl_mime_type(part, "text/html");
|
||||
|
||||
/* Text message. */
|
||||
part = curl_mime_addpart(alt);
|
||||
curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
|
||||
|
||||
/* Create the inline part. */
|
||||
part = curl_mime_addpart(alt);
|
||||
curl_mime_subparts(part, alt);
|
||||
curl_mime_type(part, "multipart/alternative");
|
||||
slist = curl_slist_append(NULL, "Content-Disposition: inline");
|
||||
curl_mime_headers(part, slist, 1);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_mime_type
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_mime_addpart (3)
|
||||
- curl_mime_data (3)
|
||||
- curl_mime_name (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
- IMAP
|
||||
- SMTP
|
||||
Added-in: 7.56.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_mime_type - set a mime part's content type
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_mime_type(3) sets a mime part's content type.
|
||||
|
||||
*part* is the part's handle to assign the content type to.
|
||||
|
||||
*mimetype* points to the null-terminated file mime type string; it may be
|
||||
set to NULL to remove a previously attached mime type.
|
||||
|
||||
The mime type string is copied into the part, thus the associated storage may
|
||||
safely be released or reused after call. Setting a part's type multiple times
|
||||
is valid: only the value set by the last call is retained.
|
||||
|
||||
In the absence of a mime type and if needed by the protocol specifications,
|
||||
a default mime type is determined by the context:
|
||||
|
||||
- If set as a custom header, use this value.
|
||||
|
||||
- application/form-data for an HTTP form post.
|
||||
|
||||
- If a remote filename is set, the mime type is taken from the filename
|
||||
extension, or application/octet-stream by default.
|
||||
|
||||
- For a multipart part, multipart/mixed.
|
||||
|
||||
- text/plain in other cases.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* create a mime handle */
|
||||
mime = curl_mime_init(curl);
|
||||
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* get data from this file */
|
||||
curl_mime_filedata(part, "image.png");
|
||||
|
||||
/* content-type for this part */
|
||||
curl_mime_type(part, "image/png");
|
||||
|
||||
/* set name */
|
||||
curl_mime_name(part, "image");
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_printf
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- fprintf (3)
|
||||
- printf (3)
|
||||
- sprintf (3)
|
||||
- vprintf (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf,
|
||||
curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf,
|
||||
curl_mvsprintf - formatted output conversion
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
int curl_mprintf(const char *format, ...);
|
||||
int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
int curl_msprintf(char *buffer, const char *format, ...);
|
||||
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||
int curl_mvprintf(const char *format, va_list args);
|
||||
int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
|
||||
va_list args);
|
||||
char *curl_maprintf(const char *format , ...);
|
||||
char *curl_mvaprintf(const char *format, va_list args);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
These functions produce output according to the format string and given
|
||||
arguments. They are mostly clones of the well-known C-style functions but
|
||||
there are slight differences in behavior.
|
||||
|
||||
We discourage users from using any of these functions in new applications.
|
||||
|
||||
Functions in the curl_mprintf() family produce output according to a format as
|
||||
described below. The functions **curl_mprintf()** and **curl_mvprintf()**
|
||||
write output to stdout, the standard output stream; **curl_mfprintf()** and
|
||||
**curl_mvfprintf()** write output to the given output stream;
|
||||
**curl_msprintf()**, **curl_msnprintf()**, **curl_mvsprintf()**, and
|
||||
**curl_mvsnprintf()** write to the character string **buffer**.
|
||||
|
||||
The functions **curl_msnprintf()** and **curl_mvsnprintf()** write at most
|
||||
*maxlength* bytes (including the terminating null byte ('0')) to
|
||||
*buffer*.
|
||||
|
||||
The functions **curl_mvprintf()**, **curl_mvfprintf()**,
|
||||
**curl_mvsprintf()**, **curl_mvsnprintf()** are equivalent to the
|
||||
functions **curl_mprintf()**, **curl_mfprintf()**, **curl_msprintf()**,
|
||||
**curl_msnprintf()**, respectively, except that they are called with a
|
||||
*va_list* instead of a variable number of arguments. These functions do
|
||||
not call the *va_end* macro. Because they invoke the *va_arg* macro,
|
||||
the value of *ap* is undefined after the call.
|
||||
|
||||
The functions **curl_maprintf()** and **curl_mvaprintf()** return the
|
||||
output string as pointer to a newly allocated memory area. The returned string
|
||||
must be curl_free(3)ed by the receiver.
|
||||
|
||||
All of these functions write the output under the control of a format string
|
||||
that specifies how subsequent arguments are converted for output.
|
||||
|
||||
# FORMAT STRING
|
||||
|
||||
The format string is composed of zero or more directives: ordinary characters
|
||||
(not %), which are copied unchanged to the output stream; and conversion
|
||||
specifications, each of which results in fetching zero or more subsequent
|
||||
arguments. Each conversion specification is introduced by the character %, and
|
||||
ends with a conversion specifier. In between there may be (in this order) zero
|
||||
or more *flags*, an optional minimum *field width*, an optional
|
||||
*precision* and an optional *length modifier*.
|
||||
|
||||
# The $ modifier
|
||||
|
||||
The arguments must correspond properly with the conversion specifier. By
|
||||
default, the arguments are used in the order given, where each '*' (see Field
|
||||
width and Precision below) and each conversion specifier asks for the next
|
||||
argument (and it is an error if insufficiently many arguments are given). One
|
||||
can also specify explicitly which argument is taken, at each place where an
|
||||
argument is required, by writing "%m$" instead of '%' and "*m$" instead
|
||||
of '*', where the decimal integer m denotes the position in the argument list
|
||||
of the desired argument, indexed starting from 1. Thus,
|
||||
~~~c
|
||||
curl_mprintf("%*d", width, num);
|
||||
~~~
|
||||
and
|
||||
~~~c
|
||||
curl_mprintf("%2$*1$d", width, num);
|
||||
~~~
|
||||
are equivalent. The second style allows repeated references to the same
|
||||
argument.
|
||||
|
||||
If the style using '$' is used, it must be used throughout for all conversions
|
||||
taking an argument and all width and precision arguments, but it may be mixed
|
||||
with "%%" formats, which do not consume an argument. There may be no gaps in
|
||||
the numbers of arguments specified using '$'; for example, if arguments 1 and
|
||||
3 are specified, argument 2 must also be specified somewhere in the format
|
||||
string.
|
||||
|
||||
# Flag characters
|
||||
|
||||
The character % is followed by zero or more of the following flags:
|
||||
|
||||
## #
|
||||
|
||||
The value should be converted to its "alternate form".
|
||||
|
||||
## 0
|
||||
|
||||
The value should be zero padded.
|
||||
|
||||
## -
|
||||
|
||||
The converted value is to be left adjusted on the field boundary. (The default
|
||||
is right justification.) The converted value is padded on the right with
|
||||
blanks, rather than on the left with blanks or zeros. A '-' overrides a &'0'
|
||||
if both are given.
|
||||
|
||||
## (space)
|
||||
|
||||
(a space: ' ') A blank should be left before a positive number (or empty
|
||||
string) produced by a signed conversion.
|
||||
|
||||
## +
|
||||
|
||||
A sign (+ or -) should always be placed before a number produced by a signed
|
||||
conversion. By default, a sign is used only for negative numbers. A '+'
|
||||
overrides a space if both are used.
|
||||
|
||||
# Field width
|
||||
|
||||
An optional decimal digit string (with nonzero first digit) specifying a
|
||||
minimum field width. If the converted value has fewer characters than the
|
||||
field width, it gets padded with spaces on the left (or right, if the
|
||||
left-adjustment flag has been given). Instead of a decimal digit string one
|
||||
may write "*" or "*m$" (for some decimal integer m) to specify that the field
|
||||
width is given in the next argument, or in the *m-th* argument,
|
||||
respectively, which must be of type int. A negative field width is taken as
|
||||
a '-' flag followed by a positive field width. In no case does a nonexistent
|
||||
or small field width cause truncation of a field; if the result of a
|
||||
conversion is wider than the field width, the field is expanded to contain the
|
||||
conversion result.
|
||||
|
||||
# Precision
|
||||
|
||||
An optional precision in the form of a period ('.') followed by an optional
|
||||
decimal digit string. Instead of a decimal digit string one may write "*" or
|
||||
"*m$" (for some decimal integer m) to specify that the precision is given in
|
||||
the next argument, or in the *m-th* argument, respectively, which must be of
|
||||
type int. If the precision is given as just '.', the precision is taken to be
|
||||
zero. A negative precision is taken as if the precision were omitted. This
|
||||
gives the minimum number of digits to appear for **d**, **i**, **o**,
|
||||
**u**, **x**, and **X** conversions, the number of digits to appear
|
||||
after the radix character for **a**, **A**, **e**, **E**, **f**, and
|
||||
**F** conversions, the maximum number of significant digits for **g** and
|
||||
**G** conversions, or the maximum number of characters to be printed from a
|
||||
string for **s** and **S** conversions.
|
||||
|
||||
# Length modifier
|
||||
|
||||
## h
|
||||
|
||||
A following integer conversion corresponds to a *short* or *unsigned short*
|
||||
argument.
|
||||
|
||||
## l
|
||||
|
||||
(ell) A following integer conversion corresponds to a *long* or
|
||||
*unsigned long* argument, or a following n conversion corresponds to a
|
||||
pointer to a long argument
|
||||
|
||||
## ll
|
||||
|
||||
(ell-ell). A following integer conversion corresponds to a *long long* or
|
||||
*unsigned long long* argument, or a following n conversion corresponds to
|
||||
a pointer to a *long long* argument.
|
||||
|
||||
## q
|
||||
|
||||
A synonym for **ll**.
|
||||
|
||||
## L
|
||||
|
||||
A following a, A, e, E, f, F, g, or G conversion corresponds to a long double
|
||||
argument.
|
||||
|
||||
## z
|
||||
|
||||
A following integer conversion corresponds to a *size_t* or *ssize_t*
|
||||
argument.
|
||||
|
||||
# Conversion specifiers
|
||||
|
||||
A character that specifies the type of conversion to be applied. The
|
||||
conversion specifiers and their meanings are:
|
||||
|
||||
## d, i
|
||||
|
||||
The int argument is converted to signed decimal notation. The precision, if
|
||||
any, gives the minimum number of digits that must appear; if the converted
|
||||
value requires fewer digits, it is padded on the left with zeros. The default
|
||||
precision is 1. When 0 is printed with an explicit precision 0, the output is
|
||||
empty.
|
||||
|
||||
## o, u, x, X
|
||||
|
||||
The unsigned int argument is converted to unsigned octal (o), unsigned decimal
|
||||
(u), or unsigned hexadecimal (**x** and **X**) notation. The letters
|
||||
*abcdef* are used for **x** conversions; the letters *ABCDEF* are
|
||||
used for **X** conversions. The precision, if any, gives the minimum number
|
||||
of digits that must appear; if the converted value requires fewer digits, it
|
||||
is padded on the left with zeros. The default precision is 1. When 0 is
|
||||
printed with an explicit precision 0, the output is empty.
|
||||
|
||||
## e, E
|
||||
|
||||
The double argument is rounded and output in the style **"[-]d.ddde{+|-}dd"**
|
||||
|
||||
## f, F
|
||||
|
||||
The double argument is rounded and output to decimal notation in the style
|
||||
**"[-]ddd.ddd"**.
|
||||
|
||||
## g, G
|
||||
|
||||
The double argument is converted in style f or e.
|
||||
|
||||
## c
|
||||
|
||||
The int argument is converted to an unsigned char, and the resulting character
|
||||
is written.
|
||||
|
||||
## s
|
||||
|
||||
The *const char ** argument is expected to be a pointer to an array of
|
||||
character type (pointer to a string). Characters from the array are written up
|
||||
to (but not including) a terminating null byte. If a precision is specified,
|
||||
no more than the number specified are written. If a precision is given, no
|
||||
null byte need be present; if the precision is not specified, or is greater
|
||||
than the size of the array, the array must contain a terminating null byte.
|
||||
|
||||
## p
|
||||
|
||||
The *void ** pointer argument is printed in hexadecimal.
|
||||
|
||||
## n
|
||||
|
||||
The number of characters written so far is stored into the integer pointed to
|
||||
by the corresponding argument.
|
||||
|
||||
## %
|
||||
|
||||
A '%' symbol is written. No argument is converted.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
const char *name = "John";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
curl_mprintf("My name is %s\n", name);
|
||||
curl_mprintf("Pi is almost %f\n", (double)25.0/8);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
The **curl_maprintf** and **curl_mvaprintf** functions return a pointer to
|
||||
a newly allocated string, or NULL if it failed.
|
||||
|
||||
All other functions return the number of characters actually printed
|
||||
(excluding the null byte used to end output to strings). Note that this
|
||||
sometimes differ from how the POSIX versions of these functions work.
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_add_handle
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_get_handles (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_setopt (3)
|
||||
- curl_multi_socket_action (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_add_handle - add an easy handle to a multi session
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Adds the *easy handle* to the *multi_handle*.
|
||||
|
||||
While an easy handle is added to a multi stack, you cannot and you must not
|
||||
use curl_easy_perform(3) on that handle. After having removed the easy
|
||||
handle from the multi stack again, it is perfectly fine to use it with the
|
||||
easy interface again.
|
||||
|
||||
If the easy handle is not set to use a shared (CURLOPT_SHARE(3)) cache,
|
||||
it is made to use a DNS cache that is shared between all easy handles within
|
||||
the multi handle when curl_multi_add_handle(3) is called.
|
||||
|
||||
When an easy interface is added to a multi handle, it is set to use a shared
|
||||
connection cache owned by the multi handle. Removing and adding new easy
|
||||
handles does not affect the pool of connections or the ability to do
|
||||
connection reuse.
|
||||
|
||||
If you have CURLMOPT_TIMERFUNCTION(3) set in the multi handle (as you
|
||||
should if you are working event-based with curl_multi_socket_action(3)
|
||||
and friends), that callback is called from within this function to ask for an
|
||||
updated timer so that your main event loop gets the activity on this handle to
|
||||
get started.
|
||||
|
||||
The easy handle remains added to the multi handle until you remove it again
|
||||
with curl_multi_remove_handle(3) - even when a transfer with that
|
||||
specific easy handle is completed.
|
||||
|
||||
You should remove the easy handle from the multi stack before you terminate
|
||||
first the easy handle and then the multi handle:
|
||||
|
||||
1 - curl_multi_remove_handle(3)
|
||||
|
||||
2 - curl_easy_cleanup(3)
|
||||
|
||||
3 - curl_multi_cleanup(3)
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* init a multi stack */
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
/* create two easy handles */
|
||||
CURL *http_handle = curl_easy_init();
|
||||
CURL *http_handle2 = curl_easy_init();
|
||||
|
||||
/* add individual transfers */
|
||||
curl_multi_add_handle(multi, http_handle);
|
||||
curl_multi_add_handle(multi, http_handle2);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_assign
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_setopt (3)
|
||||
- curl_multi_socket_action (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.5
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_assign - set data to associate with an internal socket
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd,
|
||||
void *sockptr);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function creates an association in the multi handle between the given
|
||||
socket and a private pointer of the application. This is designed for
|
||||
curl_multi_socket_action(3) uses.
|
||||
|
||||
When set, the *sockptr* pointer is passed to all future socket callbacks
|
||||
for the specific *sockfd* socket.
|
||||
|
||||
If the given *sockfd* is not already in use by libcurl, this function
|
||||
returns an error.
|
||||
|
||||
libcurl only keeps one single pointer associated with a socket, so calling
|
||||
this function several times for the same socket makes the last set pointer get
|
||||
used.
|
||||
|
||||
The idea here being that this association (socket to private pointer) is
|
||||
something that just about every application that uses this API needs and then
|
||||
libcurl can just as well do it since it already has the necessary
|
||||
functionality.
|
||||
|
||||
It is acceptable to call this function from your multi callback functions.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
int private = 123;
|
||||
curl_socket_t fd = 0; /* file descriptor to associate our data with */
|
||||
|
||||
/* make our struct pointer associated with socket fd */
|
||||
CURLMcode mc = curl_multi_assign(multi, fd, &private);
|
||||
if(mc)
|
||||
printf("error: %s\n", curl_multi_strerror(mc));
|
||||
}
|
||||
~~~
|
||||
|
||||
# TYPICAL USAGE
|
||||
|
||||
In a typical application you allocate a struct or at least use some kind of
|
||||
semi-dynamic data for each socket that we must wait for action on when using
|
||||
the curl_multi_socket_action(3) approach.
|
||||
|
||||
When our socket-callback gets called by libcurl and we get to know about yet
|
||||
another socket to wait for, we can use curl_multi_assign(3) to point out the
|
||||
particular data so that when we get updates about this same socket again, we
|
||||
do not have to find the struct associated with this socket by ourselves.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_cleanup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_init (3)
|
||||
- curl_multi_get_handles (3)
|
||||
- curl_multi_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_cleanup - close down a multi session
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is the opposite of curl_multi_init(3). Cleans up and removes a
|
||||
whole multi stack. It does not free or touch any individual easy handles in
|
||||
any way - they still need to be closed individually, using the usual
|
||||
curl_easy_cleanup(3) way. The order of cleaning up should be:
|
||||
|
||||
1 - curl_multi_remove_handle(3) before any easy handles are cleaned up
|
||||
|
||||
2 - curl_easy_cleanup(3) can now be called independently since the easy
|
||||
handle is no longer connected to the multi handle
|
||||
|
||||
3 - curl_multi_cleanup(3) should be called when all easy handles are
|
||||
removed
|
||||
|
||||
When this function is called, remaining entries in the connection pool held by
|
||||
the multi handle are shut down, which might trigger calls to the
|
||||
CURLMOPT_SOCKETFUNCTION(3) callback.
|
||||
|
||||
Passing in a NULL pointer in *multi_handle* makes this function return
|
||||
CURLM_BAD_HANDLE immediately with no other action.
|
||||
|
||||
Any use of the **multi_handle** after this function has been called and have
|
||||
returned, is illegal.
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
/* when the multi transfer is done ... */
|
||||
|
||||
/* remove all easy handles, then: */
|
||||
curl_multi_cleanup(multi);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,129 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_fdset
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_perform (3)
|
||||
- curl_multi_timeout (3)
|
||||
- curl_multi_wait (3)
|
||||
- curl_multi_waitfds (3)
|
||||
- select (2)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_fdset - extract file descriptor information from a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function extracts file descriptor information from a given multi_handle.
|
||||
libcurl returns its *fd_set* sets. The application can use these to
|
||||
select() on, but be sure to *FD_ZERO* them before calling this function as
|
||||
curl_multi_fdset(3) only adds its own descriptors, it does not zero or
|
||||
otherwise remove any others. The curl_multi_perform(3) function should
|
||||
be called as soon as one of them is ready to be read from or written to.
|
||||
|
||||
The *read_fd_set* argument should point to an object of type **fd_set**
|
||||
that on returns specifies the file descriptors to be checked for being ready
|
||||
to read.
|
||||
|
||||
The *write_fd_set* argument should point to an object of type **fd_set**
|
||||
that on return specifies the file descriptors to be checked for being ready to
|
||||
write.
|
||||
|
||||
The *exc_fd_set* argument should point to an object of type **fd_set**
|
||||
that on return specifies the file descriptors to be checked for error
|
||||
conditions.
|
||||
|
||||
If no file descriptors are set by libcurl, *max_fd* contain -1 when this
|
||||
function returns. Otherwise it contains the highest descriptor number libcurl
|
||||
set. When libcurl returns -1 in *max_fd*, it is because libcurl currently
|
||||
does something that is not possible for your application to monitor with a
|
||||
socket and unfortunately you can then not know exactly when the current action
|
||||
is completed using select(). You then need to wait a while before you proceed
|
||||
and call curl_multi_perform(3) anyway. How long to wait? Unless
|
||||
curl_multi_timeout(3) gives you a lower number, we suggest 100
|
||||
milliseconds or so, but you may want to test it out in your own particular
|
||||
conditions to find a suitable value.
|
||||
|
||||
When doing select(), you should use curl_multi_timeout(3) to figure out
|
||||
how long to wait for action. Call curl_multi_perform(3) even if no
|
||||
activity has been seen on the **fd_sets** after the timeout expires as
|
||||
otherwise internal retries and timeouts may not work as you would think and
|
||||
want.
|
||||
|
||||
If one of the sockets used by libcurl happens to be larger than what can be
|
||||
set in an **fd_set**, which on POSIX systems means that the file descriptor
|
||||
is larger than **FD_SETSIZE**, then libcurl tries to not set it. Setting a
|
||||
too large file descriptor in an **fd_set** implies an out of bounds write
|
||||
which can cause crashes, or worse. The effect of NOT storing it might possibly
|
||||
save you from the crash, but makes your program NOT wait for sockets it should
|
||||
wait for...
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd;
|
||||
int rc;
|
||||
CURLMcode mc;
|
||||
struct timeval timeout = {1, 0};
|
||||
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
do {
|
||||
|
||||
/* call curl_multi_perform() */
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
mc = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
|
||||
break;
|
||||
}
|
||||
|
||||
/* wait for activity on one of the sockets */
|
||||
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
} while(!mc);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_get_handles
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_remove_handle (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.4.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_get_handles - return all added easy handles
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURL **curl_multi_get_handles(CURLM *multi_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Returns an array with pointers to all added easy handles. The end of the list
|
||||
is marked with a NULL pointer.
|
||||
|
||||
Even if there is not a single easy handle added, this still returns an array
|
||||
but with only a single NULL pointer entry.
|
||||
|
||||
The returned array contains all the handles that are present at the time of
|
||||
the call. As soon as a handle has been removed from or a handle has been added
|
||||
to the multi handle after the handle array was returned, the two data points
|
||||
are out of sync.
|
||||
|
||||
The order of the easy handles within the array is not guaranteed.
|
||||
|
||||
The returned array must be freed with a call to curl_free(3) after use.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* init a multi stack */
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
|
||||
if(curl) {
|
||||
/* add the transfer */
|
||||
curl_multi_add_handle(multi, curl);
|
||||
|
||||
/* extract all added handles */
|
||||
CURL **list = curl_multi_get_handles(multi);
|
||||
|
||||
if(list) {
|
||||
int i;
|
||||
/* remove all added handles */
|
||||
for(i = 0; list[i]; i++) {
|
||||
curl_multi_remove_handle(multi, list[i]);
|
||||
}
|
||||
curl_free(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns NULL on failure. Otherwise it returns a pointer to an allocated array.
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_get_offt
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_remove_handle (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.16.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_get_offt - extract information from a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_get_offt(CURLM *multi_handle,
|
||||
CURLMinfo_offt info,
|
||||
curl_off_t *pvalue);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Get the *info* kept in the *multi* handle. If the *info* is not applicable,
|
||||
this function returns CURLM_UNKNOWN_OPTION.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
The following information can be extracted:
|
||||
|
||||
## CURLMINFO_XFERS_CURRENT
|
||||
|
||||
See CURLMINFO_XFERS_CURRENT(3).
|
||||
|
||||
## CURLMINFO_XFERS_RUNNING
|
||||
|
||||
See CURLMINFO_XFERS_RUNNING(3).
|
||||
|
||||
## CURLMINFO_XFERS_PENDING
|
||||
|
||||
See CURLMINFO_XFERS_PENDING(3).
|
||||
|
||||
## CURLMINFO_XFERS_DONE
|
||||
|
||||
See CURLMINFO_XFERS_DONE(3).
|
||||
|
||||
## CURLMINFO_XFERS_ADDED
|
||||
|
||||
See CURLMINFO_XFERS_ADDED(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* init a multi stack */
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
curl_off_t n;
|
||||
|
||||
if(curl) {
|
||||
/* add the transfer */
|
||||
curl_multi_add_handle(multi, curl);
|
||||
|
||||
curl_multi_get_offt(multi, CURLMINFO_XFERS_ADDED, &n);
|
||||
/* on successful add, n is 1 */
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred,
|
||||
see libcurl-errors(3).
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_info_read
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_perform (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_info_read - read multi stack information
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Ask the multi handle if there are any messages from the individual
|
||||
transfers. Messages may include information such as an error code from the
|
||||
transfer or just the fact that a transfer is completed. More details on these
|
||||
should be written down as well.
|
||||
|
||||
Repeated calls to this function returns a new struct each time, until a NULL
|
||||
is returned as a signal that there is no more to get at this point. The
|
||||
integer pointed to with *msgs_in_queue* contains the number of remaining
|
||||
messages after this function was called.
|
||||
|
||||
When you fetch a message using this function, it is removed from the internal
|
||||
queue so calling this function again does not return the same message
|
||||
again. It instead returns new messages at each new invoke until the queue is
|
||||
emptied.
|
||||
|
||||
**WARNING:** The data the returned pointer points to does not survive
|
||||
calling curl_multi_cleanup(3), curl_multi_remove_handle(3) or
|
||||
curl_easy_cleanup(3).
|
||||
|
||||
The *CURLMsg* struct is simple and only contains basic information. If
|
||||
more involved information is wanted, the particular "easy handle" is present
|
||||
in that struct and can be used in subsequent regular
|
||||
curl_easy_getinfo(3) calls (or similar):
|
||||
|
||||
~~~c
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
~~~
|
||||
When **msg** is *CURLMSG_DONE*, the message identifies a transfer that
|
||||
is done, and then **result** contains the return code for the easy handle
|
||||
that just completed.
|
||||
|
||||
At this point, there are no other **msg** types defined.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct CURLMsg *m;
|
||||
|
||||
/* call curl_multi_perform or curl_multi_socket_action first, then loop
|
||||
through and check if there are any transfers that have completed */
|
||||
|
||||
do {
|
||||
int msgq = 0;
|
||||
m = curl_multi_info_read(multi, &msgq);
|
||||
if(m && (m->msg == CURLMSG_DONE)) {
|
||||
CURL *e = m->easy_handle;
|
||||
/* m->data.result holds the error code for the transfer */
|
||||
curl_multi_remove_handle(multi, e);
|
||||
curl_easy_cleanup(e);
|
||||
}
|
||||
} while(m);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a filled-in struct, or NULL if it failed or ran out of structs.
|
||||
It also writes the number of messages left in the queue (after this read) in
|
||||
the integer the second argument points to.
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_init
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_init (3)
|
||||
- curl_global_init (3)
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_get_handles (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_init - create a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLM *curl_multi_init();
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a pointer to a *CURLM* handle to be used as input to
|
||||
all the other multi-functions, sometimes referred to as a multi handle in some
|
||||
places in the documentation. This init call MUST have a corresponding call to
|
||||
curl_multi_cleanup(3) when the operation is complete.
|
||||
|
||||
By default, several caches are stored in and held by the multi handle: DNS
|
||||
cache, connection pool, TLS session ID cache and the TLS CA cert cache. All
|
||||
transfers using the same multi handle share these caches.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* init a multi stack */
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
CURL *curl2 = curl_easy_init();
|
||||
|
||||
/* add individual transfers */
|
||||
curl_multi_add_handle(multi, curl);
|
||||
curl_multi_add_handle(multi, curl2);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns NULL, something went wrong and you cannot use the
|
||||
other curl functions.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_notify_disable
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLMOPT_NOTIFYFUNCTION (3)
|
||||
- CURLMOPT_NOTIFYDATA (3)
|
||||
- curl_multi_notify_enable (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.17.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_notify_disable - disable a notification type
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
CURLMcode curl_multi_notify_disable(CURLM *multi_handle,
|
||||
unsigned int notification);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Disables collecting the given notification type in the multi handle. A
|
||||
callback function installed via CURLMOPT_NOTIFYFUNCTION(3) is no longer
|
||||
called when this notification happens.
|
||||
|
||||
Only when a notification callback is installed *and* a notification
|
||||
is enabled are these collected and dispatched to the callback.
|
||||
|
||||
Several notification types can be enabled at the same time. Disabling
|
||||
an already disabled notification is not an error.
|
||||
|
||||
A notification can be enabled again via curl_multi_notify_enable(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
rc = curl_multi_notify_disable(multi, CURLMNOTIFY_INFO_READ);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
The return code is for the whole multi stack. Problems still might have
|
||||
occurred on individual transfers even when one of these functions return OK.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_notify_enable
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLMOPT_NOTIFYFUNCTION (3)
|
||||
- CURLMOPT_NOTIFYDATA (3)
|
||||
- curl_multi_notify_disable (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.17.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_notify_enable - enable a notification type
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
CURLMcode curl_multi_notify_enable(CURLM *multi_handle,
|
||||
unsigned int notification);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Enables collecting the given notification type in the multi handle. A
|
||||
callback function installed via CURLMOPT_NOTIFYFUNCTION(3) is called
|
||||
when this notification happens.
|
||||
|
||||
Only when a notification callback is installed *and* a notification
|
||||
is enabled are these collected and dispatched to the callback.
|
||||
|
||||
Several notification types can be enabled at the same time. Enabling
|
||||
an already enabled notification is not an error.
|
||||
|
||||
A notification can be disabled again via curl_multi_notify_disable(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
rc = curl_multi_notify_enable(multi, CURLMNOTIFY_INFO_READ);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
The return code is for the whole multi stack. Problems still might have
|
||||
occurred on individual transfers even when one of these functions return OK.
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_perform
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_wait (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_perform - run all transfers until it would block
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function performs transfers on all the added handles that need attention
|
||||
in a non-blocking fashion. The easy handles have previously been added to the
|
||||
multi handle with curl_multi_add_handle(3).
|
||||
|
||||
When an application has found out there is data available for the multi_handle
|
||||
or a timeout has elapsed, the application should call this function to
|
||||
read/write whatever there is to read or write right now etc.
|
||||
curl_multi_perform(3) returns as soon as the reads/writes are done. This
|
||||
function does not require that there actually is any data available for
|
||||
reading or that data can be written, it can be called just in case. It stores
|
||||
the number of handles that still transfer data in the second argument's
|
||||
integer-pointer.
|
||||
|
||||
If the amount of *running_handles* is changed from the previous call (or
|
||||
is less than the amount of easy handles you have added to the multi handle),
|
||||
you know that there is one or more transfers less "running". You can then call
|
||||
curl_multi_info_read(3) to get information about each individual
|
||||
completed transfer, and that returned info includes CURLcode and more. If an
|
||||
added handle fails quickly, it may never be counted as a running_handle. You
|
||||
could use curl_multi_info_read(3) to track actual status of the added
|
||||
handles in that case.
|
||||
|
||||
When *running_handles* is set to zero (0) on the return of this function,
|
||||
there is no longer any transfers in progress.
|
||||
|
||||
When this function returns error, the state of all transfers are uncertain and
|
||||
they cannot be continued. curl_multi_perform(3) should not be called
|
||||
again on the same multi handle after an error has been returned, unless first
|
||||
removing all the handles and adding new ones.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int still_running;
|
||||
CURLM *multi = curl_multi_init();
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_multi_add_handle(multi, curl);
|
||||
do {
|
||||
CURLMcode mc = curl_multi_perform(multi, &still_running);
|
||||
|
||||
if(!mc && still_running)
|
||||
/* wait for activity, timeout or "nothing" */
|
||||
mc = curl_multi_poll(multi, NULL, 0, 1000, NULL);
|
||||
|
||||
if(mc) {
|
||||
fprintf(stderr, "curl_multi_poll() failed, code %d.\n", (int)mc);
|
||||
break;
|
||||
}
|
||||
|
||||
/* if there are still transfers, loop */
|
||||
} while(still_running);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
This function returns errors regarding the whole multi stack. Problems on
|
||||
individual transfers may have occurred even when this function returns
|
||||
*CURLM_OK*. Use curl_multi_info_read(3) to figure out how individual transfers
|
||||
did.
|
||||
|
||||
# TYPICAL USAGE
|
||||
|
||||
Most applications use curl_multi_poll(3) to make libcurl wait for
|
||||
activity on any of the ongoing transfers. As soon as one or more file
|
||||
descriptor has activity or the function times out, the application calls
|
||||
curl_multi_perform(3).
|
||||
@@ -0,0 +1,150 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_poll
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_perform (3)
|
||||
- curl_multi_wait (3)
|
||||
- curl_multi_wakeup (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.66.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_poll - poll on all easy handles in a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_poll(CURLM *multi_handle,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *numfds);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_multi_poll(3) polls all file descriptors used by the curl easy
|
||||
handles contained in the given multi handle set. It blocks until activity is
|
||||
detected on at least one of the handles or *timeout_ms* has passed.
|
||||
Alternatively, if the multi handle has a pending internal timeout that has a
|
||||
shorter expiry time than *timeout_ms*, that shorter time is used instead
|
||||
to make sure timeout accuracy is reasonably kept.
|
||||
|
||||
The calling application may pass additional curl_waitfd structures which are
|
||||
similar to *poll(2)*'s *pollfd* structure to be waited on in the same
|
||||
call.
|
||||
|
||||
On completion, if *numfds* is non-NULL, it gets populated with the total
|
||||
number of file descriptors on which interesting events occurred. This number
|
||||
can include both libcurl internal descriptors as well as descriptors provided
|
||||
in *extra_fds*.
|
||||
|
||||
The curl_multi_wakeup(3) function can be used from another thread to
|
||||
wake up this function and return faster. This is one of the details
|
||||
that makes this function different than curl_multi_wait(3) which cannot
|
||||
be woken up this way.
|
||||
|
||||
If no extra file descriptors are provided and libcurl has no file descriptor
|
||||
to offer to wait for, this function instead waits during *timeout_ms*
|
||||
milliseconds (or shorter if an internal timer indicates so). This is the other
|
||||
detail that makes this function different than curl_multi_wait(3).
|
||||
|
||||
This function is encouraged to be used instead of select(3) when using the
|
||||
multi interface to allow applications to easier circumvent the common problem
|
||||
with 1024 maximum file descriptors.
|
||||
|
||||
# curl_waitfd
|
||||
|
||||
~~~c
|
||||
struct curl_waitfd {
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
~~~
|
||||
|
||||
## CURL_WAIT_POLLIN
|
||||
|
||||
Bit flag to curl_waitfd.events indicating the socket should poll on read
|
||||
events such as new data received.
|
||||
|
||||
## CURL_WAIT_POLLPRI
|
||||
|
||||
Bit flag to curl_waitfd.events indicating the socket should poll on high
|
||||
priority read events such as out of band data.
|
||||
|
||||
## CURL_WAIT_POLLOUT
|
||||
|
||||
Bit flag to curl_waitfd.events indicating the socket should poll on write
|
||||
events such as the socket being clear to write without blocking.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
extern void handle_fd(int);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *easy_handle;
|
||||
CURLM *multi_handle;
|
||||
int still_running = 0;
|
||||
int myfd = 2; /* this is our own file descriptor */
|
||||
|
||||
multi_handle = curl_multi_init();
|
||||
easy_handle = curl_easy_init();
|
||||
|
||||
/* add the individual easy handle */
|
||||
curl_multi_add_handle(multi_handle, easy_handle);
|
||||
|
||||
do {
|
||||
CURLMcode mc;
|
||||
int numfds;
|
||||
|
||||
mc = curl_multi_perform(multi_handle, &still_running);
|
||||
|
||||
if(mc == CURLM_OK) {
|
||||
struct curl_waitfd myown;
|
||||
myown.fd = myfd;
|
||||
myown.events = CURL_WAIT_POLLIN; /* wait for input */
|
||||
myown.revents = 0; /* clear it */
|
||||
|
||||
/* wait for activity on curl's descriptors or on our own,
|
||||
or timeout */
|
||||
mc = curl_multi_poll(multi_handle, &myown, 1, 1000, &numfds);
|
||||
|
||||
if(myown.revents) {
|
||||
/* did our descriptor receive an event? */
|
||||
handle_fd(myfd);
|
||||
}
|
||||
}
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
fprintf(stderr, "curl_multi failed, code %d.\n", mc);
|
||||
break;
|
||||
}
|
||||
|
||||
} while(still_running);
|
||||
|
||||
curl_multi_remove_handle(multi_handle, easy_handle);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_remove_handle
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_add_handle (3)
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.9.6
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_remove_handle - remove an easy handle from a multi session
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Removes a given *easy_handle* from the *multi_handle*. This makes the
|
||||
specified easy handle be removed from this multi handle's control.
|
||||
|
||||
When the easy handle has been removed from a multi stack, it is again
|
||||
perfectly legal to invoke curl_easy_perform(3) on this easy handle.
|
||||
|
||||
Removing an easy handle while being in use is perfectly legal and effectively
|
||||
halts the transfer in progress involving that easy handle. All other easy
|
||||
handles and transfers remain unaffected.
|
||||
|
||||
It is fine to remove a handle at any time during a transfer, just not from
|
||||
within any libcurl callback function.
|
||||
|
||||
Removing an easy handle from the multi handle before the corresponding
|
||||
transfer is complete might cause libcurl to close the connection - if the
|
||||
state of it and the internal protocol handler deem it necessary. Otherwise
|
||||
libcurl keeps the connection alive in the connection pool associated with the
|
||||
multi handle, ready to get reused for a future transfer using this multi
|
||||
handle.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
int queued = 0;
|
||||
|
||||
/* when an easy handle has completed, remove it */
|
||||
CURLMsg *msg = curl_multi_info_read(multi, &queued);
|
||||
if(msg) {
|
||||
if(msg->msg == CURLMSG_DONE) {
|
||||
/* a transfer ended */
|
||||
fprintf(stderr, "Transfer completed\n");
|
||||
curl_multi_remove_handle(multi, msg->easy_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,146 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_setopt
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_init (3)
|
||||
- curl_multi_socket (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_setopt - set options for a curl multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_setopt(CURLM *multi, CURLMoption option, parameter);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_multi_setopt(3) is used to tell a libcurl multi handle how to behave. By
|
||||
using the appropriate options to curl_multi_setopt(3), you can change
|
||||
libcurl's behavior when using that multi handle. All options are set with the
|
||||
*option* followed by the *parameter*. That parameter can be a **long**, a
|
||||
**function pointer**, an **object pointer** or a **curl_off_t** type,
|
||||
depending on what the specific option expects. Read this manual carefully as
|
||||
bad input values may cause libcurl to behave badly. You can only set one
|
||||
option in each function call.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
## CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE
|
||||
|
||||
**deprecated** See CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)
|
||||
|
||||
## CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE
|
||||
|
||||
**deprecated** See CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)
|
||||
|
||||
## CURLMOPT_MAXCONNECTS
|
||||
|
||||
Size of connection cache. See CURLMOPT_MAXCONNECTS(3)
|
||||
|
||||
## CURLMOPT_MAX_CONCURRENT_STREAMS
|
||||
|
||||
Max concurrent streams for http2. See CURLMOPT_MAX_CONCURRENT_STREAMS(3)
|
||||
|
||||
## CURLMOPT_MAX_HOST_CONNECTIONS
|
||||
|
||||
Max number of connections to a single host. See
|
||||
CURLMOPT_MAX_HOST_CONNECTIONS(3)
|
||||
|
||||
## CURLMOPT_MAX_PIPELINE_LENGTH
|
||||
|
||||
**deprecated**. See CURLMOPT_MAX_PIPELINE_LENGTH(3)
|
||||
|
||||
## CURLMOPT_MAX_TOTAL_CONNECTIONS
|
||||
|
||||
Max simultaneously open connections. See CURLMOPT_MAX_TOTAL_CONNECTIONS(3)
|
||||
|
||||
## CURLMOPT_NETWORK_CHANGED
|
||||
|
||||
Signal that the network has changed. See CURLMOPT_NETWORK_CHANGED(3)
|
||||
|
||||
## CURLMOPT_NOTIFYDATA
|
||||
|
||||
Custom pointer passed to the notify callback. See CURLMOPT_NOTIFYDATA(3)
|
||||
|
||||
## CURLMOPT_NOTIFYFUNCTION
|
||||
|
||||
Callback that receives notifications. See CURLMOPT_NOTIFYFUNCTION(3)
|
||||
|
||||
## CURLMOPT_PIPELINING
|
||||
|
||||
Enable HTTP multiplexing. See CURLMOPT_PIPELINING(3)
|
||||
|
||||
## CURLMOPT_PIPELINING_SERVER_BL
|
||||
|
||||
**deprecated**. See CURLMOPT_PIPELINING_SERVER_BL(3)
|
||||
|
||||
## CURLMOPT_PIPELINING_SITE_BL
|
||||
|
||||
**deprecated**. See CURLMOPT_PIPELINING_SITE_BL(3)
|
||||
|
||||
## CURLMOPT_PUSHDATA
|
||||
|
||||
Pointer to pass to push callback. See CURLMOPT_PUSHDATA(3)
|
||||
|
||||
## CURLMOPT_PUSHFUNCTION
|
||||
|
||||
Callback that approves or denies server pushes. See CURLMOPT_PUSHFUNCTION(3)
|
||||
|
||||
## CURLMOPT_SOCKETDATA
|
||||
|
||||
Custom pointer passed to the socket callback. See CURLMOPT_SOCKETDATA(3)
|
||||
|
||||
## CURLMOPT_SOCKETFUNCTION
|
||||
|
||||
Callback informed about what to wait for. See CURLMOPT_SOCKETFUNCTION(3)
|
||||
|
||||
## CURLMOPT_TIMERDATA
|
||||
|
||||
Custom pointer to pass to timer callback. See CURLMOPT_TIMERDATA(3)
|
||||
|
||||
## CURLMOPT_TIMERFUNCTION
|
||||
|
||||
Callback to receive timeout values. See CURLMOPT_TIMERFUNCTION(3)
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
|
||||
#define MAX_PARALLEL 45
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
/* Limit the amount of simultaneous connections curl should allow: */
|
||||
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
Note that it returns a CURLM_UNKNOWN_OPTION if you try setting an option that
|
||||
this version of libcurl does not know of.
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_socket
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_init (3)
|
||||
- the hiperfifo.c example
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_socket - read/write available data
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd,
|
||||
int *running_handles);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is deprecated. Use curl_multi_socket_action(3) instead with
|
||||
**ev_bitmask** set to 0.
|
||||
|
||||
At return, the integer **running_handles** points to contains the number of
|
||||
still running easy handles within the multi handle. When this number reaches
|
||||
zero, all transfers are complete/done. Note that when you call
|
||||
curl_multi_socket(3) on a specific socket and the counter decreases by one, it
|
||||
DOES NOT necessarily mean that this exact socket/transfer is the one that
|
||||
completed. Use curl_multi_info_read(3) to figure out which easy handle that
|
||||
completed.
|
||||
|
||||
The curl_multi_socket(3) functions inform the application about updates in the
|
||||
socket (file descriptor) status by doing none, one, or multiple calls to the
|
||||
socket callback function set with the CURLMOPT_SOCKETFUNCTION(3) option to
|
||||
curl_multi_setopt(3). They update the status with changes since the previous
|
||||
time the callback was called.
|
||||
|
||||
Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option with
|
||||
curl_multi_setopt(3). Your application then gets called with information on
|
||||
how long to wait for socket actions at most before doing the timeout action:
|
||||
call the curl_multi_socket_action(3) function with the **sockfd** argument set
|
||||
to CURL_SOCKET_TIMEOUT. You can also use the curl_multi_timeout(3) function to
|
||||
poll the value at any given time, but for an event-based system using the
|
||||
callback is far better than relying on polling the timeout value.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* the event-library gets told when there activity on the socket 'fd',
|
||||
which we translate to a call to curl_multi_socket_action() */
|
||||
int running;
|
||||
int rc;
|
||||
int fd = 2;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
rc = curl_multi_socket(multi, fd, &running);
|
||||
}
|
||||
~~~
|
||||
|
||||
# DEPRECATED
|
||||
|
||||
curl_multi_socket(3) is deprecated, use curl_multi_socket_action(3) instead.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
The return code is for the whole multi stack. Problems still might have
|
||||
occurred on individual transfers even when one of these functions return OK.
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_socket_action
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_init (3)
|
||||
- the hiperfifo.c example
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_socket_action - read/write available data given an action
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||
curl_socket_t sockfd,
|
||||
int ev_bitmask,
|
||||
int *running_handles);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
When the application has detected action on a socket handled by libcurl, it
|
||||
should call curl_multi_socket_action(3) with the **sockfd** argument
|
||||
set to the socket with the action. When the events on a socket are known, they
|
||||
can be passed as an events bitmask **ev_bitmask** by first setting
|
||||
**ev_bitmask** to 0, and then adding using bitwise OR (|) any combination of
|
||||
events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or
|
||||
CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and
|
||||
libcurl tests the descriptor internally. It is also permissible to pass
|
||||
CURL_SOCKET_TIMEOUT to the **sockfd** parameter in order to initiate the
|
||||
whole process or when a timeout occurs.
|
||||
|
||||
At return, **running_handles** points to the number of running easy handles
|
||||
within the multi handle. When this number reaches zero, all transfers are
|
||||
complete/done. When you call curl_multi_socket_action(3) on a specific
|
||||
socket and the counter decreases by one, it DOES NOT necessarily mean that
|
||||
this exact socket/transfer is the one that completed. Use
|
||||
curl_multi_info_read(3) to figure out which easy handle that completed.
|
||||
|
||||
The curl_multi_socket_action(3) function informs the application about
|
||||
updates in the socket (file descriptor) status by doing none, one, or multiple
|
||||
calls to the socket callback function set with the
|
||||
CURLMOPT_SOCKETFUNCTION(3) option to curl_multi_setopt(3). They
|
||||
update the status with changes since the previous time the callback was
|
||||
called.
|
||||
|
||||
Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option
|
||||
with curl_multi_setopt(3). Your application then gets called with
|
||||
information on how long to wait for socket actions at most before doing the
|
||||
timeout action: call the curl_multi_socket_action(3) function with the
|
||||
**sockfd** argument set to CURL_SOCKET_TIMEOUT. You can also use the
|
||||
curl_multi_timeout(3) function to poll the value at any given time, but
|
||||
for an event-based system using the callback is far better than relying on
|
||||
polling the timeout value.
|
||||
|
||||
When this function returns error, the state of all transfers are uncertain and
|
||||
they cannot be continued. curl_multi_socket_action(3) should not be
|
||||
called again on the same multi handle after an error has been returned, unless
|
||||
first removing all the handles and adding new ones.
|
||||
|
||||
# TYPICAL USAGE
|
||||
|
||||
1. Create a multi handle
|
||||
|
||||
2. Set the socket callback with CURLMOPT_SOCKETFUNCTION(3)
|
||||
|
||||
3. Set the timeout callback with CURLMOPT_TIMERFUNCTION(3), to get to
|
||||
know what timeout value to use when waiting for socket activities.
|
||||
|
||||
4. Add easy handles with curl_multi_add_handle()
|
||||
|
||||
5. Provide some means to manage the sockets libcurl is using, so you can check
|
||||
them for activity. This can be done through your application code, or by way
|
||||
of an external library such as libevent or glib.
|
||||
|
||||
6. Call curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0, ...)
|
||||
to kickstart everything. To get one or more callbacks called.
|
||||
|
||||
7. Wait for activity on any of libcurl's sockets, use the timeout value your
|
||||
callback has been told.
|
||||
|
||||
8, When activity is detected, call curl_multi_socket_action() for the
|
||||
socket(s) that got action. If no activity is detected and the timeout expires,
|
||||
call curl_multi_socket_action(3) with *CURL_SOCKET_TIMEOUT*.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
/* the event-library gets told when there activity on the socket 'fd',
|
||||
which we translate to a call to curl_multi_socket_action() */
|
||||
int running = 0;
|
||||
int fd = 3; /* the descriptor that had action */
|
||||
int bitmask = 2; /* what activity that happened */
|
||||
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
CURLMcode mc = curl_multi_socket_action(multi, fd, bitmask, &running);
|
||||
if(mc)
|
||||
printf("error: %s\n", curl_multi_strerror(mc));
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_socket_all
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_cleanup (3)
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_init (3)
|
||||
- the hiperfifo.c example
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_socket_all - reads/writes available data for all easy handles
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is deprecated for performance reasons but there are no plans to
|
||||
remove it from the API. Use curl_multi_socket_action(3) instead.
|
||||
|
||||
At return, the integer **running_handles** points to contains the number of
|
||||
still running easy handles within the multi handle. When this number reaches
|
||||
zero, all transfers are complete/done.
|
||||
|
||||
Force libcurl to (re-)check all its internal sockets and transfers instead of
|
||||
just a single one by calling curl_multi_socket_all(3). Note that there should
|
||||
not be any reason to use this function.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int running;
|
||||
int rc;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
rc = curl_multi_socket_all(multi, &running);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
|
||||
The return code is for the whole multi stack. Problems still might have
|
||||
occurred on individual transfers even when one of these functions return OK.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_strerror
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_strerror (3)
|
||||
- curl_share_strerror (3)
|
||||
- curl_url_strerror (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_strerror - return string describing error code
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const char *curl_multi_strerror(CURLMcode errornum);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a string describing the *CURLMcode* error code
|
||||
passed in the argument *errornum*.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
int still_running;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
CURLMcode mc = curl_multi_perform(multi, &still_running);
|
||||
if(mc)
|
||||
printf("error: %s\n", curl_multi_strerror(mc));
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string.
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_timeout
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_info_read (3)
|
||||
- curl_multi_setopt (3)
|
||||
- curl_multi_socket (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.15.4
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_timeout - how long to wait for action before proceeding
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
An application using the libcurl multi interface should call
|
||||
curl_multi_timeout(3) to figure out how long it should wait for socket
|
||||
actions - at most - before proceeding.
|
||||
|
||||
Proceeding means either doing the socket-style timeout action: call the
|
||||
curl_multi_socket_action(3) function with the **sockfd** argument set
|
||||
to CURL_SOCKET_TIMEOUT, or call curl_multi_perform(3) if you are using
|
||||
the simpler and older multi interface approach.
|
||||
|
||||
The timeout value returned in the long **timeout** points to, is in number
|
||||
of milliseconds at this moment. If 0, it means you should proceed immediately
|
||||
without waiting for anything. If it returns -1, there is no timeout at all set.
|
||||
|
||||
An application that uses the *multi_socket* API should not use this function.
|
||||
It should instead use the CURLMOPT_TIMERFUNCTION(3) option for proper and
|
||||
desired behavior.
|
||||
|
||||
Note: if libcurl returns a -1 timeout here, it just means that libcurl
|
||||
currently has no stored timeout value. You must not wait too long (more than a
|
||||
few seconds perhaps) before you call curl_multi_perform(3) again.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
struct timeval timeout;
|
||||
long timeo;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = 2;
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
curl_multi_timeout(multi, &timeo);
|
||||
if(timeo < 0)
|
||||
/* no set timeout, use a default */
|
||||
timeo = 980;
|
||||
|
||||
timeout.tv_sec = timeo / 1000;
|
||||
timeout.tv_usec = (timeo % 1000) * 1000;
|
||||
|
||||
/* wait for activities no longer than the set timeout */
|
||||
select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
}
|
||||
~~~
|
||||
|
||||
# TYPICAL USAGE
|
||||
|
||||
Call curl_multi_timeout(3), then wait for action on the sockets. Figure
|
||||
out which sockets to wait for by calling curl_multi_fdset(3).
|
||||
|
||||
When there is activity or timeout, call curl_multi_perform(3) and then
|
||||
loop - until all transfers are complete.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,128 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_wait
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_fdset (3)
|
||||
- curl_multi_perform (3)
|
||||
- curl_multi_poll (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.28.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_wait - poll on all easy handles in a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_wait(CURLM *multi_handle,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *numfds);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_multi_wait(3) polls all file descriptors used by the curl easy
|
||||
handles contained in the given multi handle set. It blocks until activity is
|
||||
detected on at least one of the handles or *timeout_ms* has passed.
|
||||
Alternatively, if the multi handle has a pending internal timeout that has a
|
||||
shorter expiry time than *timeout_ms*, that shorter time is being used
|
||||
instead to make sure timeout accuracy is reasonably kept.
|
||||
|
||||
The calling application may pass additional *curl_waitfd* structures which
|
||||
are similar to *poll(2)*'s *pollfd* structure to be waited on in the
|
||||
same call.
|
||||
|
||||
On completion, if *numfds* is non-NULL, it gets populated with the total
|
||||
number of file descriptors on which interesting events occurred. This number
|
||||
can include both libcurl internal descriptors as well as descriptors provided
|
||||
in *extra_fds*.
|
||||
|
||||
If no extra file descriptors are provided and libcurl has no file descriptor
|
||||
to offer to wait for, this function returns immediately. (Consider using
|
||||
curl_multi_poll(3) to avoid this behavior.)
|
||||
|
||||
This function is encouraged to be used instead of select(3) when using the
|
||||
multi interface to allow applications to easier circumvent the common problem
|
||||
with 1024 maximum file descriptors.
|
||||
|
||||
# curl_waitfd
|
||||
|
||||
~~~c
|
||||
struct curl_waitfd {
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
~~~
|
||||
|
||||
## CURL_WAIT_POLLIN
|
||||
|
||||
Bit flag to *curl_waitfd.events* indicating the socket should poll on read
|
||||
events such as new data received.
|
||||
|
||||
## CURL_WAIT_POLLPRI
|
||||
|
||||
Bit flag to *curl_waitfd.events* indicating the socket should poll on high
|
||||
priority read events such as out of band data.
|
||||
|
||||
## CURL_WAIT_POLLOUT
|
||||
|
||||
Bit flag to *curl_waitfd.events* indicating the socket should poll on
|
||||
write events such as the socket being clear to write without blocking.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *easy;
|
||||
CURLM *multi = curl_multi_init();
|
||||
int still_running;
|
||||
|
||||
easy = curl_easy_init();
|
||||
|
||||
/* add the individual easy handle */
|
||||
curl_multi_add_handle(multi, easy);
|
||||
|
||||
do {
|
||||
CURLMcode mc;
|
||||
int numfds;
|
||||
|
||||
mc = curl_multi_perform(multi, &still_running);
|
||||
|
||||
if(mc == CURLM_OK) {
|
||||
/* wait for activity, timeout or "nothing" */
|
||||
mc = curl_multi_wait(multi, NULL, 0, 1000, &numfds);
|
||||
}
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
fprintf(stderr, "curl_multi failed, code %d.\n", mc);
|
||||
break;
|
||||
}
|
||||
|
||||
} while(still_running);
|
||||
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_waitfds
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_perform (3)
|
||||
- curl_multi_poll (3)
|
||||
- curl_multi_wait (3)
|
||||
- curl_multi_fdset (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 8.8.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_waitfds - extract file descriptor information from a multi handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
CURLMcode curl_multi_waitfds(CURLM *multi,
|
||||
struct curl_waitfd *ufds,
|
||||
unsigned int size,
|
||||
unsigned int *fd_count);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function extracts *curl_waitfd* structures which are similar to
|
||||
*poll(2)*'s *pollfd* structure from a given multi_handle.
|
||||
|
||||
These structures can be used for polling on multi_handle file descriptors in a
|
||||
fashion similar to curl_multi_poll(3). The curl_multi_perform(3)
|
||||
function should be called as soon as one of them is ready to be read from or
|
||||
written to.
|
||||
|
||||
libcurl fills provided *ufds* array up to the *size*.
|
||||
If a number of descriptors used by the multi_handle is greater than the
|
||||
*size* parameter then libcurl returns CURLM_OUT_OF_MEMORY error.
|
||||
|
||||
If the *fd_count* argument is not a null pointer, it points to a variable
|
||||
that on return specifies the number of descriptors used by the multi_handle to
|
||||
be checked for being ready to read or write.
|
||||
|
||||
The client code can pass *size* equal to zero just to get the number of the
|
||||
descriptors and allocate appropriate storage for them to be used in a
|
||||
subsequent function call. In this case, *fd_count* receives a number greater
|
||||
than or equal to the number of descriptors.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURLMcode mc;
|
||||
struct curl_waitfd *ufds;
|
||||
|
||||
CURLM *multi = curl_multi_init();
|
||||
|
||||
do {
|
||||
/* call curl_multi_perform() */
|
||||
|
||||
/* get the count of file descriptors from the transfers */
|
||||
unsigned int fd_count = 0;
|
||||
|
||||
mc = curl_multi_waitfds(multi, NULL, 0, &fd_count);
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!fd_count)
|
||||
continue; /* no descriptors yet */
|
||||
|
||||
/* allocate storage for our descriptors */
|
||||
ufds = malloc(fd_count * sizeof(struct curl_waitfd));
|
||||
|
||||
/* get wait descriptors from the transfers and put them into array. */
|
||||
mc = curl_multi_waitfds(multi, ufds, fd_count, &fd_count);
|
||||
|
||||
if(mc != CURLM_OK) {
|
||||
fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
|
||||
free(ufds);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Do polling on descriptors in ufds */
|
||||
|
||||
free(ufds);
|
||||
} while(!mc);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_multi_wakeup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_multi_poll (3)
|
||||
- curl_multi_wait (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.68.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_multi_wakeup - wake up a sleeping curl_multi_poll call
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLMcode curl_multi_wakeup(CURLM *multi_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function can be called from any thread and it wakes up a sleeping
|
||||
curl_multi_poll(3) call that is currently (or is about to be) waiting
|
||||
for activity or a timeout.
|
||||
|
||||
If the function is called when there is no curl_multi_poll(3) call, it
|
||||
causes the next call to return immediately.
|
||||
|
||||
Calling this function only guarantees to wake up the current (or the next if
|
||||
there is no current) curl_multi_poll(3) call, which means it is possible
|
||||
that multiple calls to this function wake up the same waiting operation.
|
||||
|
||||
This function has no effect on curl_multi_wait(3) calls.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
extern int time_to_die(void);
|
||||
extern int set_something_to_signal_thread_1_to_exit(void);
|
||||
extern int decide_to_stop_thread1();
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *easy;
|
||||
CURLM *multi = curl_multi_init();
|
||||
int still_running;
|
||||
|
||||
easy = curl_easy_init();
|
||||
|
||||
/* add the individual easy handle */
|
||||
curl_multi_add_handle(multi, easy);
|
||||
|
||||
/* this is thread 1 */
|
||||
do {
|
||||
CURLMcode mc;
|
||||
int numfds;
|
||||
|
||||
mc = curl_multi_perform(multi, &still_running);
|
||||
|
||||
if(mc == CURLM_OK) {
|
||||
/* wait for activity, timeout or wakeup */
|
||||
mc = curl_multi_poll(multi, NULL, 0, 10000, &numfds);
|
||||
}
|
||||
|
||||
if(time_to_die())
|
||||
return 1;
|
||||
|
||||
} while(still_running);
|
||||
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
|
||||
/* this is thread 2 */
|
||||
|
||||
if(decide_to_stop_thread1()) {
|
||||
|
||||
set_something_to_signal_thread_1_to_exit();
|
||||
|
||||
curl_multi_wakeup(multi);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLMcode indicating success or error.
|
||||
|
||||
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3).
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_pushheader_byname
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLMOPT_PUSHFUNCTION (3)
|
||||
- curl_pushheader_bynum (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.44.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_pushheader_byname - get a push header by name
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_pushheader_byname(struct curl_pushheaders *h, const char *name);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This is a function that is only functional within a
|
||||
CURLMOPT_PUSHFUNCTION(3) callback. It makes no sense to try to use it
|
||||
elsewhere and it has no function then.
|
||||
|
||||
It returns the value for the given header field name (or NULL) for the
|
||||
incoming server push request. This is a shortcut so that the application does
|
||||
not have to loop through all headers to find the one it is interested in. The
|
||||
data this function points to is freed when this callback returns. If more than
|
||||
one header field use the same name, this returns only the first one.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
#include <string.h> /* for strncmp */
|
||||
|
||||
static int push_cb(CURL *parent,
|
||||
CURL *easy,
|
||||
size_t num_headers,
|
||||
struct curl_pushheaders *headers,
|
||||
void *clientp)
|
||||
{
|
||||
char *headp;
|
||||
int *transfers = (int *)clientp;
|
||||
FILE *out;
|
||||
headp = curl_pushheader_byname(headers, ":path");
|
||||
if(headp && !strncmp(headp, "/push-", 6)) {
|
||||
fprintf(stderr, "The PATH is %s\n", headp);
|
||||
|
||||
/* save the push here */
|
||||
out = fopen("pushed-stream", "wb");
|
||||
|
||||
/* write to this file */
|
||||
curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
|
||||
|
||||
(*transfers)++; /* one more */
|
||||
|
||||
return CURL_PUSH_OK;
|
||||
}
|
||||
return CURL_PUSH_DENY;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter;
|
||||
CURLM *multi = curl_multi_init();
|
||||
curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb);
|
||||
curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a pointer to the header field content or NULL.
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_pushheader_bynum
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLMOPT_PUSHFUNCTION (3)
|
||||
- curl_pushheader_byname (3)
|
||||
Protocol:
|
||||
- HTTP
|
||||
Added-in: 7.44.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_pushheader_bynum - get a push header by index
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This is a function that is only functional within a
|
||||
CURLMOPT_PUSHFUNCTION(3) callback. It makes no sense to try to use it
|
||||
elsewhere and it has no function then.
|
||||
|
||||
It returns the value for the header field at the given index **num**, for
|
||||
the incoming server push request or NULL. The data pointed to is freed by
|
||||
libcurl when this callback returns. The returned pointer points to a
|
||||
"name:value" string that gets freed when this callback returns.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
/* output all the incoming push request headers */
|
||||
static int push_cb(CURL *parent,
|
||||
CURL *easy,
|
||||
size_t num_headers,
|
||||
struct curl_pushheaders *headers,
|
||||
void *clientp)
|
||||
{
|
||||
int i = 0;
|
||||
char *field;
|
||||
do {
|
||||
field = curl_pushheader_bynum(headers, i);
|
||||
if(field)
|
||||
fprintf(stderr, "Push header: %s\n", field);
|
||||
i++;
|
||||
} while(field);
|
||||
return CURL_PUSH_OK; /* permission granted */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURLM *multi = curl_multi_init();
|
||||
curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a pointer to the header field content or NULL.
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_share_cleanup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_share_init (3)
|
||||
- curl_share_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.10
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_share_cleanup - close a shared object
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLSHcode curl_share_cleanup(CURLSH *share_handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function deletes a shared object. The share handle cannot be used anymore
|
||||
when this function has been called.
|
||||
|
||||
Passing in a NULL pointer in *share_handle* makes this function return
|
||||
immediately with no action.
|
||||
|
||||
Any use of the **share_handle** after this function has been called and have
|
||||
returned, is illegal.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
/* use the share, then ... */
|
||||
curl_share_cleanup(share);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
CURLSHE_OK (zero) means that the option was set properly, non-zero means an
|
||||
error occurred as *\<curl/curl.h\>* defines. See the libcurl-errors(3) man
|
||||
page for the full list with descriptions. If an error occurs, then the share
|
||||
object is not deleted.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_share_init
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_share_cleanup (3)
|
||||
- curl_share_setopt (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.10
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_share_init - create a share object
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLSH *curl_share_init();
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a pointer to a *CURLSH* handle to be used as input
|
||||
to all the other share-functions, sometimes referred to as a share handle in
|
||||
some places in the documentation. This init call MUST have a corresponding
|
||||
call to curl_share_cleanup(3) when all operations using the share are
|
||||
complete.
|
||||
|
||||
This *share handle* is what you pass to curl using the
|
||||
CURLOPT_SHARE(3) option with curl_easy_setopt(3), to make that
|
||||
specific curl handle use the data in this share.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
if(sh)
|
||||
printf("Error: %s\n", curl_share_strerror(sh));
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
If this function returns NULL, something went wrong (out of memory, etc.)
|
||||
and therefore the share object was not created.
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_share_setopt
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_share_cleanup (3)
|
||||
- curl_share_init (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.10
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_share_setopt - set options for a shared object
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Set the *option* to *parameter* for the given *share*.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
## CURLSHOPT_LOCKFUNC
|
||||
|
||||
See CURLSHOPT_LOCKFUNC(3).
|
||||
|
||||
## CURLSHOPT_UNLOCKFUNC
|
||||
|
||||
See CURLSHOPT_UNLOCKFUNC(3).
|
||||
|
||||
## CURLSHOPT_SHARE
|
||||
|
||||
See CURLSHOPT_SHARE(3).
|
||||
|
||||
## CURLSHOPT_UNSHARE
|
||||
|
||||
See CURLSHOPT_UNSHARE(3).
|
||||
|
||||
## CURLSHOPT_USERDATA
|
||||
|
||||
See CURLSHOPT_USERDATA(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
if(sh)
|
||||
printf("Error: %s\n", curl_share_strerror(sh));
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
CURLSHE_OK (zero) means that the option was set properly, non-zero means an
|
||||
error occurred as *\<curl/curl.h\>* defines. See the libcurl-errors(3) man
|
||||
page for the full list with descriptions.
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_share_strerror
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_strerror (3)
|
||||
- curl_multi_strerror (3)
|
||||
- curl_url_strerror (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.12.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_share_strerror - return string describing error code
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const char *curl_share_strerror(CURLSHcode errornum);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The curl_share_strerror(3) function returns a string describing the
|
||||
*CURLSHcode* error code passed in the argument *errornum*.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLSHcode sh;
|
||||
CURLSH *share = curl_share_init();
|
||||
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
if(sh)
|
||||
printf("Error: %s\n", curl_share_strerror(sh));
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string.
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_slist_append
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_slist_free_all (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_slist_append - add a string to an slist
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
struct curl_slist *curl_slist_append(struct curl_slist *list,
|
||||
const char *string);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_slist_append(3) appends a string to a linked list of strings. The
|
||||
existing **list** should be passed as the first argument and the new list is
|
||||
returned from this function. Pass in NULL in the **list** argument to create a
|
||||
new list. The specified **string** has been appended when this function
|
||||
returns. curl_slist_append(3) copies the string. The **string** argument must
|
||||
be a valid string pointer and cannot be NULL.
|
||||
|
||||
The list should be freed again (after usage) with
|
||||
curl_slist_free_all(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *handle = curl_easy_init();
|
||||
struct curl_slist *slist = NULL;
|
||||
struct curl_slist *temp = NULL;
|
||||
|
||||
slist = curl_slist_append(slist, "pragma:");
|
||||
|
||||
if(!slist)
|
||||
return -1;
|
||||
|
||||
temp = curl_slist_append(slist, "Accept:");
|
||||
|
||||
if(!temp) {
|
||||
curl_slist_free_all(slist);
|
||||
return -1;
|
||||
}
|
||||
|
||||
slist = temp;
|
||||
|
||||
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
|
||||
|
||||
curl_easy_perform(handle);
|
||||
|
||||
curl_slist_free_all(slist); /* free the list again */
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A null pointer is returned if anything went wrong, otherwise the new list
|
||||
pointer is returned. To avoid overwriting an existing non-empty list on
|
||||
failure, the new list should be returned to a temporary variable which can
|
||||
be tested for NULL before updating the original list pointer.
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_slist_free_all
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_slist_append (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_slist_free_all - free an entire curl_slist list
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_slist_free_all(struct curl_slist *list);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
curl_slist_free_all() removes all traces of a previously built curl_slist
|
||||
linked list.
|
||||
|
||||
Passing in a NULL pointer in *list* makes this function return immediately
|
||||
with no action.
|
||||
|
||||
Any use of the **list** after this function has been called and have returned,
|
||||
is illegal.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *handle = curl_easy_init();
|
||||
struct curl_slist *slist = NULL;
|
||||
|
||||
slist = curl_slist_append(slist, "X-libcurl: coolness");
|
||||
|
||||
if(!slist)
|
||||
return -1;
|
||||
|
||||
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
|
||||
|
||||
curl_easy_perform(handle);
|
||||
|
||||
curl_slist_free_all(slist); /* free the list again */
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Nothing.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_strequal
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_strnequal (3)
|
||||
- strcasecmp (3)
|
||||
- strcmp (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_strequal - compare two strings ignoring case
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
int curl_strequal(const char *str1, const char *str2);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The curl_strequal(3) function compares the two strings *str1* and *str2*,
|
||||
ignoring the case of the characters. It returns a non-zero (TRUE) integer if
|
||||
the strings are identical.
|
||||
|
||||
This function uses plain ASCII based comparisons completely disregarding the
|
||||
locale - contrary to how **strcasecmp** and other system case insensitive
|
||||
string comparisons usually work.
|
||||
|
||||
This function is provided by libcurl to enable applications to compare strings
|
||||
in a truly portable manner. There are no standard portable case insensitive
|
||||
string comparison functions. This function works on all platforms.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *name = "compare";
|
||||
if(curl_strequal(name, argv[1]))
|
||||
printf("Name and input matches\n");
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Non-zero if the strings are identical. Zero if they are not.
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_strnequal
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_strequal (3)
|
||||
- strcasecmp (3)
|
||||
- strcmp (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_strnequal - compare two strings ignoring case
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
int curl_strnequal(const char *str1, const char *str2, size_t length);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The curl_strnequal(3) function compares the two strings *str1* and *str2*,
|
||||
ignoring the case of the characters. It returns a non-zero (TRUE) integer if
|
||||
the strings are identical.
|
||||
|
||||
This function compares no more than the first *length* bytes of *str1* and
|
||||
*str2*.
|
||||
|
||||
This function uses plain ASCII based comparisons completely disregarding the
|
||||
locale - contrary to how **strcasecmp** and other system case insensitive
|
||||
string comparisons usually work.
|
||||
|
||||
This function is provided by libcurl to enable applications to compare strings
|
||||
in a truly portable manner. There are no standard portable case insensitive
|
||||
string comparison functions. This function works on all platforms.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *name = "compare";
|
||||
if(curl_strnequal(name, argv[1], 5))
|
||||
printf("Name and input matches in the 5 first bytes\n");
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Non-zero if the strings are identical. Zero if they are not.
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_unescape
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- RFC 2396
|
||||
- curl_easy_escape (3)
|
||||
- curl_easy_unescape (3)
|
||||
- curl_free (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_unescape - URL decode a string
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_unescape(const char *input, int length);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Deprecated. Use curl_easy_unescape(3) instead.
|
||||
|
||||
This function converts the URL encoded string **input** to a "plain string"
|
||||
and return that as a new allocated string. All input characters that are URL
|
||||
encoded (%XX where XX is a two-digit hexadecimal number) are converted to
|
||||
their plain text versions.
|
||||
|
||||
If the **length** argument is set to 0, curl_unescape(3) calls
|
||||
strlen() on **input** to find out the size.
|
||||
|
||||
You must curl_free(3) the returned string when you are done with it.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
char *decoded = curl_unescape("%63%75%72%6c", 12);
|
||||
if(decoded) {
|
||||
/* do not assume printf() works on the decoded data */
|
||||
printf("Decoded: ");
|
||||
/* ... */
|
||||
curl_free(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# DEPRECATED
|
||||
|
||||
Since 7.15.4, curl_easy_unescape(3) should be used. This function might
|
||||
be removed in a future release.
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string or NULL if it failed.
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_CURLU (3)
|
||||
- curl_url_cleanup (3)
|
||||
- curl_url_dup (3)
|
||||
- curl_url_get (3)
|
||||
- curl_url_set (3)
|
||||
- curl_url_strerror (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url - create a URL handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLU *curl_url();
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function allocates a URL object and returns a *CURLU* handle for it,
|
||||
to be used as input to all other URL API functions.
|
||||
|
||||
This is a handle to a URL object that holds or can hold URL components for a
|
||||
single URL. When the object is first created, there is of course no components
|
||||
stored. They are then set in the object with the curl_url_set(3)
|
||||
function.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLUcode rc;
|
||||
CURLU *url = curl_url();
|
||||
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
if(!rc) {
|
||||
char *scheme;
|
||||
rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0);
|
||||
if(!rc) {
|
||||
printf("the scheme is %s\n", scheme);
|
||||
curl_free(scheme);
|
||||
}
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a **CURLU *** if successful, or NULL if out of memory.
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url_cleanup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_CURLU (3)
|
||||
- curl_url (3)
|
||||
- curl_url_dup (3)
|
||||
- curl_url_get (3)
|
||||
- curl_url_set (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url_cleanup - free the URL handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
void curl_url_cleanup(CURLU *handle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Frees all the resources associated with the given *CURLU* handle.
|
||||
|
||||
Passing in a NULL pointer in *handle* makes this function return
|
||||
immediately with no action.
|
||||
|
||||
Any use of the **handle** after this function has been called and have
|
||||
returned, is illegal.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLU *url = curl_url();
|
||||
curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
none
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url_dup
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_CURLU (3)
|
||||
- curl_url (3)
|
||||
- curl_url_cleanup (3)
|
||||
- curl_url_get (3)
|
||||
- curl_url_set (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url_dup - duplicate a URL handle
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLU *curl_url_dup(const CURLU *inhandle);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Duplicates the URL object the input *CURLU* *inhandle* identifies and
|
||||
returns a pointer to the copy as a new *CURLU* handle. The new handle also
|
||||
needs to be freed with curl_url_cleanup(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLUcode rc;
|
||||
CURLU *url = curl_url();
|
||||
CURLU *url2;
|
||||
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
if(!rc) {
|
||||
url2 = curl_url_dup(url); /* clone it */
|
||||
curl_url_cleanup(url2);
|
||||
}
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a pointer to a new `CURLU` handle or NULL if out of memory.
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url_get
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_CURLU (3)
|
||||
- curl_url (3)
|
||||
- curl_url_cleanup (3)
|
||||
- curl_url_dup (3)
|
||||
- curl_url_set (3)
|
||||
- curl_url_strerror (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url_get - extract a part from a URL
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLUcode curl_url_get(const CURLU *url,
|
||||
CURLUPart part,
|
||||
char **content,
|
||||
unsigned int flags);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Given a *url* handle of a URL object, this function extracts an individual
|
||||
piece or the full URL from it.
|
||||
|
||||
The *part* argument specifies which part to extract (see list below) and
|
||||
*content* points to a 'char *' to get updated to point to a newly
|
||||
allocated string with the contents.
|
||||
|
||||
The *flags* argument is a bitmask with individual features.
|
||||
|
||||
The returned content pointer must be freed with curl_free(3) after use.
|
||||
|
||||
# FLAGS
|
||||
|
||||
The flags argument is zero, one or more bits set in a bitmask.
|
||||
|
||||
## CURLU_DEFAULT_PORT
|
||||
|
||||
If the handle has no port stored, this option makes curl_url_get(3)
|
||||
return the default port for the used scheme.
|
||||
|
||||
## CURLU_DEFAULT_SCHEME
|
||||
|
||||
If the handle has no scheme stored, this option makes curl_url_get(3)
|
||||
return the default scheme instead of error.
|
||||
|
||||
## CURLU_NO_DEFAULT_PORT
|
||||
|
||||
Instructs curl_url_get(3) to not return a port number if it matches the
|
||||
default port for the scheme.
|
||||
|
||||
## CURLU_URLDECODE
|
||||
|
||||
Asks curl_url_get(3) to URL decode the contents before returning it. It
|
||||
does not decode the scheme, the port number or the full URL.
|
||||
|
||||
The query component also gets plus-to-space conversion as a bonus when this
|
||||
bit is set.
|
||||
|
||||
Note that this URL decoding is charset unaware and you get a null-terminated
|
||||
string back with data that could be intended for a particular encoding.
|
||||
|
||||
If there are byte values lower than 32 in the decoded string, the get
|
||||
operation returns an error instead.
|
||||
|
||||
## CURLU_URLENCODE
|
||||
|
||||
If set, curl_url_get(3) URL encodes the hostname part when a full URL is
|
||||
retrieved. If not set (default), libcurl returns the URL with the hostname raw
|
||||
to support IDN names to appear as-is. IDN hostnames are typically using
|
||||
non-ASCII bytes that otherwise gets percent-encoded.
|
||||
|
||||
Note that even when not asking for URL encoding, the '%' (byte 37) is URL
|
||||
encoded to make sure the hostname remains valid.
|
||||
|
||||
## CURLU_PUNYCODE
|
||||
|
||||
If set and *CURLU_URLENCODE* is not set, and asked to retrieve the
|
||||
**CURLUPART_HOST** or **CURLUPART_URL** parts, libcurl returns the host
|
||||
name in its punycode version if it contains any non-ASCII octets (and is an
|
||||
IDN name).
|
||||
|
||||
If libcurl is built without IDN capabilities, using this bit makes
|
||||
curl_url_get(3) return *CURLUE_LACKS_IDN* if the hostname contains
|
||||
anything outside the ASCII range.
|
||||
|
||||
(Added in curl 7.88.0)
|
||||
|
||||
## CURLU_PUNY2IDN
|
||||
|
||||
If set and asked to retrieve the **CURLUPART_HOST** or **CURLUPART_URL**
|
||||
parts, libcurl returns the hostname in its IDN (International Domain Name)
|
||||
UTF-8 version if it otherwise is a punycode version. If the punycode name
|
||||
cannot be converted to IDN correctly, libcurl returns
|
||||
*CURLUE_BAD_HOSTNAME*.
|
||||
|
||||
If libcurl is built without IDN capabilities, using this bit makes
|
||||
curl_url_get(3) return *CURLUE_LACKS_IDN* if the hostname is using
|
||||
punycode.
|
||||
|
||||
(Added in curl 8.3.0)
|
||||
|
||||
## CURLU_GET_EMPTY
|
||||
|
||||
When this flag is used in curl_url_get(), it makes the function return empty
|
||||
query and fragments parts or when used in the full URL. By default, libcurl
|
||||
otherwise considers empty parts non-existing.
|
||||
|
||||
An empty query part is one where this is nothing following the question mark
|
||||
(before the possible fragment). An empty fragments part is one where there is
|
||||
nothing following the hash sign.
|
||||
|
||||
(Added in curl 8.8.0)
|
||||
|
||||
## CURLU_NO_GUESS_SCHEME
|
||||
|
||||
When this flag is used in curl_url_get(), it treats the scheme as non-existing
|
||||
if it was set as a result of a previous guess; when CURLU_GUESS_SCHEME was
|
||||
used parsing a URL.
|
||||
|
||||
Using this flag when getting CURLUPART_SCHEME if the scheme was set as the
|
||||
result of a guess makes curl_url_get() return CURLUE_NO_SCHEME.
|
||||
|
||||
Using this flag when getting CURLUPART_URL if the scheme was set as the result
|
||||
of a guess makes curl_url_get() return the full URL without the scheme
|
||||
component. Such a URL can then only be parsed with curl_url_set() if
|
||||
CURLU_GUESS_SCHEME is used.
|
||||
|
||||
(Added in curl 8.9.0)
|
||||
|
||||
# PARTS
|
||||
|
||||
## CURLUPART_URL
|
||||
|
||||
When asked to return the full URL, curl_url_get(3) returns a slightly cleaned
|
||||
up version of the complete URL using all available parts.
|
||||
|
||||
We advise using the *CURLU_PUNYCODE* option to get the URL as "normalized" as
|
||||
possible since IDN allows hostnames to be written in many different ways that
|
||||
still end up the same punycode version.
|
||||
|
||||
Zero-length queries and fragments are excluded from the URL unless
|
||||
CURLU_GET_EMPTY is set.
|
||||
|
||||
## CURLUPART_SCHEME
|
||||
|
||||
Scheme cannot be URL decoded on get.
|
||||
|
||||
## CURLUPART_USER
|
||||
|
||||
## CURLUPART_PASSWORD
|
||||
|
||||
## CURLUPART_OPTIONS
|
||||
|
||||
The options field is an optional field that might follow the password in the
|
||||
userinfo part. It is only recognized/used when parsing URLs for the following
|
||||
schemes: pop3, smtp and imap. The URL API still allows users to set and get
|
||||
this field independently of scheme when not parsing full URLs.
|
||||
|
||||
## CURLUPART_HOST
|
||||
|
||||
The hostname. If it is an IPv6 numeric address, the zone id is not part of it
|
||||
but is provided separately in *CURLUPART_ZONEID*. IPv6 numerical addresses
|
||||
are returned within brackets ([]).
|
||||
|
||||
IPv6 names are normalized when set, which should make them as short as
|
||||
possible while maintaining correct syntax.
|
||||
|
||||
## CURLUPART_ZONEID
|
||||
|
||||
If the hostname is a numeric IPv6 address, this field might also be set.
|
||||
|
||||
## CURLUPART_PORT
|
||||
|
||||
A port cannot be URL decoded on get. This number is returned in a string just
|
||||
like all other parts. That string is guaranteed to hold a valid port number in
|
||||
ASCII using base 10.
|
||||
|
||||
## CURLUPART_PATH
|
||||
|
||||
The *part* is always at least a slash ('/') even if no path was supplied
|
||||
in the URL. A URL path always starts with a slash.
|
||||
|
||||
## CURLUPART_QUERY
|
||||
|
||||
The initial question mark that denotes the beginning of the query part is a
|
||||
delimiter only. It is not part of the query contents.
|
||||
|
||||
A not-present query returns *part* set to NULL.
|
||||
|
||||
A zero-length query returns *part* as NULL unless CURLU_GET_EMPTY is set.
|
||||
|
||||
The query part gets pluses converted to space when asked to URL decode on get
|
||||
with the CURLU_URLDECODE bit.
|
||||
|
||||
## CURLUPART_FRAGMENT
|
||||
|
||||
The initial hash sign that denotes the beginning of the fragment is a
|
||||
delimiter only. It is not part of the fragment contents.
|
||||
|
||||
A not-present fragment returns *part* set to NULL.
|
||||
|
||||
A zero-length fragment returns *part* as NULL unless CURLU_GET_EMPTY is set.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLUcode rc;
|
||||
CURLU *url = curl_url();
|
||||
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
if(!rc) {
|
||||
char *scheme;
|
||||
rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0);
|
||||
if(!rc) {
|
||||
printf("the scheme is %s\n", scheme);
|
||||
curl_free(scheme);
|
||||
}
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a CURLUcode error value, which is CURLUE_OK (0) if everything went
|
||||
fine. See the libcurl-errors(3) man page for the full list with descriptions.
|
||||
|
||||
If this function returns an error, no URL part is returned.
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url_set
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_CURLU (3)
|
||||
- curl_url (3)
|
||||
- curl_url_cleanup (3)
|
||||
- curl_url_dup (3)
|
||||
- curl_url_get (3)
|
||||
- curl_url_strerror (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.62.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url_set - set a URL part
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLUcode curl_url_set(CURLU *url,
|
||||
CURLUPart part,
|
||||
const char *content,
|
||||
unsigned int flags);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The *url* handle to work on, passed in as the first argument, must be a
|
||||
handle previously created by curl_url(3) or curl_url_dup(3).
|
||||
|
||||
This function sets or updates individual URL components, or parts, held by the
|
||||
URL object the handle identifies.
|
||||
|
||||
The *part* argument should identify the particular URL part (see list below)
|
||||
to set or change, with *content* pointing to a null-terminated string with the
|
||||
new contents for that URL part. The contents should be in the form and
|
||||
encoding they would use in a URL: URL encoded.
|
||||
|
||||
When setting a part in the URL object that was previously already set, it
|
||||
replaces the data that was previously stored for that part with the new
|
||||
*content*.
|
||||
|
||||
The caller does not have to keep *content* around after a successful call
|
||||
as this function copies the content.
|
||||
|
||||
Setting a part to a NULL pointer removes that part's contents from the *CURLU*
|
||||
handle.
|
||||
|
||||
This function has an 8 MB maximum length limit for all provided input strings.
|
||||
In the real world, excessively long fields in URLs cause problems even if this
|
||||
function accepts them.
|
||||
|
||||
When setting or updating contents of individual URL parts, curl_url_set(3)
|
||||
might accept data that would not be otherwise possible to set in the string
|
||||
when it gets populated as a result of a full URL parse. Beware. If done so,
|
||||
extracting a full URL later on from such components might render an invalid
|
||||
URL.
|
||||
|
||||
The *flags* argument is a bitmask with independent features.
|
||||
|
||||
# PARTS
|
||||
|
||||
## CURLUPART_URL
|
||||
|
||||
Allows the full URL of the handle to be replaced. If the handle already is
|
||||
populated with a URL, the new URL can be relative to the previous.
|
||||
|
||||
When successfully setting a new URL, relative or absolute, the handle contents
|
||||
is replaced with the components of the newly set URL.
|
||||
|
||||
Pass a pointer to a null-terminated string to the *url* parameter. The string
|
||||
must point to a correctly formatted "RFC 3986+" URL or be a NULL pointer. The
|
||||
URL parser only understands and parses the subset of URLS that are
|
||||
"hierarchical" and therefore contain a `://` separator - not the ones that are
|
||||
normally specified with only a colon separator.
|
||||
|
||||
By default this API only parses URLs using schemes for protocols that are
|
||||
supported built-in. To make libcurl parse URLs generically even for schemes it
|
||||
does not know about, the **CURLU_NON_SUPPORT_SCHEME** flags bit must be set.
|
||||
Otherwise, this function returns *CURLUE_UNSUPPORTED_SCHEME* for URL schemes
|
||||
it does not recognize.
|
||||
|
||||
Unless *CURLU_NO_AUTHORITY* is set, a blank hostname is not allowed in
|
||||
the URL.
|
||||
|
||||
When a full URL is set (parsed), the hostname component is stored URL decoded.
|
||||
|
||||
It is considered fine to set a blank URL ("") as a redirect, but not as a
|
||||
normal URL. Therefore, setting a "" URL works fine if the handle already holds
|
||||
a URL, otherwise it triggers an error.
|
||||
|
||||
## CURLUPART_SCHEME
|
||||
|
||||
Scheme cannot be URL decoded on set. libcurl only accepts setting schemes up
|
||||
to 40 bytes long.
|
||||
|
||||
## CURLUPART_USER
|
||||
|
||||
If only the user part is set and not the password, the URL is represented with
|
||||
a blank password.
|
||||
|
||||
## CURLUPART_PASSWORD
|
||||
|
||||
If only the password part is set and not the user, the URL is represented with
|
||||
a blank user.
|
||||
|
||||
## CURLUPART_OPTIONS
|
||||
|
||||
The options field is an optional field that might follow the password in the
|
||||
userinfo part. It is only recognized/used when parsing URLs for the following
|
||||
schemes: pop3, smtp and imap. This function however allows users to
|
||||
independently set this field.
|
||||
|
||||
## CURLUPART_HOST
|
||||
|
||||
The hostname. If it is International Domain Name (IDN) the string must then be
|
||||
encoded as your locale says or UTF-8 (when WinIDN is used). If it is a
|
||||
bracketed IPv6 numeric address it may contain a zone id (or you can use
|
||||
*CURLUPART_ZONEID*).
|
||||
|
||||
Note that if you set an IPv6 address, it gets ruined and causes an error if
|
||||
you also set the CURLU_URLENCODE flag.
|
||||
|
||||
Unless *CURLU_NO_AUTHORITY* is set, a blank hostname is not allowed to set.
|
||||
|
||||
## CURLUPART_ZONEID
|
||||
|
||||
If the hostname is a numeric IPv6 address, this field can also be set.
|
||||
|
||||
## CURLUPART_PORT
|
||||
|
||||
The port number cannot be URL encoded on set. The given port number is
|
||||
provided as a string and the decimal number in it must be between 0 and
|
||||
65535. Anything else returns an error.
|
||||
|
||||
## CURLUPART_PATH
|
||||
|
||||
If a path is set in the URL without a leading slash, a slash is prepended
|
||||
automatically.
|
||||
|
||||
## CURLUPART_QUERY
|
||||
|
||||
The query part gets spaces converted to pluses when asked to URL encode on set
|
||||
with the *CURLU_URLENCODE* bit.
|
||||
|
||||
If used together with the *CURLU_APPENDQUERY* bit, the provided part is
|
||||
appended on the end of the existing query.
|
||||
|
||||
The question mark in the URL is not part of the actual query contents.
|
||||
|
||||
## CURLUPART_FRAGMENT
|
||||
|
||||
The hash sign in the URL is not part of the actual fragment contents.
|
||||
|
||||
# FLAGS
|
||||
|
||||
The flags argument is zero, one or more bits set in a bitmask.
|
||||
|
||||
## CURLU_APPENDQUERY
|
||||
|
||||
Can be used when setting the *CURLUPART_QUERY* component. The provided new
|
||||
part is then appended at the end of the existing query - and if the previous
|
||||
part did not end with an ampersand (&), an ampersand gets inserted before the
|
||||
new appended part.
|
||||
|
||||
When *CURLU_APPENDQUERY* is used together with *CURLU_URLENCODE*, the
|
||||
first '=' symbol is not URL encoded.
|
||||
|
||||
## CURLU_NON_SUPPORT_SCHEME
|
||||
|
||||
If set, allows curl_url_set(3) to set a non-supported scheme. It then of
|
||||
course cannot know if the provided scheme is a valid one or not.
|
||||
|
||||
## CURLU_URLENCODE
|
||||
|
||||
When set, curl_url_set(3) URL encodes the part on entry, except for
|
||||
**scheme**, **port** and **URL**.
|
||||
|
||||
When setting the path component with URL encoding enabled, the following
|
||||
characters are left as-is if present:
|
||||
|
||||
! $ & ' ( ) { } [ ] * + , ; = : @
|
||||
|
||||
The query part gets space-to-plus converted before the URL conversion is
|
||||
applied.
|
||||
|
||||
This URL encoding is charset unaware and converts the input in a byte-by-byte
|
||||
manner.
|
||||
|
||||
## CURLU_DEFAULT_SCHEME
|
||||
|
||||
If set, allows the URL to be set without a scheme and then sets that to the
|
||||
default scheme: HTTPS. Overrides the *CURLU_GUESS_SCHEME* option if both are
|
||||
set.
|
||||
|
||||
## CURLU_GUESS_SCHEME
|
||||
|
||||
If set, allows the URL to be set without a scheme and it instead "guesses"
|
||||
which scheme that was intended based on the hostname. If the outermost
|
||||
subdomain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that scheme is
|
||||
used, otherwise it picks HTTP. Conflicts with the *CURLU_DEFAULT_SCHEME*
|
||||
option which takes precedence if both are set.
|
||||
|
||||
If guessing is not allowed and there is no default scheme set, trying to parse
|
||||
a URL without a scheme returns error.
|
||||
|
||||
If the scheme ends up set as a result of guessing, i.e. it is not actually
|
||||
present in the parsed URL, it can later be figured out by using the
|
||||
**CURLU_NO_GUESS_SCHEME** flag when subsequently getting the URL or the scheme
|
||||
with curl_url_get(3).
|
||||
|
||||
## CURLU_NO_AUTHORITY
|
||||
|
||||
If set, skips authority checks. The RFC allows individual schemes to omit the
|
||||
host part (normally the only mandatory part of the authority), but libcurl
|
||||
cannot know whether this is permitted for custom schemes. Specifying the flag
|
||||
permits empty authority sections, similar to how file scheme is handled.
|
||||
|
||||
## CURLU_PATH_AS_IS
|
||||
|
||||
When set for **CURLUPART_URL**, this skips the normalization of the
|
||||
path. That is the procedure where libcurl otherwise removes sequences of
|
||||
dot-slash and dot-dot etc. The same option used for transfers is called
|
||||
CURLOPT_PATH_AS_IS(3).
|
||||
|
||||
## CURLU_ALLOW_SPACE
|
||||
|
||||
If set, the URL parser allows space (ASCII 32) where possible. The URL syntax
|
||||
does normally not allow spaces anywhere, but they should be encoded as %20
|
||||
or '+'. When spaces are allowed, they are still not allowed in the scheme.
|
||||
When space is used and allowed in a URL, it is stored as-is unless
|
||||
*CURLU_URLENCODE* is also set, which then makes libcurl URL encode the
|
||||
space before stored. This affects how the URL is constructed when
|
||||
curl_url_get(3) is subsequently used to extract the full URL or
|
||||
individual parts. (Added in 7.78.0)
|
||||
|
||||
## CURLU_DISALLOW_USER
|
||||
|
||||
If set, the URL parser does not accept embedded credentials for the
|
||||
**CURLUPART_URL**, and instead returns **CURLUE_USER_NOT_ALLOWED** for
|
||||
such URLs.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLUcode rc;
|
||||
CURLU *url = curl_url();
|
||||
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
if(!rc) {
|
||||
/* change it to an FTP URL */
|
||||
rc = curl_url_set(url, CURLUPART_SCHEME, "ftp", 0);
|
||||
}
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns a *CURLUcode* error value, which is CURLUE_OK (0) if everything
|
||||
went fine. See the libcurl-errors(3) man page for the full list with
|
||||
descriptions.
|
||||
|
||||
The input string passed to curl_url_set(3) must be shorter than eight
|
||||
million bytes. Otherwise this function returns **CURLUE_MALFORMED_INPUT**.
|
||||
|
||||
If this function returns an error, no URL part is set.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_url_strerror
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_strerror (3)
|
||||
- curl_multi_strerror (3)
|
||||
- curl_share_strerror (3)
|
||||
- curl_url_get (3)
|
||||
- curl_url_set (3)
|
||||
- libcurl-errors (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.80.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_url_strerror - return string describing error code
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const char *curl_url_strerror(CURLUcode errornum);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function returns a string describing the CURLUcode error code passed in
|
||||
the argument *errornum*.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
CURLUcode rc;
|
||||
CURLU *url = curl_url();
|
||||
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
|
||||
if(rc)
|
||||
printf("URL error: %s\n", curl_url_strerror(rc));
|
||||
curl_url_cleanup(url);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string.
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_version
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_version_info (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_version - returns the libcurl version string
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
char *curl_version();
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Returns a human readable string with the version number of libcurl and some of
|
||||
its important components (like OpenSSL version).
|
||||
|
||||
For MultiSSL builds the string contains all SSL backend names and the inactive
|
||||
backend names are in parentheses. For example "(OpenSSL/3.0.8) Schannel" or
|
||||
"OpenSSL/3.0.8 (Schannel)".
|
||||
|
||||
We recommend using curl_version_info(3) instead.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
printf("libcurl version %s\n", curl_version());
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a null-terminated string. The string resides in a statically
|
||||
allocated buffer and must not be freed by the caller.
|
||||
@@ -0,0 +1,416 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_version_info
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_version (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.10
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_version_info - returns runtime libcurl version info
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
curl_version_info_data *curl_version_info(CURLversion age);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Returns a pointer to a filled in static struct with information about various
|
||||
features in the running version of libcurl. *age* should be set to the
|
||||
version of this functionality by the time you write your program. This way,
|
||||
libcurl always returns a proper struct that your program understands, while
|
||||
programs in the future might get a different struct. **CURLVERSION_NOW** is
|
||||
the most recent one for the library you have installed:
|
||||
~~~c
|
||||
data = curl_version_info(CURLVERSION_NOW);
|
||||
~~~
|
||||
Applications should use this information to judge if things are possible to do
|
||||
or not, instead of using compile-time checks, as dynamic/DLL libraries can be
|
||||
changed independent of applications.
|
||||
|
||||
This function can alter the returned static data as long as
|
||||
curl_global_init(3) has not been called. It is therefore not thread-safe
|
||||
before libcurl initialization occurs.
|
||||
|
||||
The curl_version_info_data struct looks like this
|
||||
|
||||
~~~c
|
||||
typedef struct {
|
||||
CURLversion age; /* see description below */
|
||||
|
||||
const char *version; /* human readable string */
|
||||
unsigned int version_num; /* numeric representation */
|
||||
const char *host; /* human readable string */
|
||||
int features; /* bitmask, see below */
|
||||
char *ssl_version; /* human readable string */
|
||||
long ssl_version_num; /* not used, always zero */
|
||||
const char *libz_version; /* human readable string */
|
||||
const char *const *protocols; /* protocols */
|
||||
|
||||
/* when 'age' is CURLVERSION_SECOND or higher, the members below exist */
|
||||
const char *ares; /* human readable string */
|
||||
int ares_num; /* number */
|
||||
|
||||
/* when 'age' is CURLVERSION_THIRD or higher, the members below exist */
|
||||
const char *libidn; /* human readable string */
|
||||
|
||||
/* when 'age' is CURLVERSION_FOURTH or higher (>= 7.16.1), the members
|
||||
below exist */
|
||||
int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */
|
||||
|
||||
const char *libssh_version; /* human readable string */
|
||||
|
||||
/* when 'age' is CURLVERSION_FIFTH or higher (>= 7.57.0), the members
|
||||
below exist */
|
||||
unsigned int brotli_ver_num; /* Numeric Brotli version
|
||||
(MAJOR << 24) | (MINOR << 12) | PATCH */
|
||||
const char *brotli_version; /* human readable string. */
|
||||
|
||||
/* when 'age' is CURLVERSION_SIXTH or higher (>= 7.66.0), the members
|
||||
below exist */
|
||||
unsigned int nghttp2_ver_num; /* Numeric nghttp2 version
|
||||
(MAJOR << 16) | (MINOR << 8) | PATCH */
|
||||
const char *nghttp2_version; /* human readable string. */
|
||||
|
||||
const char *quic_version; /* human readable quic (+ HTTP/3) library +
|
||||
version or NULL */
|
||||
|
||||
/* when 'age' is CURLVERSION_SEVENTH or higher (>= 7.70.0), the members
|
||||
below exist */
|
||||
const char *cainfo; /* the built-in default CURLOPT_CAINFO, might
|
||||
be NULL */
|
||||
const char *capath; /* the built-in default CURLOPT_CAPATH, might
|
||||
be NULL */
|
||||
/* when 'age' is CURLVERSION_EIGHTH or higher (>= 7.71.0), the members
|
||||
below exist */
|
||||
unsigned int zstd_ver_num; /* Numeric Zstd version
|
||||
(MAJOR << 24) | (MINOR << 12) | PATCH */
|
||||
const char *zstd_version; /* human readable string. */
|
||||
/* when 'age' is CURLVERSION_NINTH or higher (>= 7.75.0), the members
|
||||
below exist */
|
||||
const char *hyper_version; /* human readable string. */
|
||||
/* when 'age' is CURLVERSION_TENTH or higher (>= 7.77.0), the members
|
||||
below exist */
|
||||
const char *gsasl_version; /* human readable string. */
|
||||
/* when 'age' is CURLVERSION_ELEVENTH or higher (>= 7.87.0), the members
|
||||
below exist */
|
||||
const char *const *feature_names; /* Feature names. */
|
||||
/* when 'age' is CURLVERSION_TWELFTH or higher (>= 8.8.0), the members
|
||||
below exist */
|
||||
const char *const *rtmp_version; /* human readable string */
|
||||
} curl_version_info_data;
|
||||
~~~
|
||||
|
||||
*age* describes what the age of this struct is. The number depends on how
|
||||
new the libcurl you are using is. You are however guaranteed to get a struct
|
||||
that you have a matching struct for in the header, as you tell libcurl your
|
||||
"age" with the input argument.
|
||||
|
||||
*version* is just an ASCII string for the libcurl version.
|
||||
|
||||
*version_num* is a 24 bit number created like this: \<8 bits major number\> |
|
||||
\<8 bits minor number\> | \<8 bits patch number\>. Version 7.9.8 is therefore
|
||||
returned as 0x070908.
|
||||
|
||||
*host* is an ASCII string showing what host information that this libcurl
|
||||
was built for. As discovered by a configure script or set by the build
|
||||
environment.
|
||||
|
||||
*features* is a bit mask representing available features. It can have none,
|
||||
one or more bits set. The use of this field is deprecated: use
|
||||
*feature_names* instead. The feature names description below lists the
|
||||
associated bits.
|
||||
|
||||
*feature_names* is a pointer to an array of string pointers, containing the
|
||||
names of the features that libcurl supports. The array is terminated by a NULL
|
||||
entry. See the list of features names below.
|
||||
|
||||
*ssl_version* is an ASCII string for the TLS library name + version used. If
|
||||
libcurl has no SSL support, this is NULL. For example "Schannel", "Secure
|
||||
Transport" or "OpenSSL/1.1.0g". For MultiSSL builds the string contains all
|
||||
SSL backend names and the inactive backend names are in parentheses. For
|
||||
example "(OpenSSL/3.0.8) Schannel" or "OpenSSL/3.0.8 (Schannel)".
|
||||
|
||||
*ssl_version_num* is always 0.
|
||||
|
||||
*libz_version* is an ASCII string (there is no numerical version). If
|
||||
libcurl has no libz support, this is NULL.
|
||||
|
||||
*protocols* is a pointer to an array of char * pointers, containing the
|
||||
names protocols that libcurl supports (using lowercase letters). The protocol
|
||||
names are the same as would be used in URLs. The array is terminated by a NULL
|
||||
entry.
|
||||
|
||||
# FEATURES
|
||||
|
||||
## `alt-svc`
|
||||
|
||||
*features* mask bit: CURL_VERSION_ALTSVC
|
||||
|
||||
HTTP Alt-Svc parsing and the associated options (Added in 7.64.1)
|
||||
|
||||
## `AppleSecTrust`
|
||||
|
||||
*features* mask bit: non-existent
|
||||
|
||||
libcurl was built with support for Apple's SecTrust service to verify
|
||||
server certificates (Added in 8.17.0).
|
||||
|
||||
## `AsynchDNS`
|
||||
|
||||
*features* mask bit: CURL_VERSION_ASYNCHDNS
|
||||
|
||||
libcurl was built with support for asynchronous name lookups, which allows
|
||||
more exact timeouts (even on Windows) and less blocking when using the multi
|
||||
interface.
|
||||
|
||||
## `brotli`
|
||||
|
||||
*features* mask bit: CURL_VERSION_BROTLI
|
||||
|
||||
supports HTTP Brotli content encoding using libbrotlidec
|
||||
|
||||
## `asyn-rr`
|
||||
|
||||
*features* mask bit: non-existent
|
||||
|
||||
libcurl was built to use c-ares for EXPERIMENTAL HTTPS resource record
|
||||
resolves, but uses the threaded resolver for "normal" resolves (Added in
|
||||
8.12.0)
|
||||
|
||||
## `Debug`
|
||||
|
||||
*features* mask bit: CURL_VERSION_DEBUG
|
||||
|
||||
libcurl was built with debug capabilities
|
||||
|
||||
## `ECH`
|
||||
|
||||
*features* mask bit: non-existent
|
||||
|
||||
libcurl was built with ECH support (experimental, added in 8.8.0)
|
||||
|
||||
## `gsasl`
|
||||
|
||||
*features* mask bit: CURL_VERSION_GSASL
|
||||
|
||||
libcurl was built with libgsasl and thus with some extra SCRAM-SHA
|
||||
authentication methods. (added in 7.76.0)
|
||||
|
||||
## `GSS-API`
|
||||
|
||||
*features* mask bit: CURL_VERSION_GSSAPI
|
||||
|
||||
libcurl was built with support for GSS-API. This makes libcurl use provided
|
||||
functions for Kerberos and SPNEGO authentication. It also allows libcurl
|
||||
to use the current user credentials without the app having to pass them on.
|
||||
|
||||
## `HSTS`
|
||||
|
||||
*features* mask bit: CURL_VERSION_HSTS
|
||||
|
||||
libcurl was built with support for HSTS (HTTP Strict Transport Security)
|
||||
(Added in 7.74.0)
|
||||
|
||||
## `HTTP2`
|
||||
|
||||
*features* mask bit: CURL_VERSION_HTTP2
|
||||
|
||||
libcurl was built with support for HTTP2.
|
||||
|
||||
## `HTTP3`
|
||||
|
||||
*features* mask bit: CURL_VERSION_HTTP3
|
||||
|
||||
HTTP/3 and QUIC support are built-in (Added in 7.66.0)
|
||||
|
||||
## `HTTPS-proxy`
|
||||
|
||||
*features* mask bit: CURL_VERSION_HTTPS_PROXY
|
||||
|
||||
libcurl was built with support for HTTPS-proxy.
|
||||
|
||||
## `HTTPSRR`
|
||||
|
||||
*features* mask bit: non-existent
|
||||
|
||||
libcurl was built with EXPERIMENTAL support for HTTPS resource records (Added
|
||||
in 8.12.0)
|
||||
|
||||
## `IDN`
|
||||
|
||||
*features* mask bit: CURL_VERSION_IDN
|
||||
|
||||
libcurl was built with support for IDNA, domain names with international
|
||||
letters.
|
||||
|
||||
## `IPv6`
|
||||
|
||||
*features* mask bit: CURL_VERSION_IPV6
|
||||
|
||||
supports IPv6
|
||||
|
||||
## `Kerberos`
|
||||
|
||||
*features* mask bit: CURL_VERSION_KERBEROS5
|
||||
|
||||
supports Kerberos V5 authentication for FTP, IMAP, LDAP, POP3, SMTP and
|
||||
SOCKSv5 proxy.
|
||||
|
||||
## `Largefile`
|
||||
|
||||
*features* mask bit: CURL_VERSION_LARGEFILE
|
||||
|
||||
libcurl was built with support for large files.
|
||||
|
||||
## `libz`
|
||||
|
||||
*features* mask bit: CURL_VERSION_LIBZ
|
||||
|
||||
supports HTTP deflate using libz
|
||||
|
||||
## `MultiSSL`
|
||||
|
||||
*features* mask bit: CURL_VERSION_MULTI_SSL
|
||||
|
||||
libcurl was built with multiple SSL backends. For details, see
|
||||
curl_global_sslset(3).
|
||||
|
||||
## `NTLM`
|
||||
|
||||
*features* mask bit: CURL_VERSION_NTLM
|
||||
|
||||
supports HTTP NTLM
|
||||
|
||||
## `NTLM_WB`
|
||||
|
||||
*features* mask bit: CURL_VERSION_NTLM_WB
|
||||
|
||||
libcurl was built with support for NTLM delegation to a winbind helper. This
|
||||
feature was removed from curl in 8.8.0.
|
||||
|
||||
## `PSL`
|
||||
|
||||
*features* mask bit: CURL_VERSION_PSL
|
||||
|
||||
libcurl was built with support for Mozilla's Public Suffix List. This makes
|
||||
libcurl ignore cookies with a domain that is on the list.
|
||||
|
||||
## `SPNEGO`
|
||||
|
||||
*features* mask bit: CURL_VERSION_SPNEGO
|
||||
|
||||
libcurl was built with support for SPNEGO authentication (Simple and Protected
|
||||
GSS-API Negotiation Mechanism, defined in RFC 2478.)
|
||||
|
||||
## `SSL`
|
||||
|
||||
*features* mask bit: CURL_VERSION_SSL
|
||||
|
||||
supports SSL (HTTPS/FTPS)
|
||||
|
||||
## `SSLS-EXPORT`
|
||||
|
||||
*features* mask bit: non-existent
|
||||
|
||||
libcurl was built with SSL session import/export support
|
||||
(experimental, added in 8.12.0)
|
||||
|
||||
## `SSPI`
|
||||
|
||||
*features* mask bit: CURL_VERSION_SSPI
|
||||
|
||||
libcurl was built with support for SSPI. This is only available on Windows and
|
||||
makes libcurl use Windows-provided functions for Kerberos, NTLM, SPNEGO and
|
||||
Digest authentication. It also allows libcurl to use the current user
|
||||
credentials without the app having to pass them on.
|
||||
|
||||
## `threadsafe`
|
||||
|
||||
*features* mask bit: CURL_VERSION_THREADSAFE
|
||||
|
||||
libcurl was built with thread-safety support (Atomic or SRWLOCK) to protect
|
||||
curl initialization. (Added in 7.84.0) See libcurl-thread(3)
|
||||
|
||||
## `TLS-SRP`
|
||||
|
||||
*features* mask bit: CURL_VERSION_TLSAUTH_SRP
|
||||
|
||||
libcurl was built with support for TLS-SRP (in one or more of the built-in TLS
|
||||
backends).
|
||||
|
||||
## `TrackMemory`
|
||||
|
||||
*features* mask bit: CURL_VERSION_CURLDEBUG
|
||||
|
||||
libcurl was built with memory tracking debug capabilities. This is mainly of
|
||||
interest for libcurl hackers.
|
||||
|
||||
## `Unicode`
|
||||
|
||||
*features* mask bit: CURL_VERSION_UNICODE
|
||||
|
||||
libcurl was built with Unicode support on Windows. This makes non-ASCII
|
||||
characters work in filenames and options passed to libcurl. (Added in 7.72.0)
|
||||
|
||||
## `UnixSockets`
|
||||
|
||||
*features* mask bit: CURL_VERSION_UNIX_SOCKETS
|
||||
|
||||
libcurl was built with support for Unix domain sockets.
|
||||
|
||||
## `zstd`
|
||||
|
||||
*features* mask bit: CURL_VERSION_ZSTD
|
||||
|
||||
supports HTTP zstd content encoding using zstd library (Added in 7.72.0)
|
||||
|
||||
## no name
|
||||
|
||||
*features* mask bit: CURL_VERSION_CONV
|
||||
|
||||
libcurl was built with support for character conversions provided by
|
||||
callbacks. Always 0 since 7.82.0. Deprecated.
|
||||
|
||||
## no name
|
||||
|
||||
*features* mask bit: CURL_VERSION_GSSNEGOTIATE
|
||||
|
||||
supports HTTP GSS-Negotiate. Deprecated.
|
||||
|
||||
## no name
|
||||
|
||||
*features* mask bit: CURL_VERSION_KERBEROS4
|
||||
|
||||
supports Kerberos V4 (when using FTP). Legacy bit. Deprecated since 7.33.0.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
||||
printf("libcurl version %u.%u.%u\n",
|
||||
(ver->version_num >> 16) & 0xff,
|
||||
(ver->version_num >> 8) & 0xff,
|
||||
ver->version_num & 0xff);
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a curl_version_info_data struct.
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_ws_meta
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_setopt (3)
|
||||
- curl_ws_recv (3)
|
||||
- curl_ws_send (3)
|
||||
- libcurl-ws (3)
|
||||
Protocol:
|
||||
- WS
|
||||
Added-in: 7.86.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_ws_meta - meta data WebSocket information
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
const struct curl_ws_frame *curl_ws_meta(CURL *curl);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
When the write callback (CURLOPT_WRITEFUNCTION(3)) is invoked on
|
||||
received WebSocket traffic, curl_ws_meta(3) can be called from within
|
||||
the callback to provide additional information about the current frame.
|
||||
|
||||
This function only works from within the callback, and only when receiving
|
||||
WebSocket data.
|
||||
|
||||
This function requires an easy handle as input argument for libcurl to know
|
||||
what transfer the question is about, but as there is no such pointer provided
|
||||
to the callback by libcurl itself, applications that want to use
|
||||
curl_ws_meta(3) need to pass it on to the callback on its own.
|
||||
|
||||
# struct curl_ws_frame
|
||||
|
||||
~~~c
|
||||
struct curl_ws_frame {
|
||||
int age;
|
||||
int flags;
|
||||
curl_off_t offset;
|
||||
curl_off_t bytesleft;
|
||||
size_t len;
|
||||
};
|
||||
~~~
|
||||
|
||||
## `age`
|
||||
|
||||
This field specify the age of this struct. It is always zero for now.
|
||||
|
||||
## `flags`
|
||||
|
||||
This is a bitmask with individual bits set that describes the WebSocket data.
|
||||
See the list below.
|
||||
|
||||
## `offset`
|
||||
|
||||
When this chunk is a continuation of frame data already delivered, this is
|
||||
the offset into the final frame data where this piece belongs to.
|
||||
|
||||
## `bytesleft`
|
||||
|
||||
If this is not a complete fragment, the *bytesleft* field informs about how
|
||||
many additional bytes are expected to arrive before this fragment is complete.
|
||||
|
||||
## `len`
|
||||
|
||||
The length of the current data chunk.
|
||||
|
||||
# FLAGS
|
||||
|
||||
The *message type* flags (CURLWS_TEXT/BINARY/CLOSE/PING/PONG) are mutually
|
||||
exclusive.
|
||||
|
||||
## CURLWS_TEXT
|
||||
|
||||
This is a message with text data. Note that this makes a difference to WebSocket
|
||||
but libcurl itself does not make any verification of the content or
|
||||
precautions that you actually receive valid UTF-8 content.
|
||||
|
||||
## CURLWS_BINARY
|
||||
|
||||
This is a message with binary data.
|
||||
|
||||
## CURLWS_CLOSE
|
||||
|
||||
This is a close message. No more data follows.
|
||||
|
||||
It may contain a 2-byte unsigned integer in network byte order that indicates
|
||||
the close reason and may additionally contain up to 123 bytes of further
|
||||
textual payload for a total of at most 125 bytes. libcurl does not verify that
|
||||
the textual description is valid UTF-8.
|
||||
|
||||
## CURLWS_PING
|
||||
|
||||
This is a ping message. It may contain up to 125 bytes of payload text.
|
||||
libcurl does not verify that the payload is valid UTF-8.
|
||||
|
||||
Upon receiving a ping message, libcurl automatically responds with a pong
|
||||
message unless the **CURLWS_NOAUTOPONG** or **CURLWS_RAW_MODE** bit of
|
||||
CURLOPT_WS_OPTIONS(3) is set.
|
||||
|
||||
## CURLWS_PONG
|
||||
|
||||
This is a pong message. It may contain up to 125 bytes of payload text.
|
||||
libcurl does not verify that the payload is valid UTF-8.
|
||||
|
||||
## CURLWS_CONT
|
||||
|
||||
Can only occur in conjunction with CURLWS_TEXT or CURLWS_BINARY.
|
||||
|
||||
This is not the final fragment of the message, it implies that there is
|
||||
another fragment coming as part of the same message. The application must
|
||||
reassemble the fragments to receive the complete message.
|
||||
|
||||
Only a single fragmented message can be transmitted at a time, but it may
|
||||
be interrupted by CURLWS_CLOSE, CURLWS_PING or CURLWS_PONG frames.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
|
||||
/* we pass a pointer to this struct to the callback */
|
||||
struct customdata {
|
||||
CURL *easy;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
static size_t writecb(char *buffer,
|
||||
size_t size, size_t nitems, void *p)
|
||||
{
|
||||
struct customdata *c = (struct customdata *)p;
|
||||
const struct curl_ws_frame *m = curl_ws_meta(c->easy);
|
||||
|
||||
printf("flags: %x\n", m->flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct customdata custom;
|
||||
custom.easy = curl;
|
||||
custom.ptr = NULL;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &custom);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a pointer to a *curl_ws_frame* struct with read-only
|
||||
information that is valid for this specific callback invocation. If it cannot
|
||||
return this information, or if the function is called in the wrong context, it
|
||||
returns NULL.
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_ws_recv
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_setopt (3)
|
||||
- curl_ws_send (3)
|
||||
- libcurl-ws (3)
|
||||
Protocol:
|
||||
- WS
|
||||
Added-in: 7.86.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_ws_recv - receive WebSocket data
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
|
||||
size_t *recv, const struct curl_ws_frame **meta);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Retrieves as much as possible of a received WebSocket frame into the *buffer*,
|
||||
but not more than *buflen* bytes. *recv* is set to the number of bytes
|
||||
actually stored.
|
||||
|
||||
If the function call is successful, the *meta* pointer gets set to point to a
|
||||
*const struct curl_ws_frame* that contains information about the received
|
||||
data. That struct must not be freed and its contents must not be relied upon
|
||||
anymore once another WebSocket function is called. See curl_ws_meta(3) for
|
||||
more details on that struct.
|
||||
|
||||
The application must check `meta->bytesleft` to determine whether the complete
|
||||
frame has been received. If more payload is pending, the application must call
|
||||
this function again with an updated *buffer* and *buflen* to resume receiving.
|
||||
This may for example happen when the data does not fit into the provided
|
||||
buffer or when not all frame data has been delivered over the network yet.
|
||||
|
||||
If the application wants to read the metadata without consuming any payload,
|
||||
it may call this function with a *buflen* of zero. Setting *buffer* to a NULL
|
||||
pointer is permitted in this case. Note that frames without payload are
|
||||
consumed by this action.
|
||||
|
||||
If the received message consists of multiple fragments, the *CURLWS_CONT* bit
|
||||
is set in all frames except the final one. The appropriate *CURLWS_TEXT* or
|
||||
*CURLWS_BINARY* flag is set in every frame, regardless whether it is the first
|
||||
fragment, an intermediate fragment or the final fragment. The application is
|
||||
responsible for reassembling fragmented messages. Special care must be taken
|
||||
to correctly handle control frames (i.e. CLOSE, PING and PONG) arriving in
|
||||
between consecutive fragments of a fragmented TEXT or BINARY message. See
|
||||
curl_ws_meta(3) for more details on *CURLWS_CONT*.
|
||||
|
||||
The WebSocket protocol consists of *messages* that can be delivered over the
|
||||
wire as one or more *frames* - but since a frame can be too large to buffer in
|
||||
memory, libcurl may need to deliver partial frames to the application.
|
||||
Fragments, or chunks, of frames.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(void)
|
||||
{
|
||||
char buffer[256];
|
||||
size_t offset = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "wss://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L);
|
||||
/* start HTTPS connection and upgrade to WSS, then return control */
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* Note: This example neglects fragmented messages. (CURLWS_CONT bit)
|
||||
A real application must handle them appropriately. */
|
||||
|
||||
while(!res) {
|
||||
size_t recv;
|
||||
const struct curl_ws_frame *meta;
|
||||
res = curl_ws_recv(curl, buffer + offset, sizeof(buffer) - offset, &recv,
|
||||
&meta);
|
||||
offset += recv;
|
||||
|
||||
if(res == CURLE_OK) {
|
||||
if(meta->bytesleft == 0)
|
||||
break; /* finished receiving */
|
||||
if(meta->bytesleft > sizeof(buffer) - offset)
|
||||
res = CURLE_TOO_LARGE;
|
||||
}
|
||||
|
||||
if(res == CURLE_AGAIN)
|
||||
/* in real application: wait for socket here, e.g. using select() */
|
||||
res = CURLE_OK;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
return (int)res;
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
|
||||
Returns **CURLE_GOT_NOTHING** if the associated connection is closed.
|
||||
|
||||
Instead of blocking, the function returns **CURLE_AGAIN**. The correct
|
||||
behavior is then to wait for the socket to signal readability before calling
|
||||
this function again.
|
||||
|
||||
Any other non-zero return value indicates an error. See the libcurl-errors(3)
|
||||
man page for the full list with descriptions.
|
||||
|
||||
Returns **CURLE_GOT_NOTHING** if the associated connection is closed.
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_ws_send
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_setopt (3)
|
||||
- curl_ws_recv (3)
|
||||
- curl_ws_start_frame (3)
|
||||
- libcurl-ws (3)
|
||||
Protocol:
|
||||
- WS
|
||||
Added-in: 7.86.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_ws_send - send WebSocket data
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_ws_send(CURL *curl, const void *buffer, size_t buflen,
|
||||
size_t *sent, curl_off_t fragsize,
|
||||
unsigned int flags);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Send the specific message chunk over an established WebSocket
|
||||
connection. *buffer* must point to a valid memory location containing
|
||||
(at least) *buflen* bytes of payload memory.
|
||||
|
||||
*sent* is set to the number of payload bytes actually sent. If the return value
|
||||
is **CURLE_OK** but *sent* is less than the given *buflen*, libcurl was unable
|
||||
to consume the complete payload in a single call. In this case the application
|
||||
must call this function again until all payload is processed. *buffer* and
|
||||
*buflen* must be updated on every following invocation to only point to the
|
||||
remaining piece of the payload.
|
||||
|
||||
*fragsize* should always be set to zero unless a (huge) frame shall be sent
|
||||
using multiple calls with partial content per call explicitly. In that
|
||||
case you must set the *CURLWS_OFFSET* bit and set the *fragsize* as documented
|
||||
in the section on *CURLWS_OFFSET* below.
|
||||
|
||||
*flags* must contain at least one flag indicating the type of the message.
|
||||
To send a fragmented message consisting of multiple frames, additionally set
|
||||
the *CURLWS_CONT* bit in all frames except the final one. The appropriate
|
||||
message type bit should be set in every frame of a fragmented message without
|
||||
exemption. Omitting the message type for continuation frames of a fragmented
|
||||
message is only supported for backwards compatibility and highly discouraged.
|
||||
|
||||
For more details on the supported flags see below and in curl_ws_meta(3).
|
||||
|
||||
If *CURLWS_RAW_MODE* is enabled in CURLOPT_WS_OPTIONS(3), the
|
||||
*flags* argument should be set to 0.
|
||||
|
||||
Warning: while it is possible to invoke this function from a callback,
|
||||
such a call is blocking in this situation, e.g. only returns after all data
|
||||
has been sent or an error is encountered.
|
||||
|
||||
# FLAGS
|
||||
|
||||
Supports all flags documented in curl_ws_meta(3) and additionally the following
|
||||
flags.
|
||||
|
||||
## CURLWS_OFFSET
|
||||
|
||||
The provided data is only a partial frame and there is more coming in a
|
||||
following call to *curl_ws_send()*. When sending only a piece of the
|
||||
frame like this, the *fragsize* must be provided with the total
|
||||
expected frame size in the first call and must be zero in all subsequent
|
||||
calls.
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
#include <string.h> /* for strlen */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const char *buffer = "PAYLOAD";
|
||||
size_t offset = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "wss://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L);
|
||||
/* start HTTPS connection and upgrade to WSS, then return control */
|
||||
curl_easy_perform(curl);
|
||||
|
||||
while(!res) {
|
||||
size_t sent;
|
||||
res = curl_ws_send(curl, buffer + offset, strlen(buffer) - offset, &sent,
|
||||
0, CURLWS_TEXT);
|
||||
offset += sent;
|
||||
|
||||
if(res == CURLE_OK) {
|
||||
if(offset == strlen(buffer))
|
||||
break; /* finished sending */
|
||||
}
|
||||
|
||||
if(res == CURLE_AGAIN)
|
||||
/* in real application: wait for socket here, e.g. using select() */
|
||||
res = CURLE_OK;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
return (int)res;
|
||||
}
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
|
||||
Instead of blocking, the function returns **CURLE_AGAIN**. The correct
|
||||
behavior is then to wait for the socket to signal readability before calling
|
||||
this function again.
|
||||
|
||||
Any other non-zero return value indicates an error. See the libcurl-errors(3)
|
||||
man page for the full list with descriptions.
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: curl_ws_start_frame
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_getinfo (3)
|
||||
- curl_easy_perform (3)
|
||||
- curl_easy_setopt (3)
|
||||
- curl_ws_recv (3)
|
||||
- libcurl-ws (3)
|
||||
Protocol:
|
||||
- WS
|
||||
Added-in: 8.16.0
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
curl_ws_start_frame - start a new WebSocket frame
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
~~~c
|
||||
#include <curl/curl.h>
|
||||
|
||||
CURLcode curl_ws_start_frame(CURL *curl,
|
||||
unsigned int flags,
|
||||
curl_off_t frame_len);
|
||||
~~~
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Add the WebSocket frame header for the given flags and length to
|
||||
the transfers send buffer for WebSocket encoded data. Intended for
|
||||
use in a CURLOPT_READFUNCTION(3) callback.
|
||||
|
||||
When using a CURLOPT_READFUNCTION(3) in a WebSocket transfer, any
|
||||
data returned by that function is sent as a *CURLWS_BINARY* frame
|
||||
with the length being the amount of data read.
|
||||
|
||||
To send larger frames or frames of a different type, call
|
||||
curl_ws_start_frame() from within the read function and then return
|
||||
the data belonging to the frame.
|
||||
|
||||
The function fails, if a previous frame has not been completely
|
||||
read yet. Also it fails in *CURLWS_RAW_MODE*.
|
||||
|
||||
The read function in libcurl usually treats a return value of 0
|
||||
as the end of file indication and stops any further reads. This
|
||||
would prevent sending WebSocket frames of length 0.
|
||||
|
||||
If the read function calls `curl_ws_start_frame()` however, a return
|
||||
value of 0 is *not* treated as an end of file and libcurl calls
|
||||
the read function again.
|
||||
|
||||
# FLAGS
|
||||
|
||||
Supports all flags documented in curl_ws_meta(3).
|
||||
|
||||
# %PROTOCOLS%
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
#include <string.h> /* for strlen */
|
||||
|
||||
struct read_ctx {
|
||||
CURL *easy;
|
||||
char *message;
|
||||
size_t msg_len;
|
||||
size_t nsent;
|
||||
};
|
||||
|
||||
static size_t readcb(char *buf, size_t nitems, size_t buflen, void *p)
|
||||
{
|
||||
struct read_ctx *ctx = p;
|
||||
size_t len = nitems * buflen;
|
||||
size_t left = ctx->msg_len - ctx->nsent;
|
||||
CURLcode result;
|
||||
|
||||
if(!ctx->nsent) {
|
||||
/* Want to send TEXT frame. */
|
||||
result = curl_ws_start_frame(ctx->easy, CURLWS_TEXT,
|
||||
(curl_off_t)ctx->msg_len);
|
||||
if(result) {
|
||||
fprintf(stderr, "error starting frame: %d\n", result);
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
if(left) {
|
||||
if(left < len)
|
||||
len = left;
|
||||
memcpy(buf, ctx->message + ctx->nsent, len);
|
||||
ctx->nsent += len;
|
||||
return len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *easy;
|
||||
struct read_ctx rctx;
|
||||
CURLcode res;
|
||||
|
||||
easy = curl_easy_init();
|
||||
if(!easy)
|
||||
return 1;
|
||||
|
||||
curl_easy_setopt(easy, CURLOPT_URL, "wss://example.com");
|
||||
curl_easy_setopt(easy, CURLOPT_READFUNCTION, readcb);
|
||||
/* tell curl that we want to send the payload */
|
||||
memset(&rctx, 0, sizeof(rctx));
|
||||
rctx.easy = easy;
|
||||
rctx.message = "Hello, friend!";
|
||||
rctx.msg_len = strlen(rctx.message);
|
||||
curl_easy_setopt(easy, CURLOPT_READDATA, &rctx);
|
||||
curl_easy_setopt(easy, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
/* Perform the request, res gets the return code */
|
||||
res = curl_easy_perform(easy);
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(easy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
~~~
|
||||
|
||||
# %AVAILABILITY%
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
This function returns a CURLcode indicating success or error.
|
||||
|
||||
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
|
||||
libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
|
||||
there can be an error message stored in the error buffer when non-zero is
|
||||
returned.
|
||||
|
||||
Instead of blocking, the function returns **CURLE_AGAIN**. The correct
|
||||
behavior is then to wait for the socket to signal readability before calling
|
||||
this function again.
|
||||
|
||||
Any other non-zero return value indicates an error. See the libcurl-errors(3)
|
||||
man page for the full list with descriptions.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: libcurl-easy
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- curl_easy_cleanup (3)
|
||||
- curl_easy_init (3)
|
||||
- curl_easy_setopt (3)
|
||||
- libcurl (3)
|
||||
- libcurl-errors (3)
|
||||
- libcurl-multi (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: 7.1
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
libcurl-easy - easy interface overview
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
When using libcurl's "easy" interface you init your session and get a handle
|
||||
(often referred to as an "easy handle"), which you use as input to the easy
|
||||
interface functions you use. Use curl_easy_init(3) to get the handle.
|
||||
|
||||
You continue by setting all the options you want in the upcoming transfer, the
|
||||
most important among them is the URL itself (you cannot transfer anything
|
||||
without a specified URL). You might want to set some callbacks as well that
|
||||
are called from the library when data is available etc. For example
|
||||
CURLOPT_WRITEFUNCTION(3). curl_easy_setopt(3) is used for all this.
|
||||
|
||||
CURLOPT_URL(3) is the only option you really must set, as otherwise there can
|
||||
be no transfer. Another commonly used option is CURLOPT_VERBOSE(3) that helps
|
||||
you see what libcurl is doing under the hood, which is useful when debugging
|
||||
for example. The curl_easy_setopt(3) man page has a full index of the over 300
|
||||
available options.
|
||||
|
||||
If you at any point would like to blank all previously set options for a
|
||||
single easy handle, you can call curl_easy_reset(3) and you can also make a
|
||||
clone of an easy handle (with all its set options) using
|
||||
curl_easy_duphandle(3).
|
||||
|
||||
When all is setup, you tell libcurl to perform the transfer using
|
||||
curl_easy_perform(3). It performs the entire transfer operation and does not
|
||||
return until it is done (successfully or not).
|
||||
|
||||
After the transfer has been made, you can set new options and make another
|
||||
transfer, or if you are done, cleanup the session by calling
|
||||
curl_easy_cleanup(3). If you want persistent connections, you do not cleanup
|
||||
immediately, but instead run ahead and perform other transfers using the same
|
||||
easy handle.
|
||||
@@ -0,0 +1,171 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: libcurl-env-dbg
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- libcurl-env (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: n/a
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
libcurl-env-dbg - environment variables libcurl DEBUGBUILD understands
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This is a set of variables only recognized and used if libcurl was built
|
||||
"debug enabled", which should never be true for a library used in production.
|
||||
These variables are intended for internal use only, subject to change and have
|
||||
many effects on the behavior of libcurl. Refer to the source code to determine
|
||||
how exactly they are being used.
|
||||
|
||||
## `CURL_ALTSVC_HTTP`
|
||||
|
||||
Bypass the AltSvc HTTPS protocol restriction if this variable exists.
|
||||
|
||||
## `CURL_DBG_SOCK_RBLOCK`
|
||||
|
||||
The percentage of recv() calls that should be answered with an EAGAIN at
|
||||
random. For TCP/UNIX sockets.
|
||||
|
||||
## `CURL_DBG_SOCK_RMAX`
|
||||
|
||||
The maximum data that shall be received from the network in one recv() call.
|
||||
For TCP/UNIX sockets. This is applied to every recv.
|
||||
|
||||
Example: **CURL_DBG_SOCK_RMAX=400** means recv buffer size is limited to a
|
||||
maximum of 400 bytes.
|
||||
|
||||
## `CURL_DBG_SOCK_WBLOCK`
|
||||
|
||||
The percentage of send() calls that should be answered with an EAGAIN at
|
||||
random. For TCP/UNIX sockets.
|
||||
|
||||
## `CURL_DBG_SOCK_WPARTIAL`
|
||||
|
||||
The percentage of data that shall be written to the network. For TCP/UNIX
|
||||
sockets. This is applied to every send.
|
||||
|
||||
Example: **CURL_DBG_SOCK_WPARTIAL=80** means a send with 1000 bytes would
|
||||
only send 800.
|
||||
|
||||
## `CURL_DBG_QUIC_WBLOCK`
|
||||
|
||||
The percentage of send() calls that should be answered with EAGAIN at random.
|
||||
QUIC only.
|
||||
|
||||
## `CURL_DEBUG`
|
||||
|
||||
Trace logging behavior as an alternative to calling curl_global_trace(3).
|
||||
|
||||
Example: **CURL_DEBUG=http/2** means trace details about HTTP/2 handling.
|
||||
|
||||
In the curl command line tool, built with `--enable-debug`, this environment
|
||||
variable adds to arguments like `--verbose`, `-vvv`. At least a single `-v`
|
||||
is needed to make the run emit trace output, but when it does, the contents
|
||||
of `CURL_DEBUG` are added and can override existing options.
|
||||
|
||||
Example: **CURL_DEBUG=tcp,-http/2 curl -vv url** means trace protocol details,
|
||||
triggered by `-vv`, add tracing of TCP in addition and remove tracing of
|
||||
HTTP/2.
|
||||
|
||||
## `CURL_DEBUG_SIZE`
|
||||
|
||||
Fake the size returned by CURLINFO_HEADER_SIZE and CURLINFO_REQUEST_SIZE.
|
||||
|
||||
## `CURL_DNS_SERVER`
|
||||
|
||||
When built with c-ares for name resolving, setting this environment variable
|
||||
to `[IP:port]` makes libcurl use that DNS server instead of the system
|
||||
default. This is used by the curl test suite.
|
||||
|
||||
## `CURL_FTP_PWD_STOP`
|
||||
|
||||
When set, the first transfer - when using ftp: - returns before sending
|
||||
the `PWD` command and stop any further progress. This is used to test
|
||||
an edge case
|
||||
|
||||
## `CURL_GETHOSTNAME`
|
||||
|
||||
Fake the local machine's unqualified hostname for NTLM and SMTP.
|
||||
|
||||
## `CURL_HSTS_HTTP`
|
||||
|
||||
Bypass the HSTS HTTPS protocol restriction if this variable exists.
|
||||
|
||||
## `CURL_FORCETIME`
|
||||
|
||||
A time of 0 is used for AWS signatures and NTLM if this variable exists.
|
||||
|
||||
## `CURL_ENTROPY`
|
||||
|
||||
A fixed faked value to use instead of a proper random number so that functions
|
||||
in libcurl that are otherwise getting random outputs can be tested for what
|
||||
they generate.
|
||||
|
||||
## `CURL_SMALLREQSEND`
|
||||
|
||||
An alternative size of HTTP data to be sent at a time only if smaller than the
|
||||
current.
|
||||
|
||||
## `CURL_SMALLSENDS`
|
||||
|
||||
An alternative size of socket data to be sent at a time only if smaller than
|
||||
the current.
|
||||
|
||||
## `CURL_TIME`
|
||||
|
||||
Fake Unix timestamp to use for AltSvc, HSTS and CURLINFO variables that are
|
||||
time related.
|
||||
|
||||
This variable can also be used to fake the data returned by some CURLINFO
|
||||
variables that are not time-related (such as CURLINFO_LOCAL_PORT), and in that
|
||||
case the value is not a timestamp.
|
||||
|
||||
## `CURL_TRACE`
|
||||
|
||||
LDAP tracing is enabled if this variable exists and its value is 1 or greater.
|
||||
|
||||
OpenLDAP tracing is separate. Refer to CURL_OPENLDAP_TRACE.
|
||||
|
||||
## `CURL_OPENLDAP_TRACE`
|
||||
|
||||
OpenLDAP tracing is enabled if this variable exists and its value is 1 or
|
||||
greater. There is a number of debug levels, refer to *openldap.c* comments.
|
||||
|
||||
## `CURL_WS_CHUNK_SIZE`
|
||||
|
||||
Used to influence the buffer chunk size used for WebSocket encoding and
|
||||
decoding.
|
||||
|
||||
## `CURL_WS_CHUNK_EAGAIN`
|
||||
|
||||
Used to simulate blocking sends after this chunk size for WebSocket
|
||||
connections.
|
||||
|
||||
## `CURL_WS_FORCE_ZERO_MASK`
|
||||
|
||||
Used to set the bitmask of all sent WebSocket frames to zero. The value of the
|
||||
environment variable does not matter.
|
||||
|
||||
## `CURL_FORBID_REUSE`
|
||||
|
||||
Used to set the CURLOPT_FORBID_REUSE flag on each transfer initiated
|
||||
by the curl command line tool. The value of the environment variable
|
||||
does not matter.
|
||||
|
||||
## `CURL_GRACEFUL_SHUTDOWN`
|
||||
|
||||
Make a blocking, graceful shutdown of all remaining connections when
|
||||
a multi handle is destroyed. This implicitly triggers for easy handles
|
||||
that are run via easy_perform. The value of the environment variable
|
||||
gives the shutdown timeout in milliseconds.
|
||||
|
||||
## `CURL_H2_STREAM_WIN_MAX`
|
||||
|
||||
Set to a positive 32-bit number to override the HTTP/2 stream window's
|
||||
default of 10MB. Used in testing to verify correct window update handling.
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: libcurl-env
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- libcurl-env-dbg (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: n/a
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
libcurl-env - environment variables libcurl understands
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
libcurl reads and understands a set of environment variables that if set
|
||||
controls and changes behaviors. This is the full list of variables to set and
|
||||
description of what they do. Also note that curl, the command line tool,
|
||||
supports a set of additional environment variables independently of this.
|
||||
|
||||
## `[scheme]_proxy`
|
||||
|
||||
When libcurl is given a URL to use in a transfer, it first extracts the scheme
|
||||
part from the URL and checks if there is a given proxy set for that in its
|
||||
corresponding environment variable. A URL like https://example.com makes
|
||||
libcurl use the **http_proxy** variable, while a URL like ftp://example.com
|
||||
uses the **ftp_proxy** variable.
|
||||
|
||||
These proxy variables are also checked for in their uppercase versions, except
|
||||
the **http_proxy** one which is only used lowercase. Note also that some
|
||||
systems actually have a case insensitive handling of environment variables and
|
||||
then of course **HTTP_PROXY** still works.
|
||||
|
||||
An exception exists for the WebSocket **ws** and **wss** URL schemes, where
|
||||
libcurl first checks **ws_proxy** or **wss_proxy** but if they are not set, it
|
||||
falls back and tries the http and https versions instead if set.
|
||||
|
||||
## `ALL_PROXY`
|
||||
|
||||
This is a setting to set proxy for all URLs, independently of what scheme is
|
||||
being used. Note that the scheme specific variables overrides this one if set.
|
||||
|
||||
## `CURL_SSL_BACKEND`
|
||||
|
||||
When libcurl is built to support multiple SSL backends, it selects a specific
|
||||
backend at first use. If no selection is done by the program using libcurl,
|
||||
this variable's selection is used. Setting a name that is not a built-in
|
||||
alternative makes libcurl stay with the default.
|
||||
|
||||
SSL backend names (case-insensitive): GnuTLS, mbedTLS, OpenSSL, Rustls,
|
||||
Schannel, wolfSSL
|
||||
|
||||
## `HOME`
|
||||
|
||||
When the netrc feature is used (CURLOPT_NETRC(3)), this variable is
|
||||
checked as the primary way to find the "current" home directory in which
|
||||
the .netrc file is likely to exist.
|
||||
|
||||
## `USERPROFILE`
|
||||
|
||||
When the netrc feature is used (CURLOPT_NETRC(3)), this variable is
|
||||
checked as the secondary way to find the "current" home directory (on Windows
|
||||
only) in which the .netrc file is likely to exist.
|
||||
|
||||
## `NETRC`
|
||||
|
||||
The filename used as netrc file when CURLOPT_NETRC(3) is used without
|
||||
CURLOPT_NETRC_FILE(3). (Added in 8.16.0)
|
||||
|
||||
## `NO_PROXY`
|
||||
|
||||
This has the same functionality as the CURLOPT_NOPROXY(3) option: it
|
||||
gives libcurl a comma-separated list of hostname patterns for which libcurl
|
||||
should not use a proxy.
|
||||
|
||||
## `SSLKEYLOGFILE`
|
||||
|
||||
When set and libcurl runs with an SSL backend that supports this feature,
|
||||
libcurl saves SSL secrets into the given filename. Using those SSL secrets,
|
||||
other tools (such as Wireshark) can decrypt the SSL communication and
|
||||
analyze/view the traffic.
|
||||
|
||||
These secrets and this file might be sensitive. Users are advised to take
|
||||
precautions so that they are not stolen or otherwise inadvertently revealed.
|
||||
|
||||
# Debug Variables
|
||||
|
||||
Debug variables are intended for internal use and are documented in
|
||||
libcurl-env-dbg(3).
|
||||
+764
@@ -0,0 +1,764 @@
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: libcurl-errors
|
||||
Section: 3
|
||||
Source: libcurl
|
||||
See-also:
|
||||
- CURLOPT_DEBUGFUNCTION (3)
|
||||
- CURLOPT_ERRORBUFFER (3)
|
||||
- CURLOPT_VERBOSE (3)
|
||||
- curl_easy_strerror (3)
|
||||
- curl_multi_strerror (3)
|
||||
- curl_share_strerror (3)
|
||||
- curl_url_strerror (3)
|
||||
Protocol:
|
||||
- All
|
||||
Added-in: n/a
|
||||
---
|
||||
|
||||
# NAME
|
||||
|
||||
libcurl-errors - error codes in libcurl
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This man page includes most, if not all, available error codes in libcurl.
|
||||
Why they occur and possibly what you can do to fix the problem are also included.
|
||||
|
||||
# CURLcode
|
||||
|
||||
Almost all "easy" interface functions return a CURLcode error code. No matter
|
||||
what, using the curl_easy_setopt(3) option CURLOPT_ERRORBUFFER(3)
|
||||
is a good idea as it gives you a human readable error string that may offer
|
||||
more details about the cause of the error than just the error code.
|
||||
curl_easy_strerror(3) can be called to get an error string from a given
|
||||
CURLcode number.
|
||||
|
||||
CURLcode is one of the following:
|
||||
|
||||
## CURLE_OK (0)
|
||||
|
||||
All fine. Proceed as usual.
|
||||
|
||||
## CURLE_UNSUPPORTED_PROTOCOL (1)
|
||||
|
||||
The URL you passed to libcurl used a protocol that this libcurl does not
|
||||
support. The support might be a compile-time option that you did not use, it
|
||||
can be a misspelled protocol string or just a protocol libcurl has no code
|
||||
for.
|
||||
|
||||
## CURLE_FAILED_INIT (2)
|
||||
|
||||
Early initialization code failed. This is likely to be an internal error or
|
||||
problem, or a resource problem where something fundamental could not get done
|
||||
at init time.
|
||||
|
||||
## CURLE_URL_MALFORMAT (3)
|
||||
|
||||
The URL was not properly formatted.
|
||||
|
||||
## CURLE_NOT_BUILT_IN (4)
|
||||
|
||||
A requested feature, protocol or option was not found built into this libcurl
|
||||
due to a build-time decision. This means that a feature or option was not
|
||||
enabled or explicitly disabled when libcurl was built and in order to get it
|
||||
to function you have to get a rebuilt libcurl.
|
||||
|
||||
## CURLE_COULDNT_RESOLVE_PROXY (5)
|
||||
|
||||
Could not resolve proxy. The given proxy host could not be resolved.
|
||||
|
||||
## CURLE_COULDNT_RESOLVE_HOST (6)
|
||||
|
||||
Could not resolve host. The given remote host was not resolved.
|
||||
|
||||
## CURLE_COULDNT_CONNECT (7)
|
||||
|
||||
Failed to connect() to host or proxy.
|
||||
|
||||
## CURLE_WEIRD_SERVER_REPLY (8)
|
||||
|
||||
The server sent data libcurl could not parse. This error code was known as
|
||||
*CURLE_FTP_WEIRD_SERVER_REPLY* before 7.51.0.
|
||||
|
||||
## CURLE_REMOTE_ACCESS_DENIED (9)
|
||||
|
||||
We were denied access to the resource given in the URL. For FTP, this occurs
|
||||
while trying to change to the remote directory.
|
||||
|
||||
## CURLE_FTP_ACCEPT_FAILED (10)
|
||||
|
||||
While waiting for the server to connect back when an active FTP session is
|
||||
used, an error code was sent over the control connection or similar.
|
||||
|
||||
## CURLE_FTP_WEIRD_PASS_REPLY (11)
|
||||
|
||||
After having sent the FTP password to the server, libcurl expects a proper
|
||||
reply. This error code indicates that an unexpected code was returned.
|
||||
|
||||
## CURLE_FTP_ACCEPT_TIMEOUT (12)
|
||||
|
||||
During an active FTP session while waiting for the server to connect, the
|
||||
CURLOPT_ACCEPTTIMEOUT_MS(3) (or the internal default) timeout expired.
|
||||
|
||||
## CURLE_FTP_WEIRD_PASV_REPLY (13)
|
||||
|
||||
libcurl failed to get a sensible result back from the server as a response to
|
||||
either a PASV or an EPSV command. The server is flawed.
|
||||
|
||||
## CURLE_FTP_WEIRD_227_FORMAT (14)
|
||||
|
||||
FTP servers return a 227-line as a response to a PASV command. If libcurl
|
||||
fails to parse that line, this return code is passed back.
|
||||
|
||||
## CURLE_FTP_CANT_GET_HOST (15)
|
||||
|
||||
An internal failure to lookup the host used for the new connection.
|
||||
|
||||
## CURLE_HTTP2 (16)
|
||||
|
||||
A problem was detected in the HTTP2 framing layer. This is somewhat generic
|
||||
and can be one out of several problems, see the error buffer for details.
|
||||
|
||||
## CURLE_FTP_COULDNT_SET_TYPE (17)
|
||||
|
||||
Received an error when trying to set the transfer mode to binary or ASCII.
|
||||
|
||||
## CURLE_PARTIAL_FILE (18)
|
||||
|
||||
A file transfer was shorter or larger than expected. This happens when the
|
||||
server first reports an expected transfer size, and then delivers data that
|
||||
does not match the previously given size.
|
||||
|
||||
## CURLE_FTP_COULDNT_RETR_FILE (19)
|
||||
|
||||
This was either a weird reply to a 'RETR' command or a zero byte transfer
|
||||
complete.
|
||||
|
||||
## Obsolete error (20)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_QUOTE_ERROR (21)
|
||||
|
||||
When sending custom "QUOTE" commands to the remote server, one of the commands
|
||||
returned an error code that was 400 or higher (for FTP) or otherwise
|
||||
indicated unsuccessful completion of the command.
|
||||
|
||||
## CURLE_HTTP_RETURNED_ERROR (22)
|
||||
|
||||
This is returned if CURLOPT_FAILONERROR(3) is set TRUE and the HTTP server
|
||||
returns an error code that is \>= 400.
|
||||
|
||||
## CURLE_WRITE_ERROR (23)
|
||||
|
||||
An error occurred when writing received data to a local file, or an error was
|
||||
returned to libcurl from a write callback.
|
||||
|
||||
## Obsolete error (24)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_UPLOAD_FAILED (25)
|
||||
|
||||
Failed starting the upload. For FTP, the server typically denied the STOR
|
||||
command. The error buffer usually contains the server's explanation for this.
|
||||
|
||||
## CURLE_READ_ERROR (26)
|
||||
|
||||
There was a problem reading a local file or an error returned by the read
|
||||
callback.
|
||||
|
||||
## CURLE_OUT_OF_MEMORY (27)
|
||||
|
||||
A memory allocation request failed. This is serious badness and
|
||||
things are severely screwed up if this ever occurs.
|
||||
|
||||
## CURLE_OPERATION_TIMEDOUT (28)
|
||||
|
||||
Operation timeout. The specified time-out period was reached according to the
|
||||
conditions.
|
||||
|
||||
## Obsolete error (29)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_FTP_PORT_FAILED (30)
|
||||
|
||||
The FTP PORT command returned error. This mostly happens when you have not
|
||||
specified a good enough address for libcurl to use. See
|
||||
CURLOPT_FTPPORT(3).
|
||||
|
||||
## CURLE_FTP_COULDNT_USE_REST (31)
|
||||
|
||||
The FTP REST command returned error. This should never happen if the server is
|
||||
sane.
|
||||
|
||||
## Obsolete error (32)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_RANGE_ERROR (33)
|
||||
|
||||
The server does not support or accept range requests.
|
||||
|
||||
## Obsolete error (34)
|
||||
|
||||
Not used since 7.56.0.
|
||||
|
||||
## CURLE_SSL_CONNECT_ERROR (35)
|
||||
|
||||
A problem occurred somewhere in the SSL/TLS handshake. You really want the
|
||||
error buffer and read the message there as it pinpoints the problem slightly
|
||||
more. Could be certificates (file formats, paths, permissions), passwords, and
|
||||
others.
|
||||
|
||||
## CURLE_BAD_DOWNLOAD_RESUME (36)
|
||||
|
||||
The download could not be resumed because the specified offset was out of the
|
||||
file boundary.
|
||||
|
||||
## CURLE_FILE_COULDNT_READ_FILE (37)
|
||||
|
||||
A file given with FILE:// could not be opened. Most likely because the file
|
||||
path does not identify an existing file. Did you check file permissions?
|
||||
|
||||
## CURLE_LDAP_CANNOT_BIND (38)
|
||||
|
||||
LDAP cannot bind. LDAP bind operation failed.
|
||||
|
||||
## CURLE_LDAP_SEARCH_FAILED (39)
|
||||
|
||||
LDAP search failed.
|
||||
|
||||
## Obsolete error (40)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## Obsolete error (41)
|
||||
|
||||
Not used since 7.53.0.
|
||||
|
||||
## CURLE_ABORTED_BY_CALLBACK (42)
|
||||
|
||||
Aborted by callback. A callback returned "abort" to libcurl.
|
||||
|
||||
## CURLE_BAD_FUNCTION_ARGUMENT (43)
|
||||
|
||||
A function was called with a bad parameter.
|
||||
|
||||
## Obsolete error (44)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_INTERFACE_FAILED (45)
|
||||
|
||||
Interface error. A specified outgoing interface could not be used. Set which
|
||||
interface to use for outgoing connections' source IP address with
|
||||
CURLOPT_INTERFACE(3).
|
||||
|
||||
## Obsolete error (46)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_TOO_MANY_REDIRECTS (47)
|
||||
|
||||
Too many redirects. When following redirects, libcurl hit the maximum amount.
|
||||
Set your limit with CURLOPT_MAXREDIRS(3).
|
||||
|
||||
## CURLE_UNKNOWN_OPTION (48)
|
||||
|
||||
An option passed to libcurl is not recognized/known. Refer to the appropriate
|
||||
documentation. This is most likely a problem in the program that uses
|
||||
libcurl. The error buffer might contain more specific information about which
|
||||
exact option it concerns.
|
||||
|
||||
## CURLE_SETOPT_OPTION_SYNTAX (49)
|
||||
|
||||
An option passed in to a setopt was wrongly formatted. See error message for
|
||||
details about what option.
|
||||
|
||||
## Obsolete errors (50-51)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_GOT_NOTHING (52)
|
||||
|
||||
Nothing was returned from the server, and under the circumstances, getting
|
||||
nothing is considered an error.
|
||||
|
||||
## CURLE_SSL_ENGINE_NOTFOUND (53)
|
||||
|
||||
The specified crypto engine was not found.
|
||||
|
||||
## CURLE_SSL_ENGINE_SETFAILED (54)
|
||||
|
||||
Failed setting the selected SSL crypto engine as default.
|
||||
|
||||
## CURLE_SEND_ERROR (55)
|
||||
|
||||
Failed sending network data.
|
||||
|
||||
## CURLE_RECV_ERROR (56)
|
||||
|
||||
Failure with receiving network data.
|
||||
|
||||
## Obsolete error (57)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_SSL_CERTPROBLEM (58)
|
||||
|
||||
problem with the local client certificate.
|
||||
|
||||
## CURLE_SSL_CIPHER (59)
|
||||
|
||||
Could not use specified cipher.
|
||||
|
||||
## CURLE_PEER_FAILED_VERIFICATION (60)
|
||||
|
||||
The remote server's SSL certificate or SSH fingerprint was deemed not OK.
|
||||
This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its
|
||||
previous value was 51.
|
||||
|
||||
## CURLE_BAD_CONTENT_ENCODING (61)
|
||||
|
||||
Unrecognized transfer encoding.
|
||||
|
||||
## Obsolete error (62)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_FILESIZE_EXCEEDED (63)
|
||||
|
||||
Maximum file size exceeded.
|
||||
|
||||
## CURLE_USE_SSL_FAILED (64)
|
||||
|
||||
Requested FTP SSL level failed.
|
||||
|
||||
## CURLE_SEND_FAIL_REWIND (65)
|
||||
|
||||
When doing a send operation curl had to rewind the data to retransmit, but the
|
||||
rewinding operation failed.
|
||||
|
||||
## CURLE_SSL_ENGINE_INITFAILED (66)
|
||||
|
||||
Initiating the SSL Engine failed.
|
||||
|
||||
## CURLE_LOGIN_DENIED (67)
|
||||
|
||||
The remote server denied curl to login
|
||||
|
||||
## CURLE_TFTP_NOTFOUND (68)
|
||||
|
||||
File not found on TFTP server.
|
||||
|
||||
## CURLE_TFTP_PERM (69)
|
||||
|
||||
Permission problem on TFTP server.
|
||||
|
||||
## CURLE_REMOTE_DISK_FULL (70)
|
||||
|
||||
Out of disk space on the server.
|
||||
|
||||
## CURLE_TFTP_ILLEGAL (71)
|
||||
|
||||
Illegal TFTP operation.
|
||||
|
||||
## CURLE_TFTP_UNKNOWNID (72)
|
||||
|
||||
Unknown TFTP transfer ID.
|
||||
|
||||
## CURLE_REMOTE_FILE_EXISTS (73)
|
||||
|
||||
File already exists and is not overwritten.
|
||||
|
||||
## CURLE_TFTP_NOSUCHUSER (74)
|
||||
|
||||
This error should never be returned by a properly functioning TFTP server.
|
||||
|
||||
## Obsolete error (75-76)
|
||||
|
||||
Not used in modern versions.
|
||||
|
||||
## CURLE_SSL_CACERT_BADFILE (77)
|
||||
|
||||
Problem with reading the SSL CA cert (path? access rights?)
|
||||
|
||||
## CURLE_REMOTE_FILE_NOT_FOUND (78)
|
||||
|
||||
The resource referenced in the URL does not exist.
|
||||
|
||||
## CURLE_SSH (79)
|
||||
|
||||
An unspecified error occurred during the SSH session.
|
||||
|
||||
## CURLE_SSL_SHUTDOWN_FAILED (80)
|
||||
|
||||
Failed to shut down the SSL connection.
|
||||
|
||||
## CURLE_AGAIN (81)
|
||||
|
||||
Socket is not ready for send/recv. Wait until it is ready and try again. This
|
||||
return code is only returned from curl_easy_recv(3) and curl_easy_send(3)
|
||||
|
||||
## CURLE_SSL_CRL_BADFILE (82)
|
||||
|
||||
Failed to load CRL file
|
||||
|
||||
## CURLE_SSL_ISSUER_ERROR (83)
|
||||
|
||||
Issuer check failed
|
||||
|
||||
## CURLE_FTP_PRET_FAILED (84)
|
||||
|
||||
The FTP server does not understand the PRET command at all or does not support
|
||||
the given argument. Be careful when using CURLOPT_CUSTOMREQUEST(3), a
|
||||
custom LIST command is sent with the PRET command before PASV as well.
|
||||
|
||||
## CURLE_RTSP_CSEQ_ERROR (85)
|
||||
|
||||
Mismatch of RTSP CSeq numbers.
|
||||
|
||||
## CURLE_RTSP_SESSION_ERROR (86)
|
||||
|
||||
Mismatch of RTSP Session Identifiers.
|
||||
|
||||
## CURLE_FTP_BAD_FILE_LIST (87)
|
||||
|
||||
Unable to parse FTP file list (during FTP wildcard downloading).
|
||||
|
||||
## CURLE_CHUNK_FAILED (88)
|
||||
|
||||
Chunk callback reported error.
|
||||
|
||||
## CURLE_NO_CONNECTION_AVAILABLE (89)
|
||||
|
||||
(For internal use only, is never returned by libcurl) No connection available,
|
||||
the session is queued.
|
||||
|
||||
## CURLE_SSL_PINNEDPUBKEYNOTMATCH (90)
|
||||
|
||||
Failed to match the pinned key specified with CURLOPT_PINNEDPUBLICKEY(3).
|
||||
|
||||
## CURLE_SSL_INVALIDCERTSTATUS (91)
|
||||
|
||||
Status returned failure when asked with CURLOPT_SSL_VERIFYSTATUS(3).
|
||||
|
||||
## CURLE_HTTP2_STREAM (92)
|
||||
|
||||
Stream error in the HTTP/2 framing layer.
|
||||
|
||||
## CURLE_RECURSIVE_API_CALL (93)
|
||||
|
||||
An API function was called from inside a callback.
|
||||
|
||||
## CURLE_AUTH_ERROR (94)
|
||||
|
||||
An authentication function returned an error.
|
||||
|
||||
## CURLE_HTTP3 (95)
|
||||
|
||||
A problem was detected in the HTTP/3 layer. This is somewhat generic and can
|
||||
be one out of several problems, see the error buffer for details.
|
||||
|
||||
## CURLE_QUIC_CONNECT_ERROR (96)
|
||||
|
||||
QUIC connection error. This error may be caused by an SSL library error. QUIC
|
||||
is the protocol used for HTTP/3 transfers.
|
||||
|
||||
## CURLE_PROXY (97)
|
||||
|
||||
Proxy handshake error. CURLINFO_PROXY_ERROR(3) provides extra details on
|
||||
the specific problem.
|
||||
|
||||
## CURLE_SSL_CLIENTCERT (98)
|
||||
|
||||
SSL Client Certificate required.
|
||||
|
||||
## CURLE_UNRECOVERABLE_POLL (99)
|
||||
|
||||
An internal call to poll() or select() returned error that is not recoverable.
|
||||
|
||||
## CURLE_TOO_LARGE (100)
|
||||
|
||||
A value or data field grew larger than allowed.
|
||||
|
||||
## CURLE_ECH_REQUIRED (101)"
|
||||
|
||||
ECH was attempted but failed.
|
||||
|
||||
# CURLMcode
|
||||
|
||||
This is the generic return code used by functions in the libcurl multi
|
||||
interface. Also consider curl_multi_strerror(3).
|
||||
|
||||
## CURLM_CALL_MULTI_PERFORM (-1)
|
||||
|
||||
This is not really an error. It means you should call
|
||||
curl_multi_perform(3) again without doing select() or similar in
|
||||
between. Before version 7.20.0 (released on February 9 2010) this could be returned by
|
||||
curl_multi_perform(3), but in later versions this return code is never
|
||||
used.
|
||||
|
||||
## CURLM_CALL_MULTI_SOCKET (-1)
|
||||
|
||||
An alias for *CURLM_CALL_MULTI_PERFORM*. Never returned by modern libcurl
|
||||
versions.
|
||||
|
||||
## CURLM_OK (0)
|
||||
|
||||
Things are fine.
|
||||
|
||||
## CURLM_BAD_HANDLE (1)
|
||||
|
||||
The passed-in handle is not a valid *CURLM* handle.
|
||||
|
||||
## CURLM_BAD_EASY_HANDLE (2)
|
||||
|
||||
An easy handle was not good/valid. It could mean that it is not an easy handle
|
||||
at all, or possibly that the handle already is in use by this or another multi
|
||||
handle.
|
||||
|
||||
## CURLM_OUT_OF_MEMORY (3)
|
||||
|
||||
You are doomed.
|
||||
|
||||
## CURLM_INTERNAL_ERROR (4)
|
||||
|
||||
This can only be returned if libcurl bugs. Please report it to us.
|
||||
|
||||
## CURLM_BAD_SOCKET (5)
|
||||
|
||||
The passed-in socket is not a valid one that libcurl already knows about.
|
||||
|
||||
## CURLM_UNKNOWN_OPTION (6)
|
||||
|
||||
curl_multi_setopt() with unsupported option
|
||||
|
||||
## CURLM_ADDED_ALREADY (7)
|
||||
|
||||
An easy handle already added to a multi handle was attempted to get added a
|
||||
second time.
|
||||
|
||||
## CURLM_RECURSIVE_API_CALL (8)
|
||||
|
||||
An API function was called from inside a callback.
|
||||
|
||||
## CURLM_WAKEUP_FAILURE (9)
|
||||
|
||||
Wake up is unavailable or failed.
|
||||
|
||||
## CURLM_BAD_FUNCTION_ARGUMENT (10)
|
||||
|
||||
A function was called with a bad parameter.
|
||||
|
||||
## CURLM_ABORTED_BY_CALLBACK (11)
|
||||
|
||||
A multi handle callback returned error.
|
||||
|
||||
## CURLM_UNRECOVERABLE_POLL (12)
|
||||
|
||||
An internal call to poll() or select() returned error that is not recoverable.
|
||||
|
||||
# CURLSHcode
|
||||
|
||||
The "share" interface returns a **CURLSHcode** to indicate when an error has
|
||||
occurred. Also consider curl_share_strerror(3).
|
||||
|
||||
## CURLSHE_OK (0)
|
||||
|
||||
All fine. Proceed as usual.
|
||||
|
||||
## CURLSHE_BAD_OPTION (1)
|
||||
|
||||
An invalid option was passed to the function.
|
||||
|
||||
## CURLSHE_IN_USE (2)
|
||||
|
||||
The share object is currently in use.
|
||||
|
||||
## CURLSHE_INVALID (3)
|
||||
|
||||
An invalid share object was passed to the function.
|
||||
|
||||
## CURLSHE_NOMEM (4)
|
||||
|
||||
Not enough memory was available.
|
||||
|
||||
## CURLSHE_NOT_BUILT_IN (5)
|
||||
|
||||
The requested sharing could not be done because the library you use do not have
|
||||
that particular feature enabled.
|
||||
|
||||
# CURLUcode
|
||||
|
||||
The URL interface returns a *CURLUcode* to indicate when an error has
|
||||
occurred. Also consider curl_url_strerror(3).
|
||||
|
||||
## CURLUE_OK (0)
|
||||
|
||||
All fine. Proceed as usual.
|
||||
|
||||
## CURLUE_BAD_HANDLE (1)
|
||||
|
||||
An invalid URL handle was passed as argument.
|
||||
|
||||
## CURLUE_BAD_PARTPOINTER (2)
|
||||
|
||||
An invalid 'part' argument was passed as argument.
|
||||
|
||||
## CURLUE_MALFORMED_INPUT (3)
|
||||
|
||||
A malformed input was passed to a URL API function.
|
||||
|
||||
## CURLUE_BAD_PORT_NUMBER (4)
|
||||
|
||||
The port number was not a decimal number between 0 and 65535.
|
||||
|
||||
## CURLUE_UNSUPPORTED_SCHEME (5)
|
||||
|
||||
This libcurl build does not support the given URL scheme.
|
||||
|
||||
## CURLUE_URLDECODE (6)
|
||||
|
||||
URL decode error, most likely because of rubbish in the input.
|
||||
|
||||
## CURLUE_OUT_OF_MEMORY (7)
|
||||
|
||||
A memory function failed.
|
||||
|
||||
## CURLUE_USER_NOT_ALLOWED (8)
|
||||
|
||||
Credentials was passed in the URL when prohibited.
|
||||
|
||||
## CURLUE_UNKNOWN_PART (9)
|
||||
|
||||
An unknown part ID was passed to a URL API function.
|
||||
|
||||
## CURLUE_NO_SCHEME (10)
|
||||
|
||||
There is no scheme part in the URL.
|
||||
|
||||
## CURLUE_NO_USER (11)
|
||||
|
||||
There is no user part in the URL.
|
||||
|
||||
## CURLUE_NO_PASSWORD (12)
|
||||
|
||||
There is no password part in the URL.
|
||||
|
||||
## CURLUE_NO_OPTIONS (13)
|
||||
|
||||
There is no options part in the URL.
|
||||
|
||||
## CURLUE_NO_HOST (14)
|
||||
|
||||
There is no host part in the URL.
|
||||
|
||||
## CURLUE_NO_PORT (15)
|
||||
|
||||
There is no port part in the URL.
|
||||
|
||||
## CURLUE_NO_QUERY (16)
|
||||
|
||||
There is no query part in the URL.
|
||||
|
||||
## CURLUE_NO_FRAGMENT (17)
|
||||
|
||||
There is no fragment part in the URL.
|
||||
|
||||
## CURLUE_NO_ZONEID (18)
|
||||
|
||||
There is no zone id set in the URL.
|
||||
|
||||
## CURLUE_BAD_FILE_URL (19)
|
||||
|
||||
The file:// URL is invalid.
|
||||
|
||||
## CURLUE_BAD_FRAGMENT (20)
|
||||
|
||||
The fragment part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_HOSTNAME (21)
|
||||
|
||||
The hostname contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_IPV6 (22)
|
||||
|
||||
The IPv6 address hostname contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_LOGIN (23)
|
||||
|
||||
The login part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_PASSWORD (24)
|
||||
|
||||
The password part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_PATH (25)
|
||||
|
||||
The path part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_QUERY (26)
|
||||
|
||||
The query part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_SCHEME (27)
|
||||
|
||||
The scheme part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_BAD_SLASHES (28)
|
||||
|
||||
The URL contained an invalid number of slashes.
|
||||
|
||||
## CURLUE_BAD_USER (29)
|
||||
|
||||
The user part of the URL contained bad or invalid characters.
|
||||
|
||||
## CURLUE_LACKS_IDN (30)
|
||||
|
||||
libcurl lacks IDN support.
|
||||
|
||||
## CURLUE_TOO_LARGE (31)
|
||||
|
||||
A value or data field is larger than allowed.
|
||||
|
||||
# CURLHcode
|
||||
|
||||
The header interface returns a *CURLHcode* to indicate when an error has
|
||||
occurred.
|
||||
|
||||
## CURLHE_OK (0)
|
||||
|
||||
All fine. Proceed as usual.
|
||||
|
||||
## CURLHE_BADINDEX (1)
|
||||
|
||||
There is no header with the requested index.
|
||||
|
||||
## CURLHE_MISSING (2)
|
||||
|
||||
No such header exists.
|
||||
|
||||
## CURLHE_NOHEADERS (3)
|
||||
|
||||
No headers at all have been recorded.
|
||||
|
||||
## CURLHE_NOREQUEST (4)
|
||||
|
||||
There was no such request number.
|
||||
|
||||
## CURLHE_OUT_OF_MEMORY (5)
|
||||
|
||||
Out of resources
|
||||
|
||||
## CURLHE_BAD_ARGUMENT (6)
|
||||
|
||||
One or more of the given arguments are bad.
|
||||
|
||||
## CURLHE_NOT_BUILT_IN (7)
|
||||
|
||||
HTTP support or the header API has been disabled in the build.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user