← Commit list

cb521d1f9a

Daniel Stenberg
Daniel Stenberg
2023-12-04
SUCCESS Duration: 76s

Subject

docs: make all examples in all libcurl man pages compile

Binary

Download Binary (850 KB)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

$ git checkout -f cb521d1f9a09efef3436bbb0370bae3b5f5f33b5
Previous HEAD position was 0fbbc80b24 ngtcp2: ignore errors on unknown streams
HEAD is now at cb521d1f9a docs: make all examples in all libcurl man pages compile

$ git clean -fdx
Removing Makefile
Removing Makefile.in
Removing aclocal.m4
Removing autom4te.cache/
Removing compile
Removing config.guess
Removing config.log
Removing config.status
Removing config.sub
Removing configure
Removing curl-config
Removing depcomp
Removing docs/Makefile
Removing docs/Makefile.in
Removing docs/cmdline-opts/Makefile
Removing docs/cmdline-opts/Makefile.in
Removing docs/curl.1
Removing docs/examples/.deps/
Removing docs/examples/Makefile
Removing docs/examples/Makefile.in
Removing docs/libcurl/Makefile
Removing docs/libcurl/Makefile.in
Removing docs/libcurl/opts/Makefile
Removing docs/libcurl/opts/Makefile.in
Removing include/Makefile
Removing include/Makefile.in
Removing include/curl/Makefile
Removing include/curl/Makefile.in
Removing install-sh
Removing lib/.deps/
Removing lib/.dirstamp
Removing lib/.libs/
Removing lib/Makefile
Removing lib/Makefile.in
Removing lib/base64.o
Removing lib/curl_config.h
Removing lib/curl_config.h.in
Removing lib/curl_multibyte.o
Removing lib/dynbuf.o
Removing lib/libcurl.la
Removing lib/libcurl.plist
Removing lib/libcurl.vers
Removing lib/libcurl_la-altsvc.lo
Removing lib/libcurl_la-altsvc.o
Removing lib/libcurl_la-amigaos.lo
Removing lib/libcurl_la-amigaos.o
Removing lib/libcurl_la-asyn-ares.lo
Removing lib/libcurl_la-asyn-ares.o
Removing lib/libcurl_la-asyn-thread.lo
Removing lib/libcurl_la-asyn-thread.o
Removing lib/libcurl_la-base64.lo
Removing lib/libcurl_la-base64.o
Removing lib/libcurl_la-bufq.lo
Removing lib/libcurl_la-bufq.o
Removing lib/libcurl_la-bufref.lo
Removing lib/libcurl_la-bufref.o
Removing lib/libcurl_la-c-hyper.lo
Removing lib/libcurl_la-c-hyper.o
Removing lib/libcurl_la-cf-h1-proxy.lo
Removing lib/libcurl_la-cf-h1-proxy.o
Removing lib/libcurl_la-cf-h2-proxy.lo
Removing lib/libcurl_la-cf-h2-proxy.o
Removing lib/libcurl_la-cf-haproxy.lo
Removing lib/libcurl_la-cf-haproxy.o
Removing lib/libcurl_la-cf-https-connect.lo
Removing lib/libcurl_la-cf-https-connect.o
Removing lib/libcurl_la-cf-socket.lo
Removing lib/libcurl_la-cf-socket.o
Removing lib/libcurl_la-cfilters.lo
Removing lib/libcurl_la-cfilters.o
Removing lib/libcurl_la-conncache.lo
Removing lib/libcurl_la-conncache.o
Removing lib/libcurl_la-connect.lo
Removing lib/libcurl_la-connect.o
Removing lib/libcurl_la-content_encoding.lo
Removing lib/libcurl_la-content_encoding.o
Removing lib/libcurl_la-cookie.lo
Removing lib/libcurl_la-cookie.o
Removing lib/libcurl_la-curl_addrinfo.lo
Removing lib/libcurl_la-curl_addrinfo.o
Removing lib/libcurl_la-curl_des.lo
Removing lib/libcurl_la-curl_des.o
Removing lib/libcurl_la-curl_endian.lo
Removing lib/libcurl_la-curl_endian.o
Removing lib/libcurl_la-curl_fnmatch.lo
Removing lib/libcurl_la-curl_fnmatch.o
Removing lib/libcurl_la-curl_get_line.lo
Removing lib/libcurl_la-curl_get_line.o
Removing lib/libcurl_la-curl_gethostname.lo
Removing lib/libcurl_la-curl_gethostname.o
Removing lib/libcurl_la-curl_gssapi.lo
Removing lib/libcurl_la-curl_gssapi.o
Removing lib/libcurl_la-curl_memrchr.lo
Removing lib/libcurl_la-curl_memrchr.o
Removing lib/libcurl_la-curl_multibyte.lo
Removing lib/libcurl_la-curl_multibyte.o
Removing lib/libcurl_la-curl_ntlm_core.lo
Removing lib/libcurl_la-curl_ntlm_core.o
Removing lib/libcurl_la-curl_ntlm_wb.lo
Removing lib/libcurl_la-curl_ntlm_wb.o
Removing lib/libcurl_la-curl_path.lo
Removing lib/libcurl_la-curl_path.o
Removing lib/libcurl_la-curl_range.lo
Removing lib/libcurl_la-curl_range.o
Removing lib/libcurl_la-curl_rtmp.lo
Removing lib/libcurl_la-curl_rtmp.o
Removing lib/libcurl_la-curl_sasl.lo
Removing lib/libcurl_la-curl_sasl.o
Removing lib/libcurl_la-curl_sspi.lo
Removing lib/libcurl_la-curl_sspi.o
Removing lib/libcurl_la-curl_threads.lo
Removing lib/libcurl_la-curl_threads.o
Removing lib/libcurl_la-curl_trc.lo
Removing lib/libcurl_la-curl_trc.o
Removing lib/libcurl_la-dict.lo
Removing lib/libcurl_la-dict.o
Removing lib/libcurl_la-doh.lo
Removing lib/libcurl_la-doh.o
Removing lib/libcurl_la-dynbuf.lo
Removing lib/libcurl_la-dynbuf.o
Removing lib/libcurl_la-dynhds.lo
Removing lib/libcurl_la-dynhds.o
Removing lib/libcurl_la-easy.lo
Removing lib/libcurl_la-easy.o
Removing lib/libcurl_la-easygetopt.lo
Removing lib/libcurl_la-easygetopt.o
Removing lib/libcurl_la-easyoptions.lo
Removing lib/libcurl_la-easyoptions.o
Removing lib/libcurl_la-escape.lo
Removing lib/libcurl_la-escape.o
Removing lib/libcurl_la-file.lo
Removing lib/libcurl_la-file.o
Removing lib/libcurl_la-fileinfo.lo
Removing lib/libcurl_la-fileinfo.o
Removing lib/libcurl_la-fopen.lo
Removing lib/libcurl_la-fopen.o
Removing lib/libcurl_la-formdata.lo
Removing lib/libcurl_la-formdata.o
Removing lib/libcurl_la-ftp.lo
Removing lib/libcurl_la-ftp.o
Removing lib/libcurl_la-ftplistparser.lo
Removing lib/libcurl_la-ftplistparser.o
Removing lib/libcurl_la-getenv.lo
Removing lib/libcurl_la-getenv.o
Removing lib/libcurl_la-getinfo.lo
Removing lib/libcurl_la-getinfo.o
Removing lib/libcurl_la-gopher.lo
Removing lib/libcurl_la-gopher.o
Removing lib/libcurl_la-hash.lo
Removing lib/libcurl_la-hash.o
Removing lib/libcurl_la-headers.lo
Removing lib/libcurl_la-headers.o
Removing lib/libcurl_la-hmac.lo
Removing lib/libcurl_la-hmac.o
Removing lib/libcurl_la-hostasyn.lo
Removing lib/libcurl_la-hostasyn.o
Removing lib/libcurl_la-hostip.lo
Removing lib/libcurl_la-hostip.o
Removing lib/libcurl_la-hostip4.lo
Removing lib/libcurl_la-hostip4.o
Removing lib/libcurl_la-hostip6.lo
Removing lib/libcurl_la-hostip6.o
Removing lib/libcurl_la-hostsyn.lo
Removing lib/libcurl_la-hostsyn.o
Removing lib/libcurl_la-hsts.lo
Removing lib/libcurl_la-hsts.o
Removing lib/libcurl_la-http.lo
Removing lib/libcurl_la-http.o
Removing lib/libcurl_la-http1.lo
Removing lib/libcurl_la-http1.o
Removing lib/libcurl_la-http2.lo
Removing lib/libcurl_la-http2.o
Removing lib/libcurl_la-http_aws_sigv4.lo
Removing lib/libcurl_la-http_aws_sigv4.o
Removing lib/libcurl_la-http_chunks.lo
Removing lib/libcurl_la-http_chunks.o
Removing lib/libcurl_la-http_digest.lo
Removing lib/libcurl_la-http_digest.o
Removing lib/libcurl_la-http_negotiate.lo
Removing lib/libcurl_la-http_negotiate.o
Removing lib/libcurl_la-http_ntlm.lo
Removing lib/libcurl_la-http_ntlm.o
Removing lib/libcurl_la-http_proxy.lo
Removing lib/libcurl_la-http_proxy.o
Removing lib/libcurl_la-idn.lo
Removing lib/libcurl_la-idn.o
Removing lib/libcurl_la-if2ip.lo
Removing lib/libcurl_la-if2ip.o
Removing lib/libcurl_la-imap.lo
Removing lib/libcurl_la-imap.o
Removing lib/libcurl_la-inet_ntop.lo
Removing lib/libcurl_la-inet_ntop.o
Removing lib/libcurl_la-inet_pton.lo
Removing lib/libcurl_la-inet_pton.o
Removing lib/libcurl_la-krb5.lo
Removing lib/libcurl_la-krb5.o
Removing lib/libcurl_la-ldap.lo
Removing lib/libcurl_la-ldap.o
Removing lib/libcurl_la-llist.lo
Removing lib/libcurl_la-llist.o
Removing lib/libcurl_la-macos.lo
Removing lib/libcurl_la-macos.o
Removing lib/libcurl_la-md4.lo
Removing lib/libcurl_la-md4.o
Removing lib/libcurl_la-md5.lo
Removing lib/libcurl_la-md5.o
Removing lib/libcurl_la-memdebug.lo
Removing lib/libcurl_la-memdebug.o
Removing lib/libcurl_la-mime.lo
Removing lib/libcurl_la-mime.o
Removing lib/libcurl_la-mprintf.lo
Removing lib/libcurl_la-mprintf.o
Removing lib/libcurl_la-mqtt.lo
Removing lib/libcurl_la-mqtt.o
Removing lib/libcurl_la-multi.lo
Removing lib/libcurl_la-multi.o
Removing lib/libcurl_la-netrc.lo
Removing lib/libcurl_la-netrc.o
Removing lib/libcurl_la-nonblock.lo
Removing lib/libcurl_la-nonblock.o
Removing lib/libcurl_la-noproxy.lo
Removing lib/libcurl_la-noproxy.o
Removing lib/libcurl_la-openldap.lo
Removing lib/libcurl_la-openldap.o
Removing lib/libcurl_la-parsedate.lo
Removing lib/libcurl_la-parsedate.o
Removing lib/libcurl_la-pingpong.lo
Removing lib/libcurl_la-pingpong.o
Removing lib/libcurl_la-pop3.lo
Removing lib/libcurl_la-pop3.o
Removing lib/libcurl_la-progress.lo
Removing lib/libcurl_la-progress.o
Removing lib/libcurl_la-psl.lo
Removing lib/libcurl_la-psl.o
Removing lib/libcurl_la-rand.lo
Removing lib/libcurl_la-rand.o
Removing lib/libcurl_la-rename.lo
Removing lib/libcurl_la-rename.o
Removing lib/libcurl_la-rtsp.lo
Removing lib/libcurl_la-rtsp.o
Removing lib/libcurl_la-select.lo
Removing lib/libcurl_la-select.o
Removing lib/libcurl_la-sendf.lo
Removing lib/libcurl_la-sendf.o
Removing lib/libcurl_la-setopt.lo
Removing lib/libcurl_la-setopt.o
Removing lib/libcurl_la-sha256.lo
Removing lib/libcurl_la-sha256.o
Removing lib/libcurl_la-share.lo
Removing lib/libcurl_la-share.o
Removing lib/libcurl_la-slist.lo
Removing lib/libcurl_la-slist.o
Removing lib/libcurl_la-smb.lo
Removing lib/libcurl_la-smb.o
Removing lib/libcurl_la-smtp.lo
Removing lib/libcurl_la-smtp.o
Removing lib/libcurl_la-socketpair.lo
Removing lib/libcurl_la-socketpair.o
Removing lib/libcurl_la-socks.lo
Removing lib/libcurl_la-socks.o
Removing lib/libcurl_la-socks_gssapi.lo
Removing lib/libcurl_la-socks_gssapi.o
Removing lib/libcurl_la-socks_sspi.lo
Removing lib/libcurl_la-socks_sspi.o
Removing lib/libcurl_la-speedcheck.lo
Removing lib/libcurl_la-speedcheck.o
Removing lib/libcurl_la-splay.lo
Removing lib/libcurl_la-splay.o
Removing lib/libcurl_la-strcase.lo
Removing lib/libcurl_la-strcase.o
Removing lib/libcurl_la-strdup.lo
Removing lib/libcurl_la-strdup.o
Removing lib/libcurl_la-strerror.lo
Removing lib/libcurl_la-strerror.o
Removing lib/libcurl_la-strtok.lo
Removing lib/libcurl_la-strtok.o
Removing lib/libcurl_la-strtoofft.lo
Removing lib/libcurl_la-strtoofft.o
Removing lib/libcurl_la-system_win32.lo
Removing lib/libcurl_la-system_win32.o
Removing lib/libcurl_la-telnet.lo
Removing lib/libcurl_la-telnet.o
Removing lib/libcurl_la-tftp.lo
Removing lib/libcurl_la-tftp.o
Removing lib/libcurl_la-timediff.lo
Removing lib/libcurl_la-timediff.o
Removing lib/libcurl_la-timeval.lo
Removing lib/libcurl_la-timeval.o
Removing lib/libcurl_la-transfer.lo
Removing lib/libcurl_la-transfer.o
Removing lib/libcurl_la-url.lo
Removing lib/libcurl_la-url.o
Removing lib/libcurl_la-urlapi.lo
Removing lib/libcurl_la-urlapi.o
Removing lib/libcurl_la-version.lo
Removing lib/libcurl_la-version.o
Removing lib/libcurl_la-version_win32.lo
Removing lib/libcurl_la-version_win32.o
Removing lib/libcurl_la-warnless.lo
Removing lib/libcurl_la-warnless.o
Removing lib/libcurl_la-ws.lo
Removing lib/libcurl_la-ws.o
Removing lib/nonblock.o
Removing lib/stamp-h1
Removing lib/strtoofft.o
Removing lib/timediff.o
Removing lib/vauth/.deps/
Removing lib/vauth/.dirstamp
Removing lib/vauth/libcurl_la-cleartext.lo
Removing lib/vauth/libcurl_la-cleartext.o
Removing lib/vauth/libcurl_la-cram.lo
Removing lib/vauth/libcurl_la-cram.o
Removing lib/vauth/libcurl_la-digest.lo
Removing lib/vauth/libcurl_la-digest.o
Removing lib/vauth/libcurl_la-digest_sspi.lo
Removing lib/vauth/libcurl_la-digest_sspi.o
Removing lib/vauth/libcurl_la-gsasl.lo
Removing lib/vauth/libcurl_la-gsasl.o
Removing lib/vauth/libcurl_la-krb5_gssapi.lo
Removing lib/vauth/libcurl_la-krb5_gssapi.o
Removing lib/vauth/libcurl_la-krb5_sspi.lo
Removing lib/vauth/libcurl_la-krb5_sspi.o
Removing lib/vauth/libcurl_la-ntlm.lo
Removing lib/vauth/libcurl_la-ntlm.o
Removing lib/vauth/libcurl_la-ntlm_sspi.lo
Removing lib/vauth/libcurl_la-ntlm_sspi.o
Removing lib/vauth/libcurl_la-oauth2.lo
Removing lib/vauth/libcurl_la-oauth2.o
Removing lib/vauth/libcurl_la-spnego_gssapi.lo
Removing lib/vauth/libcurl_la-spnego_gssapi.o
Removing lib/vauth/libcurl_la-spnego_sspi.lo
Removing lib/vauth/libcurl_la-spnego_sspi.o
Removing lib/vauth/libcurl_la-vauth.lo
Removing lib/vauth/libcurl_la-vauth.o
Removing lib/version_win32.o
Removing lib/vquic/.deps/
Removing lib/vquic/.dirstamp
Removing lib/vquic/libcurl_la-curl_msh3.lo
Removing lib/vquic/libcurl_la-curl_msh3.o
Removing lib/vquic/libcurl_la-curl_ngtcp2.lo
Removing lib/vquic/libcurl_la-curl_ngtcp2.o
Removing lib/vquic/libcurl_la-curl_quiche.lo
Removing lib/vquic/libcurl_la-curl_quiche.o
Removing lib/vquic/libcurl_la-vquic.lo
Removing lib/vquic/libcurl_la-vquic.o
Removing lib/vssh/.deps/
Removing lib/vssh/.dirstamp
Removing lib/vssh/libcurl_la-libssh.lo
Removing lib/vssh/libcurl_la-libssh.o
Removing lib/vssh/libcurl_la-libssh2.lo
Removing lib/vssh/libcurl_la-libssh2.o
Removing lib/vssh/libcurl_la-wolfssh.lo
Removing lib/vssh/libcurl_la-wolfssh.o
Removing lib/vtls/.deps/
Removing lib/vtls/.dirstamp
Removing lib/vtls/libcurl_la-bearssl.lo
Removing lib/vtls/libcurl_la-bearssl.o
Removing lib/vtls/libcurl_la-gtls.lo
Removing lib/vtls/libcurl_la-gtls.o
Removing lib/vtls/libcurl_la-hostcheck.lo
Removing lib/vtls/libcurl_la-hostcheck.o
Removing lib/vtls/libcurl_la-keylog.lo
Removing lib/vtls/libcurl_la-keylog.o
Removing lib/vtls/libcurl_la-mbedtls.lo
Removing lib/vtls/libcurl_la-mbedtls.o
Removing lib/vtls/libcurl_la-mbedtls_threadlock.lo
Removing lib/vtls/libcurl_la-mbedtls_threadlock.o
Removing lib/vtls/libcurl_la-openssl.lo
Removing lib/vtls/libcurl_la-openssl.o
Removing lib/vtls/libcurl_la-rustls.lo
Removing lib/vtls/libcurl_la-rustls.o
Removing lib/vtls/libcurl_la-schannel.lo
Removing lib/vtls/libcurl_la-schannel.o
Removing lib/vtls/libcurl_la-schannel_verify.lo
Removing lib/vtls/libcurl_la-schannel_verify.o
Removing lib/vtls/libcurl_la-sectransp.lo
Removing lib/vtls/libcurl_la-sectransp.o
Removing lib/vtls/libcurl_la-vtls.lo
Removing lib/vtls/libcurl_la-vtls.o
Removing lib/vtls/libcurl_la-wolfssl.lo
Removing lib/vtls/libcurl_la-wolfssl.o
Removing lib/vtls/libcurl_la-x509asn1.lo
Removing lib/vtls/libcurl_la-x509asn1.o
Removing lib/warnless.o
Removing libcurl.pc
Removing libtool
Removing ltmain.sh
Removing m4/libtool.m4
Removing m4/ltoptions.m4
Removing m4/ltsugar.m4
Removing m4/ltversion.m4
Removing m4/lt~obsolete.m4
Removing missing
Removing packages/Makefile
Removing packages/Makefile.in
Removing packages/vms/Makefile
Removing packages/vms/Makefile.in
Removing scripts/Makefile
Removing scripts/Makefile.in
Removing src/.deps/
Removing src/.libs/
Removing src/Makefile
Removing src/Makefile.in
Removing src/curl
Removing src/slist_wc.o
Removing src/tool_binmode.o
Removing src/tool_bname.o
Removing src/tool_cb_dbg.o
Removing src/tool_cb_hdr.o
Removing src/tool_cb_prg.o
Removing src/tool_cb_rea.o
Removing src/tool_cb_see.o
Removing src/tool_cb_wrt.o
Removing src/tool_cfgable.o
Removing src/tool_dirhie.o
Removing src/tool_doswin.o
Removing src/tool_easysrc.o
Removing src/tool_filetime.o
Removing src/tool_findfile.o
Removing src/tool_formparse.o
Removing src/tool_getparam.o
Removing src/tool_getpass.o
Removing src/tool_help.o
Removing src/tool_helpers.o
Removing src/tool_hugehelp.c
Removing src/tool_hugehelp.o
Removing src/tool_ipfs.o
Removing src/tool_libinfo.o
Removing src/tool_listhelp.o
Removing src/tool_main.o
Removing src/tool_msgs.o
Removing src/tool_operate.o
Removing src/tool_operhlp.o
Removing src/tool_paramhlp.o
Removing src/tool_parsecfg.o
Removing src/tool_progress.o
Removing src/tool_setopt.o
Removing src/tool_sleep.o
Removing src/tool_stderr.o
Removing src/tool_strdup.o
Removing src/tool_urlglob.o
Removing src/tool_util.o
Removing src/tool_vms.o
Removing src/tool_writeout.o
Removing src/tool_writeout_json.o
Removing src/tool_xattr.o
Removing src/var.o
Removing test-driver
Removing tests/Makefile
Removing tests/Makefile.in
Removing tests/certs/Makefile
Removing tests/certs/Makefile.in
Removing tests/certs/scripts/Makefile
Removing tests/certs/scripts/Makefile.in
Removing tests/config
Removing tests/configurehelp.pm
Removing tests/data/Makefile
Removing tests/data/Makefile.in
Removing tests/http/Makefile
Removing tests/http/Makefile.in
Removing tests/http/clients/.deps/
Removing tests/http/clients/Makefile
Removing tests/http/clients/Makefile.in
Removing tests/http/config.ini
Removing tests/libtest/.deps/
Removing tests/libtest/Makefile
Removing tests/libtest/Makefile.in
Removing tests/server/.deps/
Removing tests/server/Makefile
Removing tests/server/Makefile.in
Removing tests/unit/.deps/
Removing tests/unit/Makefile
Removing tests/unit/Makefile.in

$ autoreconf -fi
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Remember to add 'LT_INIT' to configure.ac.
configure.ac:123: installing './compile'
configure.ac:424: installing './config.guess'
configure.ac:424: installing './config.sub'
configure.ac:123: installing './install-sh'
configure.ac:129: installing './missing'
docs/examples/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'

$ bash -c find . -name config.guess -exec cp /usr/share/misc/config.guess {} \;

$ bash -c find . -name config.sub -exec cp /usr/share/misc/config.sub {} \;

$ chmod +x configure

$ ./configure --disable-shared --without-ssl --disable-docs
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking whether to enable debug build options... no
checking whether to enable compiler optimizer... (assumed) yes
checking whether to enable strict compiler warnings... no
checking whether to enable compiler warnings as errors... no
checking whether to enable curl debug memory tracking... no
checking whether to enable hiding of library internal symbols... yes
checking whether to enable c-ares for DNS lookups... no
checking whether to disable dependency on -lrt... (assumed no)
checking whether to enable ECH support... no
checking for path separator... :
checking for sed... /usr/bin/sed
checking for grep... /usr/bin/grep
checking that grep -E works... yes
checking for ar... /usr/bin/ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... ccache gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether ccache gcc accepts -g... yes
checking for ccache gcc option to enable C11 features... none needed
checking whether ccache gcc understands -c and -o together... yes
checking how to run the C preprocessor... ccache gcc -E
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for stdatomic.h... yes
checking if _Atomic is available... yes
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for code coverage support... no
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of ccache gcc... gcc3
checking curl version... 8.5.0-DEV
checking for httpd... no
checking for apache2... no
checking for apachectl... no
checking for apxs... no
configure: httpd/apache2 not in PATH, http tests disabled
configure: apxs not in PATH, http tests disabled
checking for nghttpx... no
checking for caddy... no
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking if OS is AIX (to define _ALL_SOURCE)... no
checking if _THREAD_SAFE is already defined... no
checking if _THREAD_SAFE is actually needed... no
checking if _THREAD_SAFE is onwards defined... no
checking if _REENTRANT is already defined... no
checking if _REENTRANT is actually needed... no
checking if _REENTRANT is onwards defined... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by ccache gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from ccache gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if ccache gcc supports -fno-rtti -fno-exceptions... no
checking for ccache gcc option to produce PIC... -fPIC -DPIC
checking if ccache gcc PIC flag -fPIC -DPIC works... yes
checking if ccache gcc static flag -static works... yes
checking if ccache gcc supports -c -o file.o... yes
checking if ccache gcc supports -c -o file.o... (cached) yes
checking whether the ccache gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether to build shared libraries with -version-info... yes
checking whether to build shared libraries with -no-undefined... no
checking whether to build shared libraries with -mimpure-text... no
checking whether to build shared libraries with PIC... yes
checking whether to build static libraries with PIC... yes
checking whether to build shared libraries only... no
checking whether to build static libraries only... yes
checking for windres... no
checking for inline... inline
checking if cpp -P is needed... yes
checking if cpp -P works... yes
checking if compiler is DEC/Compaq/HP C... no
checking if compiler is HP-UX C... no
checking if compiler is IBM C... no
checking if compiler is Intel C... no
checking if compiler is clang... no
checking if compiler is GNU C... yes
checking compiler version... gcc '1100' (raw: '11')
checking if compiler is SGI MIPSpro C... no
checking if compiler is SGI MIPS C... no
checking if compiler is SunPro C... no
checking if compiler is Tiny C... no
checking if compiler accepts some basic options... yes
configure: compiler options added: -Werror-implicit-function-declaration 
checking if compiler optimizer assumed setting might be used... yes
checking if compiler accepts optimizer enabling options... yes
configure: compiler options added: -O2
checking if compiler accepts strict warning options... yes
configure: compiler options added: -Wno-system-headers 
checking if compiler halts on compilation errors... yes
checking if compiler halts on negative sized arrays... yes
checking if compiler halts on function prototype mismatch... yes
checking if compiler supports hiding library internal symbols... yes
checking for windows.h... no
checking whether build target is a native Windows one... no
checking whether build target supports WIN32 file API... no
checking whether build target supports WIN32 crypto API... no
checking for good-to-use Darwin CFLAGS... no
checking whether to link macOS CoreFoundation, CoreServices, and SystemConfiguration frameworks... no
checking to see if the compiler supports __builtin_available()... no
checking whether to support http... yes
checking whether to support ftp... yes
checking whether to support file... yes
checking whether to support ldap... yes
checking whether to support ldaps... yes
checking whether to support rtsp... yes
checking whether to support proxies... yes
checking whether to support dict... yes
checking whether to support telnet... yes
checking whether to support tftp... yes
checking whether to support pop3... yes
checking whether to support imap... yes
checking whether to support smb... yes
checking whether to support smtp... yes
checking whether to support gopher... yes
checking whether to support mqtt... no
checking whether to provide built-in manual... yes
checking whether to enable generation of C code... yes
checking whether to use libgcc... no
checking if X/Open network library is required... no
checking for gethostbyname... yes
checking for windows.h... (cached) no
checking for winsock2.h... (cached) no
checking for proto/bsdsocket.h... no
checking for connect in libraries... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... yes
checking for monotonic clock_gettime... yes
checking for clock_gettime in libraries... no additional lib required
checking if monotonic clock_gettime works... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for raw monotonic clock_gettime... yes
checking for pkg-config... /usr/bin/pkg-config
checking for zlib options with pkg-config... found
checking for zlib.h... yes
configure: found both libz and libz.h header
checking for BrotliDecoderDecompress in -lbrotlidec... no
checking for brotli/decode.h... no
checking for ZSTD_createDStream in -lzstd... no
checking for zstd.h... no
checking for lber.h... no
checking for ldap.h... no
checking for ldap_ssl.h... no
checking for LDAP libraries... cannot find LDAP libraries
checking whether to enable IPv6... yes
checking if struct sockaddr_in6 has sin6_scope_id member... yes
checking if argv can be written to... yes
checking if GSS-API support is requested... no
checking whether to enable Windows native SSL/TLS... no
checking whether to enable Secure Transport... no
checking whether to enable Amiga native SSL/TLS (AmiSSL v5)... no
checking for library containing psl_builtin... -lpsl
checking for library containing gsasl_init... no
checking for RTMP_Init in -lrtmp... no
checking whether versioned symbols are wanted... no
checking whether to enable Windows native IDN (Windows native builds only)... no
checking whether to build with libidn2... (assumed) yes
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libidn2 options with pkg-config... no
configure: IDN_LIBS: "-lidn2"
configure: IDN_LDFLAGS: ""
configure: IDN_CPPFLAGS: ""
configure: IDN_DIR: ""
checking if idn2_lookup_ul can be linked... no
checking for idn2.h... no
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libnghttp2 options with pkg-config... no
checking for nghttp2_session_get_stream_local_window_size in -lnghttp2... no
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for fish options with pkg-config... no
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for sys/select.h... yes
checking for sys/socket.h... yes
checking for sys/ioctl.h... yes
checking for unistd.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for arpa/inet.h... yes
checking for net/if.h... yes
checking for netinet/in.h... yes
checking for netinet/in6.h... no
checking for sys/un.h... yes
checking for linux/tcp.h... yes
checking for netinet/tcp.h... yes
checking for netinet/udp.h... yes
checking for netdb.h... yes
checking for sys/sockio.h... no
checking for sys/stat.h... (cached) yes
checking for sys/param.h... yes
checking for termios.h... yes
checking for termio.h... yes
checking for fcntl.h... yes
checking for io.h... no
checking for pwd.h... yes
checking for utime.h... yes
checking for sys/utime.h... no
checking for sys/poll.h... yes
checking for poll.h... yes
checking for socket.h... no
checking for sys/resource.h... yes
checking for libgen.h... yes
checking for locale.h... yes
checking for stdbool.h... yes
checking for sys/filio.h... no
checking for sys/wait.h... yes
checking for setjmp.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for struct timeval... yes
checking run-time libs availability... fine
checking size of size_t... 8
checking size of long... 8
checking size of int... 4
checking size of time_t... 8
checking size of off_t... 8
checking size of curl_off_t... 8
checking size of curl_socket_t... 4
checking for long long... yes
checking for ssize_t... yes
checking for bool... yes
checking for sa_family_t... yes
checking for suseconds_t... yes
checking if time_t is unsigned... no
checking for sys/types.h... (cached) yes
checking for poll.h... (cached) yes
checking for sys/poll.h... (cached) yes
checking for in_addr_t... yes
checking for struct sockaddr_storage... yes
checking for sys/select.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for select... yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for recv... yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for send... yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for MSG_NOSIGNAL... yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking if alarm can be linked... yes
checking if alarm is prototyped... yes
checking if alarm is compilable... yes
checking if alarm usage allowed... yes
checking if alarm might be used... yes
checking for sys/types.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for libgen.h... (cached) yes
checking if basename can be linked... yes
checking if basename is prototyped... yes
checking if basename is compilable... yes
checking if basename usage allowed... yes
checking if basename might be used... yes
checking for sys/types.h... (cached) yes
checking for socket.h... (cached) no
checking if closesocket can be linked... no
checking if closesocket might be used... no
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking if CloseSocket can be linked... no
checking if CloseSocket might be used... no
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking for fcntl.h... (cached) yes
checking if fcntl can be linked... yes
checking if fcntl is prototyped... yes
checking if fcntl is compilable... yes
checking if fcntl usage allowed... yes
checking if fcntl might be used... yes
checking if fcntl O_NONBLOCK is compilable... yes
checking if fcntl O_NONBLOCK usage allowed... yes
checking if fcntl O_NONBLOCK might be used... yes
checking for windows.h... (cached) no
checking for winsock2.h... (cached) no
checking for ws2tcpip.h... (cached) no
checking for sys/types.h... (cached) yes
checking for netdb.h... (cached) yes
checking if freeaddrinfo can be linked... yes
checking if freeaddrinfo is prototyped... yes
checking if freeaddrinfo is compilable... yes
checking if freeaddrinfo usage allowed... yes
checking if freeaddrinfo might be used... yes
checking for sys/types.h... (cached) yes
checking for sys/xattr.h... yes
checking if fsetxattr can be linked... yes
checking if fsetxattr is prototyped... yes
checking if fsetxattr takes 5 args.... yes
checking if fsetxattr is compilable... yes
checking if fsetxattr usage allowed... yes
checking if fsetxattr might be used... yes
checking if ftruncate can be linked... yes
checking if ftruncate is prototyped... yes
checking if ftruncate is compilable... yes
checking if ftruncate usage allowed... yes
checking if ftruncate might be used... yes
checking for sys/types.h... (cached) yes
checking if getaddrinfo can be linked... yes
checking if getaddrinfo is prototyped... yes
checking if getaddrinfo is compilable... yes
checking if getaddrinfo seems to work... yes
checking if getaddrinfo usage allowed... yes
checking if getaddrinfo might be used... yes
checking if getaddrinfo is threadsafe... yes
checking if gethostbyname can be linked... yes
checking if gethostbyname is prototyped... yes
checking if gethostbyname is compilable... yes
checking if gethostbyname usage allowed... yes
checking if gethostbyname might be used... yes
checking if gethostbyname_r can be linked... yes
checking if gethostbyname_r is prototyped... yes
checking if gethostbyname_r takes 3 args.... no
checking if gethostbyname_r takes 5 args.... no
checking if gethostbyname_r takes 6 args.... yes
checking if gethostbyname_r is compilable... yes
checking if gethostbyname_r usage allowed... yes
checking if gethostbyname_r might be used... yes
checking if gethostname can be linked... yes
checking if gethostname is prototyped... yes
checking if gethostname is compilable... yes
checking for gethostname arg 2 data type... size_t
checking if gethostname usage allowed... yes
checking if gethostname might be used... yes
checking if getpeername can be linked... yes
checking if getpeername is prototyped... yes
checking if getpeername is compilable... yes
checking if getpeername usage allowed... yes
checking if getpeername might be used... yes
checking if getsockname can be linked... yes
checking if getsockname is prototyped... yes
checking if getsockname is compilable... yes
checking if getsockname usage allowed... yes
checking if getsockname might be used... yes
checking for net/if.h... (cached) yes
checking if if_nametoindex can be linked... yes
checking if if_nametoindex is prototyped... yes
checking if if_nametoindex is compilable... yes
checking if if_nametoindex usage allowed... yes
checking if if_nametoindex might be used... yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for netinet/in.h... (cached) yes
checking for ifaddrs.h... yes
checking if getifaddrs can be linked... yes
checking if getifaddrs is prototyped... yes
checking if getifaddrs is compilable... yes
checking if getifaddrs seems to work... yes
checking if getifaddrs usage allowed... yes
checking if getifaddrs might be used... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking if gmtime_r can be linked... yes
checking if gmtime_r is prototyped... yes
checking if gmtime_r is compilable... yes
checking if gmtime_r seems to work... yes
checking if gmtime_r usage allowed... yes
checking if gmtime_r might be used... yes
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for netinet/in.h... (cached) yes
checking for arpa/inet.h... (cached) yes
checking if inet_ntop can be linked... yes
checking if inet_ntop is prototyped... yes
checking if inet_ntop is compilable... yes
checking if inet_ntop seems to work... yes
checking if inet_ntop usage allowed... yes
checking if inet_ntop might be used... yes
checking if inet_pton can be linked... yes
checking if inet_pton is prototyped... yes
checking if inet_pton is compilable... yes
checking if inet_pton seems to work... yes
checking if inet_pton usage allowed... yes
checking if inet_pton might be used... yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys/ioctl.h... (cached) yes
checking for stropts.h... no
checking if ioctl can be linked... yes
checking if ioctl is prototyped... yes
checking if ioctl is compilable... yes
checking if ioctl usage allowed... yes
checking if ioctl might be used... yes
checking if ioctl FIONBIO is compilable... yes
checking if ioctl FIONBIO usage allowed... yes
checking if ioctl FIONBIO might be used... yes
checking if ioctl SIOCGIFADDR is compilable... yes
checking if ioctl SIOCGIFADDR usage allowed... yes
checking if ioctl SIOCGIFADDR might be used... yes
checking if ioctlsocket can be linked... no
checking if ioctlsocket might be used... no
checking if IoctlSocket can be linked... no
checking if IoctlSocket might be used... no
checking if memrchr can be linked... yes
checking if memrchr is prototyped... no
checking if memrchr might be used... no
checking if poll can be linked... yes
checking if poll is prototyped... yes
checking if poll is compilable... yes
checking if poll seems to work... yes
checking if poll usage allowed... yes
checking if poll might be used... yes
checking for sys/types.h... (cached) yes
checking if sigaction can be linked... yes
checking if sigaction is prototyped... yes
checking if sigaction is compilable... yes
checking if sigaction usage allowed... yes
checking if sigaction might be used... yes
checking if siginterrupt can be linked... yes
checking if siginterrupt is prototyped... yes
checking if siginterrupt is compilable... yes
checking if siginterrupt usage allowed... yes
checking if siginterrupt might be used... yes
checking if signal can be linked... yes
checking if signal is prototyped... yes
checking if signal is compilable... yes
checking if signal usage allowed... yes
checking if signal might be used... yes
checking for sys/types.h... (cached) yes
checking if sigsetjmp can be linked... no
checking if sigsetjmp seems a macro... yes
checking if sigsetjmp is compilable... yes
checking if sigsetjmp usage allowed... yes
checking if sigsetjmp might be used... yes
checking if socket can be linked... yes
checking if socket is prototyped... yes
checking if socket is compilable... yes
checking if socket usage allowed... yes
checking if socket might be used... yes
checking if socketpair can be linked... yes
checking if socketpair is prototyped... yes
checking if socketpair is compilable... yes
checking if socketpair usage allowed... yes
checking if socketpair might be used... yes
checking if strcasecmp can be linked... yes
checking if strcasecmp is prototyped... yes
checking if strcasecmp is compilable... yes
checking if strcasecmp usage allowed... yes
checking if strcasecmp might be used... yes
checking if strcmpi can be linked... no
checking if strcmpi might be used... no
checking if strdup can be linked... yes
checking if strdup is prototyped... yes
checking if strdup is compilable... yes
checking if strdup usage allowed... yes
checking if strdup might be used... yes
checking if strerror_r can be linked... yes
checking if strerror_r is prototyped... yes
checking if strerror_r is compilable... yes
checking if strerror_r is glibc like... no
checking if strerror_r is POSIX like... yes
checking if strerror_r seems to work... yes
checking if strerror_r usage allowed... yes
checking if strerror_r might be used... yes
checking if stricmp can be linked... no
checking if stricmp might be used... no
checking if strtok_r can be linked... yes
checking if strtok_r is prototyped... yes
checking if strtok_r is compilable... yes
checking if strtok_r usage allowed... yes
checking if strtok_r might be used... yes
checking if strtoll can be linked... yes
checking if strtoll is prototyped... yes
checking if strtoll is compilable... yes
checking if strtoll usage allowed... yes
checking if strtoll might be used... yes
checking for ccache gcc options needed to detect all undeclared functions... none needed
checking whether getpwuid_r is declared... yes
checking for _fseeki64... no
checking deeper for _fseeki64... but still no
checking for arc4random... no
checking deeper for arc4random... but still no
checking for fnmatch... yes
checking for fseeko... yes
checking for geteuid... yes
checking for getpass_r... no
checking deeper for getpass_r... but still no
checking for getppid... yes
checking for getpwuid... yes
checking for getpwuid_r... yes
checking for getrlimit... yes
checking for gettimeofday... yes
checking for if_nametoindex... yes
checking for mach_absolute_time... no
checking deeper for mach_absolute_time... but still no
checking for pipe... yes
checking for sched_yield... yes
checking for sendmsg... yes
checking for setlocale... yes
checking for setmode... no
checking deeper for setmode... but still no
checking for setrlimit... yes
checking for snprintf... yes
checking for utime... yes
checking for utimes... yes
checking whether fseeko is declared... yes
checking how to set a socket into non-blocking mode... fcntl O_NONBLOCK
checking for perl... /usr/bin/perl
checking for gnroff... no
checking for nroff... /usr/bin/nroff
checking how to use *nroff to get plain text from man pages... -man
checking whether to enable the threaded resolver... yes
checking whether to use POSIX threads for threaded resolver... auto
checking for pthread.h... yes
checking for pthread_create... yes
checking convert -I options to -isystem... yes
checking whether to enable verbose strings... yes
checking whether to enable SSPI support (Windows native builds only)... no
checking whether to enable basic authentication method... yes
checking whether to enable bearer authentication method... yes
checking whether to enable digest authentication method... yes
checking whether to enable kerberos authentication method... yes
checking whether to enable negotiate authentication method... yes
checking whether to enable aws sig methods... yes
checking whether to support NTLM... yes
checking whether to enable NTLM delegation to winbind's helper... no
checking whether to enable TLS-SRP authentication... yes
checking whether to enable Unix domain sockets... auto
checking for struct sockaddr_un.sun_path... yes
checking whether to support cookies... yes
checking whether to support socketpair... yes
checking whether to support HTTP authentication... yes
checking whether to support DoH... yes
checking whether to support the MIME API... yes
checking whether to support binding connections locally... yes
checking whether to support the form API... yes
checking whether to support date parsing... yes
checking whether to support netrc parsing... yes
checking whether to support progress-meter... yes
checking whether to support DNS shuffling... yes
checking whether to support curl_easy_option*... yes
checking whether to support alt-svc... yes
checking whether to support headers-api... yes
configure: disables HSTS due to lack of SSL
checking whether to support WebSockets... no
checking whether hiding of library internal symbols will actually happen... yes
checking if this build supports HTTPS-proxy... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating docs/Makefile
config.status: creating docs/examples/Makefile
config.status: creating docs/libcurl/Makefile
config.status: creating docs/libcurl/opts/Makefile
config.status: creating docs/cmdline-opts/Makefile
config.status: creating include/Makefile
config.status: creating include/curl/Makefile
config.status: creating src/Makefile
config.status: creating lib/Makefile
config.status: creating scripts/Makefile
config.status: creating lib/libcurl.vers
config.status: creating lib/libcurl.plist
config.status: creating tests/Makefile
config.status: creating tests/config
config.status: creating tests/certs/Makefile
config.status: creating tests/certs/scripts/Makefile
config.status: creating tests/data/Makefile
config.status: creating tests/server/Makefile
config.status: creating tests/libtest/Makefile
config.status: creating tests/unit/Makefile
config.status: creating tests/http/config.ini
config.status: creating tests/http/Makefile
config.status: creating tests/http/clients/Makefile
config.status: creating packages/Makefile
config.status: creating packages/vms/Makefile
config.status: creating curl-config
config.status: creating libcurl.pc
config.status: creating lib/curl_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: Configured to build curl/libcurl:

  Host setup:       x86_64-pc-linux-gnu
  Install prefix:   /usr/local
  Compiler:         ccache gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers
   CPPFLAGS:        
   LDFLAGS:         
   LIBS:            -lpsl -lz

  curl version:     8.5.0-DEV
  SSL:              no      (--with-{openssl,gnutls,mbedtls,wolfssl,schannel,secure-transport,amissl,bearssl,rustls} )
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             enabled
  brotli:           no      (--with-brotli)
  zstd:             no      (--with-zstd)
  GSS-API:          no      (--with-gssapi)
  GSASL:            no      (libgsasl not found)
  TLS-SRP:          no      (--enable-tls-srp)
  resolver:         POSIX threaded
  IPv6:             enabled
  Unix sockets:     enabled
  IDN:              no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=no, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  Code coverage:    disabled
  SSPI:             no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     
  ca fallback:      
  LDAP:             no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS:            no      (--enable-ldaps)
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  PSL:              enabled
  Alt-svc:          enabled (--disable-alt-svc)
  Headers API:      enabled (--disable-headers-api)
  HSTS:             no      (--enable-hsts)
  HTTP1:            enabled (internal)
  HTTP2:            no      (--with-nghttp2)
  HTTP3:            no      (--with-ngtcp2 --with-nghttp3, --with-quiche, --with-msh3)
  ECH:              no      (--enable-ech)
  WebSockets:       no      (--enable-websockets)
  Protocols:        DICT FILE FTP GOPHER HTTP IMAP MQTT POP3 RTSP SMTP TELNET TFTP
  Features:         AsynchDNS IPv6 Largefile PSL UnixSockets alt-svc libz threadsafe

configure: WARNING: unrecognized options: --disable-docs
configure: WARNING: Cannot find libraries for LDAP support: LDAP disabled
configure: WARNING: libgsasl was not found
configure: WARNING: Cannot find libraries for IDN support: IDN disabled
configure: WARNING: unrecognized options: --disable-docs

$ make -j3
Making all in lib
make[1]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/lib'
make  all-am
make[2]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/lib'
  CC       libcurl_la-amigaos.lo
  CC       libcurl_la-altsvc.lo
  CC       libcurl_la-asyn-ares.lo
  CC       libcurl_la-asyn-thread.lo
  CC       libcurl_la-base64.lo
  CC       libcurl_la-bufq.lo
  CC       libcurl_la-bufref.lo
  CC       libcurl_la-c-hyper.lo
  CC       libcurl_la-cf-h1-proxy.lo
  CC       libcurl_la-cf-h2-proxy.lo
  CC       libcurl_la-cf-haproxy.lo
  CC       libcurl_la-cf-https-connect.lo
  CC       libcurl_la-cf-socket.lo
  CC       libcurl_la-cfilters.lo
  CC       libcurl_la-conncache.lo
  CC       libcurl_la-connect.lo
  CC       libcurl_la-content_encoding.lo
  CC       libcurl_la-cookie.lo
  CC       libcurl_la-curl_addrinfo.lo
  CC       libcurl_la-curl_des.lo
  CC       libcurl_la-curl_endian.lo
  CC       libcurl_la-curl_fnmatch.lo
  CC       libcurl_la-curl_get_line.lo
  CC       libcurl_la-curl_gethostname.lo
  CC       libcurl_la-curl_gssapi.lo
  CC       libcurl_la-curl_memrchr.lo
  CC       libcurl_la-curl_multibyte.lo
  CC       libcurl_la-curl_ntlm_core.lo
  CC       libcurl_la-curl_ntlm_wb.lo
  CC       libcurl_la-curl_path.lo
  CC       libcurl_la-curl_range.lo
  CC       libcurl_la-curl_rtmp.lo
  CC       libcurl_la-curl_sasl.lo
  CC       libcurl_la-curl_sspi.lo
  CC       libcurl_la-curl_threads.lo
  CC       libcurl_la-curl_trc.lo
  CC       libcurl_la-dict.lo
  CC       libcurl_la-doh.lo
  CC       libcurl_la-dynbuf.lo
  CC       libcurl_la-dynhds.lo
  CC       libcurl_la-easy.lo
  CC       libcurl_la-easygetopt.lo
  CC       libcurl_la-easyoptions.lo
  CC       libcurl_la-escape.lo
  CC       libcurl_la-file.lo
  CC       libcurl_la-fileinfo.lo
  CC       libcurl_la-fopen.lo
  CC       libcurl_la-formdata.lo
  CC       libcurl_la-ftp.lo
  CC       libcurl_la-ftplistparser.lo
  CC       libcurl_la-getenv.lo
  CC       libcurl_la-getinfo.lo
  CC       libcurl_la-gopher.lo
  CC       libcurl_la-headers.lo
  CC       libcurl_la-hash.lo
  CC       libcurl_la-hmac.lo
  CC       libcurl_la-hostasyn.lo
  CC       libcurl_la-hostip.lo
  CC       libcurl_la-hostip4.lo
  CC       libcurl_la-hostip6.lo
  CC       libcurl_la-hostsyn.lo
  CC       libcurl_la-hsts.lo
  CC       libcurl_la-http.lo
  CC       libcurl_la-http1.lo
  CC       libcurl_la-http2.lo
  CC       libcurl_la-http_aws_sigv4.lo
  CC       libcurl_la-http_chunks.lo
  CC       libcurl_la-http_digest.lo
  CC       libcurl_la-http_negotiate.lo
  CC       libcurl_la-http_ntlm.lo
  CC       libcurl_la-http_proxy.lo
  CC       libcurl_la-idn.lo
  CC       libcurl_la-if2ip.lo
  CC       libcurl_la-inet_ntop.lo
  CC       libcurl_la-imap.lo
  CC       libcurl_la-inet_pton.lo
  CC       libcurl_la-krb5.lo
  CC       libcurl_la-ldap.lo
  CC       libcurl_la-llist.lo
  CC       libcurl_la-macos.lo
  CC       libcurl_la-md4.lo
  CC       libcurl_la-md5.lo
  CC       libcurl_la-memdebug.lo
  CC       libcurl_la-mime.lo
  CC       libcurl_la-mprintf.lo
  CC       libcurl_la-mqtt.lo
  CC       libcurl_la-multi.lo
  CC       libcurl_la-netrc.lo
  CC       libcurl_la-nonblock.lo
  CC       libcurl_la-noproxy.lo
  CC       libcurl_la-openldap.lo
  CC       libcurl_la-parsedate.lo
  CC       libcurl_la-pingpong.lo
  CC       libcurl_la-pop3.lo
  CC       libcurl_la-progress.lo
  CC       libcurl_la-psl.lo
  CC       libcurl_la-rand.lo
  CC       libcurl_la-rename.lo
  CC       libcurl_la-rtsp.lo
  CC       libcurl_la-select.lo
  CC       libcurl_la-sendf.lo
  CC       libcurl_la-setopt.lo
  CC       libcurl_la-sha256.lo
  CC       libcurl_la-share.lo
  CC       libcurl_la-slist.lo
  CC       libcurl_la-smb.lo
  CC       libcurl_la-smtp.lo
  CC       libcurl_la-socketpair.lo
  CC       libcurl_la-socks.lo
  CC       libcurl_la-socks_gssapi.lo
  CC       libcurl_la-socks_sspi.lo
  CC       libcurl_la-speedcheck.lo
  CC       libcurl_la-splay.lo
  CC       libcurl_la-strcase.lo
  CC       libcurl_la-strdup.lo
  CC       libcurl_la-strerror.lo
  CC       libcurl_la-strtok.lo
  CC       libcurl_la-strtoofft.lo
  CC       libcurl_la-system_win32.lo
  CC       libcurl_la-telnet.lo
  CC       libcurl_la-tftp.lo
  CC       libcurl_la-timediff.lo
  CC       libcurl_la-timeval.lo
  CC       libcurl_la-transfer.lo
  CC       libcurl_la-url.lo
  CC       libcurl_la-urlapi.lo
  CC       libcurl_la-version.lo
  CC       libcurl_la-version_win32.lo
  CC       libcurl_la-warnless.lo
  CC       libcurl_la-ws.lo
  CC       vauth/libcurl_la-cleartext.lo
  CC       vauth/libcurl_la-cram.lo
  CC       vauth/libcurl_la-digest.lo
  CC       vauth/libcurl_la-digest_sspi.lo
  CC       vauth/libcurl_la-gsasl.lo
  CC       vauth/libcurl_la-krb5_gssapi.lo
  CC       vauth/libcurl_la-ntlm.lo
  CC       vauth/libcurl_la-krb5_sspi.lo
  CC       vauth/libcurl_la-ntlm_sspi.lo
  CC       vauth/libcurl_la-oauth2.lo
  CC       vauth/libcurl_la-spnego_gssapi.lo
  CC       vauth/libcurl_la-spnego_sspi.lo
  CC       vauth/libcurl_la-vauth.lo
  CC       vtls/libcurl_la-bearssl.lo
  CC       vtls/libcurl_la-gtls.lo
  CC       vtls/libcurl_la-hostcheck.lo
  CC       vtls/libcurl_la-keylog.lo
  CC       vtls/libcurl_la-mbedtls.lo
  CC       vtls/libcurl_la-mbedtls_threadlock.lo
  CC       vtls/libcurl_la-openssl.lo
  CC       vtls/libcurl_la-rustls.lo
  CC       vtls/libcurl_la-schannel.lo
  CC       vtls/libcurl_la-schannel_verify.lo
  CC       vtls/libcurl_la-sectransp.lo
  CC       vtls/libcurl_la-vtls.lo
  CC       vtls/libcurl_la-wolfssl.lo
  CC       vtls/libcurl_la-x509asn1.lo
  CC       vquic/libcurl_la-curl_msh3.lo
  CC       vquic/libcurl_la-curl_ngtcp2.lo
  CC       vquic/libcurl_la-curl_quiche.lo
  CC       vquic/libcurl_la-vquic.lo
  CC       vssh/libcurl_la-libssh.lo
  CC       vssh/libcurl_la-libssh2.lo
  CC       vssh/libcurl_la-wolfssh.lo
  CCLD     libcurl.la
make[2]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/lib'
make[1]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/lib'
Making all in src
make[1]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/src'
Making all in ../docs
make[2]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/docs'
Making all in .
make[3]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/docs'
if test "..x" != "..x" -a -e "./curl.1"; then \
	/usr/bin/install -c -m 644 "./curl.1" /root/asi_db/builds/curl/_worktrees/w0/docs/curl.1 \
	&& touch -r "./curl.1" /root/asi_db/builds/curl/_worktrees/w0/docs/curl.1; fi
cd cmdline-opts && make
make[4]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/docs/cmdline-opts'
  GENERATE ../../docs/curl.1
make[4]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/docs/cmdline-opts'
make[3]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/docs'
Making all in cmdline-opts
make[3]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/docs/cmdline-opts'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/docs/cmdline-opts'
make[2]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/docs'
make[2]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0/src'
  CC       tool_binmode.o
  CC       slist_wc.o
  CC       tool_bname.o
  CC       tool_cb_dbg.o
  CC       tool_cb_hdr.o
  CC       tool_cb_prg.o
  CC       tool_cb_rea.o
  CC       tool_cb_see.o
  CC       tool_cb_wrt.o
  CC       tool_cfgable.o
  CC       tool_dirhie.o
  CC       tool_doswin.o
  CC       tool_easysrc.o
  CC       tool_filetime.o
  CC       tool_findfile.o
  CC       tool_formparse.o
  CC       tool_getparam.o
  CC       tool_getpass.o
  CC       tool_help.o
  CC       tool_helpers.o
  HUGE     tool_hugehelp.c
  CC       tool_ipfs.o
  CC       tool_libinfo.o
  CC       tool_listhelp.o
  CC       tool_main.o
  CC       tool_msgs.o
  CC       tool_operate.o
  CC       tool_operhlp.o
  CC       tool_paramhlp.o
  CC       tool_parsecfg.o
  CC       tool_progress.o
  CC       tool_setopt.o
  CC       tool_sleep.o
  CC       tool_stderr.o
  CC       tool_strdup.o
  CC       tool_urlglob.o
  CC       tool_util.o
  CC       tool_vms.o
  CC       tool_writeout.o
  CC       tool_writeout_json.o
  CC       tool_xattr.o
  CC       var.o
  CC       ../lib/base64.o
  CC       ../lib/curl_multibyte.o
  CC       ../lib/dynbuf.o
  CC       ../lib/nonblock.o
  CC       ../lib/strtoofft.o
  CC       ../lib/timediff.o
  CC       ../lib/version_win32.o
  CC       ../lib/warnless.o
  CC       tool_hugehelp.o
  CCLD     curl
make[2]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/src'
make[1]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0/src'
make[1]: Entering directory '/root/asi_db/builds/curl/_worktrees/w0'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/root/asi_db/builds/curl/_worktrees/w0'

Commit Diff GitHub →

.github/scripts/verify-examples.pl +0 -2docs/libcurl/curl_easy_cleanup.3 +11 -6docs/libcurl/curl_easy_duphandle.3 +12 -9docs/libcurl/curl_easy_escape.3 +10 -7docs/libcurl/curl_easy_getinfo.3 +5 -1docs/libcurl/curl_easy_header.3 +12 -3docs/libcurl/curl_easy_init.3 +9 -6docs/libcurl/curl_easy_nextheader.3 +21 -12docs/libcurl/curl_easy_option_by_id.3 +6 -3docs/libcurl/curl_easy_option_by_name.3 +6 -3docs/libcurl/curl_easy_option_next.3 +9 -6docs/libcurl/curl_easy_pause.3 +9 -2docs/libcurl/curl_easy_perform.3 +9 -6docs/libcurl/curl_easy_recv.3 +21 -10docs/libcurl/curl_easy_reset.3 +8 -4docs/libcurl/curl_easy_send.3 +19 -10docs/libcurl/curl_easy_setopt.3 +9 -6docs/libcurl/curl_easy_strerror.3 +14 -6docs/libcurl/curl_easy_unescape.3 +13 -10docs/libcurl/curl_easy_upkeep.3 +18 -15docs/libcurl/curl_escape.3 +7 -4docs/libcurl/curl_formadd.3 +93 -76docs/libcurl/curl_formfree.3 +19 -10docs/libcurl/curl_formget.3 +15 -14docs/libcurl/curl_free.3 +3 -0docs/libcurl/curl_getdate.3 +26 -23docs/libcurl/curl_getenv.3 +3 -0docs/libcurl/curl_global_cleanup.3 +6 -3docs/libcurl/curl_global_init.3 +6 -3docs/libcurl/curl_global_init_mem.3 +12 -3docs/libcurl/curl_global_sslset.3 +4 -0docs/libcurl/curl_global_trace.3 +7 -4docs/libcurl/curl_mime_addpart.3 +15 -9docs/libcurl/curl_mime_data.3 +14 -8docs/libcurl/curl_mime_data_cb.3 +17 -12docs/libcurl/curl_mime_encoder.3 +16 -10docs/libcurl/curl_mime_filedata.3 +16 -10docs/libcurl/curl_mime_filename.3 +21 -12docs/libcurl/curl_mime_free.3 +11 -5docs/libcurl/curl_mime_headers.3 +22 -8docs/libcurl/curl_mime_init.3 +19 -15docs/libcurl/curl_mime_name.3 +14 -8docs/libcurl/curl_mime_subparts.3 +29 -16docs/libcurl/curl_mime_type.3 +18 -12docs/libcurl/curl_mprintf.3 +6 -1docs/libcurl/curl_multi_add_handle.3 +10 -3docs/libcurl/curl_multi_assign.3 +11 -2docs/libcurl/curl_multi_cleanup.3 +8 -3docs/libcurl/curl_multi_fdset.3 +27 -8docs/libcurl/curl_multi_get_handles.3 +17 -10docs/libcurl/curl_multi_info_read.3 +19 -12docs/libcurl/curl_multi_init.3 +10 -5docs/libcurl/curl_multi_perform.3 +20 -12docs/libcurl/curl_multi_poll.3 +22 -18docs/libcurl/curl_multi_remove_handle.3 +13 -7docs/libcurl/curl_multi_setopt.3 +10 -3docs/libcurl/curl_multi_socket.3 +10 -4docs/libcurl/curl_multi_socket_action.3 +12 -5docs/libcurl/curl_multi_strerror.3 +8 -4docs/libcurl/curl_multi_timeout.3 +18 -10docs/libcurl/curl_multi_wait.3 +21 -31docs/libcurl/curl_multi_wakeup.3 +29 -22docs/libcurl/curl_pushheader_byname.3 +14 -7docs/libcurl/curl_pushheader_bynum.3 +11 -7docs/libcurl/curl_share_cleanup.3 +4 -1docs/libcurl/curl_share_init.3 +4 -1docs/libcurl/curl_share_setopt.3 +4 -1docs/libcurl/curl_share_strerror.3 +4 -1docs/libcurl/curl_slist_append.3 +18 -15docs/libcurl/curl_slist_free_all.3 +11 -8docs/libcurl/curl_strequal.3 +8 -4docs/libcurl/curl_unescape.3 +11 -9docs/libcurl/curl_url.3 +3 -0docs/libcurl/curl_url_cleanup.3 +3 -0docs/libcurl/curl_url_dup.3 +3 -0docs/libcurl/curl_url_get.3 +3 -0docs/libcurl/curl_url_set.3 +3 -1docs/libcurl/curl_url_strerror.3 +3 -1docs/libcurl/curl_version.3 +4 -1docs/libcurl/curl_version_info.3 +8 -5docs/libcurl/curl_ws_meta.3 +13 -6docs/libcurl/curl_ws_recv.3 +9 -1docs/libcurl/curl_ws_send.3 +14 -5docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 +16 -12docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_CAINFO.3 +9 -7docs/libcurl/opts/CURLINFO_CAPATH.3 +9 -7docs/libcurl/opts/CURLINFO_CERTINFO.3 +23 -18docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3 +20 -15docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_CONN_ID.3 +14 -9docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 +14 -10docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3 +14 -10docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3 +14 -10docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3 +14 -10docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3 +15 -11docs/libcurl/opts/CURLINFO_COOKIELIST.3 +23 -19docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 +16 -13docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.3 +15 -12docs/libcurl/opts/CURLINFO_FILETIME.3 +18 -13docs/libcurl/opts/CURLINFO_FILETIME_T.3 +18 -14docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3 +15 -11docs/libcurl/opts/CURLINFO_HEADER_SIZE.3 +14 -11docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3 +21 -17docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3 +16 -13docs/libcurl/opts/CURLINFO_HTTP_VERSION.3 +12 -9docs/libcurl/opts/CURLINFO_LASTSOCKET.3 +16 -12docs/libcurl/opts/CURLINFO_LOCAL_IP.3 +3 -0docs/libcurl/opts/CURLINFO_LOCAL_PORT.3 +1 -0docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3 +15 -12docs/libcurl/opts/CURLINFO_OS_ERRNO.3 +14 -11docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 +16 -11docs/libcurl/opts/CURLINFO_PRIMARY_IP.3 +3 -0docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3 +14 -11docs/libcurl/opts/CURLINFO_PRIVATE.3 +17 -10docs/libcurl/opts/CURLINFO_PROTOCOL.3 +12 -9docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3 +22 -18docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 +15 -12docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3 +16 -11docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 +13 -10docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_REDIRECT_URL.3 +14 -11docs/libcurl/opts/CURLINFO_REFERER.3 +15 -12docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3 +14 -11docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 +12 -9docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 +14 -11docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3 +12 -9docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3 +12 -9docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3 +12 -9docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.3 +12 -9docs/libcurl/opts/CURLINFO_SCHEME.3 +14 -11docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 +14 -10docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3 +14 -10docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 +13 -9docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3 +13 -9docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 +13 -9docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3 +14 -9docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 +13 -9docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3 +13 -9docs/libcurl/opts/CURLINFO_SSL_ENGINES.3 +13 -10docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3 +15 -10docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_TLS_SESSION.3 +13 -8docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 +2 -2docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 +14 -10docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 +15 -11docs/libcurl/opts/CURLINFO_XFER_ID.3 +13 -9docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 +6 -3docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 +6 -3docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3 +6 -3docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 +3 -0docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.3 +6 -3docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.3 +6 -3docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3 +6 -3docs/libcurl/opts/CURLMOPT_PIPELINING.3 +6 -3docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.3 +10 -7docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.3 +10 -6docs/libcurl/opts/CURLMOPT_PUSHDATA.3 +9 -2docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 +9 -2docs/libcurl/opts/CURLMOPT_SOCKETDATA.3 +16 -12docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 +16 -12docs/libcurl/opts/CURLMOPT_TIMERDATA.3 +18 -27docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.3 +18 -27docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3 +11 -3docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3 +9 -6docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.3 +10 -7docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3 +14 -9docs/libcurl/opts/CURLOPT_ALTSVC.3 +8 -5docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 +8 -5docs/libcurl/opts/CURLOPT_APPEND.3 +9 -6docs/libcurl/opts/CURLOPT_AUTOREFERER.3 +13 -9docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 +14 -11docs/libcurl/opts/CURLOPT_BUFFERSIZE.3 +11 -7docs/libcurl/opts/CURLOPT_CAINFO.3 +9 -6docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 +17 -11docs/libcurl/opts/CURLOPT_CAPATH.3 +10 -6docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.3 +14 -10docs/libcurl/opts/CURLOPT_CERTINFO.3 +23 -18docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3 +10 -1docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 +10 -1docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3 +9 -0docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.3 +19 -3docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.3 +19 -3docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.3 +9 -6docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3 +9 -6docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3 +11 -8docs/libcurl/opts/CURLOPT_CONNECT_TO.3 +15 -12docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3 +14 -9docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3 +10 -8docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3 +11 -8docs/libcurl/opts/CURLOPT_COOKIE.3 +8 -5docs/libcurl/opts/CURLOPT_COOKIEFILE.3 +11 -7docs/libcurl/opts/CURLOPT_COOKIEJAR.3 +12 -8docs/libcurl/opts/CURLOPT_COOKIELIST.3 +35 -29docs/libcurl/opts/CURLOPT_COOKIESESSION.3 +13 -9docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3 +12 -9docs/libcurl/opts/CURLOPT_CRLF.3 +10 -7docs/libcurl/opts/CURLOPT_CRLFILE.3 +10 -6docs/libcurl/opts/CURLOPT_CURLU.3 +13 -10docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 +11 -7docs/libcurl/opts/CURLOPT_DEBUGDATA.3 +14 -0docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3 +7 -7docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3 +11 -8docs/libcurl/opts/CURLOPT_DIRLISTONLY.3 +11 -7docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 +8 -5docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3 +14 -10docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3 +10 -6docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3 +10 -6docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3 +10 -6docs/libcurl/opts/CURLOPT_DNS_SERVERS.3 +11 -6docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 +10 -7docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3 +12 -8docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 +11 -7docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 +11 -7docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 +11 -7docs/libcurl/opts/CURLOPT_DOH_URL.3 +8 -5docs/libcurl/opts/CURLOPT_EGDSOCKET.3 +10 -6docs/libcurl/opts/CURLOPT_ERRORBUFFER.3 +27 -23docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3 +9 -6docs/libcurl/opts/CURLOPT_FAILONERROR.3 +11 -8docs/libcurl/opts/CURLOPT_FILETIME.3 +18 -13docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3 +19 -5docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3 +16 -5docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3 +9 -6docs/libcurl/opts/CURLOPT_FORBID_REUSE.3 +11 -5docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3 +9 -4docs/libcurl/opts/CURLOPT_FTPPORT.3 +11 -6docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3 +12 -8docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 +10 -6docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 +10 -8docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 +12 -7docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 +11 -7docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 +11 -7docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3 +12 -8docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3 +13 -9docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 +12 -7docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 +12 -7docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3 +11 -8docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 +10 -7docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 +9 -6docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3 +9 -6docs/libcurl/opts/CURLOPT_HEADER.3 +8 -5docs/libcurl/opts/CURLOPT_HEADERDATA.3 +13 -10docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3 +8 -5docs/libcurl/opts/CURLOPT_HEADEROPT.3 +19 -16docs/libcurl/opts/CURLOPT_HSTS.3 +7 -4docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 +15 -8docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 +23 -5docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 +15 -8docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 +23 -5docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 +7 -4docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 +9 -6docs/libcurl/opts/CURLOPT_HTTP200ALIASES.3 +12 -9docs/libcurl/opts/CURLOPT_HTTPAUTH.3 +11 -8docs/libcurl/opts/CURLOPT_HTTPGET.3 +10 -7docs/libcurl/opts/CURLOPT_HTTPHEADER.3 +12 -9docs/libcurl/opts/CURLOPT_HTTPPOST.3 +33 -19docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3 +9 -6docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.3 +9 -6docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.3 +9 -6docs/libcurl/opts/CURLOPT_HTTP_VERSION.3 +12 -9docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 +9 -6docs/libcurl/opts/CURLOPT_INFILESIZE.3 +14 -7docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 +13 -7docs/libcurl/opts/CURLOPT_INTERFACE.3 +10 -6docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.3 +15 -4docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3 +14 -4docs/libcurl/opts/CURLOPT_IOCTLDATA.3 +13 -4docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3 +13 -4docs/libcurl/opts/CURLOPT_IPRESOLVE.3 +11 -8docs/libcurl/opts/CURLOPT_ISSUERCERT.3 +10 -6docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 +18 -10docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.3 +10 -7docs/libcurl/opts/CURLOPT_KEYPASSWD.3 +12 -8docs/libcurl/opts/CURLOPT_KRBLEVEL.3 +10 -6docs/libcurl/opts/CURLOPT_LOCALPORT.3 +12 -8docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.3 +12 -8docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3 +10 -6docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 +15 -11docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 +15 -11docs/libcurl/opts/CURLOPT_MAIL_AUTH.3 +10 -6docs/libcurl/opts/CURLOPT_MAIL_FROM.3 +10 -6docs/libcurl/opts/CURLOPT_MAIL_RCPT.3 +14 -10docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.3 +15 -11docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 +9 -6docs/libcurl/opts/CURLOPT_MAXCONNECTS.3 +10 -7docs/libcurl/opts/CURLOPT_MAXFILESIZE.3 +10 -7docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3 +11 -8docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.3 +9 -6docs/libcurl/opts/CURLOPT_MAXREDIRS.3 +12 -9docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.3 +10 -7docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.3 +11 -8docs/libcurl/opts/CURLOPT_MIMEPOST.3 +22 -15docs/libcurl/opts/CURLOPT_MIME_OPTIONS.3 +20 -17docs/libcurl/opts/CURLOPT_NETRC.3 +9 -6docs/libcurl/opts/CURLOPT_NETRC_FILE.3 +10 -7docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.3 +11 -7docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.3 +9 -6docs/libcurl/opts/CURLOPT_NOBODY.3 +10 -7docs/libcurl/opts/CURLOPT_NOPROGRESS.3 +10 -7docs/libcurl/opts/CURLOPT_NOPROXY.3 +12 -9docs/libcurl/opts/CURLOPT_NOSIGNAL.3 +10 -6docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3 +18 -12docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3 +17 -12docs/libcurl/opts/CURLOPT_PASSWORD.3 +10 -6docs/libcurl/opts/CURLOPT_PATH_AS_IS.3 +9 -5docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3 +16 -10docs/libcurl/opts/CURLOPT_PIPEWAIT.3 +8 -5docs/libcurl/opts/CURLOPT_PORT.3 +10 -6docs/libcurl/opts/CURLOPT_POST.3 +11 -7docs/libcurl/opts/CURLOPT_POSTFIELDS.3 +26 -24docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3 +13 -8docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.3 +14 -9docs/libcurl/opts/CURLOPT_POSTQUOTE.3 +14 -10docs/libcurl/opts/CURLOPT_POSTREDIR.3 +12 -9docs/libcurl/opts/CURLOPT_PREQUOTE.3 +13 -9docs/libcurl/opts/CURLOPT_PREREQDATA.3 +13 -4docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3 +13 -4docs/libcurl/opts/CURLOPT_PRE_PROXY.3 +9 -6docs/libcurl/opts/CURLOPT_PRIVATE.3 +17 -10docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 +26 -18docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.3 +32 -24docs/libcurl/opts/CURLOPT_PROTOCOLS.3 +12 -9docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.3 +11 -8docs/libcurl/opts/CURLOPT_PROXY.3 +8 -5docs/libcurl/opts/CURLOPT_PROXYAUTH.3 +15 -12docs/libcurl/opts/CURLOPT_PROXYHEADER.3 +13 -10docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3 +12 -8docs/libcurl/opts/CURLOPT_PROXYPORT.3 +11 -7docs/libcurl/opts/CURLOPT_PROXYTYPE.3 +12 -9docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3 +12 -8docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3 +11 -7docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3 +12 -8docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 +19 -13docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3 +12 -8docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3 +11 -7docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 +12 -8docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 +20 -12docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3 +11 -7docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3 +13 -8docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3 +9 -6docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3 +14 -10docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 +21 -13docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3 +14 -10docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 +27 -16docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.3 +10 -7docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3 +11 -7docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.3 +9 -6docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.3 +9 -6docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3 +11 -7docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3 +13 -9docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.3 +13 -8docs/libcurl/opts/CURLOPT_PUT.3 +30 -14docs/libcurl/opts/CURLOPT_QUICK_EXIT.3 +8 -5docs/libcurl/opts/CURLOPT_QUOTE.3 +14 -10docs/libcurl/opts/CURLOPT_RANDOM_FILE.3 +10 -6docs/libcurl/opts/CURLOPT_RANGE.3 +10 -7docs/libcurl/opts/CURLOPT_READDATA.3 +15 -8docs/libcurl/opts/CURLOPT_READFUNCTION.3 +10 -7docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3 +12 -9docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.3 +11 -8docs/libcurl/opts/CURLOPT_REFERER.3 +9 -6docs/libcurl/opts/CURLOPT_REQUEST_TARGET.3 +11 -8docs/libcurl/opts/CURLOPT_RESOLVE.3 +15 -12docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3 +10 -7docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 +12 -9docs/libcurl/opts/CURLOPT_RESUME_FROM.3 +16 -11docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3 +16 -13docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3 +10 -6docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3 +11 -7docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3 +10 -6docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.3 +11 -7docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.3 +11 -8docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.3 +12 -8docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 +12 -8docs/libcurl/opts/CURLOPT_SASL_IR.3 +10 -6docs/libcurl/opts/CURLOPT_SEEKDATA.3 +12 -2docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 +12 -3docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.3 +11 -7docs/libcurl/opts/CURLOPT_SERVICE_NAME.3 +9 -6docs/libcurl/opts/CURLOPT_SHARE.3 +21 -17docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3 +15 -10docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3 +18 -12docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3 +12 -9docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3 +11 -7docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3 +11 -7docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3 +11 -7docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.3 +10 -7docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.3 +18 -8docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.3 +15 -6docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3 +11 -7docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3 +11 -7docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3 +14 -5docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3 +15 -5docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3 +11 -7docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.3 +12 -8docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3 +11 -7docs/libcurl/opts/CURLOPT_SSLCERT.3 +12 -8docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3 +13 -9docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 +20 -12docs/libcurl/opts/CURLOPT_SSLENGINE.3 +10 -6docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3 +11 -7docs/libcurl/opts/CURLOPT_SSLKEY.3 +12 -8docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3 +13 -9docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 +27 -16docs/libcurl/opts/CURLOPT_SSLVERSION.3 +10 -7docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3 +10 -6docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3 +2 -2docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3 +2 -2docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 +10 -6docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3 +10 -6docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3 +10 -6docs/libcurl/opts/CURLOPT_SSL_FALSESTART.3 +8 -5docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3 +12 -8docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.3 +11 -7docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 +9 -6docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 +9 -6docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3 +11 -7docs/libcurl/opts/CURLOPT_STDERR.3 +9 -6docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.3 +11 -8docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3 +11 -8docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3 +12 -9docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3 +13 -10docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3 +8 -5docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 +13 -10docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 +13 -10docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 +13 -10docs/libcurl/opts/CURLOPT_TCP_NODELAY.3 +9 -6docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3 +14 -10docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3 +11 -7docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 +16 -13docs/libcurl/opts/CURLOPT_TIMECONDITION.3 +13 -10docs/libcurl/opts/CURLOPT_TIMEOUT.3 +9 -6docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3 +9 -6docs/libcurl/opts/CURLOPT_TIMEVALUE.3 +12 -9docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 +12 -9docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 +11 -7docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3 +12 -8docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3 +12 -8docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3 +12 -8docs/libcurl/opts/CURLOPT_TRAILERDATA.3 +11 -4docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3 +10 -6docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.3 +8 -5docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3 +11 -6docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3 +9 -6docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 +18 -15docs/libcurl/opts/CURLOPT_UPLOAD.3 +30 -14docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 +11 -7docs/libcurl/opts/CURLOPT_URL.3 +8 -5docs/libcurl/opts/CURLOPT_USERAGENT.3 +8 -5docs/libcurl/opts/CURLOPT_USERNAME.3 +10 -6docs/libcurl/opts/CURLOPT_USERPWD.3 +10 -6docs/libcurl/opts/CURLOPT_USE_SSL.3 +10 -7docs/libcurl/opts/CURLOPT_VERBOSE.3 +10 -7docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3 +16 -9docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 +19 -15docs/libcurl/opts/CURLOPT_WS_OPTIONS.3 +11 -7docs/libcurl/opts/CURLOPT_XFERINFODATA.3 +25 -20docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.3 +31 -24docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.3 +10 -6docs/libcurl/opts/CURLSHOPT_LOCKFUNC.3 +7 -1docs/libcurl/opts/CURLSHOPT_SHARE.3 +4 -1docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.3 +6 -1docs/libcurl/opts/CURLSHOPT_UNSHARE.3 +4 -1docs/libcurl/opts/CURLSHOPT_USERDATA.3 +8 -1include/curl/curl.h +1 -0
.github/scripts/verify-examples.pl+0 -2
@@ -50,8 +50,6 @@ sub extract {
open(F, "<$f");
open(O, ">$cfile");
print O "#include <curl/curl.h>\n";
- print O "extern struct CURLM *multi;\n";
- print O "extern struct CURL *easy;\n";
while(<F>) {
$iline++;
if(/^.SH EXAMPLE/) {
docs/libcurl/curl_easy_cleanup.3+11 -6
@@ -57,12 +57,17 @@ Passing in a NULL pointer in \fIhandle\fP makes this function return
immediately with no action.
.SH EXAMPLE
.nf
-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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_duphandle.3+12 -9
@@ -52,15 +52,18 @@ In multi-threaded programs, this function must be called in a synchronous way,
the input handle may not be in use when cloned.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-CURL *nother;
-if(curl) {
- CURLcode res;
- 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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_escape.3+10 -7
@@ -57,14 +57,17 @@ The caller of \fIcurl_easy_escape(3)\fP must make sure that the data passed in
to the function is encoded correctly.
.SH EXAMPLE
.nf
-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);
+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);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_getinfo.3+5 -1
@@ -298,8 +298,11 @@ pretransfer and transfer before final transaction was started. So, this is
zero if no redirection took place.
.SH EXAMPLE
.nf
- curl = curl_easy_init();
+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);
@@ -315,6 +318,7 @@ zero if no redirection took place.
/* always cleanup */
curl_easy_cleanup(curl);
}
+}
.fi
.SH AVAILABILITY
Added in 7.4.1
docs/libcurl/curl_easy_header.3+12 -3
@@ -127,9 +127,18 @@ response that might happen before the "real" response.
The header is an HTTP/2 or HTTP/3 pseudo header
.SH EXAMPLE
.nf
-struct curl_header *type;
-CURLHcode h =
- curl_easy_header(easy, "Content-Type", 0, CURLH_HEADER, -1, &type);
+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);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.83.0. Officially supported since 7.84.0.
docs/libcurl/curl_easy_init.3+9 -6
@@ -57,12 +57,15 @@ this function.
.SH EXAMPLE
.nf
-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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_nextheader.3+21 -12
@@ -68,20 +68,29 @@ 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.
.SH EXAMPLE
.nf
-struct curl_header *prev = NULL;
-struct curl_header *h;
+int main(void)
+{
+ struct curl_header *prev = NULL;
+ struct curl_header *h;
-/* extract the normal headers from the first request */
-while((h = curl_easy_nextheader(easy, CURLH_HEADER, 0, prev))) {
- printf("%s: %s\\n", h->name, h->value);
- prev = 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(easy, origin, -1, 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;
+ }
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_option_by_id.3+6 -3
@@ -41,9 +41,12 @@ well.
If libcurl has no option with the given id, this function returns NULL.
.SH EXAMPLE
.nf
-const struct curl_easyoption *opt = curl_easy_option_by_id(CURLOPT_URL);
-if(opt) {
- printf("This option wants type %x\\n", opt->type);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_option_by_name.3+6 -3
@@ -40,9 +40,12 @@ insensitive.
If libcurl has no option with the given name, this function returns NULL.
.SH EXAMPLE
.nf
-const struct curl_easyoption *opt = curl_easy_option_by_name("URL");
-if(opt) {
- printf("This option wants CURLoption %x\\n", (int)opt->id);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_option_next.3+9 -6
@@ -70,12 +70,15 @@ struct curl_easyoption {
.fi
.SH EXAMPLE
.nf
-/* 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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_pause.3+9 -2
@@ -92,8 +92,15 @@ When such a paused stream is unpaused again, any buffered data is delivered
first.
.SH EXAMPLE
.nf
-/* pause a transfer in both directions */
-curl_easy_pause(curl, CURL_READFUNC_PAUSE | CURL_WRITEFUNC_PAUSE);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pause a transfer in both directions */
+ curl_easy_pause(curl, CURL_READFUNC_PAUSE | CURL_WRITEFUNC_PAUSE);
+
+ }
+}
.fi
.SH "MEMORY USE"
When pausing a download transfer by returning the magic return code from a
docs/libcurl/curl_easy_perform.3+9 -6
@@ -63,12 +63,15 @@ While the \fBeasy_handle\fP is added to a multi handle, it cannot be used by
\fIcurl_easy_perform(3)\fP.
.SH EXAMPLE
.nf
-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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_recv.3+21 -10
@@ -63,18 +63,29 @@ Furthermore if you wait on the socket and it tells you there is data to read,
read was for internal SSL processing, and no other data is available.
.SH EXAMPLE
.nf
- 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);
+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) {
- /* Extract the socket from the curl handle - we need it for waiting. */
- res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+ if(res == CURLE_OK) {
+ char buf[256];
+ size_t nread;
+ long sockfd;
- /* read data */
- res = curl_easy_recv(curl, buf, sizeof(buf), &nread);
- }
+ /* 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);
+ }
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.18.2.
docs/libcurl/curl_easy_reset.3+8 -4
@@ -40,11 +40,15 @@ connections, the Session ID cache, the DNS cache, the cookies, the shares or
the alt-svc cache.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
-/* ... the handle is used and options are set ... */
-
-curl_easy_reset(curl);
+ /* ... the handle is used and options are set ... */
+ curl_easy_reset(curl);
+ }
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.12.1
docs/libcurl/curl_easy_send.3+19 -10
@@ -58,18 +58,27 @@ Furthermore if you wait on the socket and it tells you it's writable,
sent was for internal SSL processing, and no other data could be sent.
.SH EXAMPLE
.nf
- 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);
+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) {
- /* Extract the socket from the curl handle - we need it for waiting. */
- res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+ if(res == CURLE_OK) {
+ long 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);
- }
+ /* send data */
+ res = curl_easy_send(curl, "hello", 5, &sent);
+ }
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.18.2.
docs/libcurl/curl_easy_setopt.3+9 -6
@@ -709,12 +709,15 @@ To be set by toplevel tools like "curl" to skip lengthy cleanups when they are a
TELNET options. See \fICURLOPT_TELNETOPTIONS(3)\fP
.SH EXAMPLE
.nf
-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);
+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);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_strerror.3+14 -6
@@ -38,12 +38,20 @@ Typically applications also appreciate \fICURLOPT_ERRORBUFFER(3)\fP for more
specific error descriptions generated at runtime.
.SH EXAMPLE
.nf
- /* 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));
+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));
+ }
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.12.0
docs/libcurl/curl_easy_unescape.3+13 -10
@@ -54,17 +54,20 @@ TPF, but it was otherwise ignored.
You must \fIcurl_free(3)\fP the returned string when you are done with it.
.SH EXAMPLE
.nf
-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);
+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);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_easy_upkeep.3+18 -15
@@ -47,27 +47,30 @@ The connection upkeep interval is set with
\fICURLOPT_UPKEEP_INTERVAL_MS(3)\fP.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- /* Make a connection to an HTTP/2 server. */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+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);
+ /* Set the interval to 30000ms / 30s */
+ curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* Perform more work here. */
+ /* 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);
+ /* 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. */
+ /* Perform more work here. */
- /* always cleanup */
- curl_easy_cleanup(curl);
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_escape.3+7 -4
@@ -44,10 +44,13 @@ on \fBstring\fP to find out the size.
You must \fIcurl_free(3)\fP the returned string when you are done with it.
.SH EXAMPLE
.nf
-char *output = curl_escape("data to convert", 15);
-if(output) {
- printf("Encoded: %s\\n", output);
- curl_free(output);
+int main(void)
+{
+ char *output = curl_escape("data to convert", 15);
+ if(output) {
+ printf("Encoded: %s\\n", output);
+ curl_free(output);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_formadd.3+93 -76
@@ -175,82 +175,99 @@ for the curl handle.
See example below.
.SH EXAMPLE
.nf
- 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, record_length,
- 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);
+#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);
+ }
+}
+.fi
.SH AVAILABILITY
Deprecated in 7.56.0. Before this release, field names were allowed to
contain zero-valued bytes. The pseudo-filename "-" to read stdin is
docs/libcurl/curl_formfree.3+19 -10
@@ -48,19 +48,28 @@ Passing in a NULL pointer in \fIform\fP makes this function return immediately
with no action.
.SH EXAMPLE
.nf
- /* Fill in a file upload field */
- curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "file",
- CURLFORM_FILE, "nice-image.jpg",
- CURLFORM_END);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct curl_httppost *formpost;
+ struct curl_httppost *lastptr;
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+ /* Fill in a file upload field */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "file",
+ CURLFORM_FILE, "nice-image.jpg",
+ CURLFORM_END);
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
- /* then cleanup the formpost chain */
- curl_formfree(formpost);
+ curl_easy_perform(curl);
+
+ /* then cleanup the formpost chain */
+ curl_formfree(formpost);
+ }
+}
.fi
.SH AVAILABILITY
Deprecated in 7.56.0.
docs/libcurl/curl_formget.3+15 -14
@@ -50,21 +50,22 @@ request. This, because first then does libcurl known which actual read
callback to use!
.SH EXAMPLE
.nf
- 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_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;
- }
+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;
+}
+.fi
.SH AVAILABILITY
This function was added in libcurl 7.15.5. The form API is deprecated in
libcurl 7.56.0.
docs/libcurl/curl_free.3+3 -0
@@ -39,11 +39,14 @@ Passing in a NULL pointer in \fIptr\fP makes this function return immediately
with no action.
.SH EXAMPLE
.nf
+int main(void)
+{
char *width = curl_getenv("COLUMNS");
if(width) {
/* it was set! */
curl_free(width);
}
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/curl_getdate.3+26 -23
@@ -70,29 +70,32 @@ year, MM as the month number and DD as the day of the month, for the specified
calendar date.
.SH EXAMPLE
.nf
- 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);
+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);
+}
.fi
.SH STANDARDS
This parser handles date formats specified in RFC 822 (including the update in
docs/libcurl/curl_getenv.3+3 -0
@@ -38,11 +38,14 @@ systems libcurl builds on (including win32).
You must \fIcurl_free(3)\fP the returned string when you are done with it.
.SH EXAMPLE
.nf
+int main(void)
+{
char *width = curl_getenv("COLUMNS");
if(width) {
/* it was set! */
curl_free(width);
}
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/curl_global_cleanup.3+6 -3
@@ -58,11 +58,14 @@ recommend you do not run libcurl from any module that may be unloaded
dynamically. This behavior may be addressed in the future.
.SH EXAMPLE
.nf
- curl_global_init(CURL_GLOBAL_DEFAULT);
+int main(void)
+{
+ curl_global_init(CURL_GLOBAL_DEFAULT);
- /* use libcurl, then before exiting... */
+ /* use libcurl, then before exiting... */
- curl_global_cleanup();
+ curl_global_cleanup();
+}
.fi
.SH AVAILABILITY
Added in 7.8
docs/libcurl/curl_global_init.3+6 -3
@@ -101,11 +101,14 @@ connecting or when waiting for data. Otherwise, curl waits until full timeout
elapses. (Added in 7.30.0)
.SH EXAMPLE
.nf
- curl_global_init(CURL_GLOBAL_DEFAULT);
+int main(void)
+{
+ curl_global_init(CURL_GLOBAL_DEFAULT);
- /* use libcurl, then before exiting... */
+ /* use libcurl, then before exiting... */
- curl_global_cleanup();
+ curl_global_cleanup();
+}
.fi
.SH AVAILABILITY
Added in 7.8
docs/libcurl/curl_global_init_mem.3+12 -3
@@ -65,9 +65,18 @@ Manipulating these gives considerable powers to the application to severely
screw things up for libcurl. Take care!
.SH EXAMPLE
.nf
- curl_global_init_mem(CURL_GLOBAL_DEFAULT, curl_malloc_cb,
- curl_free_cb, curl_realloc_cb,
- curl_strdup_cb, curl_calloc_cb);
+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);
+}
.fi
.SH AVAILABILITY
Added in 7.12.0
docs/libcurl/curl_global_sslset.3+4 -0
@@ -103,6 +103,9 @@ typedef enum {
.fi
.SH EXAMPLE
.nf
+int main(void)
+{
+ int i;
/* choose a specific backend */
curl_global_sslset(CURLSSLBACKEND_WOLFSSL, NULL, NULL);
@@ -113,6 +116,7 @@ typedef enum {
for(i = 0; list[i]; i++)
printf("SSL backend #%d: '%s' (ID: %d)\\n",
i, list[i]->name, list[i]->id);
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.56.0. Before this version, there was no
docs/libcurl/curl_global_trace.3+7 -4
@@ -91,11 +91,14 @@ trace.
.SH EXAMPLE
.nf
- /* log details of HTTP/2 and SSL handling */
- curl_global_trace("http/2,ssl");
+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");
+ /* log all details, except SSL handling */
+ curl_global_trace("all,-ssl");
+}
.fi
Below is a trace sample where "http/2" was configured. The trace output
docs/libcurl/curl_mime_addpart.3+15 -9
@@ -39,18 +39,24 @@ subsequently be populated using functions from the mime API.
appended.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 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");
+ /* 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");
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_data.3+14 -8
@@ -52,17 +52,23 @@ Setting large data is memory consuming: one might consider using
\fIcurl_mime_data_cb(3)\fP in such a case.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 a part */
+ part = curl_mime_addpart(mime);
- /* add data to the part */
- curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
+ /* add data to the part */
+ curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_data_cb.3+17 -12
@@ -104,7 +104,7 @@ 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.
.nf
-
+#include <string.h> /* for memcpy */
char hugedata[512000];
struct ctl {
@@ -146,17 +146,22 @@ int seek_callback(void *arg, curl_off_t offset, int origin)
return CURL_SEEKFUNC_OK;
}
- CURL *easy = curl_easy_init();
- curl_mime *mime = curl_mime_init(easy);
- 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);
-
+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);
+ }
+}
+.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
.SH RETURN VALUE
docs/libcurl/curl_mime_encoder.3+16 -10
@@ -74,20 +74,26 @@ a part with content set with \fIcurl_mime_subparts(3)\fP is strongly
discouraged.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 a part */
+ part = curl_mime_addpart(mime);
- /* send a file */
- curl_mime_filedata(part, "image.png");
+ /* send a file */
+ curl_mime_filedata(part, "image.png");
- /* encode file data in base64 for transfer */
- curl_mime_encoder(part, "base64");
+ /* encode file data in base64 for transfer */
+ curl_mime_encoder(part, "base64");
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_filedata.3+16 -10
@@ -58,20 +58,26 @@ Setting a part's contents multiple times is valid: only the value set by the
last call is retained.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 a part */
+ part = curl_mime_addpart(mime);
- /* send data from this file */
- curl_mime_filedata(part, "image.png");
+ /* send data from this file */
+ curl_mime_filedata(part, "image.png");
- /* set name */
- curl_mime_name(part, "data");
+ /* set name */
+ curl_mime_name(part, "data");
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_filename.3+21 -12
@@ -47,23 +47,32 @@ 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.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+static char imagebuf[]="imagedata";
- /* add a part */
- part = curl_mime_addpart(mime);
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* send image data from memory */
- curl_mime_data(part, imagebuf, imagebuf_len);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* create a mime handle */
+ mime = curl_mime_init(curl);
- /* set a file name to make it look like a file upload */
- curl_mime_filename(part, "image.png");
+ /* add a part */
+ part = curl_mime_addpart(mime);
- /* set name */
- curl_mime_name(part, "data");
+ /* 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");
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_free.3+11 -5
@@ -47,13 +47,19 @@ Passing in a NULL pointer in \fImime\fP makes this function return immediately
with no action.
.SH EXAMPLE
.nf
- /* Build the mime message. */
- mime = curl_mime_init(curl);
+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);
+ /* Free multipart message. */
+ curl_mime_free(mime);
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_headers.3+22 -8
@@ -47,18 +47,32 @@ Setting a part's custom headers list multiple times is valid: only the value
set by the last call is retained.
.SH EXAMPLE
.nf
- struct curl_slist *headers = NULL;
+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");
+ headers = curl_slist_append(headers, "Custom-Header: mooo");
- /* use these headers, please take ownership */
- curl_mime_headers(part, headers, TRUE);
+ mime = curl_mime_init(easy);
+ part = curl_mime_addpart(mime);
- /* pass on this data */
- curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED);
+ /* use these headers in the part, takes ownership */
+ curl_mime_headers(part, headers, 1);
- /* set name */
- curl_mime_name(part, "numbers");
+ /* 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);
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_init.3+19 -15
@@ -44,24 +44,28 @@ 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.
.SH EXAMPLE
.nf
- CURL *easy = curl_easy_init();
- curl_mime *mime;
- curl_mimepart *part;
+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");
+ /* 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);
+ /* 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);
+ /* Clean-up. */
+ curl_easy_cleanup(easy);
+ curl_mime_free(mime);
+}
+.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
.SH RETURN VALUE
docs/libcurl/curl_mime_name.3+14 -8
@@ -44,17 +44,23 @@ is valid: only the value set by the last call is retained. It is possible to
reset the name of a part by setting \fIname\fP to NULL.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 a part */
+ part = curl_mime_addpart(mime);
- /* give the part a name */
- curl_mime_name(part, "shoe_size");
+ /* give the part a name */
+ curl_mime_name(part, "shoe_size");
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_subparts.3+29 -16
@@ -46,25 +46,38 @@ last call is retained. It is possible to unassign previous part's contents by
setting \fIsubparts\fP to NULL.
.SH EXAMPLE
.nf
- /* The inline part is an alternative proposing the html and the text
- versions of the email. */
- alt = curl_mime_init(curl);
- /* HTML message. */
- part = curl_mime_addpart(alt);
- curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
- curl_mime_type(part, "text/html");
+static char *inline_html = "<title>example</title>";
+static char *inline_text = "once upon the time";
- /* Text message. */
- part = curl_mime_addpart(alt);
- curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct curl_slist *slist;
- /* Create the inline part. */
- part = curl_mime_addpart(mime);
- 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);
+ /* 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);
+ }
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mime_type.3+18 -12
@@ -57,23 +57,29 @@ extension, or application/octet-stream by default.
- text/plain in other cases.
.SH EXAMPLE
.nf
- curl_mime *mime;
- curl_mimepart *part;
+int main(void)
+{
+ curl_mime *mime;
+ curl_mimepart *part;
- /* create a mime handle */
- mime = curl_mime_init(easy);
+ 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 a part */
+ part = curl_mime_addpart(mime);
- /* get data from this file */
- curl_mime_filedata(part, "image.png");
+ /* get data from this file */
+ curl_mime_filedata(part, "image.png");
- /* content-type for this part */
- curl_mime_type(part, "image/png");
+ /* content-type for this part */
+ curl_mime_type(part, "image/png");
- /* set name */
- curl_mime_name(part, "image");
+ /* set name */
+ curl_mime_name(part, "image");
+}
+}
.fi
.SH AVAILABILITY
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
docs/libcurl/curl_mprintf.3+6 -1
@@ -237,8 +237,13 @@ by the corresponding argument.
A '%' is written. No argument is converted.
.SH EXAMPLE
.nf
+const char *name = "John";
+
+int main(void)
+{
curl_mprintf("My name is %s\\n", name);
- curl_mprintf("Pi is almost %f\\n", 25/8);
+ curl_mprintf("Pi is almost %f\\n", (double)25.0/8);
+}
.fi
.SH AVAILABILITY
These functions might be removed from the public libcurl API in the future. Do
docs/libcurl/curl_multi_add_handle.3+10 -3
@@ -67,12 +67,19 @@ first the easy handle and then the multi handle:
3 - \fIcurl_multi_cleanup(3)\fP
.SH EXAMPLE
.nf
+int main(void)
+{
/* init a multi stack */
- multi_handle = curl_multi_init();
+ 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_handle, http_handle);
- curl_multi_add_handle(multi_handle, http_handle2);
+ curl_multi_add_handle(multi, http_handle);
+ curl_multi_add_handle(multi, http_handle2);
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_assign.3+11 -2
@@ -54,8 +54,17 @@ functionality.
It is acceptable to call this function from your multi callback functions.
.SH EXAMPLE
.nf
- /* make our struct pointer associated with socket fd */
- mc = curl_multi_assign(multi_handle, fd, ourstructp);
+int main(void)
+{
+ CURLM *multi = curl_multi_init();
+ void *ourstructp; /* pointer to our data */
+ curl_socket_t fd; /* file descriptor to associate our data with */
+
+ /* make our struct pointer associated with socket fd */
+ CURLMcode mc = curl_multi_assign(multi, fd, ourstructp);
+ if(mc)
+ printf("error: %s\\n", curl_multi_strerror(mc));
+}
.fi
.SH AVAILABILITY
Added in 7.15.5
docs/libcurl/curl_multi_cleanup.3+8 -3
@@ -48,10 +48,15 @@ Passing in a NULL pointer in \fImulti_handle\fP makes this function return
CURLM_BAD_HANDLE immediately with no other action.
.SH EXAMPLE
.nf
- /* when the multi transfer is done ... */
+int main(void)
+{
+ CURLM *multi = curl_multi_init();
- /* remove all easy handles, then: */
- curl_multi_cleanup(multi_handle);
+ /* when the multi transfer is done ... */
+
+ /* remove all easy handles, then: */
+ curl_multi_cleanup(multi);
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_fdset.3+27 -8
@@ -80,16 +80,35 @@ save you from the crash, but makes your program NOT wait for sockets it should
wait for...
.SH EXAMPLE
.nf
- /* get file descriptors from the transfers */
- mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
+int main(void)
+{
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ int maxfd;
+ int rc;
+ CURLMcode mc;
+ struct timeval timeout = {1, 0};
- if(mc != CURLM_OK) {
- fprintf(stderr, "curl_multi_fdset() failed, code %d.\\n", mc);
- break;
- }
+ CURLM *multi = curl_multi_init();
- /* wait for activity on one of the sockets */
- rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
+ do {
+
+ /* call curl_multi_perform() */
+
+ /* 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);
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_get_handles.3+17 -10
@@ -47,22 +47,29 @@ The order of the easy handles within the array is not guaranteed.
The returned array must be freed with a call to \fIcurl_free(3)\fP after use.
.SH EXAMPLE
.nf
+int main(void)
+{
/* init a multi stack */
- multi_handle = curl_multi_init();
+ CURLM *multi = curl_multi_init();
+ CURL *curl = curl_easy_init();
- /* add a transfer */
- curl_multi_add_handle(multi_handle, http_handle);
+ if(curl) {
+ /* add the transfer */
+ curl_multi_add_handle(multi, curl);
- /* extract all added handles */
- CURL **list = curl_multi_get_handles(multi_handle);
+ /* extract all added handles */
+ CURL **list = curl_multi_get_handles(multi);
- if(list) {
- /* remove all added handles */
- for(i = 0; list[i]; i++) {
- curl_multi_remove_handle(multi_handle, list[i]);
+ if(list) {
+ int i;
+ /* remove all added handles */
+ for(i = 0; list[i]; i++) {
+ curl_multi_remove_handle(multi, list[i]);
+ }
+ curl_free(list);
}
- curl_free(list);
}
+}
.fi
.SH AVAILABILITY
Added in 8.4.0
docs/libcurl/curl_multi_info_read.3+19 -12
@@ -72,21 +72,28 @@ that just completed.
At this point, there are no other \fBmsg\fP types defined.
.SH EXAMPLE
.nf
-struct CURLMsg *m;
+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 */
+ /* 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_handle, &msgq);
- if(m && (m->msg == CURLMSG_DONE)) {
- CURL *e = m->easy_handle;
- transfers--;
- curl_multi_remove_handle(multi_handle, e);
- curl_easy_cleanup(e);
+ 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);
}
-} while(m);
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_init.3+10 -5
@@ -37,12 +37,17 @@ places in the documentation. This init call MUST have a corresponding call to
\fIcurl_multi_cleanup(3)\fP when the operation is complete.
.SH EXAMPLE
.nf
-/* init a multi stack */
-multi_handle = curl_multi_init();
+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_handle, http_handle);
-curl_multi_add_handle(multi_handle, http_handle2);
+ /* add individual transfers */
+ curl_multi_add_handle(multi, curl);
+ curl_multi_add_handle(multi, curl2);
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_perform.3+20 -12
@@ -62,21 +62,29 @@ again on the same multi handle after an error has been returned, unless first
removing all the handles and adding new ones.
.SH EXAMPLE
.nf
-int still_running;
-do {
- CURLMcode mc = curl_multi_perform(multi_handle, &still_running);
+int main(void)
+{
+ int still_running;
+ CURL *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_handle, NULL, 0, 1000, NULL);
+ 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(mc) {
+ fprintf(stderr, "curl_multi_poll() failed, code %d.\\n", (int)mc);
+ break;
+ }
-/* if there are still transfers, loop! */
-} while(still_running);
+ /* if there are still transfers, loop! */
+ } while(still_running);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.9.6
docs/libcurl/curl_multi_poll.3+22 -18
@@ -83,31 +83,35 @@ Bit flag to curl_waitfd.events indicating the socket should poll on write
events such as the socket being clear to write without blocking.
.SH EXAMPLE
.nf
-CURL *easy_handle;
-CURLM *multi_handle;
+int main(void)
+{
+ CURL *easy_handle;
+ CURLM *multi_handle;
+ int still_running = 0;
-/* add the individual easy handle */
-curl_multi_add_handle(multi_handle, easy_handle);
+ /* add the individual easy handle */
+ curl_multi_add_handle(multi_handle, easy_handle);
-do {
- CURLMcode mc;
- int numfds;
+ do {
+ CURLMcode mc;
+ int numfds;
- mc = curl_multi_perform(multi_handle, &still_running);
+ mc = curl_multi_perform(multi_handle, &still_running);
- if(mc == CURLM_OK) {
- /* wait for activity or timeout */
- mc = curl_multi_poll(multi_handle, NULL, 0, 1000, &numfds);
- }
+ if(mc == CURLM_OK) {
+ /* wait for activity or timeout */
+ mc = curl_multi_poll(multi_handle, NULL, 0, 1000, &numfds);
+ }
- if(mc != CURLM_OK) {
- fprintf(stderr, "curl_multi failed, code %d.\\n", mc);
- break;
- }
+ if(mc != CURLM_OK) {
+ fprintf(stderr, "curl_multi failed, code %d.\\n", mc);
+ break;
+ }
-} while(still_running);
+ } while(still_running);
-curl_multi_remove_handle(multi_handle, easy_handle);
+ curl_multi_remove_handle(multi_handle, easy_handle);
+}
.fi
.SH AVAILABILITY
Added in 7.66.0.
docs/libcurl/curl_multi_remove_handle.3+13 -7
@@ -52,13 +52,19 @@ multi handle, ready to get reused for a future transfer using this multi
handle.
.SH EXAMPLE
.nf
-/* when an easy handle has completed, remove it */
-msg = curl_multi_info_read(multi_handle, &queued);
-if(msg) {
- if(msg->msg == CURLMSG_DONE) {
- /* a transfer ended */
- fprintf(stderr, "Transfer completed\\n");
- curl_multi_remove_handle(multi_handle, msg->easy_handle);
+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);
+ }
}
}
.fi
docs/libcurl/curl_multi_setopt.3+10 -3
@@ -74,10 +74,17 @@ See \fICURLMOPT_TIMERDATA(3)\fP
.IP CURLMOPT_MAX_CONCURRENT_STREAMS
See \fICURLMOPT_MAX_CONCURRENT_STREAMS(3)\fP
.SH EXAMPLE
-.fi
- /* Limit the amount of simultaneous connections curl should allow: */
- curl_multi_setopt(handle, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
.nf
+
+#define MAX_PARALLEL 45
+
+int main(void)
+{
+ CURLM *multi;
+ /* Limit the amount of simultaneous connections curl should allow: */
+ curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
+}
+.fi
.SH AVAILABILITY
Added in 7.15.4
.SH RETURN VALUE
docs/libcurl/curl_multi_socket.3+10 -4
@@ -70,10 +70,16 @@ just a single one by calling \fIcurl_multi_socket_all(3)\fP. Note that there
should not be any reason to use this function.
.SH EXAMPLE
.nf
-/* 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;
-rc = curl_multi_socket(multi_handle, fd, &running);
+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;
+ CURLM *multi;
+ rc = curl_multi_socket(multi, fd, &running);
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.15.4, and is deemed stable since
docs/libcurl/curl_multi_socket_action.3+12 -5
@@ -97,11 +97,18 @@ socket(s) that got action. If no activity is detected and the timeout expires,
call \fIcurl_multi_socket_action(3)\fP with \fICURL_SOCKET_TIMEOUT\fP.
.SH EXAMPLE
.nf
-/* 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;
-rc = curl_multi_socket_action(multi_handle, fd, EVENT,
- &running);
+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;
+ CURLM *multi; /* the stack we work with */
+ int fd; /* the descriptor that had action */
+ int bitmask; /* what activity that happened */
+ CURLMcode mc = curl_multi_socket_action(multi, fd, bitmask, &running);
+ if(mc)
+ printf("error: %s\\n", curl_multi_strerror(mc));
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0.
docs/libcurl/curl_multi_strerror.3+8 -4
@@ -35,11 +35,15 @@ This function returns a string describing the \fICURLMcode\fP error code
passed in the argument \fIerrornum\fP.
.SH EXAMPLE
.nf
-int still_running;
+int main(void)
+{
+ int still_running;
+ CURLM *multi = curl_multi_init();
-CURLMcode mc = curl_multi_perform(multi_handle, &still_running);
-if(mc)
- printf("error: %s\\n", curl_multi_strerror(mc));
+ CURLMcode mc = curl_multi_perform(multi, &still_running);
+ if(mc)
+ printf("error: %s\\n", curl_multi_strerror(mc));
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.12.0
docs/libcurl/curl_multi_timeout.3+18 -10
@@ -54,19 +54,27 @@ currently has no stored timeout value. You must not wait too long (more than a
few seconds perhaps) before you call \fIcurl_multi_perform(3)\fP again.
.SH EXAMPLE
.nf
-struct timeval timeout;
-long timeo;
+int main(void)
+{
+ struct timeval timeout;
+ long timeo;
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ int maxfd;
+ CURLM *multi = curl_multi_init();
-curl_multi_timeout(multi_handle, &timeo);
-if(timeo < 0)
- /* no set timeout, use a default */
- timeo = 980;
+ 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;
+ 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);
+ /* wait for activities no longer than the set timeout */
+ select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
+}
.fi
.SH TYPICAL USAGE
Call \fIcurl_multi_timeout(3)\fP, then wait for action on the sockets. Figure
docs/libcurl/curl_multi_wait.3+21 -31
@@ -77,45 +77,35 @@ Bit flag to \fIcurl_waitfd.events\fP indicating the socket should poll on
write events such as the socket being clear to write without blocking.
.SH EXAMPLE
.nf
-CURL *easy_handle;
-CURLM *multi_handle;
+int main(void)
+{
+ CURL *easy;
+ CURLM *multi = curl_multi_init();
+ int still_running;
-/* add the individual easy handle */
-curl_multi_add_handle(multi_handle, easy_handle);
+ /* add the individual easy handle */
+ curl_multi_add_handle(multi, easy);
-do {
- CURLMcode mc;
- int numfds;
+ do {
+ CURLMcode mc;
+ int numfds;
- mc = curl_multi_perform(multi_handle, &still_running);
+ mc = curl_multi_perform(multi, &still_running);
- if(mc == CURLM_OK ) {
- /* wait for activity, timeout or "nothing" */
- mc = curl_multi_wait(multi_handle, NULL, 0, 1000, &numfds);
- }
-
- if(mc != CURLM_OK) {
- fprintf(stderr, "curl_multi failed, code %d.\\n", mc);
- break;
- }
-
- /* 'numfds' being zero means either a timeout or no file descriptors to
- wait for. Try timeout on first occurrence, then assume no file
- descriptors and no file descriptors to wait for means wait for 100
- milliseconds. */
+ if(mc == CURLM_OK) {
+ /* wait for activity, timeout or "nothing" */
+ mc = curl_multi_wait(multi, NULL, 0, 1000, &numfds);
+ }
- if(!numfds) {
- repeats++; /* count number of repeated zero numfds */
- if(repeats > 1) {
- WAITMS(100); /* sleep 100 milliseconds */
+ if(mc != CURLM_OK) {
+ fprintf(stderr, "curl_multi failed, code %d.\\n", mc);
+ break;
}
- }
- else
- repeats = 0;
-} while(still_running);
+ } while(still_running);
-curl_multi_remove_handle(multi_handle, easy_handle);
+ curl_multi_remove_handle(multi, easy);
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.28.0.
docs/libcurl/curl_multi_wakeup.3+29 -22
@@ -45,40 +45,47 @@ that multiple calls to this function wake up the same waiting operation.
This function has no effect on \fIcurl_multi_wait(3)\fP calls.
.SH EXAMPLE
.nf
-CURL *easy_handle;
-CURLM *multi_handle;
+extern int time_to_die(void);
+extern int set_something_to_signal_thread_1_to_exit(void);
+extern int decide_to_stop_thread1();
-/* add the individual easy handle */
-curl_multi_add_handle(multi_handle, easy_handle);
+int main(void)
+{
+ CURL *easy;
+ CURLM *multi;
+ int still_running;
-/* this is thread 1 */
-do {
- CURLMcode mc;
- int numfds;
+ /* add the individual easy handle */
+ curl_multi_add_handle(multi, easy);
- mc = curl_multi_perform(multi_handle, &still_running);
+ /* this is thread 1 */
+ do {
+ CURLMcode mc;
+ int numfds;
- if(mc == CURLM_OK) {
- /* wait for activity, timeout or wakeup */
- mc = curl_multi_poll(multi_handle, NULL, 0, 10000, &numfds);
- }
+ mc = curl_multi_perform(multi, &still_running);
- if(time_to_die())
- exit(1);
+ if(mc == CURLM_OK) {
+ /* wait for activity, timeout or wakeup */
+ mc = curl_multi_poll(multi, NULL, 0, 10000, &numfds);
+ }
-} while(still_running);
+ if(time_to_die())
+ return 1;
-curl_multi_remove_handle(multi_handle, easy_handle);
+ } while(still_running);
-/* this is thread 2 */
+ curl_multi_remove_handle(multi, easy);
-if(something makes us decide to stop thread 1) {
+ /* this is thread 2 */
- set_something_to_signal_thread_1_to_exit();
+ if(decide_to_stop_thread1()) {
- curl_multi_wakeup(multi_handle);
-}
+ set_something_to_signal_thread_1_to_exit();
+ curl_multi_wakeup(multi);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.68.0
docs/libcurl/curl_pushheader_byname.3+14 -7
@@ -43,11 +43,13 @@ one header field use the same name, this returns only the first one.
.SH EXAMPLE
.nf
-int curl_push_callback(CURL *parent,
- CURL *easy,
- size_t num_headers,
- struct curl_pushheaders *headers,
- void *clientp)
+#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;
@@ -69,8 +71,13 @@ int curl_push_callback(CURL *parent,
return CURL_PUSH_DENY;
}
-curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, curl_push_callback);
-curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
+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);
+}
.fi
.SH AVAILABILITY
Added in 7.44.0
docs/libcurl/curl_pushheader_bynum.3+11 -7
@@ -43,13 +43,13 @@ libcurl when this callback returns. The returned pointer points to a
.SH EXAMPLE
.nf
/* output all the incoming push request headers */
-int curl_push_callback(CURL *parent,
- CURL *easy,
- size_t num_headers,
- struct curl_pushheaders *headers,
- void *clientp)
+static int push_cb(CURL *parent,
+ CURL *easy,
+ size_t num_headers,
+ struct curl_pushheaders *headers,
+ void *clientp)
{
- sizt_t i = 0;
+ int i = 0;
char *field;
do {
field = curl_pushheader_bynum(headers, i);
@@ -60,7 +60,11 @@ int curl_push_callback(CURL *parent,
return CURL_PUSH_OK; /* permission granted */
}
-curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, curl_push_callback);
+int main(void)
+{
+ CURLM *multi = curl_multi_init();
+ curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb);
+}
.fi
.SH AVAILABILITY
Added in 7.44.0
docs/libcurl/curl_share_cleanup.3+4 -1
@@ -38,11 +38,14 @@ Passing in a NULL pointer in \fIshare_handle\fP makes this function return
immediately with no action.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
/* use the share, then ... */
curl_share_cleanup(share);
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/curl_share_init.3+4 -1
@@ -42,11 +42,14 @@ This \fIshare handle\fP is what you pass to curl using the
specific curl handle use the data in this share.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ 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));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/curl_share_setopt.3+4 -1
@@ -45,11 +45,14 @@ See \fICURLSHOPT_UNSHARE(3)\fP.
See \fICURLSHOPT_USERDATA(3)\fP.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ 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));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/curl_share_strerror.3+4 -1
@@ -35,11 +35,14 @@ The \fIcurl_share_strerror(3)\fP function returns a string describing the
\fICURLSHcode\fP error code passed in the argument \fIerrornum\fP.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ 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));
+}
.fi
.SH AVAILABILITY
This function was added in libcurl 7.12.0
docs/libcurl/curl_slist_append.3+18 -15
@@ -42,29 +42,32 @@ The list should be freed again (after usage) with
\fIcurl_slist_free_all(3)\fP.
.SH EXAMPLE
.nf
-CURL *handle;
-struct curl_slist *slist=NULL;
-struct curl_slist *temp=NULL;
+int main(void)
+{
+ CURL *handle;
+ struct curl_slist *slist = NULL;
+ struct curl_slist *temp = NULL;
-slist = curl_slist_append(slist, "pragma:");
+ slist = curl_slist_append(slist, "pragma:");
-if (slist == NULL)
- return -1;
+ if(!slist)
+ return -1;
-temp = curl_slist_append(slist, "Accept:")
+ temp = curl_slist_append(slist, "Accept:");
-if (temp == NULL) {
- curl_slist_free_all(slist);
- return -1;
-}
+ if(!temp) {
+ curl_slist_free_all(slist);
+ return -1;
+ }
-slist = temp;
+ slist = temp;
-curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
+ curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
-curl_easy_perform(handle);
+ curl_easy_perform(handle);
-curl_slist_free_all(slist); /* free the list again */
+ curl_slist_free_all(slist); /* free the list again */
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/curl_slist_free_all.3+11 -8
@@ -38,19 +38,22 @@ Passing in a NULL pointer in \fIlist\fP makes this function return immediately
with no action.
.SH EXAMPLE
.nf
-CURL *handle;
-struct curl_slist *slist=NULL;
+int main(void)
+{
+ CURL *handle;
+ struct curl_slist *slist = NULL;
-slist = curl_slist_append(slist, "X-libcurl: coolness");
+ slist = curl_slist_append(slist, "X-libcurl: coolness");
-if (slist == NULL)
- return -1;
+ if(!slist)
+ return -1;
-curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
+ curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
-curl_easy_perform(handle);
+ curl_easy_perform(handle);
-curl_slist_free_all(slist); /* free the list again */
+ curl_slist_free_all(slist); /* free the list again */
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/curl_strequal.3+8 -4
@@ -46,10 +46,14 @@ strings in a truly portable manner. There are no standard portable case
insensitive string comparison functions. These two work on all platforms.
.SH EXAMPLE
.nf
-if(curl_strequal(name, input))
- printf("Name and input matches\\n");
-if(curl_strnequal(name, input, 5))
- printf("Name and input matches in the 5 first bytes\\n");
+int main(int argc, char **argv)
+{
+ const char *name = "compare";
+ if(curl_strequal(name, argv[1]))
+ printf("Name and input matches\\n");
+ if(curl_strnequal(name, argv[1], 5))
+ printf("Name and input matches in the 5 first bytes\\n");
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/curl_unescape.3+11 -9
@@ -44,15 +44,17 @@ strlen() on \fBinput\fP to find out the size.
You must \fIcurl_free(3)\fP the returned string when you are done with it.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- int decodelen;
- char *decoded = curl_unescape("%63%75%72%6c", 12, &decodelen);
- if(decoded) {
- /* do not assume printf() works on the decoded data! */
- printf("Decoded: ");
- /* ... */
- curl_free(decoded);
+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);
+ }
}
}
.fi
docs/libcurl/curl_url.3+3 -0
@@ -40,6 +40,8 @@ stored. They are then set in the object with the \fIcurl_url_set(3)\fP
function.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLUcode rc;
CURLU *url = curl_url();
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
@@ -52,6 +54,7 @@ function.
}
curl_url_cleanup(url);
}
+}
.fi
.SH AVAILABILITY
Added in 7.62.0
docs/libcurl/curl_url_cleanup.3+3 -0
@@ -37,9 +37,12 @@ Passing in a NULL pointer in \fIhandle\fP makes this function return
immediately with no action.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLU *url = curl_url();
curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
curl_url_cleanup(url);
+}
.fi
.SH AVAILABILITY
Added in 7.62.0
docs/libcurl/curl_url_dup.3+3 -0
@@ -36,6 +36,8 @@ returns a pointer to the copy as a new \fICURLU\fP handle. The new handle also
needs to be freed with \fIcurl_url_cleanup(3)\fP.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLUcode rc;
CURLU *url = curl_url();
CURLU *url2;
@@ -45,6 +47,7 @@ needs to be freed with \fIcurl_url_cleanup(3)\fP.
curl_url_cleanup(url2);
}
curl_url_cleanup(url);
+}
.fi
.SH AVAILABILITY
Added in 7.62.0
docs/libcurl/curl_url_get.3+3 -0
@@ -145,6 +145,8 @@ The initial hash sign that denotes the beginning of the fragment is a
delimiter only. It is not part of the fragment contents.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLUcode rc;
CURLU *url = curl_url();
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
@@ -157,6 +159,7 @@ delimiter only. It is not part of the fragment contents.
}
curl_url_cleanup(url);
}
+}
.fi
.SH AVAILABILITY
Added in 7.62.0. CURLUPART_ZONEID was added in 7.65.0.
docs/libcurl/curl_url_set.3+3 -1
@@ -179,15 +179,17 @@ If set, the URL parser does not accept embedded credentials for the
such URLs.
.SH EXAMPLE
.nf
+int main(void)
+{
CURLUcode rc;
CURLU *url = curl_url();
rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
if(!rc) {
- char *scheme;
/* change it to an FTP URL */
rc = curl_url_set(url, CURLUPART_SCHEME, "ftp", 0);
}
curl_url_cleanup(url);
+}
.fi
.SH AVAILABILITY
Added in 7.62.0. CURLUPART_ZONEID was added in 7.65.0.
docs/libcurl/curl_url_strerror.3+3 -1
@@ -35,14 +35,16 @@ This function returns a string describing the CURLUcode error code passed in
the argument \fIerrornum\fP.
.SH EXAMPLE
.nf
+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);
+}
.fi
-
.SH AVAILABILITY
Added in 7.80.0
.SH RETURN VALUE
docs/libcurl/curl_version.3+4 -1
@@ -37,7 +37,10 @@ its important components (like OpenSSL version).
We recommend using \fIcurl_version_info(3)\fP instead!
.SH EXAMPLE
.nf
-printf("libcurl version %s\\n", curl_version());
+int main(void)
+{
+ printf("libcurl version %s\\n", curl_version());
+}
.fi
.SH AVAILABILITY
docs/libcurl/curl_version_info.3+8 -5
@@ -306,11 +306,14 @@ names are the same as would be used in URLs. The array is terminated by a NULL
entry.
.SH EXAMPLE
.nf
-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);
+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);
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/curl_ws_meta.3+13 -6
@@ -96,15 +96,22 @@ static size_t writecb(unsigned char *buffer,
struct customdata *c = (struct customdata *)p;
const struct curl_ws_frame *m = curl_ws_meta(c->easy);
- /* m->flags tells us about the traffic */
+ printf("flags: %x\\n", m->flags);
}
+int main(void)
{
- struct customdata custom;
- custom.easy = easy;
- custom.ptr = NULL;
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, &custom);
+ 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);
+
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/curl_ws_recv.3+9 -1
@@ -48,10 +48,18 @@ that contains information about the received data. See the
\fIcurl_ws_meta(3)\fP for details on that struct.
.SH EXAMPLE
.nf
+int main(void)
+{
size_t rlen;
const struct curl_ws_frame *meta;
char buffer[256];
- CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
+ if(res)
+ printf("error: %s\\n", curl_easy_strerror(res));
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.86.0.
docs/libcurl/curl_ws_send.3+14 -5
@@ -79,13 +79,22 @@ expected fragment size in the first call and it needs to be zero in subsequent
calls.
.SH EXAMPLE
.nf
-int ping(CURL *curl, const char *send_payload)
+#include <string.h> /* for strlen */
+
+const char *send_payload = "magic";
+
+int main(void)
{
size_t sent;
- CURLcode result =
- curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0,
- CURLWS_PING);
- return (int)result;
+ CURLcode res;
+ CURL *curl = curl_easy_init();
+ curl_easy_setopt(curl, CURLOPT_URL, "wss://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L);
+ curl_easy_perform(curl);
+ res = curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0,
+ CURLWS_PING);
+ curl_easy_cleanup(curl);
+ return (int)res;
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3+16 -12
@@ -48,21 +48,25 @@ is complete, and is typically used in combination with
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_socket_t sockfd;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_socket_t sockfd;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Do not do the transfer - only connect to host */
- curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
- res = curl_easy_perform(curl);
+ /* Do not do the transfer - only connect to host */
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ res = curl_easy_perform(curl);
- /* Extract the socket from the curl handle */
- res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+ /* Extract the socket from the curl handle */
+ res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
- if(res != CURLE_OK) {
- printf("Error: %s\\n", curl_easy_strerror(res));
- return 1;
+ if(res != CURLE_OK) {
+ printf("Error: %s\\n", curl_easy_strerror(res));
+ return 1;
+ }
}
}
.fi
docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3+14 -10
@@ -46,19 +46,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double connect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double connect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", connect);
+ res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", connect);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3+15 -11
@@ -47,20 +47,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t connect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t connect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
- (long)(connect % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
+ (long)(connect % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_CAINFO.3+9 -7
@@ -47,15 +47,17 @@ The \fBpath\fP pointer is set to NULL if there is no default path.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- char *cainfo = NULL;
- curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
- if(cainfo)
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ char *cainfo = NULL;
+ curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
+ if(cainfo) {
printf("default ca info path: %s\\n", cainfo);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_CAPATH.3+9 -7
@@ -47,15 +47,17 @@ The \fBpath\fP pointer is set to NULL if there is no default path.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- char *capath = NULL;
- curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath);
- if(capath)
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ char *capath = NULL;
+ curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath);
+ if(capath) {
printf("default ca path: %s\\n", capath);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_CERTINFO.3+23 -18
@@ -54,34 +54,39 @@ the SSL backend and the certificate.
All TLS-based
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
- /* connect to any HTTPS site, trusted or not */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ /* connect to any HTTPS site, trusted or not */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
- curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
+ curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- if (!res) {
- struct curl_certinfo *ci;
- res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
+ if(!res) {
+ int i;
+ struct curl_certinfo *ci;
+ res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
- if (!res) {
- printf("%d certs!\\n", ci->num_of_certs);
+ if(!res) {
+ printf("%d certs!\\n", ci->num_of_certs);
- for(i = 0; i < ci->num_of_certs; i++) {
- struct curl_slist *slist;
+ for(i = 0; i < ci->num_of_certs; i++) {
+ struct curl_slist *slist;
- for(slist = ci->certinfo[i]; slist; slist = slist->next)
- printf("%s\\n", slist->data);
+ for(slist = ci->certinfo[i]; slist; slist = slist->next)
+ printf("%s\\n", slist->data);
+ }
}
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3+20 -15
@@ -44,26 +44,31 @@ custom "If-Match-*" header.
HTTP and some
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
- /* January 1, 2020 is 1577833200 */
- curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* If-Modified-Since the above time stamp */
- curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
- (long)CURL_TIMECOND_IFMODSINCE);
+ /* January 1, 2020 is 1577833200 */
+ curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* If-Modified-Since the above time stamp */
+ curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
+ (long)CURL_TIMECOND_IFMODSINCE);
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the time condition */
- long unmet;
- res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
if(!res) {
- printf("The time condition was %sfulfilled\\n", unmet?"NOT":"");
+ /* check the time condition */
+ long unmet;
+ res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
+ if(!res) {
+ printf("The time condition was %sfulfilled\\n", unmet?"NOT":"");
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONNECT_TIME.3+14 -10
@@ -42,19 +42,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double connect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double connect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", connect);
+ res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", connect);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3+15 -11
@@ -43,20 +43,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t connect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t connect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
- (long)(connect % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
+ (long)(connect % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_CONN_ID.3+14 -9
@@ -44,18 +44,23 @@ same multi handle.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
- /* Perform the request */
- res = curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- curl_off_t conn_id;
- res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id);
if(!res) {
- printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\\n", conn_id);
+ curl_off_t conn_id;
+ res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id);
+ if(!res) {
+ printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\\n", conn_id);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3+14 -10
@@ -43,19 +43,23 @@ sensible variable type.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- double cl;
- res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
if(!res) {
- printf("Size: %.0f\\n", cl);
+ /* check the size */
+ double cl;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
+ if(!res) {
+ printf("Size: %.0f\\n", cl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3+14 -10
@@ -40,19 +40,23 @@ the size is not known.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- curl_off_t cl;
- res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
if(!res) {
- printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
+ /* check the size */
+ curl_off_t cl;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
+ if(!res) {
+ printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3+14 -10
@@ -42,19 +42,23 @@ more sensible variable type.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the upload */
- res = curl_easy_perform(curl);
+ /* Perform the upload */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- double cl;
- res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
if(!res) {
- printf("Size: %.0f\\n", cl);
+ /* check the size */
+ double cl;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
+ if(!res) {
+ printf("Size: %.0f\\n", cl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3+14 -10
@@ -39,19 +39,23 @@ upload. Stores -1 if the size is not known.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the upload */
- res = curl_easy_perform(curl);
+ /* Perform the upload */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- curl_off_t cl;
- res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl);
if(!res) {
- printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
+ /* check the size */
+ curl_off_t cl;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl);
+ if(!res) {
+ printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3+15 -11
@@ -47,21 +47,25 @@ The modern way to get this header from a response is to instead use the
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+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);
+ res = curl_easy_perform(curl);
- if(!res) {
- /* extract the content-type */
- char *ct = NULL;
- res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
- if(!res && ct) {
- printf("Content-Type: %s\\n", ct);
+ if(!res) {
+ /* extract the content-type */
+ char *ct = NULL;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
+ if(!res && ct) {
+ printf("Content-Type: %s\\n", ct);
+ }
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_COOKIELIST.3+23 -19
@@ -45,31 +45,35 @@ domain name are not exported by this option.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable the cookie engine */
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
+ /* enable the cookie engine */
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- if(!res) {
- /* extract all known cookies */
- struct curl_slist *cookies = NULL;
- res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
- if(!res && cookies) {
- /* a linked list of cookies in cookie file format */
- struct curl_slist *each = cookies;
- while(each) {
- printf("%s\\n", each->data);
- each = each->next;
+ if(!res) {
+ /* extract all known cookies */
+ struct curl_slist *cookies = NULL;
+ res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
+ if(!res && cookies) {
+ /* a linked list of cookies in cookie file format */
+ struct curl_slist *each = cookies;
+ while(each) {
+ printf("%s\\n", each->data);
+ each = each->next;
+ }
+ /* we must free these cookies when we are done */
+ curl_slist_free_all(cookies);
}
- /* we must free these cookies when we are done */
- curl_slist_free_all(cookies);
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3+16 -13
@@ -46,20 +46,23 @@ corresponding CURL handle.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data");
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *method = NULL;
- curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
- if(method)
- printf("Redirected to method: %s\\n", method);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *method = NULL;
+ curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
+ if(method)
+ printf("Redirected to method: %s\\n", method);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.3+15 -12
@@ -44,19 +44,22 @@ CURL handle.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *url = NULL;
- curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
- if(url)
- printf("Redirect to: %s\\n", url);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *url = NULL;
+ curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
+ if(url)
+ printf("Redirect to: %s\\n", url);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_FILETIME.3+18 -13
@@ -48,21 +48,26 @@ the year 2038 on systems using 32 bit longs (Windows).
HTTP(S), FTP(S), SFTP
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* Ask for filetime */
- curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
- if((CURLE_OK == res) && (filetime >= 0)) {
- time_t file_time = (time_t)filetime;
- printf("filetime %s: %s", filename, ctime(&file_time));
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ /* Ask for filetime */
+ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ long filetime = 0;
+ res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
+ if((CURLE_OK == res) && (filetime >= 0)) {
+ time_t file_time = (time_t)filetime;
+ printf("filetime: %s", ctime(&file_time));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_FILETIME_T.3+18 -14
@@ -50,22 +50,26 @@ range.
HTTP(S), FTP(S), SFTP
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* Ask for filetime */
- curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- curl_off_t filetime;
- res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
- if((CURLE_OK == res) && (filetime >= 0)) {
- time_t file_time = (time_t)filetime;
- printf("filetime %s: %s", filename, ctime(&file_time));
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* Ask for filetime */
+ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ curl_off_t filetime;
+ res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
+ if((CURLE_OK == res) && (filetime >= 0)) {
+ time_t file_time = (time_t)filetime;
+ printf("filetime: %s", ctime(&file_time));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3+15 -11
@@ -44,21 +44,25 @@ CURL handle.
FTP(S) and SFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- if(!res) {
- /* extract the entry path */
- char *ep = NULL;
- res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep);
- if(!res && ep) {
- printf("Entry path was: %s\\n", ep);
+ if(!res) {
+ /* extract the entry path */
+ char *ep = NULL;
+ res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep);
+ if(!res && ep) {
+ printf("Entry path was: %s\\n", ep);
+ }
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_HEADER_SIZE.3+14 -11
@@ -41,18 +41,21 @@ The total includes the size of any received headers suppressed by
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long size;
- res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
- if(!res)
- printf("Header size: %ld bytes\\n", size);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long size;
+ res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
+ if(!res)
+ printf("Header size: %ld bytes\\n", size);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3+21 -17
@@ -40,29 +40,33 @@ bits is explained in the \fICURLOPT_HTTPAUTH(3)\fP option for
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+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);
+ res = curl_easy_perform(curl);
- if(!res) {
- /* extract the available authentication types */
- long auth;
- res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
if(!res) {
- if(!auth)
- printf("No auth available, perhaps no 401?\\n");
- else {
- printf("%s%s%s%s\\n",
- auth & CURLAUTH_BASIC ? "Basic ":"",
- auth & CURLAUTH_DIGEST ? "Digest ":"",
- auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
- auth % CURLAUTH_NTLM ? "NTLM ":"");
+ /* extract the available authentication types */
+ long auth;
+ res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
+ if(!res) {
+ if(!auth)
+ printf("No auth available, perhaps no 401?\\n");
+ else {
+ printf("%s%s%s%s\\n",
+ auth & CURLAUTH_BASIC ? "Basic ":"",
+ auth & CURLAUTH_DIGEST ? "Digest ":"",
+ auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
+ auth % CURLAUTH_NTLM ? "NTLM ":"");
+ }
}
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3+16 -13
@@ -39,21 +39,24 @@ available.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* typically CONNECT is used to do HTTPS over HTTP proxies */
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long code;
- res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
- if(!res && code)
- printf("The CONNECT response code: %03ld\\n", code);
+ /* typically CONNECT is used to do HTTPS over HTTP proxies */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long code;
+ res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code);
+ if(!res && code)
+ printf("The CONNECT response code: %03ld\\n", code);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_HTTP_VERSION.3+12 -9
@@ -40,16 +40,19 @@ CURL_HTTP_VERSION_3 or 0 if the version cannot be determined.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long http_version;
- curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long http_version;
+ curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_LASTSOCKET.3+16 -12
@@ -48,21 +48,25 @@ type is 64 bits large while its 'long' is 32 bits. Use the
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- long sockfd; /* does not work on win64! */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ long sockfd; /* does not work on win64! */
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Do not do the transfer - only connect to host */
- curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
- res = curl_easy_perform(curl);
+ /* Do not do the transfer - only connect to host */
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ res = curl_easy_perform(curl);
- /* Extract the socket from the curl handle */
- res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
+ /* Extract the socket from the curl handle */
+ res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
- if(res != CURLE_OK) {
- printf("Error: %s\\n", curl_easy_strerror(res));
- return 1;
+ if(res != CURLE_OK) {
+ printf("Error: %s\\n", curl_easy_strerror(res));
+ return 1;
+ }
}
}
.fi
docs/libcurl/opts/CURLINFO_LOCAL_IP.3+3 -0
@@ -45,8 +45,11 @@ CURL handle.
All
.SH EXAMPLE
.nf
+int main(void)
{
char *ip;
+ CURLcode res;
+ CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
docs/libcurl/opts/CURLINFO_LOCAL_PORT.3+1 -0
@@ -38,6 +38,7 @@ connection done with this \fBcurl\fP handle.
All
.SH EXAMPLE
.nf
+int main(void)
{
CURL *curl;
CURLcode res;
docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3+14 -10
@@ -43,19 +43,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double namelookup;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double namelookup;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", namelookup);
+ res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", namelookup);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3+15 -11
@@ -43,20 +43,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t namelookup;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t namelookup;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
- (long)(namelookup % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
+ (long)(namelookup % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3+15 -12
@@ -42,19 +42,22 @@ to make persistent connections to save time.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long connects;
- res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects);
- if(res)
- printf("It needed %d connects\\n", connects);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long connects;
+ res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects);
+ if(res)
+ printf("It needed %ld connects\\n", connects);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_OS_ERRNO.3+14 -11
@@ -39,19 +39,22 @@ operation. The number is OS and system specific.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res != CURLE_OK) {
- long error;
- res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
- if(res && error) {
- printf("Errno: %ld\\n", error);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res != CURLE_OK) {
+ long error;
+ res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
+ if(res && error) {
+ printf("Errno: %ld\\n", error);
+ }
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3+14 -10
@@ -47,19 +47,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double pretransfer;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double pretransfer;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", pretransfer);
+ res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", pretransfer);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3+16 -11
@@ -47,20 +47,25 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t pretransfer;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t pretransfer;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", pretransfer / 1000000,
- (long)(pretransfer % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\\n",
+ pretransfer / 1000000,
+ (long)(pretransfer % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PRIMARY_IP.3+3 -0
@@ -45,8 +45,11 @@ CURL handle.
All network based ones
.SH EXAMPLE
.nf
+int main(void)
{
char *ip;
+ CURLcode res;
+ CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3+14 -11
@@ -43,18 +43,21 @@ accessed URL.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long port;
- res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
- if(!res)
- printf("Connected to remote port: %ld\\n", port);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long port;
+ res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
+ if(!res)
+ printf("Connected to remote port: %ld\\n", port);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PRIVATE.3+17 -10
@@ -40,19 +40,26 @@ pointer, although effectively being a 'void *'.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- void *pointer = 0x2345454;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ void *pointer = (void *)0x2345454;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* set the private pointer */
- curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
- ret = curl_easy_perform(curl);
+ /* set the private pointer */
+ curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
+ res = curl_easy_perform(curl);
- /* extract the private pointer again */
- ret = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
+ /* extract the private pointer again */
+ res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
- curl_easy_cleanup(curl);
+ if(res)
+ printf("error: %s\\n", curl_easy_strerror(res));
+
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PROTOCOL.3+12 -9
@@ -51,16 +51,19 @@ CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long protocol;
- curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long protocol;
+ curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3+22 -18
@@ -41,30 +41,34 @@ bits is explained in the \fICURLOPT_PROXYAUTH(3)\fP option for
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- if(!res) {
- /* extract the available proxy authentication types */
- long auth;
- res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth);
if(!res) {
- if(!auth)
- printf("No proxy auth available, perhaps no 407?\\n");
- else {
- printf("%s%s%s%s\\n",
- auth & CURLAUTH_BASIC ? "Basic ":"",
- auth & CURLAUTH_DIGEST ? "Digest ":"",
- auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
- auth % CURLAUTH_NTLM ? "NTLM ":"");
+ /* extract the available proxy authentication types */
+ long auth;
+ res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth);
+ if(!res) {
+ if(!auth)
+ printf("No proxy auth available, perhaps no 407?\\n");
+ else {
+ printf("%s%s%s%s\\n",
+ auth & CURLAUTH_BASIC ? "Basic ":"",
+ auth & CURLAUTH_DIGEST ? "Digest ":"",
+ auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
+ auth % CURLAUTH_NTLM ? "NTLM ":"");
+ }
}
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PROXY_ERROR.3+15 -12
@@ -79,20 +79,23 @@ The error code is zero (\fBCURLPX_OK\fP) if no response code was available.
All that can be done over SOCKS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1");
- res = curl_easy_perform(curl);
- if(res == CURLE_PROXY) {
- long proxycode;
- res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode);
- if(!res && proxycode)
- printf("The detailed proxy error: %ld\\n", proxycode);
+ curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_PROXY) {
+ long proxycode;
+ res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode);
+ if(!res && proxycode)
+ printf("The detailed proxy error: %ld\\n", proxycode);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3+16 -11
@@ -40,17 +40,22 @@ option. This is only used for HTTPS proxies.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- long verifyresult;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT, &verifyresult);
- printf("The peer verification said %s\\n", verifyresult?
- "fine":"BAAAD");
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ long verifyresult;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
+ res = curl_easy_perform(curl);
+ if(res)
+ printf("error: %s\\n", curl_easy_strerror(res));
+ curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT, &verifyresult);
+ printf("The peer verification said %s\\n", verifyresult?
+ "fine" : "bad");
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3+13 -10
@@ -39,17 +39,20 @@ actually followed.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long redirects;
- curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long redirects;
+ curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3+14 -10
@@ -43,19 +43,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double redirect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double redirect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", redirect);
+ res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", redirect);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3+15 -11
@@ -44,20 +44,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t redirect;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t redirect;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
- (long)(redirect % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
+ (long)(redirect % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REDIRECT_URL.3+14 -11
@@ -44,18 +44,21 @@ redirect to happen (since 7.54.1).
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *url = NULL;
- curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &url);
- if(url)
- printf("Redirect to: %s\\n", url);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *url = NULL;
+ curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &url);
+ if(url)
+ printf("Redirect to: %s\\n", url);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REFERER.3+15 -12
@@ -41,19 +41,22 @@ CURL handle.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/referrer");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *hdr = NULL;
- curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
- if(hdr)
- printf("Referrer header: %s\\n", hdr);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/referrer");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *hdr = NULL;
+ curl_easy_getinfo(curl, CURLINFO_REFERER, &hdr);
+ if(hdr)
+ printf("Referrer header: %s\\n", hdr);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3+14 -11
@@ -39,18 +39,21 @@ than one request if \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long req;
- res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
- if(!res)
- printf("Request size: %ld bytes\\n", req);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long req;
+ res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
+ if(!res)
+ printf("Request size: %ld bytes\\n", req);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3+12 -9
@@ -43,16 +43,19 @@ Note that a proxy's CONNECT response should be read with
HTTP, FTP, SMTP and LDAP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long response_code;
- curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long response_code;
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RETRY_AFTER.3+14 -11
@@ -46,18 +46,21 @@ Returns zero delay if there was no header.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- curl_off_t wait = 0;
- curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
- if(wait)
- printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\\n", wait);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ curl_off_t wait = 0;
+ curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &wait);
+ if(wait)
+ printf("Wait for %" CURL_FORMAT_CURL_OFF_T " seconds\\n", wait);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3+12 -9
@@ -39,16 +39,19 @@ by the application.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long cseq;
- curl_easy_getinfo(curl, CURLINFO_RTSP_CLIENT_CSEQ, &cseq);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long cseq;
+ curl_easy_getinfo(curl, CURLINFO_RTSP_CLIENT_CSEQ, &cseq);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3+12 -9
@@ -40,16 +40,19 @@ value.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long cseq;
- curl_easy_getinfo(curl, CURLINFO_RTSP_CSEQ_RECV, &cseq);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long cseq;
+ curl_easy_getinfo(curl, CURLINFO_RTSP_CSEQ_RECV, &cseq);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3+12 -9
@@ -44,16 +44,19 @@ retrieve this info before closing the active connection.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- long cseq;
- curl_easy_getinfo(curl, CURLINFO_RTSP_SERVER_CSEQ, &cseq);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ long cseq;
+ curl_easy_getinfo(curl, CURLINFO_RTSP_SERVER_CSEQ, &cseq);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.3+12 -9
@@ -45,16 +45,19 @@ CURL handle.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *id;
- curl_easy_getinfo(curl, CURLINFO_RTSP_SESSION_ID, &id);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://rtsp.example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *id;
+ curl_easy_getinfo(curl, CURLINFO_RTSP_SESSION_ID, &id);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_SCHEME.3+14 -11
@@ -43,18 +43,21 @@ corresponding CURL handle.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- if(res == CURLE_OK) {
- char *scheme = NULL;
- curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
- if(scheme)
- printf("scheme: %s\\n", scheme); /* scheme: HTTP */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
+ if(res == CURLE_OK) {
+ char *scheme = NULL;
+ curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
+ if(scheme)
+ printf("scheme: %s\\n", scheme); /* scheme: HTTP */
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3+14 -10
@@ -44,19 +44,23 @@ sensible variable type.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- double dl;
- res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
if(!res) {
- printf("Downloaded %.0f bytes\\n", cl);
+ /* check the size */
+ double dl;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
+ if(!res) {
+ printf("Downloaded %.0f bytes\\n", dl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3+14 -10
@@ -41,19 +41,23 @@ commonly called body. All meta and header data is excluded from this amount.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- /* check the size */
- curl_off_t dl;
- res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl);
if(!res) {
- printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", dl);
+ /* check the size */
+ curl_off_t dl;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl);
+ if(!res) {
+ printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", dl);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3+13 -9
@@ -42,18 +42,22 @@ sensible variable type.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- double ul;
- res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &ul);
if(!res) {
- printf("Uploaded %.0f bytes\\n", ul);
+ double ul;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &ul);
+ if(!res) {
+ printf("Uploaded %.0f bytes\\n", ul);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3+13 -9
@@ -39,18 +39,22 @@ were uploaded.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- curl_off_t ul;
- res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &ul);
if(!res) {
- printf("Uploaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", ul);
+ curl_off_t ul;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &ul);
+ if(!res) {
+ printf("Uploaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", ul);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3+13 -9
@@ -41,18 +41,22 @@ sensible variable type.
.SH PROTOCOLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- double speed;
- res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
if(!res) {
- printf("Download speed %.0f bytes/sec\\n", speed);
+ double speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
+ if(!res) {
+ printf("Download speed %.0f bytes/sec\\n", speed);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3+14 -9
@@ -38,18 +38,23 @@ that curl measured for the complete download. Measured in bytes/second.
.SH PROTOCOLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- curl_off_t speed;
- res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &speed);
if(!res) {
- printf("Download speed %" CURL_FORMAT_CURL_OFF_T " bytes/sec\\n", speed);
+ curl_off_t speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &speed);
+ if(!res) {
+ printf("Download speed %" CURL_FORMAT_CURL_OFF_T " bytes/sec\\n",
+ speed);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3+13 -9
@@ -40,18 +40,22 @@ sensible variable type.
.SH PROTOCOLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- double speed;
- res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
if(!res) {
- printf("Upload speed %.0f bytes/sec\\n", speed);
+ double speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
+ if(!res) {
+ printf("Upload speed %.0f bytes/sec\\n", speed);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3+13 -9
@@ -38,18 +38,22 @@ curl measured for the complete upload. Measured in bytes/second.
.SH PROTOCOLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- curl_off_t speed;
- res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD_T, &speed);
if(!res) {
- printf("Upload speed %" CURL_FORMAT_CURL_OFF_T " bytes/sec\\n", speed);
+ curl_off_t speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD_T, &speed);
+ if(!res) {
+ printf("Upload speed %" CURL_FORMAT_CURL_OFF_T " bytes/sec\\n", speed);
+ }
}
}
}
docs/libcurl/opts/CURLINFO_SSL_ENGINES.3+13 -10
@@ -43,17 +43,20 @@ data for you.
All TLS based ones.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- struct curl_slist *engines;
- res = curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);
- if((res == CURLE_OK) && engines) {
- /* we have a list, free it when done using it */
- curl_slist_free_all(engines);
- }
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_slist *engines;
+ res = curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);
+ if((res == CURLE_OK) && engines) {
+ /* we have a list, free it when done using it */
+ curl_slist_free_all(engines);
+ }
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3+15 -10
@@ -42,16 +42,21 @@ option).
All using TLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- long verifyresult;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT, &verifyresult);
- printf("The peer verification said %s\\n", verifyresult?
- "BAAAD":"fine");
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ long verifyresult;
+ 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_getinfo(curl, CURLINFO_SSL_VERIFYRESULT, &verifyresult);
+ printf("The peer verification said %s\\n", verifyresult?
+ "BAAAD":"fine");
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3+14 -10
@@ -45,19 +45,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double start;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double start;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", start);
+ res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", start);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3+15 -11
@@ -46,20 +46,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t start;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t start;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
- (long)(start % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
+ (long)(start % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_TLS_SESSION.3+13 -8
@@ -52,14 +52,19 @@ that document for more information.
All TLS-based
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- struct curl_tlssessioninfo *tls;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_TLS_SESSION, &tls);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_tlssessioninfo *tls;
+ 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_getinfo(curl, CURLINFO_TLS_SESSION, &tls);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3+2 -2
@@ -133,13 +133,13 @@ static size_t wf(void *ptr, size_t size, size_t nmemb, void *stream)
CURLcode res = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &info);
if(info && !res) {
if(CURLSSLBACKEND_OPENSSL == info->backend) {
- printf("OpenSSL ver. %s\\n", SSL_get_version((SSL*)info->internals));
+ printf("OpenSSL ver. %s\\n", SSL_get_version((SSL*)info->internals));
}
}
return size * nmemb;
}
-int main(int argc, char** argv)
+int main(int argc, char **argv)
{
CURLcode res;
curl = curl_easy_init();
docs/libcurl/opts/CURLINFO_TOTAL_TIME.3+14 -10
@@ -43,19 +43,23 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- double total;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double total;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %.1f", total);
+ res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", total);
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3+15 -11
@@ -44,20 +44,24 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_off_t total;
- curl_easy_setopt(curl, CURLOPT_URL, url);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_off_t total;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ res = curl_easy_perform(curl);
if(CURLE_OK == res) {
- printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
- (long)(total % 1000000));
+ res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
+ if(CURLE_OK == res) {
+ printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
+ (long)(total % 1000000));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLINFO_XFER_ID.3+13 -9
@@ -45,18 +45,22 @@ same multi handle.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Perform the request */
- res = curl_easy_perform(curl);
+ /* Perform the request */
+ res = curl_easy_perform(curl);
- if(!res) {
- curl_off_t xfer_id;
- res = curl_easy_getinfo(curl, CURLINFO_XFER_ID, &xfer_id);
if(!res) {
- printf("Transfer ID: %" CURL_FORMAT_CURL_OFF_T "\\n", xfer_id);
+ curl_off_t xfer_id;
+ res = curl_easy_getinfo(curl, CURLINFO_XFER_ID, &xfer_id);
+ if(!res) {
+ printf("Transfer ID: %" CURL_FORMAT_CURL_OFF_T "\\n", xfer_id);
+ }
}
}
}
docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3+6 -3
@@ -46,9 +46,12 @@ The default value is 0, which means that the penalization is inactive.
HTTP(S)
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-long maxchunk = 10000;
-curl_multi_setopt(m, CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, maxchunk);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ long maxchunk = 10000;
+ curl_multi_setopt(m, CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, maxchunk);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3+6 -3
@@ -46,9 +46,12 @@ The default value is 0, which means that the size penalization is inactive.
HTTP(S)
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-long maxlength = 10000;
-curl_multi_setopt(m, CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, maxlength);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ long maxlength = 10000;
+ curl_multi_setopt(m, CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, maxlength);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3+6 -3
@@ -56,9 +56,12 @@ See DESCRIPTION
All
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-/* only keep 10 connections in the cache */
-curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ /* only keep 10 connections in the cache */
+ curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L);
+}
.fi
.SH AVAILABILITY
Added in 7.16.3
docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3+3 -0
@@ -45,9 +45,12 @@ value passed here would be honored based on other system resources properties.
All
.SH EXAMPLE
.nf
+int main(void)
+{
CURLM *m = curl_multi_init();
/* max concurrent streams 200 */
curl_multi_setopt(m, CURLMOPT_MAX_CONCURRENT_STREAMS, 200L);
+}
.fi
.SH AVAILABILITY
Added in 7.67.0
docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.3+6 -3
@@ -58,9 +58,12 @@ timeout is however treated as a per-connect timeout.
HTTP(S)
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-/* do no more than 2 connections per host */
-curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ /* do no more than 2 connections per host */
+ curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.3+6 -3
@@ -50,9 +50,12 @@ total number of requests in-flight is \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP *
HTTP(S)
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-/* set a more conservative pipe length */
-curl_multi_setopt(m, CURLMOPT_MAX_PIPELINE_LENGTH, 3L);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ /* set a more conservative pipe length */
+ curl_multi_setopt(m, CURLMOPT_MAX_PIPELINE_LENGTH, 3L);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3+6 -3
@@ -56,9 +56,12 @@ controlled by the number of easy handles added.
All
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-/* never do more than 15 connections */
-curl_multi_setopt(m, CURLMOPT_MAX_TOTAL_CONNECTIONS, 15L);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ /* never do more than 15 connections */
+ curl_multi_setopt(m, CURLMOPT_MAX_TOTAL_CONNECTIONS, 15L);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_PIPELINING.3+6 -3
@@ -53,9 +53,12 @@ Before that, default was \fBCURLPIPE_NOTHING\fP.
HTTP(S)
.SH EXAMPLE
.nf
-CURLM *m = curl_multi_init();
-/* try HTTP/2 multiplexing */
-curl_multi_setopt(m, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
+int main(void)
+{
+ CURLM *m = curl_multi_init();
+ /* try HTTP/2 multiplexing */
+ curl_multi_setopt(m, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
+}
.fi
.SH AVAILABILITY
Added in 7.16.0. Multiplex support bit added in 7.43.0. HTTP/1 Pipelining
docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.3+10 -7
@@ -50,14 +50,17 @@ The default value is NULL, which means that there is no block list.
.SH PROTOCOLS
.SH EXAMPLE
.nf
- char *server_block_list[] =
- {
- "Microsoft-IIS/6.0",
- "nginx/0.8.54",
- NULL
- };
-
+static char *server_block_list[] =
+{
+ "Microsoft-IIS/6.0",
+ "nginx/0.8.54",
+ NULL
+};
+int main(void)
+{
+ CURLM *m = curl_multi_init();
curl_multi_setopt(m, CURLMOPT_PIPELINING_SERVER_BL, server_block_list);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.3+10 -6
@@ -46,14 +46,18 @@ The default value is NULL, which means that there is no block list.
HTTP(S)
.SH EXAMPLE
.nf
- char *site_block_list[] =
- {
- "www.haxx.se",
- "www.example.com:1234",
- NULL
- };
+static char *site_block_list[] =
+{
+ "www.haxx.se",
+ "www.example.com:1234",
+ NULL
+};
+int main(void)
+{
+ CURLM *m = curl_multi_init();
curl_multi_setopt(m, CURLMOPT_PIPELINING_SITE_BL, site_block_list);
+}
.fi
.SH AVAILABILITY
Added in 7.30.0
docs/libcurl/opts/CURLMOPT_PUSHDATA.3+9 -2
@@ -41,6 +41,8 @@ NULL
HTTP(S)
.SH EXAMPLE
.nf
+#include <string.h>
+
/* only allow pushes for file names starting with "push-" */
int push_callback(CURL *parent,
CURL *easy,
@@ -68,8 +70,13 @@ int push_callback(CURL *parent,
return CURL_PUSH_DENY;
}
-curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
-curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
+int main(void)
+{
+ int counter;
+ CURLM *multi = curl_multi_init();
+ curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
+ curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
+}
.fi
.SH AVAILABILITY
Added in 7.44.0
docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3+9 -2
@@ -91,6 +91,8 @@ NULL, no callback
HTTP(S) (HTTP/2 only)
.SH EXAMPLE
.nf
+#include <string.h>
+
/* only allow pushes for file names starting with "push-" */
int push_callback(CURL *parent,
CURL *easy,
@@ -118,8 +120,13 @@ int push_callback(CURL *parent,
return CURL_PUSH_DENY;
}
-curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
-curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
+int main(void)
+{
+ int counter;
+ CURLM *multi = curl_multi_init();
+ curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
+ curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
+}
.fi
.SH AVAILABILITY
Added in 7.44.0
docs/libcurl/opts/CURLMOPT_SOCKETDATA.3+16 -12
@@ -42,28 +42,32 @@ NULL
All
.SH EXAMPLE
.nf
+struct priv {
+ void *ours;
+};
+
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = (GlobalInfo*) cbp;
- SockInfo *fdp = (SockInfo*) sockp;
+ struct priv *p = sockp;
+ printf("my ptr: %p\\n", p->ours);
if(what == CURL_POLL_REMOVE) {
- remsock(fdp);
+ /* remove the socket from our collection */
+ }
+ if(what & CURL_POLL_IN) {
+ /* wait for read on this socket */
}
- else {
- if(!fdp) {
- addsock(s, e, what, g);
- }
- else {
- setsock(fdp, s, e, what, g);
- }
+ if(what & CURL_POLL_OUT) {
+ /* wait for write on this socket */
}
+
return 0;
}
-main()
+int main(void)
{
- GlobalInfo setup;
+ struct priv setup;
+ CURLM *multi = curl_multi_init();
/* ... use socket callback and custom pointer */
curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb);
curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, &setup);
docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3+16 -12
@@ -85,28 +85,32 @@ NULL (no callback)
All
.SH EXAMPLE
.nf
+struct priv {
+ void *ours;
+};
+
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
- GlobalInfo *g = cbp;
- SockInfo *fdp = sockp;
+ struct priv *p = sockp;
+ printf("our ptr: %p\\n", p->ours);
if(what == CURL_POLL_REMOVE) {
- remsock(fdp);
+ /* remove the socket from our collection */
+ }
+ if(what & CURL_POLL_IN) {
+ /* wait for read on this socket */
}
- else {
- if(!fdp) {
- addsock(s, e, what, g);
- }
- else {
- setsock(fdp, s, e, what, g);
- }
+ if(what & CURL_POLL_OUT) {
+ /* wait for write on this socket */
}
+
return 0;
}
-main()
+int main(void)
{
- GlobalInfo setup;
+ struct priv setup;
+ CURLM *multi = curl_multi_init();
/* ... use socket callback and custom pointer */
curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb);
curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, &setup);
docs/libcurl/opts/CURLMOPT_TIMERDATA.3+18 -27
@@ -42,39 +42,30 @@ NULL
All
.SH EXAMPLE
.nf
-static gboolean timeout_cb(gpointer user_data)
-{
- int running;
- if(user_data) {
- g_free(user_data);
- curl_multi_setopt(curl_handle, CURLMOPT_TIMERDATA, NULL);
- }
- curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &running);
- return G_SOURCE_REMOVE;
-}
+struct priv {
+ void *custom;
+};
static int timerfunc(CURLM *multi, long timeout_ms, void *clientp)
{
- guint *id = clientp;
-
- if(id)
- g_source_remove(*id);
+ struct priv *mydata = clientp;
+ printf("our ptr: %p\\n", mydata->custom);
- /* -1 means we should just delete our timer. */
- if(timeout_ms == -1) {
- g_free(id);
- id = NULL;
- }
- else {
- if(!id)
- id = g_new(guint, 1);
- *id = g_timeout_add(timeout_ms, timeout_cb, id);
- }
- current_timer = id;
- return 0;
+ if(timeout_ms) {
+ /* this is the new single timeout to wait for */
+ }
+ else {
+ /* delete the timeout, nothing to wait for now */
+ }
}
-curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, timerfunc);
+int main(void)
+{
+ struct priv mydata;
+ CURLM *multi = curl_multi_init();
+ curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, timerfunc);
+ curl_multi_setopt(multi, CURLMOPT_TIMERDATA, &mydata);
+}
.fi
.SH AVAILABILITY
Added in 7.16.0
docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.3+18 -27
@@ -70,39 +70,30 @@ NULL
All
.SH EXAMPLE
.nf
-static gboolean timeout_cb(gpointer user_data)
-{
- int running;
- if(user_data) {
- g_free(user_data);
- curl_multi_setopt(curl_handle, CURLMOPT_TIMERDATA, NULL);
- }
- curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &running);
- return G_SOURCE_REMOVE;
-}
+struct priv {
+ void *custom;
+};
static int timerfunc(CURLM *multi, long timeout_ms, void *clientp)
{
- guint *id = clientp;
-
- if(id)
- g_source_remove(*id);
+ struct priv *mydata = clientp;
+ printf("our ptr: %p\\n", mydata->custom);
- /* -1 means we should just delete our timer. */
- if(timeout_ms == -1) {
- g_free(id);
- id = NULL;
- }
- else {
- if(!id)
- id = g_new(guint, 1);
- *id = g_timeout_add(timeout_ms, timeout_cb, id);
- }
- current_timer = id;
- return 0;
+ if(timeout_ms) {
+ /* this is the new single timeout to wait for */
+ }
+ else {
+ /* delete the timeout, nothing to wait for now */
+ }
}
-curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, timerfunc);
+int main(void)
+{
+ struct priv mydata;
+ CURLM *multi = curl_multi_init();
+ curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, timerfunc);
+ curl_multi_setopt(multi, CURLMOPT_TIMERDATA, &mydata);
+}
.fi
.SH AVAILABILITY
Added in 7.16.0
docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3+11 -3
@@ -52,10 +52,18 @@ Default is NULL.
All
.SH EXAMPLE
.nf
- curl_easy_setopt(curl_handle, CURLOPT_ABSTRACT_UNIX_SOCKET, "/tmp/foo.sock");
- curl_easy_setopt(curl_handle, CURLOPT_URL, "http://localhost/");
-.fi
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_ABSTRACT_UNIX_SOCKET, "/tmp/foo.sock");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/");
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.53.0.
.SH RETURN VALUE
docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3+9 -6
@@ -40,14 +40,17 @@ server to connect back to libcurl when an active FTP connection is used.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/path/file");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/path/file");
- /* wait no more than 5 seconds for FTP server responses */
- curl_easy_setopt(curl, CURLOPT_ACCEPTTIMEOUT_MS, 5000L);
+ /* wait no more than 5 seconds for FTP server responses */
+ curl_easy_setopt(curl, CURLOPT_ACCEPTTIMEOUT_MS, 5000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.3+10 -7
@@ -82,15 +82,18 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable all supported built-in compressions */
- curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
+ /* enable all supported built-in compressions */
+ curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3+14 -9
@@ -39,15 +39,20 @@ Pass a long specifying the scope id value to use when connecting to IPv6 address
All, when using IPv6
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- long my_scope_id;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- my_scope_id = if_nametoindex("eth0");
- curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+#include <net/if.h> /* for if_nametoindex() */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ long my_scope_id;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ my_scope_id = if_nametoindex("eth0");
+ curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_ALTSVC.3+8 -5
@@ -44,11 +44,14 @@ NULL. The alt-svc cache is not read nor written to file.
HTTPS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
- curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
+ curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH "FILE FORMAT"
docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3+8 -5
@@ -71,11 +71,14 @@ only set if libcurl was built with support for those versions.
HTTPS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, (long)CURLALTSVC_H1);
- curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, (long)CURLALTSVC_H1);
+ curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_APPEND.3+9 -6
@@ -40,14 +40,17 @@ instead of overwrite it. This is only useful when uploading to an FTP site.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
- curl_easy_setopt(curl, CURLOPT_APPEND, 1L);
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+ curl_easy_setopt(curl, CURLOPT_APPEND, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_AUTOREFERER.3+13 -9
@@ -45,19 +45,23 @@ considered a minor privacy leak by some.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* follow redirects */
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ /* follow redirects */
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- /* set Referer: automatically when following redirects */
- curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
+ /* set Referer: automatically when following redirects */
+ curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_AWS_SIGV4.3+14 -11
@@ -67,20 +67,23 @@ as calling this with \fB"aws:amz"\fP in parameter.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
+int main(void)
+{
+ CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL,
- "https://service.region.example.com/uri");
- curl_easy_setopt(c, CURLOPT_AWS_SIGV4, "provider1:provider2");
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "https://service.region.example.com/uri");
+ curl_easy_setopt(curl, CURLOPT_AWS_SIGV4, "provider1:provider2");
- /* service and region can also be set in CURLOPT_AWS_SIGV4 */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/uri");
- curl_easy_setopt(c, CURLOPT_AWS_SIGV4,
- "provider1:provider2:region:service");
+ /* service and region can also be set in CURLOPT_AWS_SIGV4 */
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/uri");
+ curl_easy_setopt(curl, CURLOPT_AWS_SIGV4,
+ "provider1:provider2:region:service");
- curl_easy_setopt(c, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY");
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_BUFFERSIZE.3+11 -7
@@ -54,16 +54,20 @@ CURL_MAX_WRITE_SIZE (16kB)
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
- /* ask libcurl to allocate a larger receive buffer */
- curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
+ /* ask libcurl to allocate a larger receive buffer */
+ curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CAINFO.3+9 -6
@@ -62,12 +62,15 @@ Schannel, this option is not set by default.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/certs/cabundle.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/certs/cabundle.pem");
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3+17 -11
@@ -51,17 +51,23 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-char *strpem; /* strpem must point to a PEM string */
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- blob.data = strpem;
- blob.len = strlen(strpem);
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+#include <string.h>
+
+int main(void)
+{
+ char *strpem; /* strpem must point to a PEM string */
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ blob.data = strpem;
+ blob.len = strlen(strpem);
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CAPATH.3+10 -6
@@ -51,12 +51,16 @@ A default path detected at build time.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.3+14 -10
@@ -49,20 +49,24 @@ store remain forever. By default, libcurl caches this info for 24 hours.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* only reuse certificate stores for a short time */
- curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L);
+ /* only reuse certificate stores for a short time */
+ curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- /* in this second request, the cache is not used if more than
- sixty seconds passed since the previous connection */
- ret = curl_easy_perform(curl);
+ /* in this second request, the cache is not used if more than
+ sixty seconds passed since the previous connection */
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CERTINFO.3+23 -18
@@ -43,34 +43,39 @@ its option \fICURLINFO_CERTINFO(3)\fP.
All TLS-based
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
- /* connect to any HTTPS site, trusted or not */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+ /* connect to any HTTPS site, trusted or not */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
- curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
+ curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- if (!res) {
- struct curl_certinfo *ci;
- res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
+ if(!res) {
+ struct curl_certinfo *ci;
+ res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
- if (!res) {
- printf("%d certs!\\n", ci->num_of_certs);
+ if(!res) {
+ int i;
+ printf("%d certs!\\n", ci->num_of_certs);
- for(i = 0; i < ci->num_of_certs; i++) {
- struct curl_slist *slist;
+ for(i = 0; i < ci->num_of_certs; i++) {
+ struct curl_slist *slist;
- for(slist = ci->certinfo[i]; slist; slist = slist->next)
- printf("%s\\n", slist->data);
+ for(slist = ci->certinfo[i]; slist; slist = slist->next)
+ printf("%s\\n", slist->data);
+ }
}
}
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3+10 -1
@@ -90,10 +90,17 @@ NULL
FTP
.SH EXAMPLE
.nf
+#include <stdio.h>
+
+struct callback_data {
+ FILE *output;
+};
+
static long file_is_coming(struct curl_fileinfo *finfo,
- struct callback_data *data,
+ void *ptr,
int remains)
{
+ struct callback_data *data = ptr;
printf("%3d %40s %10luB ", remains, finfo->filename,
(unsigned long)finfo->size);
@@ -130,6 +137,8 @@ int main()
/* data for callback */
struct callback_data callback_info;
+ CURL *curl = curl_easy_init();
+
/* callback is called before download of concrete file started */
curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info);
docs/libcurl/opts/CURLOPT_CHUNK_DATA.3+10 -1
@@ -41,10 +41,17 @@ NULL
FTP
.SH EXAMPLE
.nf
+#include <stdio.h>
+
+struct callback_data {
+ FILE *output;
+};
+
static long file_is_coming(struct curl_fileinfo *finfo,
- struct callback_data *data,
+ void *ptr,
int remains)
{
+ struct callback_data *data = ptr;
printf("%3d %40s %10luB ", remains, finfo->filename,
(unsigned long)finfo->size);
@@ -81,6 +88,8 @@ int main()
/* data for callback */
struct callback_data callback_info;
+ CURL *curl = curl_easy_init();
+
/* callback is called before download of concrete file started */
curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info);
docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3+9 -0
@@ -48,6 +48,12 @@ NULL
FTP
.SH EXAMPLE
.nf
+#include <stdio.h>
+
+struct callback_data {
+ FILE *output;
+};
+
static long file_is_downloaded(struct callback_data *data)
{
if(data->output) {
@@ -61,6 +67,9 @@ int main()
{
/* data for callback */
struct callback_data callback_info;
+
+ CURL *curl = curl_easy_init();
+
curl_easy_setopt(curl, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info);
}
docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.3+19 -3
@@ -42,15 +42,31 @@ The default value of this parameter is NULL.
All except file:
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
static int closesocket(void *clientp, curl_socket_t item)
{
+ struct priv *my = clientp;
+ printf("our ptr: %p\\n", my->custom);
+
printf("libcurl wants to close %d now\\n", (int)item);
return 0;
}
-/* call this function to close sockets */
-curl_easy_setopt(curl, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
-curl_easy_setopt(curl, CURLOPT_CLOSESOCKETDATA, &sockfd);
+int main(void)
+{
+ struct priv myown;
+ CURL *curl = curl_easy_init();
+
+ /* call this function to close sockets */
+ curl_easy_setopt(curl, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
+ curl_easy_setopt(curl, CURLOPT_CLOSESOCKETDATA, &myown);
+
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+}
.fi
.SH AVAILABILITY
Added in 7.21.7
docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.3+19 -3
@@ -53,15 +53,31 @@ By default libcurl uses the standard socket close function.
All
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
static int closesocket(void *clientp, curl_socket_t item)
{
+ struct priv *my = clientp;
+ printf("our ptr: %p\\n", my->custom);
+
printf("libcurl wants to close %d now\\n", (int)item);
return 0;
}
-/* call this function to close sockets */
-curl_easy_setopt(curl, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
-curl_easy_setopt(curl, CURLOPT_CLOSESOCKETDATA, &sockfd);
+int main(void)
+{
+ struct priv myown;
+ CURL *curl = curl_easy_init();
+
+ /* call this function to close sockets */
+ curl_easy_setopt(curl, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
+ curl_easy_setopt(curl, CURLOPT_CLOSESOCKETDATA, &myown);
+
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+}
.fi
.SH AVAILABILITY
Added in 7.21.7
docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.3+9 -6
@@ -66,14 +66,17 @@ signals to be used unless \fICURLOPT_NOSIGNAL(3)\fP is set.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* complete connection within 10 seconds */
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
+ /* complete connection within 10 seconds */
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3+9 -6
@@ -43,14 +43,17 @@ See \fICURLOPT_CONNECTTIMEOUT(3)\fP for details.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* complete connection within 10000 milliseconds */
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
+ /* complete connection within 10000 milliseconds */
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3+11 -8
@@ -60,14 +60,17 @@ application wants to use it. Once it has been removed with
HTTP, SMTP, POP3 and IMAP. For WS and WSS starting in 7.86.0.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
- ret = curl_easy_perform(curl);
- if(ret == CURLE_OK) {
- /* only connected! */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ ret = curl_easy_perform(curl);
+ if(ret == CURLE_OK) {
+ /* only connected! */
+ }
}
}
.fi
docs/libcurl/opts/CURLOPT_CONNECT_TO.3+15 -12
@@ -88,22 +88,25 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl;
-struct curl_slist *connect_to = NULL;
-connect_to = curl_slist_append(NULL, "example.com::server1.example.com:");
+int main(void)
+{
+ CURL *curl;
+ struct curl_slist *connect_to = NULL;
+ connect_to = curl_slist_append(NULL, "example.com::server1.example.com:");
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
-}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
-curl_slist_free_all(connect_to);
+ curl_slist_free_all(connect_to);
+}
.fi
.SH AVAILABILITY
Added in 7.49.0
docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3+14 -9
@@ -77,12 +77,12 @@ FTP, SMTP, IMAP, POP3
.nf
static CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length)
{
- char *tempptrin, *tempptrout;
- size_t bytes = length;
- int rc;
- tempptrin = tempptrout = buffer;
- rc = platform_a2e(&tempptrin, &bytes, &tempptrout, &bytes);
- if(rc == PLATFORM_CONV_OK) {
+ int rc = 0;
+
+ /* in-place convert 'buffer' from ASCII to EBCDIC */
+
+ if(rc == 0) {
+ /* success */
return CURLE_OK;
}
else {
@@ -90,9 +90,14 @@ static CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length)
}
}
-/* use platform-specific functions for codeset conversions */
-curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
- my_conv_from_ascii_to_ebcdic);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+
+ /* use platform-specific functions for codeset conversions */
+ curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
+ my_conv_from_ascii_to_ebcdic);
+}
.fi
.SH AVAILABILITY
Not available and deprecated since 7.82.0.
docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3+10 -8
@@ -76,12 +76,10 @@ TLS-based protocols.
.nf
static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
{
- char *tempptrin, *tempptrout;
- size_t bytes = length;
- int rc;
- tempptrin = tempptrout = buffer;
- rc = platform_u2e(&tempptrin, &bytes, &tempptrout, &bytes);
- if(rc == PLATFORM_CONV_OK) {
+ int rc = 0;
+ /* in-place convert 'buffer' from UTF-8 to EBCDIC */
+ if(rc == 0) {
+ /* success */
return CURLE_OK;
}
else {
@@ -89,8 +87,12 @@ static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
}
}
-curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
- my_conv_from_utf8_to_ebcdic);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
+ my_conv_from_utf8_to_ebcdic);
+}
.fi
.SH AVAILABILITY
Not available and deprecated since 7.82.0.
docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3+11 -8
@@ -77,12 +77,10 @@ FTP, SMTP, IMAP, POP3
.nf
static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length)
{
- char *tempptrin, *tempptrout;
- size_t bytes = length;
- int rc;
- tempptrin = tempptrout = buffer;
- rc = platform_e2a(&tempptrin, &bytes, &tempptrout, &bytes);
- if(rc == PLATFORM_CONV_OK) {
+ int rc = 0;
+ /* in-place convert 'buffer' from EBCDIC to ASCII */
+ if(rc == 0) {
+ /* success */
return CURLE_OK;
}
else {
@@ -90,8 +88,13 @@ static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length)
}
}
-curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
- my_conv_from_ebcdic_to_ascii);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+
+ curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
+ my_conv_from_ebcdic_to_ascii);
+}
.fi
.SH AVAILABILITY
Not available and deprecated since 7.82.0.
docs/libcurl/opts/CURLOPT_COOKIE.3+8 -5
@@ -68,13 +68,16 @@ NULL, no cookies
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_COOKIE, "tool=curl; fun=yes;");
+ curl_easy_setopt(curl, CURLOPT_COOKIE, "tool=curl; fun=yes;");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_COOKIEFILE.3+11 -7
@@ -72,16 +72,20 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* get cookies from an existing file */
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
+ /* get cookies from an existing file */
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH "Cookie file format"
docs/libcurl/opts/CURLOPT_COOKIEJAR.3+12 -8
@@ -60,17 +60,21 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* export cookies to this file when closing the handle */
- curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
+ /* export cookies to this file when closing the handle */
+ curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- /* close the handle, write the cookies! */
- curl_easy_cleanup(curl);
+ /* close the handle, write the cookies! */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_COOKIELIST.3+35 -29
@@ -74,35 +74,41 @@ HTTP
#define SEP "\\t" /* Tab separates the fields */
-char *my_cookie =
- "example.com" /* Hostname */
- SEP "FALSE" /* Include subdomains */
- SEP "/" /* Path */
- SEP "FALSE" /* Secure */
- SEP "0" /* Expiry in epoch time format. 0 == Session */
- SEP "foo" /* Name */
- SEP "bar"; /* Value */
-
-/* my_cookie is imported immediately via CURLOPT_COOKIELIST. */
-curl_easy_setopt(curl, CURLOPT_COOKIELIST, my_cookie);
-
-/* The list of cookies in cookies.txt are not be imported until right
- before a transfer is performed. Cookies in the list that have the same
- hostname, path and name as in my_cookie are skipped. That is because
- libcurl has already imported my_cookie and it's considered a "live"
- cookie. A live cookie is not replaced by one read from a file.
-*/
-curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); /* import */
-
-/* Cookies are exported after curl_easy_cleanup is called. The server
- may have added, deleted or modified cookies by then. The cookies that
- were skipped on import are not exported.
-*/
-curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies.txt"); /* export */
-
-curl_easy_perform(curl); /* cookies imported from cookies.txt */
-
-curl_easy_cleanup(curl); /* cookies exported to cookies.txt */
+int main(void)
+{
+ char *my_cookie =
+ "example.com" /* Hostname */
+ SEP "FALSE" /* Include subdomains */
+ SEP "/" /* Path */
+ SEP "FALSE" /* Secure */
+ SEP "0" /* Expiry in epoch time format. 0 == Session */
+ SEP "foo" /* Name */
+ SEP "bar"; /* Value */
+
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* my_cookie is imported immediately via CURLOPT_COOKIELIST. */
+ curl_easy_setopt(curl, CURLOPT_COOKIELIST, my_cookie);
+
+ /* The list of cookies in cookies.txt are not be imported until right
+ before a transfer is performed. Cookies in the list that have the same
+ hostname, path and name as in my_cookie are skipped. That is because
+ libcurl has already imported my_cookie and it's considered a "live"
+ cookie. A live cookie is not replaced by one read from a file.
+ */
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); /* import */
+
+ /* Cookies are exported after curl_easy_cleanup is called. The server
+ may have added, deleted or modified cookies by then. The cookies that
+ were skipped on import are not exported.
+ */
+ curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies.txt"); /* export */
+
+ curl_easy_perform(curl); /* cookies imported from cookies.txt */
+
+ curl_easy_cleanup(curl); /* cookies exported to cookies.txt */
+ }
+}
.fi
.SH "Cookie file format"
The cookie file format and general cookie concepts in curl are described
docs/libcurl/opts/CURLOPT_COOKIESESSION.3+13 -9
@@ -48,19 +48,23 @@ the same session.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* new "session", do not load session cookies */
- curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L);
+ /* new "session", do not load session cookies */
+ curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L);
- /* get the (non session) cookies from this file */
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
+ /* get the (non session) cookies from this file */
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3+12 -9
@@ -51,18 +51,21 @@ NULL
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- char local_buffer[1024]="data to send";
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ char local_buffer[1024]="data to send";
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* size of the data to copy from the buffer and send in the request */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L);
+ /* size of the data to copy from the buffer and send in the request */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L);
- /* send data from the local stack */
- curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, local_buffer);
+ /* send data from the local stack */
+ curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, local_buffer);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CRLF.3+10 -7
@@ -43,13 +43,16 @@ This is a legacy option of questionable use.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
- curl_easy_setopt(curl, CURLOPT_CRLF, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CRLF, 1L);
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CRLFILE.3+10 -6
@@ -61,12 +61,16 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_CRLFILE, "/etc/certs/crl.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_CRLFILE, "/etc/certs/crl.pem");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CURLU.3+13 -10
@@ -49,19 +49,22 @@ The default value of this parameter is NULL.
All
.SH EXAMPLE
.nf
-CURL *handle = curl_easy_init();
-CURLU *urlp = curl_url();
-int res = 0;
-if(curl) {
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ CURLU *urlp = curl_url();
+ if(curl) {
+ CURLcode res;
+ CURLUcode ret;
+ ret = curl_url_set(urlp, CURLUPART_URL, "https://example.com", 0);
- res = curl_url_set(urlp, CURLUPART_URL, "https://example.com", 0);
+ curl_easy_setopt(curl, CURLOPT_CURLU, urlp);
- curl_easy_setopt(handle, CURLOPT_CURLU, urlp);
+ res = curl_easy_perform(curl);
- ret = curl_easy_perform(handle);
-
- curl_url_cleanup(urlp);
- curl_easy_cleanup(handle);
+ curl_url_cleanup(urlp);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3+11 -7
@@ -96,16 +96,20 @@ NULL
HTTP, FTP, IMAP, POP3 and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* DELETE the given path */
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
+ /* DELETE the given path */
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DEBUGDATA.3+14 -0
@@ -41,6 +41,20 @@ NULL
All
.SH EXAMPLE
.nf
+struct data {
+ void *custom;
+};
+
+static int my_trace(CURL *handle, curl_infotype type,
+ char *data, size_t size,
+ void *clientp)
+{
+ struct data *mine = clientp;
+ printf("our ptr: %p\\n", mine->custom);
+
+ /* output debug info */
+}
+
int main(void)
{
CURL *curl;
docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3+7 -7
@@ -99,25 +99,25 @@ void dump(const char *text,
{
size_t i;
size_t c;
- unsigned int width=0x10;
+ unsigned int width = 0x10;
fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\\n",
text, (long)size, (long)size);
- for(i=0; i<size; i+= width) {
+ for(i = 0; i < size; i += width) {
fprintf(stream, "%4.4lx: ", (long)i);
/* show hex to the left */
for(c = 0; c < width; c++) {
- if(i+c < size)
- fprintf(stream, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stream, "%02x ", ptr[i + c]);
else
fputs(" ", stream);
}
/* show data on the right */
- for(c = 0; (c < width) && (i+c < size); c++) {
- char x = (ptr[i+c] >= 0x20 && ptr[i+c] < 0x80) ? ptr[i+c] : '.';
+ for(c = 0; (c < width) && (i + c < size); c++) {
+ char x = (ptr[i + c] >= 0x20 && ptr[i + c] < 0x80) ? ptr[i + c] : '.';
fputc(x, stream);
}
@@ -134,7 +134,7 @@ int my_trace(CURL *handle, curl_infotype type,
(void)handle; /* prevent compiler warning */
(void)clientp;
- switch (type) {
+ switch(type) {
case CURLINFO_TEXT:
fputs("== Info: ", stderr);
fwrite(data, size, 1, stderr);
docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3+11 -8
@@ -62,16 +62,19 @@ NULL (make a guess based on the host)
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- /* set a URL without a scheme */
- curl_easy_setopt(curl, CURLOPT_URL, "example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* set a URL without a scheme */
+ curl_easy_setopt(curl, CURLOPT_URL, "example.com");
- /* set the default protocol (scheme) for schemeless URLs */
- curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
+ /* set the default protocol (scheme) for schemeless URLs */
+ curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DIRLISTONLY.3+11 -7
@@ -56,16 +56,20 @@ effectively breaks that feature.
FTP, SFTP and POP3
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/");
- /* list only */
- curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L);
+ /* list only */
+ curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3+8 -5
@@ -44,13 +44,16 @@ This is the equivalent to the \fICURLU_DISALLOW_USER\fP flag for the
Several
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3+14 -10
@@ -60,20 +60,24 @@ Since version 8.1.0, libcurl prunes entries from the DNS cache if it exceeds
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* only reuse addresses for a short time */
- curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 2L);
+ /* only reuse addresses for a short time */
+ curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 2L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- /* in this second request, the cache is not be used if more than
- two seconds have passed since the previous name resolve */
- ret = curl_easy_perform(curl);
+ /* in this second request, the cache is not be used if more than
+ two seconds have passed since the previous name resolve */
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3+10 -6
@@ -45,12 +45,16 @@ NULL
All protocols except file:// - protocols that resolve host names.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3+10 -6
@@ -45,12 +45,16 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP4, "192.168.0.14");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP4, "192.168.0.14");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3+10 -6
@@ -45,12 +45,16 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP6, "fe80::a9ff:fe46:b619");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP6, "fe80::a9ff:fe46:b619");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_SERVERS.3+11 -6
@@ -49,12 +49,17 @@ NULL - use system default
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "192.168.1.100:53,192.168.1.101");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_DNS_SERVERS,
+ "192.168.1.100:53,192.168.1.101");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3+10 -7
@@ -54,15 +54,18 @@ performance impacts and may cause IPv4 to be used before IPv6 or vice versa.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3+12 -8
@@ -47,15 +47,19 @@ share DNS cache between transfers.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* switch off the use of a global, thread unsafe, cache */
- curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE, 0L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* switch off the use of a global, thread unsafe, cache */
+ curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE, 0L);
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
+
.fi
.SH AVAILABILITY
Deprecated since 7.11.1. Function removed in 7.62.0.
docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3+11 -7
@@ -62,16 +62,20 @@ of the DoH server certificate.
DoH
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://cloudflare-dns.com/dns-query");
+ curl_easy_setopt(curl, CURLOPT_DOH_URL,
+ "https://cloudflare-dns.com/dns-query");
- /* Disable host name verification of the DoH server */
- curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L);
+ /* Disable host name verification of the DoH server */
+ curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3+11 -7
@@ -73,16 +73,20 @@ the correct end-point.
DoH
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://cloudflare-dns.com/dns-query");
+ curl_easy_setopt(curl, CURLOPT_DOH_URL,
+ "https://cloudflare-dns.com/dns-query");
- /* Disable certificate verification of the DoH server */
- curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L);
+ /* Disable certificate verification of the DoH server */
+ curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3+11 -7
@@ -50,16 +50,20 @@ the verification fails.
DoH
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://cloudflare-dns.com/dns-query");
+ curl_easy_setopt(curl, CURLOPT_DOH_URL,
+ "https://cloudflare-dns.com/dns-query");
- /* Ask for OCSP stapling when verifying the DoH server */
- curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYSTATUS, 1L);
+ /* Ask for OCSP stapling when verifying the DoH server */
+ curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYSTATUS, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_DOH_URL.3+8 -5
@@ -70,11 +70,14 @@ the default name resolver.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_EGDSOCKET.3+10 -6
@@ -45,12 +45,16 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_EGDSOCKET, "/var/egd.socket");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_EGDSOCKET, "/var/egd.socket");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_ERRORBUFFER.3+27 -23
@@ -55,34 +55,38 @@ NULL
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- CURLcode res;
- char errbuf[CURL_ERROR_SIZE];
+#include <string.h> /* for strlen() */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ char errbuf[CURL_ERROR_SIZE];
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* provide a buffer to store errors in */
- curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
+ /* provide a buffer to store errors in */
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
- /* set the error buffer as empty before performing a request */
- errbuf[0] = 0;
+ /* set the error buffer as empty before performing a request */
+ errbuf[0] = 0;
- /* perform the request */
- res = curl_easy_perform(curl);
+ /* perform the request */
+ res = curl_easy_perform(curl);
- /* if the request did not complete correctly, show the error
- information. if no detailed error information was written to errbuf
- show the more generic information from curl_easy_strerror instead.
- */
- if(res != CURLE_OK) {
- size_t len = strlen(errbuf);
- fprintf(stderr, "\\nlibcurl: (%d) ", res);
- if(len)
- fprintf(stderr, "%s%s", errbuf,
- ((errbuf[len - 1] != '\\n') ? "\\n" : ""));
- else
- fprintf(stderr, "%s\\n", curl_easy_strerror(res));
+ /* if the request did not complete correctly, show the error
+ information. if no detailed error information was written to errbuf
+ show the more generic information from curl_easy_strerror instead.
+ */
+ if(res != CURLE_OK) {
+ size_t len = strlen(errbuf);
+ fprintf(stderr, "\\nlibcurl: (%d) ", res);
+ if(len)
+ fprintf(stderr, "%s%s", errbuf,
+ ((errbuf[len - 1] != '\\n') ? "\\n" : ""));
+ else
+ fprintf(stderr, "%s\\n", curl_easy_strerror(res));
+ }
}
}
.fi
docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3+9 -6
@@ -43,14 +43,17 @@ sent anyway.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* wait 3 seconds for 100-continue */
- curl_easy_setopt(curl, CURLOPT_EXPECT_100_TIMEOUT_MS, 3000L);
+ /* wait 3 seconds for 100-continue */
+ curl_easy_setopt(curl, CURLOPT_EXPECT_100_TIMEOUT_MS, 3000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FAILONERROR.3+11 -8
@@ -52,14 +52,17 @@ get closed and \fICURLE_HTTP_RETURNED_ERROR\fP is returned.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
- ret = curl_easy_perform(curl);
- if(ret == CURLE_HTTP_RETURNED_ERROR) {
- /* an HTTP response error problem */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
+ ret = curl_easy_perform(curl);
+ if(ret == CURLE_HTTP_RETURNED_ERROR) {
+ /* an HTTP response error problem */
+ }
}
}
.fi
docs/libcurl/opts/CURLOPT_FILETIME.3+18 -13
@@ -43,21 +43,26 @@ transfer to extract the received time (if any).
HTTP(S), FTP(S), SFTP, FILE, SMB(S)
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* Ask for filetime */
- curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
- res = curl_easy_perform(curl);
- if(CURLE_OK == res) {
- res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
- if((CURLE_OK == res) && (filetime >= 0)) {
- time_t file_time = (time_t)filetime;
- printf("filetime %s: %s", filename, ctime(&file_time));
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/path.html");
+ /* Ask for filetime */
+ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ long filetime;
+ res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
+ if((CURLE_OK == res) && (filetime >= 0)) {
+ time_t file_time = (time_t)filetime;
+ printf("filetime: %s", ctime(&file_time));
+ }
}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3+19 -5
@@ -40,22 +40,36 @@ NULL
FTP
.SH EXAMPLE
.nf
+extern int string_match(const char *s1, const char *s2);
+
+struct local_stuff {
+ void *custom;
+};
+
static int my_fnmatch(void *clientp,
const char *pattern, const char *string)
{
- struct local_stuff *data = (struct local_stuff *)clientp;
+ struct local_stuff *my = clientp;
+ printf("my ptr: %p\\n", my->custom);
+
if(string_match(pattern, string))
return CURL_FNMATCHFUNC_MATCH;
else
return CURL_FNMATCHFUNC_NOMATCH;
}
+int main(void)
{
struct local_stuff local_data;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
- curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
- curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
- curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
+ curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
+ curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
+ curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3+16 -5
@@ -50,22 +50,33 @@ NULL == an internal function for wildcard matching.
FTP
.SH EXAMPLE
.nf
+extern int string_match(const char *s1, const char *s2);
+
+struct local_stuff {
+ void *custom;
+};
static int my_fnmatch(void *clientp,
const char *pattern, const char *string)
{
- struct local_stuff *data = (struct local_stuff *)clientp;
+ struct local_stuff *data = clientp;
+ printf("my pointer: %p\\n", data->custom);
if(string_match(pattern, string))
return CURL_FNMATCHFUNC_MATCH;
else
return CURL_FNMATCHFUNC_NOMATCH;
}
+int main(void)
{
struct local_stuff local_data;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
- curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
- curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
- curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
+ curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
+ curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
+ curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3+9 -6
@@ -68,14 +68,17 @@ would otherwise select internally.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* example.com is redirected, so we tell libcurl to follow redirection */
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ /* example.com is redirected, so we tell libcurl to follow redirection */
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FORBID_REUSE.3+11 -5
@@ -46,13 +46,19 @@ Set to 0 to have libcurl keep the connection open for possible later reuse
Most
.SH EXAMPLE
.nf
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
- curl_easy_perform(curl);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
+ curl_easy_perform(curl);
- /* this second transfer may not reuse the same connection */
- curl_easy_perform(curl);
+ /* this second transfer may not reuse the same connection */
+ curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3+9 -4
@@ -48,11 +48,16 @@ Set \fIfresh\fP to 0 to have libcurl attempt reusing an existing connection
Most
.SH EXAMPLE
.nf
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
- /* this transfer must use a new connection, not reuse an existing */
- curl_easy_perform(curl);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
+ /* this transfer must use a new connection, not reuse an existing */
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTPPORT.3+11 -6
@@ -78,12 +78,17 @@ NULL
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
- curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/old-server/file.txt");
+ curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3+12 -8
@@ -49,14 +49,18 @@ CURLFTPAUTH_DEFAULT
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
- /* funny server, ask for SSL before TLS */
- curl_easy_setopt(curl, CURLOPT_FTPSSLAUTH, (long)CURLFTPAUTH_SSL);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
+ /* funny server, ask for SSL before TLS */
+ curl_easy_setopt(curl, CURLOPT_FTPSSLAUTH, (long)CURLFTPAUTH_SSL);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3+10 -6
@@ -44,15 +44,19 @@ NULL
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_FTP_ACCOUNT, "human-resources");
+ curl_easy_setopt(curl, CURLOPT_FTP_ACCOUNT, "human-resources");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3+10 -8
@@ -45,15 +45,17 @@ NULL
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER, "two users");
+ res = curl_easy_perform(curl);
- curl_easy_setopt(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER, "two users");
-
- ret = curl_easy_perform(curl);
-
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3+12 -7
@@ -62,15 +62,20 @@ CURLFTP_CREATE_DIR_NONE (0)
FTP and SFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/non-existing/new.txt");
- curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
- (long)CURLFTP_CREATE_DIR_RETRY);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/non-existing/new.txt");
+ curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
+ (long)CURLFTP_CREATE_DIR_RETRY);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3+11 -7
@@ -57,15 +57,19 @@ CURLFTPMETHOD_MULTICWD
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
- curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
- (long)CURLFTPMETHOD_SINGLECWD);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
+ curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
+ (long)CURLFTPMETHOD_SINGLECWD);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3+11 -7
@@ -50,15 +50,19 @@ This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
- /* please ignore the IP in the PASV response */
- curl_easy_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, 1L);
- ret = curl_easy_perform(curl);
+ /* please ignore the IP in the PASV response */
+ curl_easy_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, 1L);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3+12 -8
@@ -50,14 +50,18 @@ CURLFTPSSL_CCC_NONE
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL);
- /* go back to clear-text FTP after authenticating */
- curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, (long)CURLFTPSSL_CCC_ACTIVE);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL);
+ /* go back to clear-text FTP after authenticating */
+ curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, (long)CURLFTPSSL_CCC_ACTIVE);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3+13 -9
@@ -50,19 +50,23 @@ then.
.SH PROTOCOLS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
- /* contact us back, aka "active" FTP */
- curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
+ /* contact us back, aka "active" FTP */
+ curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
- /* FTP the way the neanderthals did it */
- curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L);
+ /* FTP the way the neanderthals did it */
+ curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3+12 -7
@@ -50,16 +50,21 @@ If the server is an IPv6 host, this option has no effect.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/old-server/file.txt");
- /* let's shut off this modern feature */
- curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0L);
+ /* let's shut off this modern feature */
+ curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3+12 -7
@@ -42,16 +42,21 @@ no effect when using the active FTP transfers mode.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/old-server/file.txt");
- /* a drftpd server, do it! */
- curl_easy_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);
+ /* a drftpd server, do it! */
+ curl_easy_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3+11 -8
@@ -45,14 +45,17 @@ CURLGSSAPI_DELEGATION_NONE
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* delegate if okayed by policy */
- curl_easy_setopt(curl, CURLOPT_GSSAPI_DELEGATION,
- (long)CURLGSSAPI_DELEGATION_POLICY_FLAG);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* delegate if okayed by policy */
+ curl_easy_setopt(curl, CURLOPT_GSSAPI_DELEGATION,
+ (long)CURLGSSAPI_DELEGATION_POLICY_FLAG);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3+10 -7
@@ -49,15 +49,18 @@ CURL_HET_DEFAULT (currently defined as 200L)
All except FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 300L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 300L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3+9 -6
@@ -47,12 +47,15 @@ Most applications do not need this option.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3+9 -6
@@ -45,12 +45,15 @@ NULL, no HAProxy header is sent
HTTP, HAProxy PROTOCOL
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HEADER.3+8 -5
@@ -57,13 +57,16 @@ custom HTTP headers!
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
+ curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HEADERDATA.3+13 -10
@@ -58,24 +58,27 @@ struct my_info {
static size_t header_callback(char *buffer, size_t size,
size_t nitems, void *userdata)
{
- struct my_info *i = (struct my_info *)userdata;
-
+ struct my_info *i = userdata;
+ printf("shoe size: %d\\n", i->shoesize);
/* now this callback can access the my_info struct */
return nitems * size;
}
-CURL *curl = curl_easy_init();
-if(curl) {
- struct my_info my = { 10, "the cookies are in the cupboard" };
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct my_info my = { 10, "the cookies are in the cupboard" };
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
+ curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
- /* pass in custom data to the callback */
- curl_easy_setopt(curl, CURLOPT_HEADERDATA, &my);
+ /* pass in custom data to the callback */
+ curl_easy_setopt(curl, CURLOPT_HEADERDATA, &my);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3+8 -5
@@ -110,13 +110,16 @@ static size_t header_callback(char *buffer, size_t size,
return nitems * size;
}
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
+ curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HEADEROPT.3+19 -16
@@ -52,23 +52,26 @@ CURLHEADER_SEPARATE (changed in 7.42.1, used CURLHEADER_UNIFIED before then)
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- struct curl_slist *list;
- list = curl_slist_append(NULL, "Shoesize: 10");
- list = curl_slist_append(list, "Accept:");
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ struct curl_slist *list;
+ list = curl_slist_append(NULL, "Shoesize: 10");
+ list = curl_slist_append(list, "Accept:");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
- /* HTTPS over a proxy makes a separate CONNECT to the proxy, so tell
- libcurl to not send the custom headers to the proxy. Keep them
- separate! */
- curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
- ret = curl_easy_perform(curl);
- curl_slist_free_all(list);
- curl_easy_cleanup(curl);
+ /* HTTPS over a proxy makes a separate CONNECT to the proxy, so tell
+ libcurl to not send the custom headers to the proxy. Keep them
+ separate! */
+ curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
+ ret = curl_easy_perform(curl);
+ curl_slist_free_all(list);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTS.3+7 -4
@@ -64,10 +64,13 @@ NULL, no file name
HTTPS and HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTSREADDATA.3+15 -8
@@ -44,16 +44,23 @@ NULL
This feature is only used for HTTP(S) transfer.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-struct MyData this;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+struct MyData {
+ void *custom;
+};
- /* pass pointer that gets passed in to the
- CURLOPT_HSTSREADFUNCTION callback */
- curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &this);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ struct MyData this;
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
- curl_easy_perform(curl);
+ /* pass pointer that gets passed in to the
+ CURLOPT_HSTSREADFUNCTION callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &this);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3+23 -5
@@ -69,14 +69,32 @@ NULL - no callback.
This feature is only used for HTTP(S) transfer.
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
+static CURLSTScode hsts_cb(CURL *easy, struct curl_hstsentry *sts,
+ void *clientp)
+{
+ /* populate the struct as documented */
+ return CURLSTS_OK;
+}
+
+int main(void)
{
- /* set HSTS read callback */
- curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hstsread);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct priv my_stuff;
+ CURLcode res;
+
+ /* set HSTS read callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hsts_cb);
- /* pass in suitable argument to the callback */
- curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &hstspreload[0]);
+ /* pass in suitable argument to the callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &my_stuff);
- result = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3+15 -8
@@ -44,16 +44,23 @@ NULL
This feature is only used for HTTP(S) transfer.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-struct MyData this;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+struct MyData {
+ void *custom;
+};
- /* pass pointer that gets passed in to the
- CURLOPT_HSTSWRITEFUNCTION callback */
- curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &this);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ struct MyData this;
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
- curl_easy_perform(curl);
+ /* pass pointer that gets passed in to the
+ CURLOPT_HSTSWRITEFUNCTION callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &this);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3+23 -5
@@ -73,14 +73,32 @@ NULL - no callback.
This feature is only used for HTTP(S) transfer.
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
+static CURLSTScode hswr_cb(CURL *easy, struct curl_hstsentry *sts,
+ struct curl_index *count, void *clientp)
+{
+ /* save the passed in HSTS data somewhere */
+ return CURLSTS_OK;
+}
+
+int main(void)
{
- /* set HSTS read callback */
- curl_easy_setopt(curl, CURLOPT_HSTSWRITEFUNCTION, hstswrite);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct priv my_stuff;
+ CURLcode res;
+
+ /* set HSTS read callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSWRITEFUNCTION, hswr_cb);
- /* pass in suitable argument to the callback */
- curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &hstspreload[0]);
+ /* pass in suitable argument to the callback */
+ curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &my_stuff);
- result = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HSTS_CTRL.3+7 -4
@@ -55,10 +55,13 @@ to the file when closing the handle.
HTTPS and HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3+9 -6
@@ -46,12 +46,15 @@ responses.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HTTP09_ALLOWED, 1L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HTTP09_ALLOWED, 1L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTP200ALIASES.3+12 -9
@@ -51,17 +51,20 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_slist *list;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct curl_slist *list;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- list = curl_slist_append(NULL, "ICY 200 OK");
- list = curl_slist_append(list, "WEIRDO 99 FINE");
+ list = curl_slist_append(NULL, "ICY 200 OK");
+ list = curl_slist_append(list, "WEIRDO 99 FINE");
- curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list);
- curl_easy_perform(curl);
- curl_slist_free_all(list); /* free the list again */
+ curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list);
+ curl_easy_perform(curl);
+ curl_slist_free_all(list); /* free the list again */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTPAUTH.3+11 -8
@@ -108,14 +108,17 @@ CURLAUTH_BASIC
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* allow whatever auth the server speaks */
- curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
- curl_easy_setopt(curl, CURLOPT_USERPWD, "james:bond");
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* allow whatever auth the server speaks */
+ curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
+ curl_easy_setopt(curl, CURLOPT_USERPWD, "james:bond");
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTPGET.3+10 -7
@@ -48,15 +48,18 @@ reset a handle to default method, consider \fIcurl_easy_reset(3)\fP.
HTTP(S)
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* use a GET to fetch this */
- curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
+ /* use a GET to fetch this */
+ curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTPHEADER.3+12 -9
@@ -136,21 +136,24 @@ NULL
HTTP, IMAP and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
+int main(void)
+{
+ CURL *curl = curl_easy_init();
-struct curl_slist *list = NULL;
+ struct curl_slist *list = NULL;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- list = curl_slist_append(list, "Shoesize: 10");
- list = curl_slist_append(list, "Accept:");
+ list = curl_slist_append(list, "Shoesize: 10");
+ list = curl_slist_append(list, "Accept:");
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- curl_slist_free_all(list); /* free the list */
+ curl_slist_free_all(list); /* free the list */
+ }
}
.fi
docs/libcurl/opts/CURLOPT_HTTPPOST.3+33 -19
@@ -52,27 +52,41 @@ NULL
HTTP
.SH EXAMPLE
.nf
-/* Fill in the file upload field. This makes libcurl load data from
- the given file name when curl_easy_perform() is called. */
-curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "sendfile",
- CURLFORM_FILE, "postit2.c",
- CURLFORM_END);
+int main(void)
+{
+ struct curl_httppost *formpost;
+ struct curl_httppost *lastptr;
-/* Fill in the filename field */
-curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "filename",
- CURLFORM_COPYCONTENTS, "postit2.c",
- CURLFORM_END);
+ /* Fill in the file upload field. This makes libcurl load data from
+ the given file name when curl_easy_perform() is called. */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "sendfile",
+ CURLFORM_FILE, "postit2.c",
+ CURLFORM_END);
-/* Fill in the submit field too, even if this is rarely needed */
-curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "submit",
- CURLFORM_COPYCONTENTS, "send",
- CURLFORM_END);
+ /* Fill in the filename field */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "filename",
+ CURLFORM_COPYCONTENTS, "postit2.c",
+ CURLFORM_END);
+
+ /* Fill in the submit field too, even if this is rarely needed */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "submit",
+ CURLFORM_COPYCONTENTS, "send",
+ CURLFORM_END);
+
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
+ curl_formfree(formpost);
+}
.fi
.SH AVAILABILITY
As long as HTTP is enabled. Deprecated in 7.56.0.
docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3+9 -6
@@ -56,12 +56,15 @@ rarely works through the proxy anyway).
All network protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
- curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
+ curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.3+9 -6
@@ -42,12 +42,15 @@ default content decoding but requires you to use
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HTTP_CONTENT_DECODING, 0L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HTTP_CONTENT_DECODING, 0L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.3+9 -6
@@ -41,12 +41,15 @@ does chunked transfer decoding by default unless this option is set to zero.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HTTP_TRANSFER_DECODING, 0L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HTTP_TRANSFER_DECODING, 0L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_HTTP_VERSION.3+12 -9
@@ -80,15 +80,18 @@ Before that: CURL_HTTP_VERSION_1_1
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
- (long)CURL_HTTP_VERSION_2TLS);
- ret = curl_easy_perform(curl);
- if(ret == CURLE_HTTP_RETURNED_ERROR) {
- /* an HTTP response error problem */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
+ (long)CURL_HTTP_VERSION_2TLS);
+ ret = curl_easy_perform(curl);
+ if(ret == CURLE_HTTP_RETURNED_ERROR) {
+ /* an HTTP response error problem */
+ }
}
}
.fi
docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3+9 -6
@@ -51,14 +51,17 @@ Only use this option if strictly necessary.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* we know the server is silly, ignore content-length */
- curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
+ /* we know the server is silly, ignore content-length */
+ curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_INFILESIZE.3+14 -7
@@ -57,17 +57,24 @@ Unset
Many
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- long uploadsize = FILE_SIZE;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
+#define FILE_SIZE 12345L
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ long uploadsize = FILE_SIZE;
- curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/destination.tar.gz");
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3+13 -7
@@ -53,17 +53,23 @@ Unset
Many
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_off_t uploadsize = FILE_SIZE;
+#define FILE_SIZE 123456
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_off_t uploadsize = FILE_SIZE;
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/destination.tar.gz");
- curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize);
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_INTERFACE.3+10 -6
@@ -60,15 +60,19 @@ NULL, use whatever the TCP stack finds suitable
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
+ curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.3+15 -4
@@ -42,16 +42,27 @@ NULL
RTSP
.SH EXAMPLE
.nf
-static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *user)
+struct local {
+ void *custom;
+};
+static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp)
{
- struct local *l = (struct local *)user;
+ struct local *l = userp;
+ printf("my pointer: %p\\n", l->custom);
/* take care of the packet in 'ptr', then return... */
return size * nmemb;
}
+
+int main(void)
{
struct local rtp_data;
- curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
- curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
+ curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3+14 -4
@@ -72,16 +72,26 @@ NULL, the interleave data is then passed to the regular write function:
RTSP
.SH EXAMPLE
.nf
-static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *user)
+struct local {
+ void *custom;
+};
+
+static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp)
{
- struct local *l = (struct local *)user;
+ struct local *l = userp;
+ printf("our ptr: %p\\n", l->custom);
/* take care of the packet in 'ptr', then return... */
return size * nmemb;
}
+
+int main(void)
{
struct local rtp_data;
- curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
- curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
+ curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_IOCTLDATA.3+13 -4
@@ -40,20 +40,29 @@ By default, the value of this parameter is NULL.
Used with HTTP
.SH EXAMPLE
.nf
+#include <unistd.h> /* for lseek */
+
+struct data {
+ int fd; /* our file descriptor */
+};
+
static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
{
struct data *io = (struct data *)clientp;
if(cmd == CURLIOCMD_RESTARTREAD) {
- lseek(fd, 0, SEEK_SET);
- current_offset = 0;
+ lseek(io->fd, 0, SEEK_SET);
return CURLIOE_OK;
}
return CURLIOE_UNKNOWNCMD;
}
+int main(void)
{
struct data ioctl_data;
- curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
- curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
+ curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3+13 -4
@@ -70,20 +70,29 @@ By default, this parameter is set to NULL. Not used.
Used with HTTP
.SH EXAMPLE
.nf
+#include <unistd.h> /* for lseek */
+
+struct data {
+ int fd; /* our file descriptor */
+};
+
static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
{
struct data *io = (struct data *)clientp;
if(cmd == CURLIOCMD_RESTARTREAD) {
- lseek(fd, 0, SEEK_SET);
- current_offset = 0;
+ lseek(io->fd, 0, SEEK_SET);
return CURLIOE_OK;
}
return CURLIOE_UNKNOWNCMD;
}
+int main(void)
{
struct data ioctl_data;
- curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
- curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
+ curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_IPRESOLVE.3+11 -8
@@ -53,19 +53,22 @@ CURL_IPRESOLVE_WHATEVER
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- /* of all addresses example.com resolves to, only IPv6 ones are used */
- curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
+ /* of all addresses example.com resolves to, only IPv6 ones are used */
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
-
.SH AVAILABILITY
Always
.SH RETURN VALUE
docs/libcurl/opts/CURLOPT_ISSUERCERT.3+10 -6
@@ -56,12 +56,16 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_ISSUERCERT, "/etc/certs/cacert.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_ISSUERCERT, "/etc/certs/cacert.pem");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3+18 -10
@@ -62,16 +62,24 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- blob.data = certificateData;
- blob.len = filesize;
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_ISSUERCERT_BLOB, &blob);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+
+extern char *certificateData;
+extern size_t filesize;
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ blob.data = certificateData;
+ blob.len = filesize;
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_ISSUERCERT_BLOB, &blob);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.3+10 -7
@@ -48,13 +48,16 @@ Most applications do not need this option.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "sending data");
- curl_easy_setopt(curl, CURLOPT_KEEP_SENDING_ON_ERROR, 1L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "sending data");
+ curl_easy_setopt(curl, CURLOPT_KEEP_SENDING_ON_ERROR, 1L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_KEYPASSWD.3+12 -8
@@ -45,14 +45,18 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_KRBLEVEL.3+10 -6
@@ -46,12 +46,16 @@ NULL
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_KRBLEVEL, "private");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_KRBLEVEL, "private");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_LOCALPORT.3+12 -8
@@ -42,14 +42,18 @@ this option is set. Valid port numbers are 1 - 65535.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
- /* and try 20 more ports following that */
- curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
+ /* and try 20 more ports following that */
+ curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.3+12 -8
@@ -46,14 +46,18 @@ setup failures.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
- /* and try 20 more ports following that */
- curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
+ /* and try 20 more ports following that */
+ curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3+10 -6
@@ -57,12 +57,16 @@ NULL
Only IMAP, LDAP, POP3 and SMTP support login options.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, "AUTH=*");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, "AUTH=*");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3+15 -11
@@ -43,18 +43,22 @@ slow and abort.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* abort if slower than 30 bytes/sec during 60 seconds */
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
- res = curl_easy_perform(curl);
- if(CURLE_OPERATION_TIMEDOUT == res) {
- printf("Timeout!\\n");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ /* abort if slower than 30 bytes/sec during 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OPERATION_TIMEDOUT == res) {
+ printf("Timeout!\\n");
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3+15 -11
@@ -42,18 +42,22 @@ library to consider it too slow and abort.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* abort if slower than 30 bytes/sec during 60 seconds */
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
- res = curl_easy_perform(curl);
- if(CURLE_OPERATION_TIMEDOUT == res) {
- printf("Timeout!\\n");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ /* abort if slower than 30 bytes/sec during 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OPERATION_TIMEDOUT == res) {
+ printf("Timeout!\\n");
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
}
- /* always cleanup */
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAIL_AUTH.3+10 -6
@@ -56,12 +56,16 @@ NULL
SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_MAIL_AUTH, "<secret@cave>");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_MAIL_AUTH, "<secret@cave>");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAIL_FROM.3+10 -6
@@ -49,12 +49,16 @@ blank
SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "[email protected]");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "[email protected]");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAIL_RCPT.3+14 -10
@@ -56,16 +56,20 @@ NULL
SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_slist *list;
- list = curl_slist_append(NULL, "root@localhost");
- list = curl_slist_append(list, "[email protected]");
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, list);
- ret = curl_easy_perform(curl);
- curl_slist_free_all(list);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_slist *list;
+ list = curl_slist_append(NULL, "root@localhost");
+ list = curl_slist_append(list, "[email protected]");
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, list);
+ res = curl_easy_perform(curl);
+ curl_slist_free_all(list);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.3+15 -11
@@ -51,20 +51,24 @@ RCPT TO command.
SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_slist *list;
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct curl_slist *list;
+ CURLcode res;
- /* Adding one valid and one invalid email address */
- list = curl_slist_append(NULL, "[email protected]");
- list = curl_slist_append(list, "invalidemailaddress");
+ /* Adding one valid and one invalid email address */
+ list = curl_slist_append(NULL, "[email protected]");
+ list = curl_slist_append(list, "invalidemailaddress");
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L);
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L);
- ret = curl_easy_perform(curl);
- curl_slist_free_all(list);
- curl_easy_cleanup(curl);
+ res = curl_easy_perform(curl);
+ curl_slist_free_all(list);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3+9 -6
@@ -49,14 +49,17 @@ Default maximum age is set to 118 seconds.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* only allow 30 seconds idle time */
- curl_easy_setopt(curl, CURLOPT_MAXAGE_CONN, 30L);
+ /* only allow 30 seconds idle time */
+ curl_easy_setopt(curl, CURLOPT_MAXAGE_CONN, 30L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXCONNECTS.3+10 -7
@@ -54,13 +54,16 @@ acknowledged, and you must instead use \fIcurl_multi_setopt(3)\fP and the
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* limit the connection cache for this handle to no more than 3 */
- curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* limit the connection cache for this handle to no more than 3 */
+ curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXFILESIZE.3+10 -7
@@ -50,13 +50,16 @@ None
FTP, HTTP and MQTT
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* refuse to download if larger than 1000 bytes! */
- curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, 1000L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* refuse to download if larger than 1000 bytes! */
+ curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, 1000L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3+11 -8
@@ -49,14 +49,17 @@ None
FTP, HTTP and MQTT
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_off_t ridiculous = 1 << 48;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* refuse to download if larger than ridiculous */
- curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_off_t ridiculous = (curl_off_t)1 << 48;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* refuse to download if larger than ridiculous */
+ curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.3+9 -6
@@ -51,14 +51,17 @@ Default \fImaxlifetime\fP is 0 seconds (i.e., disabled).
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* only allow each connection to be reused for 30 seconds */
- curl_easy_setopt(curl, CURLOPT_MAXLIFETIME_CONN, 30L);
+ /* only allow each connection to be reused for 30 seconds */
+ curl_easy_setopt(curl, CURLOPT_MAXLIFETIME_CONN, 30L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAXREDIRS.3+12 -9
@@ -47,18 +47,21 @@ to get stuck in never-ending redirect loops.
HTTP(S)
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* enable redirect following */
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ /* enable redirect following */
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- /* allow three redirects */
- curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);
+ /* allow three redirects */
+ curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.3+10 -7
@@ -49,13 +49,16 @@ This option does not affect transfer speeds done with FILE:// URLs.
All but file://
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* cap the download speed to 31415 bytes/sec */
- curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)31415);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* cap the download speed to 31415 bytes/sec */
+ curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)31415);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.3+11 -8
@@ -51,14 +51,17 @@ This option does not affect transfer speeds done with FILE:// URLs.
All except file://
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* cap the upload speed to 1000 bytes/sec */
- curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)1000);
- /* (set some upload options as well!) */
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* cap the upload speed to 1000 bytes/sec */
+ curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)1000);
+ /* (set some upload options as well!) */
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_MIMEPOST.3+22 -15
@@ -48,23 +48,30 @@ is reset to GET. Instead you should set a desired request method explicitly.
HTTP, SMTP, IMAP.
.SH EXAMPLE
.nf
- curl_mime *multipart = curl_mime_init(handle);
- curl_mimepart *part = curl_mime_addpart(multipart);
- curl_mime_name(part, "name");
- curl_mime_data(part, "daniel", CURL_ZERO_TERMINATED);
- part = curl_mime_addpart(multipart);
- curl_mime_name(part, "project");
- curl_mime_data(part, "curl", CURL_ZERO_TERMINATED);
- part = curl_mime_addpart(multipart);
- curl_mime_name(part, "logotype-image");
- curl_mime_filedata(part, "curl.png");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_mime *multipart = curl_mime_init(curl);
+ if(multipart) {
+ curl_mimepart *part = curl_mime_addpart(multipart);
+ curl_mime_name(part, "name");
+ curl_mime_data(part, "daniel", CURL_ZERO_TERMINATED);
+ part = curl_mime_addpart(multipart);
+ curl_mime_name(part, "project");
+ curl_mime_data(part, "curl", CURL_ZERO_TERMINATED);
+ part = curl_mime_addpart(multipart);
+ curl_mime_name(part, "logotype-image");
+ curl_mime_filedata(part, "curl.png");
- /* Set the form info */
- curl_easy_setopt(handle, CURLOPT_MIMEPOST, multipart);
+ /* Set the form info */
+ curl_easy_setopt(curl, CURLOPT_MIMEPOST, multipart);
- curl_easy_perform(handle); /* post away! */
-
- curl_mime_free(multipart); /* free the post data */
+ curl_easy_perform(curl); /* post away! */
+ curl_mime_free(multipart); /* free the post data */
+ }
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.56.0
docs/libcurl/opts/CURLOPT_MIME_OPTIONS.3+20 -17
@@ -60,29 +60,32 @@ When the containing multipart form is sent, this is normally transmitted as
HTTP, IMAP, SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-curl_mime *form = NULL;
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ curl_mime *form = NULL;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_MIME_OPTIONS, CURLMIMEOPT_FORMESCAPE);
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_MIME_OPTIONS, CURLMIMEOPT_FORMESCAPE);
- form = curl_mime_init(curl);
- if(form) {
- curl_mimepart *part = curl_mime_addpart(form);
+ form = curl_mime_init(curl);
+ if(form) {
+ curl_mimepart *part = curl_mime_addpart(form);
- if(part) {
- curl_mime_filedata(part, "strange\\\\file\\\\name");
- curl_mime_name(part, "strange\\"field\\"name");
- curl_easy_setopt(curl, CURLOPT_MIMEPOST, form);
+ if(part) {
+ curl_mime_filedata(part, "strange\\\\file\\\\name");
+ curl_mime_name(part, "strange\\"field\\"name");
+ curl_easy_setopt(curl, CURLOPT_MIMEPOST, form);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
- }
- curl_easy_cleanup(curl);
- curl_mime_free(mime);
+ curl_easy_cleanup(curl);
+ curl_mime_free(form);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NETRC.3+9 -6
@@ -105,12 +105,15 @@ CURL_NETRC_IGNORED
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
- curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NETRC_FILE.3+10 -7
@@ -45,13 +45,16 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
- curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
- curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
+ curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.3+11 -7
@@ -42,13 +42,17 @@ this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP.
SFTP, SCP and FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/newdir/file.zip");
- curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
- curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "sftp://upload.example.com/newdir/file.zip");
+ curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
+ curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.3+9 -6
@@ -42,12 +42,15 @@ this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP.
SFTP, SCP and FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NOBODY.3+10 -7
@@ -54,15 +54,18 @@ URL you request).
Most
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* get us the resource without a body - use HEAD! */
- curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
+ /* get us the resource without a body - use HEAD! */
+ curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NOPROGRESS.3+10 -7
@@ -42,15 +42,18 @@ getting called.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable progress meter */
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
+ /* enable progress meter */
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NOPROXY.3+12 -9
@@ -66,15 +66,18 @@ NULL
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- /* accept various URLs */
- curl_easy_setopt(curl, CURLOPT_URL, input);
- /* use this proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
- /* ... but make sure this host name is not proxied */
- curl_easy_setopt(curl, CURLOPT_NOPROXY, "www.example.com");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* accept various URLs */
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* use this proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
+ /* ... but make sure this host name is not proxied */
+ curl_easy_setopt(curl, CURLOPT_NOPROXY, "www.example.com");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_NOSIGNAL.3+10 -6
@@ -57,15 +57,19 @@ raised.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
+ curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3+18 -12
@@ -61,21 +61,27 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
return CURL_SOCKOPT_ALREADY_CONNECTED;
}
-curl = curl_easy_init();
-if(curl) {
- /* libcurl thinks that you connect to the host
- * and port that you specify in the URL option. */
- curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
- /* call this function to get a socket */
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ extern int sockfd; /* the already connected one */
+
+ /* libcurl thinks that you connect to the host
+ * and port that you specify in the URL option. */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
+ /* call this function to get a socket */
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
- /* call this function to set options for the socket */
- curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
+ /* call this function to set options for the socket */
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3+17 -12
@@ -101,21 +101,26 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
return CURL_SOCKOPT_ALREADY_CONNECTED;
}
-curl = curl_easy_init();
-if(curl) {
- /* libcurl thinks that you connect to the host
- * and port that you specify in the URL option. */
- curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
- /* call this function to get a socket */
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ extern int sockfd; /* the already connected one */
+ /* libcurl thinks that you connect to the host
+ * and port that you specify in the URL option. */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
+ /* call this function to get a socket */
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
- /* call this function to set options for the socket */
- curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
+ /* call this function to set options for the socket */
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PASSWORD.3+10 -6
@@ -46,15 +46,19 @@ blank
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PATH_AS_IS.3+9 -5
@@ -53,13 +53,17 @@ The corresponding flag for the \fIcurl_url_set(3)\fP function is called
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/../../etc/password");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "https://example.com/../../etc/password");
- curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L);
+ curl_easy_setopt(curl, CURLOPT_PATH_AS_IS, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3+16 -10
@@ -56,16 +56,22 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "/etc/publickey.der");
- /* OR
- curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "sha256//YhKJKSzoTt2b5FP18fvpHo7fJYqQCjAa3HWY3tvRMwE=;sha256//t62CeU2tQiqkexU74Gxa2eg7fRbEgoChTociMee9wno=");
- */
-
- /* Perform the request */
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "/etc/publickey.der");
+ /* OR
+ curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY,
+ "sha256//YhKJKSzoTt2b5FP18fvpHo7fJYqQCjAa3HWY3"
+ "tvRMwE=;sha256//t62CeU2tQiqkexU74Gxa2eg7fRbEg"
+ "oChTociMee9wno=");
+ */
+
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH PUBLIC KEY EXTRACTION
docs/libcurl/opts/CURLOPT_PIPEWAIT.3+8 -5
@@ -58,12 +58,15 @@ and support level.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L);
- /* now add this easy handle to the multi handle */
+ /* now add this easy handle to the multi handle */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PORT.3+10 -6
@@ -52,12 +52,16 @@ impossible to set with this API.
Used for all protocols that speak to a port number.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_POST.3+11 -7
@@ -78,16 +78,20 @@ Instead you should set a new request type explicitly as described above.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_POST, 1L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_POST, 1L);
- /* set up the read callback with CURLOPT_READFUNCTION */
+ /* set up the read callback with CURLOPT_READFUNCTION */
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_POSTFIELDS.3+26 -24
@@ -77,40 +77,42 @@ HTTP
.SH EXAMPLE
.nf
/* send an application/x-www-form-urlencoded POST */
-CURL *curl = curl_easy_init();
-if(curl) {
- const char *data = "data to send";
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ const char *data = "data to send";
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* size of the POST data if strlen() is not good enough */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L);
+ /* size of the POST data if strlen() is not good enough */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L);
- /* pass in a pointer to the data - libcurl does not copy */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
+ /* pass in a pointer to the data - libcurl does not copy */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
- curl_easy_perform(curl);
-}
+ curl_easy_perform(curl);
+ }
-/* send an application/json POST */
-CURL *curl = curl_easy_init();
-if(curl) {
- const char *json = "{\"name\": \"daniel\"}";
- struct curl_slist *slist1 = NULL;
- slist1 = curl_slist_append(slist1, "Content-Type: application/json");
- slist1 = curl_slist_append(slist1, "Accept: application/json");
+ /* send an application/json POST */
+ curl = curl_easy_init();
+ if(curl) {
+ const char *json = "{\"name\": \"daniel\"}";
+ struct curl_slist *slist1 = NULL;
+ slist1 = curl_slist_append(slist1, "Content-Type: application/json");
+ slist1 = curl_slist_append(slist1, "Accept: application/json");
- /* set custom headers */
- curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
+ /* set custom headers */
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist1);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* pass in a pointer to the data - libcurl does not copy */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
+ /* pass in a pointer to the data - libcurl does not copy */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
-
.fi
.SH AVAILABILITY
Always
docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3+13 -8
@@ -45,18 +45,23 @@ If you post more than 2GB, use \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- const char *data = "data to send";
+#include <string.h> /* for strlen */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ const char *data = "data to send";
- /* size of the POST data */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data));
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
+ /* size of the POST data */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data));
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.3+14 -9
@@ -43,19 +43,24 @@ this size is set to -1, libcurl uses strlen() to get the size or relies on the
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- const char *data = large_chunk;
- curl_off_t length_of_data; /* set somehow */
+extern char *large_chunk; /* pointer to somewhere */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ const char *data = large_chunk;
+ curl_off_t length_of_data; /* set somehow */
- /* size of the POST data */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
+ /* size of the POST data */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data);
- curl_easy_perform(curl);
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_POSTQUOTE.3+14 -10
@@ -45,20 +45,24 @@ NULL
SFTP and FTP
.SH EXAMPLE
.nf
-struct curl_slist *cmdlist = NULL;
-cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
-cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
+int main(void)
+{
+ struct curl_slist *cmdlist = NULL;
+ cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
+ cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
- /* pass in the FTP commands to run after the transfer */
- curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);
+ /* pass in the FTP commands to run after the transfer */
+ curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_POSTREDIR.3+12 -9
@@ -52,18 +52,21 @@ when setting \fICURLOPT_FOLLOWLOCATION(3)\fP.
HTTP(S)
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* a silly POST example */
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data=true");
+ /* a silly POST example */
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data=true");
- /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and
- 303 HTTP response codes */
- curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
+ /* example.com is redirected, so we tell libcurl to send POST on 301,
+ 302 and 303 HTTP response codes */
+ curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PREQUOTE.3+13 -9
@@ -50,19 +50,23 @@ NULL
FTP
.SH EXAMPLE
.nf
-struct curl_slist *cmdlist = NULL;
-cmdlist = curl_slist_append(cmdlist, "SYST");
+int main(void)
+{
+ struct curl_slist *cmdlist = NULL;
+ cmdlist = curl_slist_append(cmdlist, "SYST");
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
- /* pass in the FTP commands to run */
- curl_easy_setopt(curl, CURLOPT_PREQUOTE, cmdlist);
+ /* pass in the FTP commands to run */
+ curl_easy_setopt(curl, CURLOPT_PREQUOTE, cmdlist);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PREREQDATA.3+13 -4
@@ -40,20 +40,29 @@ NULL
All
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
static int prereq_callback(void *clientp,
char *conn_primary_ip,
char *conn_local_ip,
int conn_primary_port,
int conn_local_port)
{
- printf("Connection made to %s:%s\\n", conn_primary_ip, conn_primary_port);
+ printf("Connection made to %s:%d\\n", conn_primary_ip, conn_primary_port);
return CURL_PREREQFUNC_OK;
}
+int main(void)
{
- struct data prereq_data;
- curl_easy_setopt(CURL *handle, CURLOPT_PREREQFUNCTION, prereq_callback);
- curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, &prereq_data);
+ struct priv prereq_data;
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_PREREQFUNCTION, prereq_callback);
+ curl_easy_setopt(curl, CURLOPT_PREREQDATA, &prereq_data);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3+13 -4
@@ -81,20 +81,29 @@ By default, this is NULL and unused.
ALL
.SH EXAMPLE
.nf
+struct priv {
+ void *custom;
+};
+
static int prereq_callback(void *clientp,
char *conn_primary_ip,
char *conn_local_ip,
int conn_primary_port,
int conn_local_port)
{
- printf("Connection made to %s:%s\\n", conn_primary_ip, conn_primary_port);
+ printf("Connection made to %s:%d\\n", conn_primary_ip, conn_primary_port);
return CURL_PREREQFUNC_OK;
}
+int main(void)
{
- struct data prereq_data;
- curl_easy_setopt(CURL *handle, CURLOPT_PREREQFUNCTION, prereq_callback);
- curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, &prereq_data);
+ struct priv prereq_data;
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_PREREQFUNCTION, prereq_callback);
+ curl_easy_setopt(curl, CURLOPT_PREREQDATA, &prereq_data);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PRE_PROXY.3+9 -6
@@ -66,12 +66,15 @@ single port number used widely for proxies. Specify it!
All except file://. Note that some protocols do not work well over proxy.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_PRE_PROXY, "socks4://socks-proxy:1080");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_PRE_PROXY, "socks4://socks-proxy:1080");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PRIVATE.3+17 -10
@@ -42,19 +42,26 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-struct private secrets;
-if(curl) {
- struct private *extracted;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+struct private {
+ void *custom;
+};
- /* store a pointer to our private struct */
- curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ struct private secrets;
+ if(curl) {
+ struct private *extracted;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
+ /* store a pointer to our private struct */
+ curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
- /* we can extract the private pointer again too */
- curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
+ curl_easy_perform(curl);
+
+ /* we can extract the private pointer again too */
+ curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROGRESSDATA.3+26 -18
@@ -40,30 +40,38 @@ The default value of this parameter is NULL.
All
.SH EXAMPLE
.nf
- struct progress {
- char *private;
- size_t size;
- };
+struct progress {
+ char *private;
+ size_t size;
+};
- static size_t progress_callback(void *clientp,
- double dltotal,
- double dlnow,
- double ultotal,
- double ulnow)
- {
- struct memory *progress = (struct progress *)clientp;
+static size_t progress_callback(void *clientp,
+ double dltotal,
+ double dlnow,
+ double ultotal,
+ double ulnow)
+{
+ struct progress *memory = clientp;
+ printf("private: %p\\n", memory->private);
- /* use the values */
+ /* use the values */
- return 0; /* all is good */
- }
+ return 0; /* all is good */
+}
- struct progress data;
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct progress data;
- /* pass struct to callback */
- curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, &data);
+ /* pass struct to callback */
+ curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
- curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
+ curl_easy_perform(curl);
+ }
+}
.fi
.SH AVAILABILITY
Always
docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.3+32 -24
@@ -84,30 +84,38 @@ users.
All
.SH EXAMPLE
.nf
- struct progress {
- char *private;
- size_t size;
- };
-
- static size_t progress_callback(void *clientp,
- double dltotal,
- double dlnow,
- double ultotal,
- double ulnow)
- {
- struct progress *memory = (struct progress *)clientp;
-
- /* use the values */
-
- return 0; /* all is good */
- }
-
- struct progress data;
-
- /* pass struct to callback */
- curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, &data);
-
- curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
+struct progress {
+ char *private;
+ size_t size;
+};
+
+static size_t progress_callback(void *clientp,
+ double dltotal,
+ double dlnow,
+ double ultotal,
+ double ulnow)
+{
+ struct progress *memory = clientp;
+ printf("private: %p\\n", memory->private);
+
+ /* use the values */
+
+ return 0; /* all is good */
+}
+
+int main(void)
+{
+ struct progress data;
+
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pass struct to callback */
+ curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data);
+ curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
+
+ curl_easy_perform(curl);
+ }
+}
.fi
.SH AVAILABILITY
Deprecated since 7.32.0.
docs/libcurl/opts/CURLOPT_PROTOCOLS.3+12 -9
@@ -80,17 +80,20 @@ All protocols built-in.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- /* pass in the URL from an external source */
- curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
+int main(int argc, char **argv)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pass in the URL from an external source */
+ curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
- /* only allow HTTP, TFTP and SFTP */
- curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
- CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
+ /* only allow HTTP, TFTP and SFTP */
+ curl_easy_setopt(curl, CURLOPT_PROTOCOLS,
+ CURLPROTO_HTTP | CURLPROTO_TFTP | CURLPROTO_SFTP);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.3+11 -8
@@ -61,16 +61,19 @@ All protocols built-in
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- /* pass in the URL from an external source */
- curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
+int main(int argc, char **argv)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pass in the URL from an external source */
+ curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
- /* only allow HTTP, TFTP and SFTP */
- curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");
+ /* only allow HTTP, TFTP and SFTP */
+ curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY.3+8 -5
@@ -109,11 +109,14 @@ single port number used widely for proxies. Specify it!
All except file://. Note that some protocols do not work well over proxy.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYAUTH.3+15 -12
@@ -48,18 +48,21 @@ CURLAUTH_BASIC
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* use this proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
- /* allow whatever auth the proxy speaks */
- curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
- /* set the proxy credentials */
- curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* use this proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
+ /* allow whatever auth the proxy speaks */
+ curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
+ /* set the proxy credentials */
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYHEADER.3+13 -10
@@ -51,22 +51,25 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
+int main(void)
+{
+ CURL *curl = curl_easy_init();
-struct curl_slist *list;
+ struct curl_slist *list;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80");
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example.com:80");
- list = curl_slist_append(NULL, "Shoesize: 10");
- list = curl_slist_append(list, "Accept:");
+ list = curl_slist_append(NULL, "Shoesize: 10");
+ list = curl_slist_append(list, "Accept:");
- curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list);
+ curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- curl_slist_free_all(list); /* free the list again */
+ curl_slist_free_all(list); /* free the list again */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3+12 -8
@@ -46,14 +46,18 @@ blank
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
- curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
- curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
+ curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYPORT.3+11 -7
@@ -46,13 +46,17 @@ than 65535.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PROXY, "localhost");
- curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "localhost");
+ curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYTYPE.3+12 -9
@@ -65,15 +65,18 @@ CURLPROXY_HTTP
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "local.example.com:1080");
- /* set the proxy type */
- curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "local.example.com:1080");
+ /* set the proxy type */
+ curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3+12 -8
@@ -48,14 +48,18 @@ blank
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
- curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
- curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
+ curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3+11 -7
@@ -48,13 +48,17 @@ This is NULL by default.
Used with all protocols that can use a proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
- curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "clark%20kent:superman");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "clark%20kent:superman");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3+12 -8
@@ -60,14 +60,18 @@ Built-in system specific
Used with HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* using an HTTPS proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
- curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, "/etc/certs/cabundle.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* using an HTTPS proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
+ curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, "/etc/certs/cabundle.pem");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3+19 -13
@@ -53,19 +53,25 @@ NULL
Used with HTTPS proxy
.SH EXAMPLE
.nf
-char *strpem; /* strpem must point to a PEM string */
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* using an HTTPS proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
- blob.data = strpem;
- blob.len = strlen(strpem);
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO_BLOB, &blob);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+#include <string.h> /* for strlen */
+
+extern char *strpem; /* strpem must point to a PEM string */
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* using an HTTPS proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
+ blob.data = strpem;
+ blob.len = strlen(strpem);
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO_BLOB, &blob);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3+12 -8
@@ -48,14 +48,18 @@ NULL
Everything used over an HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* using an HTTPS proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
- curl_easy_setopt(curl, CURLOPT_PROXY_CAPATH, "/etc/cert-dir");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* using an HTTPS proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
+ curl_easy_setopt(curl, CURLOPT_PROXY_CAPATH, "/etc/cert-dir");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3+11 -7
@@ -60,13 +60,17 @@ NULL
Used with HTTPS proxy.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:80");
- curl_easy_setopt(curl, CURLOPT_PROXY_CRLFILE, "/etc/certs/crl.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:80");
+ curl_easy_setopt(curl, CURLOPT_PROXY_CRLFILE, "/etc/certs/crl.pem");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3+12 -8
@@ -57,14 +57,18 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* using an HTTPS proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
- curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT, "/etc/certs/cacert.pem");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* using an HTTPS proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
+ curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT, "/etc/certs/cacert.pem");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3+20 -12
@@ -63,18 +63,26 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* using an HTTPS proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
- blob.data = certificateData;
- blob.len = filesize;
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT_BLOB, &blob);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+
+extern char *certificateData; /* point to the data */
+size_t filesize; /* size of the data */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* using an HTTPS proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
+ blob.data = certificateData;
+ blob.len = filesize;
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT_BLOB, &blob);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3+11 -7
@@ -47,13 +47,17 @@ NULL
Used with HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "superman");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "superman");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3+13 -8
@@ -52,15 +52,20 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
- curl_easy_setopt(curl, CURLOPT_PROXY_PINNEDPUBLICKEY,
- "sha256//YhKJKSzoTt2b5FP18fvpHo7fJYqQCjAa3HWY3tvRMwE=;sha256//t62CeU2tQiqkexU74Gxa2eg7fRbEgoChTociMee9wno=");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443");
+ curl_easy_setopt(curl, CURLOPT_PROXY_PINNEDPUBLICKEY,
+ "sha256//YhKJKSzoTt2b5FP18fvpHo7fJYqQCjA"
+ "a3HWY3tvRMwE=;sha256//t62CeU2tQiqkexU74"
+ "Gxa2eg7fRbEgoChTociMee9wno=");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH PUBLIC KEY EXTRACTION
docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3+9 -6
@@ -45,12 +45,15 @@ See above
All network protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY_SERVICE_NAME, "custom");
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SERVICE_NAME, "custom");
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3+13 -9
@@ -55,15 +55,19 @@ NULL
Used with HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3+14 -10
@@ -48,16 +48,20 @@ option.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3+21 -13
@@ -51,19 +51,27 @@ NULL
Used with HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- blob.data = certificateData;
- blob.len = filesize;
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+
+extern char *certificateData; /* point to data */
+extern size_t filesize; /* size of the data */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ blob.data = certificateData;
+ blob.len = filesize;
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3+13 -9
@@ -49,15 +49,19 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3+14 -10
@@ -43,16 +43,20 @@ option.
Used with HTTPS proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEYTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEYTYPE, "PEM");
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3+27 -16
@@ -47,23 +47,34 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- blob.data = certificateData;
- blob.len = filesize;
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
- blob.data = privateKeyData;
- blob.len = privateKeySize;
- curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY_BLOB, &blob);
- curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+extern char *certificateData; /* point to data */
+extern size_t filesize; /* size of data */
+
+extern char *privateKeyData; /* point to data */
+extern size_t privateKeySize; /* size */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ blob.data = certificateData;
+ blob.len = filesize;
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
+
+ blob.data = privateKeyData;
+ blob.len = privateKeySize;
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY_BLOB, &blob);
+ curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.3+10 -7
@@ -85,15 +85,18 @@ CURL_SSLVERSION_DEFAULT
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* ask libcurl to use TLS version 1.0 or later */
- curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+ /* ask libcurl to use TLS version 1.0 or later */
+ curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3+11 -7
@@ -65,13 +65,17 @@ NULL, use internal default
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost");
- curl_easy_setopt(curl, CURLOPT_PROXY_SSL_CIPHER_LIST, "TLSv1");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost");
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSL_CIPHER_LIST, "TLSv1");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3+13 -9
@@ -83,15 +83,19 @@ could be a privacy violation and unexpected.
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- /* weaken TLS only for use with silly proxies */
- curl_easy_setopt(curl, CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST |
- CURLSSLOPT_NO_REVOKE);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ /* weaken TLS only for use with silly proxies */
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST |
+ CURLSSLOPT_NO_REVOKE);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.3+9 -6
@@ -68,14 +68,17 @@ of the proxy certificate.
All protocols when used over an HTTPS proxy.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Set the default value: strict name check please */
- curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYHOST, 2L);
+ /* Set the default value: strict name check please */
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYHOST, 2L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.3+9 -6
@@ -72,14 +72,17 @@ the correct end-point.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Set the default value: strict certificate check please */
- curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYPEER, 1L);
+ /* Set the default value: strict certificate check please */
+ curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYPEER, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3+11 -7
@@ -54,13 +54,17 @@ NULL, use internal default
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLS13_CIPHERS,
- "TLS_CHACHA20_POLY1305_SHA256");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLS13_CIPHERS,
+ "TLS_CHACHA20_POLY1305_SHA256");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3+13 -9
@@ -46,15 +46,19 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3+13 -9
@@ -52,15 +52,19 @@ blank
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3+13 -9
@@ -46,15 +46,19 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.3+13 -8
@@ -44,14 +44,19 @@ doing FTP via a proxy. Beware that not all proxies support this feature.
FTP over proxy
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:80");
- curl_easy_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L);
- curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL,
+ "ftp://example.com/old-server/file.txt");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:80");
+ curl_easy_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L);
+ curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_PUT.3+30 -14
@@ -44,25 +44,41 @@ This option is \fBdeprecated\fP since version 7.12.1. Use
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- /* we want to use our own read function */
- curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
+static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
+{
+ FILE *src = userdata;
+ /* copy as much data as possible into the 'ptr' buffer, but no more than
+ 'size' * 'nmemb' bytes! */
+ size_t retcode = fread(ptr, size, nmemb, src);
- /* enable PUT */
- curl_easy_setopt(curl, CURLOPT_PUT, 1L);
+ return retcode;
+}
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ FILE *src = fopen("local-file", "r");
+ curl_off_t fsize; /* set this to the size of the input file */
+
+ /* we want to use our own read function */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb);
+
+ /* enable PUT */
+ curl_easy_setopt(curl, CURLOPT_PUT, 1L);
- /* specify target */
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
+ /* specify target */
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
- /* now specify which pointer to pass to our callback */
- curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
+ /* now specify which pointer to pass to our callback */
+ curl_easy_setopt(curl, CURLOPT_READDATA, src);
- /* Set the size of the file to upload */
- curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
+ /* Set the size of the file to upload */
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
- /* Now run off and do what you have been told! */
- curl_easy_perform(curl);
+ /* Now run off and do what you have been told! */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_QUICK_EXIT.3+8 -5
@@ -44,11 +44,14 @@ possible (though short-lived) leak of associated resources.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_QUICK_EXIT, 1L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_QUICK_EXIT, 1L);
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_QUOTE.3+14 -10
@@ -102,20 +102,24 @@ NULL
SFTP and FTP
.SH EXAMPLE
.nf
-struct curl_slist *cmdlist = NULL;
-cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
-cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
+int main(void)
+{
+ struct curl_slist *cmdlist = NULL;
+ cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
+ cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
- /* pass in the FTP commands to run before the transfer */
- curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
+ /* pass in the FTP commands to run before the transfer */
+ curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RANDOM_FILE.3+10 -6
@@ -45,12 +45,16 @@ NULL, not used
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, "junk.txt");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, "junk.txt");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RANGE.3+10 -7
@@ -60,15 +60,18 @@ NULL
HTTP, FTP, FILE, RTSP and SFTP.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* get the first 200 bytes */
- curl_easy_setopt(curl, CURLOPT_RANGE, "0-199");
+ /* get the first 200 bytes */
+ curl_easy_setopt(curl, CURLOPT_RANGE, "0-199");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_READDATA.3+15 -8
@@ -48,16 +48,23 @@ By default, this is a FILE * to stdin.
This is used for all protocols when sending data.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-struct MyData this;
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+struct MyData {
+ void *custom;
+};
- /* pass pointer that gets passed in to the
- CURLOPT_READFUNCTION callback */
- curl_easy_setopt(curl, CURLOPT_READDATA, &this);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ struct MyData this;
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
+ /* pass pointer that gets passed in to the
+ CURLOPT_READFUNCTION callback */
+ curl_easy_setopt(curl, CURLOPT_READDATA, &this);
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_READFUNCTION.3+10 -7
@@ -94,18 +94,21 @@ size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
return retcode;
}
-void setup(char *uploadthis)
+int main(int argc, char **argv)
{
- FILE *file = fopen(uploadthis, "rb");
+ FILE *file = fopen(argv[1], "rb");
CURLcode result;
- /* set callback to use */
- curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* set callback to use */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
- /* pass in suitable argument to callback */
- curl_easy_setopt(curl, CURLOPT_READDATA, (void *)file);
+ /* pass in suitable argument to callback */
+ curl_easy_setopt(curl, CURLOPT_READDATA, (void *)file);
- result = curl_easy_perform(curl);
+ result = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3+12 -9
@@ -89,17 +89,20 @@ SMB and SMBS.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- /* pass in the URL from an external source */
- curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
+int main(int argc, char **argv)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pass in the URL from an external source */
+ curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
- /* only allow redirects to HTTP and HTTPS URLs */
- curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,
- CURLPROTO_HTTP | CURLPROTO_HTTPS);
+ /* only allow redirects to HTTP and HTTPS URLs */
+ curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,
+ CURLPROTO_HTTP | CURLPROTO_HTTPS);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.3+11 -8
@@ -67,16 +67,19 @@ SMB and SMBS.
All
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- /* pass in the URL from an external source */
- curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
+int main(int argc, char **argv)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* pass in the URL from an external source */
+ curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
- /* only allow redirects to HTTP and HTTPS URLs */
- curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+ /* only allow redirects to HTTP and HTTPS URLs */
+ curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_REFERER.3+9 -6
@@ -44,14 +44,17 @@ NULL
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* tell it where we found the link to this place */
- curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.com/aboutme.html");
+ /* tell it where we found the link to this place */
+ curl_easy_setopt(curl, CURLOPT_REFERER, "https://example.org/me.html");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_REQUEST_TARGET.3+11 -8
@@ -43,16 +43,19 @@ NULL
HTTP
.SH EXAMPLE
.nf
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/*");
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/*");
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
- /* issue an OPTIONS * request (no leading slash) */
- curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*");
+ /* issue an OPTIONS * request (no leading slash) */
+ curl_easy_setopt(curl, CURLOPT_REQUEST_TARGET, "*");
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RESOLVE.3+15 -12
@@ -79,22 +79,25 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl;
-struct curl_slist *host = NULL;
-host = curl_slist_append(NULL, "example.com:443:127.0.0.1");
+int main(void)
+{
+ CURL *curl;
+ struct curl_slist *host = NULL;
+ host = curl_slist_append(NULL, "example.com:443:127.0.0.1");
-curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
-}
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
-curl_slist_free_all(host);
+ curl_slist_free_all(host);
+}
.fi
.SH AVAILABILITY
Added in 7.21.3. Removal support added in 7.42.0.
docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3+10 -7
@@ -51,13 +51,16 @@ static int resolver_start_cb(void *resolver_state, void *reserved,
return 0;
}
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
- curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
+ curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3+12 -9
@@ -59,8 +59,8 @@ NULL (No callback)
All
.SH EXAMPLE
.nf
-static int resolver_start_cb(void *resolver_state, void *reserved,
- void *userdata)
+static int start_cb(void *resolver_state, void *reserved,
+ void *userdata)
{
(void)reserved;
printf("Received resolver_state=%p userdata=%p\\n",
@@ -68,13 +68,16 @@ static int resolver_start_cb(void *resolver_state, void *reserved,
return 0;
}
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
- curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, start_cb);
+ curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RESUME_FROM.3+16 -11
@@ -50,21 +50,26 @@ If you need to resume a transfer beyond the 2GB limit, use
HTTP, FTP, SFTP, FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ long size_of_file;
- /* resume upload at byte index 200 */
- curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
- /* ask for upload */
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+ /* resume upload at byte index 200 */
+ curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
- /* set total data amount to expect */
- curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
+ /* ask for upload */
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* set total data amount to expect */
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
+
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3+16 -13
@@ -47,24 +47,27 @@ file to the remote target file.
HTTP, FTP, SFTP, FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_off_t resume_position = GET_IT_SOMEHOW;
- curl_off_t file_size = GET_IT_SOMEHOW_AS_WELL;
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_off_t resume_position; /* get it somehow */
+ curl_off_t file_size; /* get it somehow as well */
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
- /* resuming upload at this position, possibly beyond 2GB */
- curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, resume_position);
+ /* resuming upload at this position, possibly beyond 2GB */
+ curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, resume_position);
- /* ask for upload */
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+ /* ask for upload */
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
- /* set total data amount to expect */
- curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_size);
+ /* set total data amount to expect */
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_size);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3+10 -6
@@ -41,12 +41,16 @@ increments from this new number henceforth.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- curl_easy_setopt(curl, CURLOPT_RTSP_CLIENT_CSEQ, 1234L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RTSP_CLIENT_CSEQ, 1234L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3+11 -7
@@ -100,13 +100,17 @@ application a chance to run.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- /* ask for options! */
- curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ /* ask for options! */
+ curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3+10 -6
@@ -41,12 +41,16 @@ unimplemented.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- curl_easy_setopt(curl, CURLOPT_RTSP_SERVER_CSEQ, 1234L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RTSP_SERVER_CSEQ, 1234L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.3+11 -7
@@ -46,13 +46,17 @@ NULL
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- char *prev_id; /* saved from before somehow */
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- curl_easy_setopt(curl, CURLOPT_RTSP_SESSION_ID, prev_id);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ char *prev_id; /* saved from before somehow */
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RTSP_SESSION_ID, prev_id);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.3+11 -8
@@ -51,14 +51,17 @@ option.
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- char *prev_id; /* saved from before somehow */
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI,
- "rtsp://foo.example.com/twister/video");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI,
+ "rtsp://foo.example.com/twister/video");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.3+12 -8
@@ -45,14 +45,18 @@ NULL
RTSP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
- curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
- curl_easy_setopt(curl, CURLOPT_RTSP_TRANSPORT,
- "RTP/AVP;unicast;client_port=4588-4589");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
+ curl_easy_setopt(curl, CURLOPT_RTSP_TRANSPORT,
+ "RTP/AVP;unicast;client_port=4588-4589");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3+12 -8
@@ -50,14 +50,18 @@ blank
IMAP, LDAP, POP3 and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com/");
- curl_easy_setopt(curl, CURLOPT_USERNAME, "Kurt");
- curl_easy_setopt(curl, CURLOPT_PASSWORD, "xipj3plmq");
- curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, "Ursel");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com/");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "Kurt");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "xipj3plmq");
+ curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, "Ursel");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SASL_IR.3+10 -6
@@ -52,12 +52,16 @@ SASL-IR CAPABILITY.
IMAP, POP3 and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
- curl_easy_setopt(curl, CURLOPT_SASL_IR, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SASL_IR, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SEEKDATA.3+12 -2
@@ -40,6 +40,12 @@ If you do not set this, NULL is passed to the callback.
HTTP, FTP, SFTP
.SH EXAMPLE
.nf
+#include <unistd.h> /* for lseek() */
+
+struct data {
+ int our_fd;
+};
+
static int seek_cb(void *clientp, curl_off_t offset, int origin)
{
struct data *d = (struct data *)clientp;
@@ -47,10 +53,14 @@ static int seek_cb(void *clientp, curl_off_t offset, int origin)
return CURL_SEEKFUNC_OK;
}
+int main(void)
{
struct data seek_data;
- curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_cb);
- curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, &seek_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb);
+ curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3+12 -3
@@ -70,17 +70,26 @@ By default, this is NULL and unused.
HTTP, FTP, SFTP
.SH EXAMPLE
.nf
+#include <unistd.h> /* for lseek */
+
+struct data {
+ int our_fd;
+};
static int seek_cb(void *clientp, curl_off_t offset, int origin)
{
struct data *d = (struct data *)clientp;
- lseek(our_fd, offset, origin);
+ lseek(d->our_fd, offset, origin);
return CURL_SEEKFUNC_OK;
}
+int main(void)
{
struct data seek_data;
- curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_cb);
- curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, &seek_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb);
+ curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.3+11 -7
@@ -48,14 +48,18 @@ None
FTP, IMAP, POP3, SMTP, and SSH
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
- /* wait no more than 23 seconds */
- curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23L);
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
+ /* wait no more than 23 seconds */
+ curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23L);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SERVICE_NAME.3+9 -6
@@ -45,12 +45,15 @@ See above
HTTP, FTP, IMAP, LDAP, POP3 and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SERVICE_NAME, "custom");
- ret = curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SERVICE_NAME, "custom");
+ ret = curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SHARE.3+21 -17
@@ -55,26 +55,30 @@ NULL
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-CURL *curl2 = curl_easy_init(); /* a second handle */
-if(curl) {
- CURLSH *shobject = curl_share_init();
- curl_share_setopt(shobject, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ CURL *curl2 = curl_easy_init(); /* a second handle */
+ if(curl) {
+ CURLcode res;
+ CURLSH *shobject = curl_share_init();
+ curl_share_setopt(shobject, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
- curl_easy_setopt(curl, CURLOPT_SHARE, shobject);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
+ curl_easy_setopt(curl, CURLOPT_SHARE, shobject);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
- /* the second handle shares cookies from the first */
- curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/second");
- curl_easy_setopt(curl2, CURLOPT_COOKIEFILE, "");
- curl_easy_setopt(curl2, CURLOPT_SHARE, shobject);
- ret = curl_easy_perform(curl2);
- curl_easy_cleanup(curl2);
+ /* the second handle shares cookies from the first */
+ curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/second");
+ curl_easy_setopt(curl2, CURLOPT_COOKIEFILE, "");
+ curl_easy_setopt(curl2, CURLOPT_SHARE, shobject);
+ res = curl_easy_perform(curl2);
+ curl_easy_cleanup(curl2);
- curl_share_cleanup(shobject);
+ curl_share_cleanup(shobject);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3+15 -10
@@ -44,23 +44,28 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
curlsocktype purpose)
{
int val = *(int *)clientp;
- setsockopt(curldfd, SOL_SOCKET, SO_RCVBUF, (const char *)&val, sizeof(val));
+ setsockopt((int)curlfd, SOL_SOCKET, SO_RCVBUF,
+ (const char *)&val, sizeof(val));
return CURL_SOCKOPT_OK;
}
-curl = curl_easy_init();
-if(curl) {
- int recvbuffersize = 256 * 1024;
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ int recvbuffersize = 256 * 1024;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* call this function to set options for the socket */
- curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
- curl_easy_setopt(curl, CURLOPT_SOCKOPTDATA, &recvbuffersize);
+ /* call this function to set options for the socket */
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTDATA, &recvbuffersize);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3+18 -12
@@ -100,21 +100,27 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
return CURL_SOCKOPT_ALREADY_CONNECTED;
}
-curl = curl_easy_init();
-if(curl) {
- /* libcurl thinks that you connect to the host
- * and port that you specify in the URL option. */
- curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
- /* call this function to get a socket */
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
- curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ int sockfd; /* our custom file descriptor */
+ /* libcurl thinks that you connect to the host
+ * and port that you specify in the URL option. */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
+ /* call this function to get a socket */
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
+ curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
- /* call this function to set options for the socket */
- curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
+ /* call this function to set options for the socket */
+ curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
- res = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.16.0. The \fICURL_SOCKOPT_ALREADY_CONNECTED\fP return code was
docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3+12 -9
@@ -44,18 +44,21 @@ CURLAUTH_BASIC|CURLAUTH_GSSAPI
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* request to use a SOCKS5 proxy */
- curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:[email protected]");
+ /* request to use a SOCKS5 proxy */
+ curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:[email protected]");
- /* enable username/password authentication only */
- curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC);
+ /* enable username/password authentication only */
+ curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3+11 -7
@@ -43,13 +43,17 @@ negotiation.
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy");
- curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_NEC, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy");
+ curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_NEC, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3+11 -7
@@ -47,13 +47,17 @@ See above
All network protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy");
- curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE, "rcmd-special");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy");
+ curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE, "rcmd-special");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3+11 -7
@@ -46,13 +46,17 @@ CURLSSH_AUTH_ANY (all available)
SFTP and SCP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
- CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
+ CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.3+10 -7
@@ -42,15 +42,18 @@ may or may not do it.
All SSH based protocols: SCP, SFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com");
- /* enable built-in compression */
- curl_easy_setopt(curl, CURLOPT_SSH_COMPRESSION, 1L);
+ /* enable built-in compression */
+ curl_easy_setopt(curl, CURLOPT_SSH_COMPRESSION, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.3+18 -8
@@ -40,21 +40,31 @@ NULL
SCP and SFTP
.SH EXAMPLE
.nf
-int hostkeycb(void *clientp, /* passed with CURLOPT_SSH_HOSTKEYDATA */
- int keytype, /* CURLKHTYPE */
- const char * key, /* host key to check */
- size_t keylen); /* length of the key */
+struct mine {
+ void *custom;
+};
+
+static int hostkeycb(void *clientp, /* CURLOPT_SSH_HOSTKEYDATA */
+ int keytype, /* CURLKHTYPE */
+ const char *key, /* host key to check */
+ size_t keylen) /* length of the key */
{
/* 'clientp' points to the callback_data struct */
/* investigate the situation and return the correct value */
return CURLKHMATCH_OK;
}
+
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
- curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYFUNCTION, hostkeycb);
- curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYDATA, &callback_data);
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct mine callback_data;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
+ curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYFUNCTION, hostkeycb);
+ curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYDATA, &callback_data);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.3+15 -6
@@ -61,21 +61,30 @@ NULL
SCP and SFTP
.SH EXAMPLE
.nf
+struct mine {
+ void *custom;
+};
+
int hostkeycb(void *clientp, /* passed with CURLOPT_SSH_HOSTKEYDATA */
int keytype, /* CURLKHTYPE */
- const char * key, /* host key to check */
- size_t keylen); /* length of the key */
+ const char *key, /* host key to check */
+ size_t keylen) /* length of the key */
{
/* 'clientp' points to the callback_data struct */
/* investigate the situation and return the correct value */
return CURLKHMATCH_OK;
}
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
- curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYFUNCTION, hostkeycb);
- curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYDATA, &callback_data);
+ struct mine callback_data;
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
+ curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYFUNCTION, hostkeycb);
+ curl_easy_setopt(curl, CURLOPT_SSH_HOSTKEYDATA, &callback_data);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3+11 -7
@@ -47,13 +47,17 @@ NULL
SCP and SFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
- "afe17cd62a0f3b61f1ab9cb22ba269a7");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
+ "afe17cd62a0f3b61f1ab9cb22ba269a7");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3+11 -7
@@ -42,13 +42,17 @@ NULL
SCP and SFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
- "NDVkMTQxMGQ1ODdmMjQ3MjczYjAyOTY5MmRkMjVmNDQ=");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
+ "NDVkMTQxMGQ1ODdmMjQ3MjczYjAyOTY5MmRkMjVmNDQ=");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3+14 -5
@@ -40,6 +40,9 @@ NULL
SFTP and SCP
.SH EXAMPLE
.nf
+struct mine {
+ void *custom;
+};
static int keycb(CURL *easy,
const struct curl_khkey *knownkey,
const struct curl_khkey *foundkey,
@@ -50,13 +53,19 @@ static int keycb(CURL *easy,
/* investigate the situation and return the correct value */
return CURLKHSTAT_FINE_ADD_TO_FILE;
}
+
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
- curl_easy_setopt(curl, CURLOPT_SSH_KEYFUNCTION, keycb);
- curl_easy_setopt(curl, CURLOPT_SSH_KEYDATA, &callback_data);
- curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/home/user/known_hosts");
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct mine callback_data;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
+ curl_easy_setopt(curl, CURLOPT_SSH_KEYFUNCTION, keycb);
+ curl_easy_setopt(curl, CURLOPT_SSH_KEYDATA, &callback_data);
+ curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/home/user/known_hosts");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3+15 -5
@@ -105,6 +105,10 @@ NULL
SFTP and SCP
.SH EXAMPLE
.nf
+struct mine {
+ void *custom;
+};
+
static int keycb(CURL *easy,
const struct curl_khkey *knownkey,
const struct curl_khkey *foundkey,
@@ -115,13 +119,19 @@ static int keycb(CURL *easy,
/* investigate the situation and return the correct value */
return CURLKHSTAT_FINE_ADD_TO_FILE;
}
+
+int main(void)
{
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
- curl_easy_setopt(curl, CURLOPT_SSH_KEYFUNCTION, keycb);
- curl_easy_setopt(curl, CURLOPT_SSH_KEYDATA, &callback_data);
- curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/home/user/known_hosts");
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct mine callback_data;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/thisfile.txt");
+ curl_easy_setopt(curl, CURLOPT_SSH_KEYFUNCTION, keycb);
+ curl_easy_setopt(curl, CURLOPT_SSH_KEYDATA, &callback_data);
+ curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/home/user/known_hosts");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+}
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3+11 -7
@@ -47,13 +47,17 @@ NULL
SFTP and SCP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS,
- "/home/clarkkent/.ssh/known_hosts");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS,
+ "/home/clarkkent/.ssh/known_hosts");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.3+12 -8
@@ -48,14 +48,18 @@ As explained above
SFTP and SCP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
- "/home/clarkkent/.ssh/id_rsa");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "password");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
+ "/home/clarkkent/.ssh/id_rsa");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "password");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3+11 -7
@@ -49,13 +49,17 @@ NULL
SFTP and SCP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
- curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE,
- "/home/clarkkent/.ssh/id_rsa.pub");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
+ curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE,
+ "/home/clarkkent/.ssh/id_rsa.pub");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLCERT.3+12 -8
@@ -65,14 +65,18 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3+13 -9
@@ -48,15 +48,19 @@ option.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
+ curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3+20 -12
@@ -51,18 +51,26 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob stblob;
- stblob.data = certificateData;
- stblob.len = filesize;
- stblob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &stblob);
- curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "P12");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+
+extern char *certificateData; /* point to data */
+extern size_t filesize; /* size of data */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob stblob;
+ stblob.data = certificateData;
+ stblob.len = filesize;
+ stblob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &stblob);
+ curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "P12");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLENGINE.3+10 -6
@@ -43,12 +43,16 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3+11 -7
@@ -42,13 +42,17 @@ None
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic");
- curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic");
+ curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLKEY.3+12 -8
@@ -48,14 +48,18 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3+13 -9
@@ -48,15 +48,19 @@ option.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
- curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
+ curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3+27 -16
@@ -49,23 +49,34 @@ NULL
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_blob blob;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- blob.data = certificateData;
- blob.len = filesize;
- blob.flags = CURL_BLOB_COPY;
- curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &blob);
- curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
- blob.data = privateKeyData;
- blob.len = privateKeySize;
- curl_easy_setopt(curl, CURLOPT_SSLKEY_BLOB, &blob);
- curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
- curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+extern char *certificateData; /* point to cert */
+extern size_t filesize; /* size of cert */
+
+extern char *privateKeyData; /* point to key */
+extern size_t privateKeySize; /* size of key */
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_blob blob;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ blob.data = certificateData;
+ blob.len = filesize;
+ blob.flags = CURL_BLOB_COPY;
+ curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &blob);
+ curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
+
+ blob.data = privateKeyData;
+ blob.len = privateKeySize;
+ curl_easy_setopt(curl, CURLOPT_SSLKEY_BLOB, &blob);
+ curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
+ curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSLVERSION.3+10 -7
@@ -94,15 +94,18 @@ CURL_SSLVERSION_DEFAULT
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* ask libcurl to use TLS version 1.0 or later */
- curl_easy_setopt(curl, CURLOPT_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
+ /* ask libcurl to use TLS version 1.0 or later */
+ curl_easy_setopt(curl, CURLOPT_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3+10 -6
@@ -67,12 +67,16 @@ NULL, use internal default
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3+2 -2
@@ -59,7 +59,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
* X509 structure that SSL can use
*/
PEM_read_bio_X509(bio, &cert, 0, NULL);
- if(cert == NULL)
+ if(!cert)
printf("PEM_read_bio_X509 failed...\\n");
/* get a pointer to the X509 certificate store (which may be empty) */
@@ -79,7 +79,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
int main(void)
{
- CURL * ch;
+ CURL *ch;
CURLcode rv;
char *mypem = /* example CA cert PEM - shortened */
"-----BEGIN CERTIFICATE-----\\n"
docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3+2 -2
@@ -101,7 +101,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
* X509 structure that SSL can use
*/
PEM_read_bio_X509(bio, &cert, 0, NULL);
- if(cert == NULL)
+ if(!cert)
printf("PEM_read_bio_X509 failed...\\n");
/* get a pointer to the X509 certificate store (which may be empty) */
@@ -121,7 +121,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
int main(void)
{
- CURL * ch;
+ CURL *ch;
CURLcode rv;
char *mypem = /* example CA cert PEM - shortened */
"-----BEGIN CERTIFICATE-----\\n"
docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3+10 -6
@@ -41,12 +41,16 @@ the SSL backend libcurl is built to use supports it).
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSL_EC_CURVES, "X25519:P-521");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSL_EC_CURVES, "X25519:P-521");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3+10 -6
@@ -41,12 +41,16 @@ is built to use supports it), which can be used to negotiate http2.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3+10 -6
@@ -43,12 +43,16 @@ is built to use supports it), which can be used to negotiate http2.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_NPN, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_NPN, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_FALSESTART.3+8 -5
@@ -44,11 +44,14 @@ when performing a full handshake.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_SSL_FALSESTART, 1L);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_SSL_FALSESTART, 1L);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3+12 -8
@@ -82,14 +82,18 @@ could be a privacy violation and unexpected.
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* weaken TLS only for use with silly servers */
- curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_ALLOW_BEAST |
- CURLSSLOPT_NO_REVOKE);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* weaken TLS only for use with silly servers */
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_ALLOW_BEAST |
+ CURLSSLOPT_NO_REVOKE);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.3+11 -7
@@ -43,13 +43,17 @@ wild that may require you to disable this in order for you to succeed.
All TLS-based
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* switch off session-id use! */
- curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* switch off session-id use! */
+ curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3+9 -6
@@ -90,14 +90,17 @@ may be inaccessible if SNI is not sent.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Set the default value: strict name check please */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
+ /* Set the default value: strict name check please */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3+9 -6
@@ -74,14 +74,17 @@ malicious servers.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* Set the default value: strict certificate check please */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
+ /* Set the default value: strict certificate check please */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3+11 -7
@@ -45,13 +45,17 @@ extension, the verification fails.
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- /* ask for OCSP stapling! */
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ /* ask for OCSP stapling! */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_STDERR.3+9 -6
@@ -45,13 +45,16 @@ stderr
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-FILE *filep = fopen("dump", "wb");
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_STDERR, filep);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ FILE *filep = fopen("dump", "wb");
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_STDERR, filep);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.3+11 -8
@@ -53,16 +53,19 @@ NULL
HTTP/2
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-CURL *curl2 = curl_easy_init(); /* a second handle */
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ CURL *curl2 = curl_easy_init(); /* a second handle */
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
- /* the second depends on the first */
- curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
- curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS, curl);
+ /* the second depends on the first */
+ curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
+ curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS, curl);
- /* then add both to a multi handle and transfer them! */
+ /* then add both to a multi handle and transfer them! */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3+11 -8
@@ -56,16 +56,19 @@ NULL
HTTP/2
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-CURL *curl2 = curl_easy_init(); /* a second handle */
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ CURL *curl2 = curl_easy_init(); /* a second handle */
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
- /* the second depends on the first */
- curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
- curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS_E, curl);
+ /* the second depends on the first */
+ curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
+ curl_easy_setopt(curl2, CURLOPT_STREAM_DEPENDS_E, curl);
- /* then add both to a multi handle and transfer them! */
+ /* then add both to a multi handle and transfer them! */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3+12 -9
@@ -56,17 +56,20 @@ If nothing is set, the HTTP/2 protocol itself uses its own default which is
HTTP/2
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-CURL *curl2 = curl_easy_init(); /* a second handle */
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
- curl_easy_setopt(curl, CURLOPT_STREAM_WEIGHT, 10L);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ CURL *curl2 = curl_easy_init(); /* a second handle */
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
+ curl_easy_setopt(curl, CURLOPT_STREAM_WEIGHT, 10L);
- /* the second has twice the weight */
- curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
- curl_easy_setopt(curl2, CURLOPT_STREAM_WEIGHT, 20L);
+ /* the second has twice the weight */
+ curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
+ curl_easy_setopt(curl2, CURLOPT_STREAM_WEIGHT, 20L);
- /* then add both to a multi handle and transfer them! */
+ /* then add both to a multi handle and transfer them! */
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3+13 -10
@@ -73,19 +73,22 @@ Content-Type: application/json
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
- curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
- curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
- curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
+ curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
+ curl_easy_setopt(curl, CURLOPT_PROXY, "http://foo:3128");
+ curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
+ curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* always cleanup */
- curl_easy_cleanup(curl);
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3+8 -5
@@ -46,11 +46,14 @@ Fast Open is also known to be problematic on or across certain networks.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3+13 -10
@@ -43,20 +43,23 @@ disable keepalive probes
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable TCP keep-alive for this transfer */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
- /* keep-alive idle time to 120 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+ /* keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
- /* interval time between keep-alive probes: 60 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3+13 -10
@@ -44,20 +44,23 @@ this amount.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable TCP keep-alive for this transfer */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
- /* set keep-alive idle time to 120 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+ /* set keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
- /* interval time between keep-alive probes: 60 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3+13 -10
@@ -43,20 +43,23 @@ this amount.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* enable TCP keep-alive for this transfer */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
- /* set keep-alive idle time to 120 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+ /* set keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
- /* interval time between keep-alive probes: 60 seconds */
- curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TCP_NODELAY.3+9 -6
@@ -52,12 +52,15 @@ overdone.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* leave Nagle enabled */
- curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ /* leave Nagle enabled */
+ curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3+14 -10
@@ -43,16 +43,20 @@ NULL
TELNET
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- struct curl_slist *options;
- options = curl_slist_append(NULL, "TTTYPE=vt100");
- options = curl_slist_append(options, "USER=foobar");
- curl_easy_setopt(curl, CURLOPT_URL, "telnet://example.com/");
- curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, options);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- curl_slist_free_all(options);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ struct curl_slist *options;
+ options = curl_slist_append(NULL, "TTTYPE=vt100");
+ options = curl_slist_append(options, "USER=foobar");
+ curl_easy_setopt(curl, CURLOPT_URL, "telnet://example.com/");
+ curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, options);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ curl_slist_free_all(options);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3+11 -7
@@ -44,13 +44,17 @@ is used.
TFTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/bootimage");
- /* try using larger blocks */
- curl_easy_setopt(curl, CURLOPT_TFTP_BLKSIZE, 2048L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/bootimage");
+ /* try using larger blocks */
+ curl_easy_setopt(curl, CURLOPT_TFTP_BLKSIZE, 2048L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3+16 -13
@@ -49,24 +49,27 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp)
return fwrite(ptr, size, nmemb, (FILE *)fp);
}
-CURL *curl = curl_easy_init();
-if(curl) {
- FILE *fp = fopen("foo.bin", "wb");
- if(fp) {
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ FILE *fp = fopen("foo.bin", "wb");
+ if(fp) {
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)fp);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
- curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin");
+ curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/foo.bin");
- /* do not send TFTP options requests */
- curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
+ /* do not send TFTP options requests */
+ curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
- fclose(fp);
+ fclose(fp);
+ }
+ curl_easy_cleanup(curl);
}
- curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TIMECONDITION.3+13 -10
@@ -47,19 +47,22 @@ CURL_TIMECOND_NONE (0)
HTTP, FTP, RTSP, and FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* January 1, 2020 is 1577833200 */
- curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
+ /* January 1, 2020 is 1577833200 */
+ curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
- /* If-Modified-Since the above time stamp */
- curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
- (long)CURL_TIMECOND_IFMODSINCE);
+ /* If-Modified-Since the above time stamp */
+ curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
+ (long)CURL_TIMECOND_IFMODSINCE);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TIMEOUT.3+9 -6
@@ -67,14 +67,17 @@ Default timeout is 0 (zero) which means it never times out during transfer.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* complete within 20 seconds */
- curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);
+ /* complete within 20 seconds */
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3+9 -6
@@ -42,14 +42,17 @@ Default timeout is 0 (zero) which means it never times out during transfer.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* complete within 20000 milliseconds */
- curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 20000L);
+ /* complete within 20000 milliseconds */
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 20000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TIMEVALUE.3+12 -9
@@ -45,18 +45,21 @@ instead.
HTTP, FTP, RTSP, and FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* January 1, 2020 is 1577833200 */
- curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
+ /* January 1, 2020 is 1577833200 */
+ curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
- /* If-Modified-Since the above time stamp */
- curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
+ /* If-Modified-Since the above time stamp */
+ curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3+12 -9
@@ -46,18 +46,21 @@ to be used to set dates beyond the year 2038.
HTTP, FTP, RTSP, and FILE
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* January 1, 2020 is 1577833200 */
- curl_easy_setopt(curl, CURLOPT_TIMEVALUE_LARGE, (curl_off_t)1577833200);
+ /* January 1, 2020 is 1577833200 */
+ curl_easy_setopt(curl, CURLOPT_TIMEVALUE_LARGE, (curl_off_t)1577833200);
- /* If-Modified-Since the above time stamp */
- curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
+ /* If-Modified-Since the above time stamp */
+ curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3+11 -7
@@ -53,13 +53,17 @@ NULL, use internal default
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_TLS13_CIPHERS,
- "TLS_CHACHA20_POLY1305_SHA256");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_TLS13_CIPHERS,
+ "TLS_CHACHA20_POLY1305_SHA256");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3+12 -8
@@ -47,14 +47,18 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3+12 -8
@@ -52,14 +52,18 @@ blank
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3+12 -8
@@ -47,14 +47,18 @@ NULL
All TLS-based protocols
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
- curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TRAILERDATA.3+11 -4
@@ -39,11 +39,18 @@ NULL
HTTP
.SH EXAMPLE
.nf
-/* Assuming we have a CURL handle in the hndl variable. */
+struct MyData {
+ void *custom;
+};
-struct MyData data;
-
-curl_easy_setopt(hndl, CURLOPT_TRAILERDATA, &data);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct MyData data;
+ curl_easy_setopt(curl, CURLOPT_TRAILERDATA, &data);
+ }
+}
.fi
A more complete example can be found in examples/http_trailers.html
docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3+10 -6
@@ -47,12 +47,16 @@ simply sets the mode to ASCII and performs a standard transfer.
FTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/textfile");
- curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/textfile");
+ curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.3+8 -5
@@ -51,11 +51,14 @@ by both HTTP clients and HTTP servers.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3+11 -6
@@ -56,16 +56,21 @@ Default is NULL, meaning that no Unix domain sockets are used.
All protocols except for FILE and FTP are supported in theory. HTTP, IMAP,
POP3 and SMTP should in particular work (including their SSL/TLS variants).
.SH EXAMPLE
-Given that you have an HTTP server running listening on /tmp/httpd.sock, you
-can request an HTTP resource with:
-
.nf
- curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, "/tmp/httpd.sock");
- curl_easy_setopt(curl_handle, CURLOPT_URL, "http://localhost/");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_UNIX_SOCKET_PATH, "/tmp/httpd.sock");
+ curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/");
+
+ curl_easy_perform(curl);
+ }
+}
.fi
If you are on Linux and somehow have a need for paths larger than 107 bytes,
-you could use the proc filesystem to bypass the limitation:
+you can use the proc filesystem to bypass the limitation:
.nf
int dirfd = open(long_directory_path_to_socket, O_DIRECTORY | O_RDONLY);
docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3+9 -6
@@ -57,12 +57,15 @@ redirecting to new hosts.
HTTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
- curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L);
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3+18 -15
@@ -51,27 +51,30 @@ CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60 seconds)
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- /* Make a connection to an HTTP/2 server. */
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+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);
+ /* Set the interval to 30000ms / 30s */
+ curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
- /* Perform more work here. */
+ /* 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);
+ /* 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. */
+ /* Perform more work here. */
- /* always cleanup */
- curl_easy_cleanup(curl);
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_UPLOAD.3+30 -14
@@ -52,25 +52,41 @@ transfer, you must specify the size of the data with
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- /* we want to use our own read function */
- curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
+static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
+{
+ FILE *src = userdata;
+ /* copy as much data as possible into the 'ptr' buffer, but no more than
+ 'size' * 'nmemb' bytes! */
+ size_t retcode = fread(ptr, size, nmemb, src);
- /* enable uploading */
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+ return retcode;
+}
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ FILE *src = fopen("local-file", "r");
+ curl_off_t fsize; /* set this to the size of the input file */
+
+ /* we want to use our own read function */
+ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb);
+
+ /* enable uploading */
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
- /* specify target */
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
+ /* specify target */
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
- /* now specify which pointer to pass to our callback */
- curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
+ /* now specify which pointer to pass to our callback */
+ curl_easy_setopt(curl, CURLOPT_READDATA, src);
- /* Set the size of the file to upload */
- curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
+ /* Set the size of the file to upload */
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
- /* Now run off and do what you have been told! */
- curl_easy_perform(curl);
+ /* Now run off and do what you have been told! */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3+11 -7
@@ -56,16 +56,20 @@ transfer as that may lead to unintended consequences.
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
- /* ask libcurl to allocate a larger upload buffer */
- curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
+ /* ask libcurl to allocate a larger upload buffer */
+ curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_URL.3+8 -5
@@ -113,11 +113,14 @@ User provided URLs can also be made to point to sites that redirect further on
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
-
- curl_easy_perform(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_USERAGENT.3+8 -5
@@ -44,13 +44,16 @@ NULL, no User-Agent: header is used by default.
HTTP, HTTPS
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- curl_easy_setopt(curl, CURLOPT_USERAGENT, "Dark Secret Ninja/1.0");
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, "Dark Secret Ninja/1.0");
- curl_easy_perform(curl);
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_USERNAME.3+10 -6
@@ -66,15 +66,19 @@ blank
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_USERNAME, "clark");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "clark");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_USERPWD.3+10 -6
@@ -74,15 +74,19 @@ NULL
Most
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
- curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
+ curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
- ret = curl_easy_perform(curl);
+ res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_USE_SSL.3+10 -7
@@ -54,15 +54,18 @@ CURLUSESSL_NONE
FTP, SMTP, POP3, IMAP, LDAP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/file.ext");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/file.ext");
- /* require use of SSL for this, or fail */
- curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+ /* require use of SSL for this, or fail */
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_VERBOSE.3+10 -7
@@ -48,15 +48,18 @@ To also get all the protocol data sent and received, consider using the
All
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- /* ask libcurl to show us the verbose output */
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+ /* ask libcurl to show us the verbose output */
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- /* Perform the request */
- curl_easy_perform(curl);
+ /* Perform the request */
+ curl_easy_perform(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3+16 -9
@@ -86,19 +86,26 @@ Using the rules above, a file name pattern can be constructed:
This feature is only supported for FTP download.
.SH EXAMPLE
.nf
-/* initialization of easy handle */
-handle = curl_easy_init();
-/* turn on wildcard matching */
-curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
+extern long begin_cb(struct curl_fileinfo *, void *, int);
+extern long end_cb(void *ptr);
-/* callback is called before download of concrete file started */
-curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* turn on wildcard matching */
+ curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
-/* callback is called after data from the file have been transferred */
-curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
+ /* callback is called before download of concrete file started */
+ curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, begin_cb);
-/* See more on https://curl.se/libcurl/c/ftp-wildcard.html */
+ /* callback is called after data from the file have been transferred */
+ curl_easy_setopt(curl, CURLOPT_CHUNK_END_FUNCTION, end_cb);
+
+ /* See more on https://curl.se/libcurl/c/ftp-wildcard.html */
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.21.0
docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3+19 -15
@@ -81,6 +81,9 @@ libcurl uses 'fwrite' as a callback by default.
For all protocols
.SH EXAMPLE
.nf
+#include <stdlib.h> /* for realloc */
+#include <string.h> /* for memcpy */
+
struct memory {
char *response;
size_t size;
@@ -92,7 +95,7 @@ static size_t cb(void *data, size_t size, size_t nmemb, void *clientp)
struct memory *mem = (struct memory *)clientp;
char *ptr = realloc(mem->response, mem->size + realsize + 1);
- if(ptr == NULL)
+ if(!ptr)
return 0; /* out of memory! */
mem->response = ptr;
@@ -103,25 +106,26 @@ static size_t cb(void *data, size_t size, size_t nmemb, void *clientp)
return realsize;
}
-struct memory chunk = {0};
-CURLcode res;
-CURL *curl_handle = curl_easy_init();
-
-if (curl_handle)
+int main(void)
{
- /* send all data to this function */
- curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, cb);
+ struct memory chunk = {0};
+ CURLcode res;
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ /* send all data to this function */
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb);
- /* we pass our 'chunk' struct to the callback function */
- curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
+ /* we pass our 'chunk' struct to the callback function */
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
- /* send a request */
- res = curl_easy_perform(curl_handle);
+ /* send a request */
+ res = curl_easy_perform(curl);
- /* remember to free the buffer */
- free(chunk.response);
+ /* remember to free the buffer */
+ free(chunk.response);
- curl_easy_cleanup(curl_handle);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_WS_OPTIONS.3+11 -7
@@ -52,13 +52,17 @@ application.
WebSocket
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "ws://example.com/");
- /* tell curl we deal with all the WebSocket magic ourselves */
- curl_easy_setopt(curl, CURLOPT_WS_OPTIONS, (long)CURLWS_RAW_MODE);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "ws://example.com/");
+ /* tell curl we deal with all the WebSocket magic ourselves */
+ curl_easy_setopt(curl, CURLOPT_WS_OPTIONS, (long)CURLWS_RAW_MODE);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLOPT_XFERINFODATA.3+25 -20
@@ -42,30 +42,35 @@ The default value of this parameter is NULL.
All
.SH EXAMPLE
.nf
- struct progress {
- char *private;
- size_t size;
- };
+struct progress {
+ char *private;
+ size_t size;
+};
- static size_t progress_callback(void *clientp,
- curl_off_t dltotal,
- curl_off_t dlnow,
- curl_off_t ultotal,
- curl_off_t ulnow)
- {
- struct memory *progress = (struct progress *)clientp;
+static size_t progress_cb(void *clientp,
+ curl_off_t dltotal,
+ curl_off_t dlnow,
+ curl_off_t ultotal,
+ curl_off_t ulnow)
+{
+ struct progress *memory = clientp;
+ printf("private ptr: %p\\n", memory->private);
+ /* use the values */
- /* use the values */
+ return 0; /* all is good */
+}
- return 0; /* all is good */
- }
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct progress data;
- struct progress data;
-
- /* pass struct to callback */
- curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, &data);
-
- curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, progress_callback);
+ /* pass struct to callback */
+ curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
+ curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_cb);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.32.0
docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.3+31 -24
@@ -81,30 +81,37 @@ users.
All
.SH EXAMPLE
.nf
- struct progress {
- char *private;
- size_t size;
- };
-
- static size_t progress_callback(void *clientp,
- curl_off_t dltotal,
- curl_off_t dlnow,
- curl_off_t ultotal,
- curl_off_t ulnow)
- {
- struct progress *memory = (struct progress *)clientp;
-
- /* use the values */
-
- return 0; /* all is good */
- }
-
- struct progress data;
-
- /* pass struct to callback */
- curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, &data);
-
- curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, progress_callback);
+struct progress {
+ char *private;
+ size_t size;
+};
+
+static size_t progress_callback(void *clientp,
+ curl_off_t dltotal,
+ curl_off_t dlnow,
+ curl_off_t ultotal,
+ curl_off_t ulnow)
+{
+ struct progress *memory = clientp;
+ printf("my ptr: %p\\n", memory->private);
+
+ /* use the values */
+
+ return 0; /* all is good */
+}
+
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ struct progress data;
+
+ /* pass struct to callback */
+ curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
+
+ curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback);
+ }
+}
.fi
.SH AVAILABILITY
Added in 7.32.0. This callback replaces \fICURLOPT_PROGRESSFUNCTION(3)\fP
docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.3+10 -6
@@ -47,12 +47,16 @@ NULL
HTTP, IMAP, LDAP, POP3 and SMTP
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
- curl_easy_setopt(curl, CURLOPT_URL, "pop3://example.com/");
- curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, "1ab9cb22ba269a7");
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ curl_easy_setopt(curl, CURLOPT_URL, "pop3://example.com/");
+ curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, "1ab9cb22ba269a7");
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
}
.fi
.SH AVAILABILITY
docs/libcurl/opts/CURLSHOPT_LOCKFUNC.3+7 -1
@@ -55,11 +55,17 @@ This pointer is not used by libcurl itself.
All
.SH EXAMPLE
.nf
+extern void mutex_lock(CURL *handle, curl_lock_data data,
+ curl_lock_access access, void *clientp);
+
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, mutex_lock);
if(sh)
printf("Error: %s\\n", curl_share_strerror(sh));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/opts/CURLSHOPT_SHARE.3+4 -1
@@ -86,11 +86,14 @@ Added in 7.88.0
All
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
if(sh)
printf("Error: %s\\n", curl_share_strerror(sh));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.3+6 -1
@@ -51,11 +51,16 @@ This pointer is not used by libcurl itself.
All
.SH EXAMPLE
.nf
+extern void mutex_unlock(CURL *, curl_lock_data, void *);
+
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock);
if(sh)
printf("Error: %s\\n", curl_share_strerror(sh));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/opts/CURLSHOPT_UNSHARE.3+4 -1
@@ -55,11 +55,14 @@ The Public Suffix List is no longer shared.
All
.SH EXAMPLE
.nf
+int main(void)
+{
CURLSHcode sh;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_COOKIE);
if(sh)
printf("Error: %s\\n", curl_share_strerror(sh));
+}
.fi
.SH AVAILABILITY
Added in 7.10
docs/libcurl/opts/CURLSHOPT_USERDATA.3+8 -1
@@ -38,12 +38,19 @@ the \fIclientp\fP argument to the callbacks set with
All
.SH EXAMPLE
.nf
+struct secrets {
+ void *custom;
+};
+
+int main(void)
+{
CURLSHcode sh;
struct secrets private_stuff;
- share = curl_share_init();
+ CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff);
if(sh)
printf("Error: %s\\n", curl_share_strerror(sh));
+}
.fi
.SH AVAILABILITY
Added in 7.10
include/curl/curl.h+1 -0
@@ -3211,6 +3211,7 @@ CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
#include "options.h"
#include "header.h"
#include "websockets.h"
+#include "mprintf.h"
/* the typechecker doesn't work in C++ (yet) */
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \