diff --git a/.github/scripts/cleanspell.pl b/.github/scripts/cleanspell.pl index 329a97240..06648a3f9 100755 --- a/.github/scripts/cleanspell.pl +++ b/.github/scripts/cleanspell.pl @@ -71,6 +71,7 @@ while() { $_ =~ s/curl_url_(dup)//g; $_ =~ s/curl_pushheader_by(name|num)//g; $_ =~ s/libcurl-(env|ws)//g; + $_ =~ s/libcurl\\-(env|ws)//g; $_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)//gi; print O $_; } diff --git a/.github/scripts/spellcheck.words b/.github/scripts/spellcheck.words index 4bee9bf60..182a3bdb4 100644 --- a/.github/scripts/spellcheck.words +++ b/.github/scripts/spellcheck.words @@ -83,6 +83,7 @@ CCC CDN CentOS CFLAGS +cflags CGI's CHACHA chacha @@ -138,10 +139,11 @@ cshrc CTRL cURL CURLcode +curldown CURLE CURLH -CURLINFO curlimages +CURLINFO curlrc curltest customizable @@ -161,8 +163,8 @@ deepcode DELE DER deselectable -Deserialized deserialization +Deserialized destructor detections dev @@ -350,11 +352,10 @@ interoperable interoperates IoT ipadOS -IPFS -IPNS -ipld -trustless IPCXN +IPFS +ipld +IPNS IPv IPv4 IPv4/6 @@ -804,6 +805,7 @@ TPF TrackMemory transcode Tru +trustless Tse Tsujikawa TTL @@ -826,6 +828,7 @@ unencoded unencrypted unescape Unglobbed +Unicode UNICOS unix UnixSockets diff --git a/.github/scripts/verify-examples.pl b/.github/scripts/verify-examples.pl index 377fe8340..28d24595f 100755 --- a/.github/scripts/verify-examples.pl +++ b/.github/scripts/verify-examples.pl @@ -91,12 +91,20 @@ sub extract { return ($fail ? 0 : $l); } +my $count; for my $m (@files) { - print "Verify $m\n"; + #print "Verify $m\n"; my $out = extract($m); if($out) { $error |= testcompile($m); $error |= checksrc($m); } + $count++; +} +if(!$error) { + print "Verified $count man pages ok\n"; +} +else { + print "Detected problems\n"; } exit $error; diff --git a/.github/workflows/man-examples.yml b/.github/workflows/man-examples.yml index 249ebfe2f..6f0d1e8ae 100644 --- a/.github/workflows/man-examples.yml +++ b/.github/workflows/man-examples.yml @@ -28,5 +28,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: render nroff versions + run: autoreconf -fi && ./configure --without-ssl --without-libpsl && make -C docs + - name: verify examples run: ./.github/scripts/verify-examples.pl docs/libcurl/curl*.3 docs/libcurl/opts/*.3 diff --git a/.github/workflows/proselint.yml b/.github/workflows/proselint.yml index aead0b5b0..871266722 100644 --- a/.github/workflows/proselint.yml +++ b/.github/workflows/proselint.yml @@ -42,7 +42,8 @@ jobs: "checks": { "typography.diacritical_marks": false, "typography.symbols": false, - "annotations.misc": false + "annotations.misc": false, + "security.password": false } } JSON diff --git a/Makefile.am b/Makefile.am index d0b1fef59..b56ca1a1e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,12 +153,6 @@ dist-hook: cp -p $$file $(distdir)$$strip; \ done) -html: - cd docs && $(MAKE) html - -pdf: - cd docs && $(MAKE) pdf - check: test examples check-docs if CROSSCOMPILING diff --git a/appveyor.yml b/appveyor.yml index 534109e56..039e040a1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -84,7 +84,7 @@ environment: ENABLE_UNICODE: 'OFF' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1139 !1501' + DISABLED_TESTS: '!1139 !1501 !1140 !1173 !1177 !1477' - job_name: 'CMake, VS2022, Debug, x64, Schannel, Static, Unicode' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' BUILD_SYSTEM: CMake @@ -95,7 +95,7 @@ environment: ENABLE_UNICODE: 'ON' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1139 !1501' + DISABLED_TESTS: '!1139 !1501 !1140 !1173 !1177 !1477' - job_name: 'CMake, VS2022, Debug, x64, no SSL, Static' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' BUILD_SYSTEM: CMake @@ -106,7 +106,7 @@ environment: ENABLE_UNICODE: 'OFF' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1139 !1501' + DISABLED_TESTS: '!1139 !1501 !1140 !1173 !1177 !1477' - job_name: 'CMake, VS2022, Debug, x64, no SSL, Static, HTTP only' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' BUILD_SYSTEM: CMake @@ -117,7 +117,7 @@ environment: ENABLE_UNICODE: 'OFF' HTTP_ONLY: 'ON' TESTING: 'ON' - DISABLED_TESTS: '!1139 !1501' + DISABLED_TESTS: '!1139 !1501 !1140 !1173 !1177 !1477' # generated CMake-based MSYS Makefiles builds (mingw cross-compiling) - job_name: 'CMake, mingw-w64, gcc 13, Debug, x64, Schannel, Static, Unicode, Unity' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' @@ -128,7 +128,7 @@ environment: ENABLE_UNICODE: 'ON' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1086 !1139 !1451 !1501' + DISABLED_TESTS: '!1086 !1139 !1451 !1501 !1140 !1173 !1177 !1477' ADD_PATH: 'C:/msys64/mingw64/bin' MSYS2_ARG_CONV_EXCL: '/*' BUILD_OPT: -k @@ -142,7 +142,7 @@ environment: ENABLE_UNICODE: 'ON' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1086 !1139 !1451 !1501' + DISABLED_TESTS: '!1086 !1139 !1451 !1501 !1140 !1173 !1177 !1477' ADD_PATH: 'C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin' MSYS2_ARG_CONV_EXCL: '/*' BUILD_OPT: -k @@ -156,7 +156,7 @@ environment: HTTP_ONLY: 'OFF' TESTING: 'ON' # test 286 disabled due to https://github.com/curl/curl/issues/12040 - DISABLED_TESTS: '~286 !1086 !1139 !1451 !1501' + DISABLED_TESTS: '~286 !1086 !1139 !1451 !1501 !1140 !1173 !1177 !1477' ADD_PATH: 'C:/msys64/mingw64/bin' MSYS2_ARG_CONV_EXCL: '/*' BUILD_OPT: -k @@ -170,7 +170,7 @@ environment: ENABLE_UNICODE: 'OFF' HTTP_ONLY: 'OFF' TESTING: 'ON' - DISABLED_TESTS: '!1086 !1139 !1451 !1501' + DISABLED_TESTS: '!1086 !1139 !1451 !1501 !1140 !1173 !1177 !1477' ADD_PATH: 'C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin' MSYS2_ARG_CONV_EXCL: '/*' BUILD_OPT: -k diff --git a/docs/.gitignore b/docs/.gitignore index 8d0bfb31b..a087be744 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -2,7 +2,5 @@ # # SPDX-License-Identifier: curl -*.html -*.pdf -curl.1 -*.1.dist +*.1 +*.3 diff --git a/docs/CONTRIBUTE.md b/docs/CONTRIBUTE.md index 72d319001..11c9473b4 100644 --- a/docs/CONTRIBUTE.md +++ b/docs/CONTRIBUTE.md @@ -116,7 +116,7 @@ features are working as they are supposed to. To maintain this situation and improve it, all new features and functions that are added need to be tested in the test suite. Every feature that is added should get at least one valid test case that verifies that it works as documented. If every submitter also -posts a few test cases, it will not end up as a heavy burden on a single person! +posts a few test cases, it will not end up as a heavy burden on a single person. If you do not have test cases or perhaps you have done something that is hard to write tests for, do explain exactly how you have otherwise tested and diff --git a/docs/CURLDOWN.md b/docs/CURLDOWN.md new file mode 100644 index 000000000..4a37fc2f6 --- /dev/null +++ b/docs/CURLDOWN.md @@ -0,0 +1,125 @@ +# curldown + +A markdown-like syntax for libcurl man pages. + +## Purpose + +A text format for writing libcurl documentation in the shape of man pages. + +Make it easier for users to contribute and write documentation. A format that +is easier on the eye in its source format. + +Make it harder to do syntactical mistakes. + +Use a format that allows creating man pages that end up looking exactly like +the man pages did when we wrote them in nroff format. + +Take advantage of the fact that people these days are accustomed to markdown +by using a markdown-like syntax. + +This allows us to fix issues in the nroff format easier since now we generate +them. For example: escaping minus to prevent them from being turned into +Unicode by man. + +Generate nroff output that looks (next to) *identical* to the previous files, +so that the look, existing test cases, HTML conversions, existing +infrastructure etc remain mostly intact. + +Contains meta-data in a structured way to allow better output (for example the +see also information) and general awareness of what the file is about. + +## File extension + +Since curldown looks similar to markdown, we use `.md` extensions on the +files. + +## Conversion + +Convert **from curldown to nroff** with `cd2nroff`. Generates nroff man pages. + +Convert **from nroff to curldown** with `nroff2cd`. This is only meant to be +used for the initial conversion to curldown and should ideally never be needed +again. + +Convert, check or clean up an existing curldown to nicer, better, cleaner +curldown with **cd2cd**. + +Mass-convert all curldown files to nroff in specified directories with +`cdall`: + + cdall [dir1] [dir2] [dir3] .. + +## Known issues + +The `cd2nroff` tool does not yet handle *italics* or **bold** where the start +and the end markers are used on separate lines. + +The `nroff2cd` tool generates code style quotes for all `.fi` sections since +the nroff format does not carry a distinction. + +# Format + +Each curldown starts with a header with meta-data: + + --- + c: Copyright (C) Daniel Stenberg, , et al. + SPDX-License-Identifier: curl + Title: CURLOPT_AWS_SIGV4 + Section: 3 + Source: libcurl + See-also: + - CURLOPT_HEADEROPT (3) + - CURLOPT_HTTPAUTH (3) + --- + +All curldown files *must* have all the headers present and at least one +`See-also:` entry specified. + +Following the header in the file, is the manual page using markdown-like +syntax: + +~~~ + # NAME + a page - this is a page descriving something + + # SYNOPSIS + ~~~c + #include + + CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param); + ~~~ +~~~ + +Quoted source code should start with `~~~c` and end with `~~~` while regular +quotes can start with `~~~` or just be indented with 4 spaces. + +Headers at top-level `#` get converted to `.SH`. + +`nroff2cd` supports the `##` next level header which gets converted to `.IP`. + +Write bold words or phrases within `**` like: + + This is a **bold** word. + +Write italics like: + + This is *italics*. + +Due to how man pages don't support backticks especially formatted, such +occurrences in the source will instead just use italics in the generated +output: + + This `word` appears in italics. + +When generating the nroff output, the tooling will remove superfluous newlines, +meaning they can be used freely in the source file to make the text more +readable. + +All mentioned curl symbols that have their own man pages, like +`curl_easy_perform(3)` will automatically be rendered using italics in the +output without having to enclose it with asterisks. This helps ensuring that +they get converted to links properly later in the HTML version on the website, +as converted with `roffit`. This makes the curldown text easier to read even +when mentioning many curl symbols. + +This auto-linking works for patterns matching `(lib|)curl[^ ]*(3)`. diff --git a/docs/GOVERNANCE.md b/docs/GOVERNANCE.md index dd09de456..0f7029e82 100644 --- a/docs/GOVERNANCE.md +++ b/docs/GOVERNANCE.md @@ -179,4 +179,4 @@ this. ### Stop being a maintainer If you (appear to) not be active in the project anymore, you may be removed as -a maintainer. Thank you for your service! +a maintainer. Thank you for your service. diff --git a/docs/HISTORY.md b/docs/HISTORY.md index f39c45ea1..d28217ca6 100644 --- a/docs/HISTORY.md +++ b/docs/HISTORY.md @@ -327,7 +327,7 @@ April: added the cyassl backend (later renamed to WolfSSL) January: the curl tool defaults to HTTP/2 for HTTPS URLs - December: curl 7.52.0 introduced support for HTTPS-proxy! + December: curl 7.52.0 introduced support for HTTPS-proxy First TLS 1.3 support diff --git a/docs/Makefile.am b/docs/Makefile.am index e53cf305a..b3f2b07c8 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -26,24 +26,21 @@ AUTOMAKE_OPTIONS = foreign no-dependencies # EXTRA_DIST breaks with $(abs_builddir) so build it using this variable # but distribute it (using the relative file name) in the next variable -man_MANS = $(abs_builddir)/curl.1 +man_MANS = $(abs_builddir)/curl.1 mk-ca-bundle.1 noinst_man_MANS = curl.1 mk-ca-bundle.1 dist_man_MANS = curl-config.1 -GENHTMLPAGES = curl.html curl-config.html mk-ca-bundle.html -PDFPAGES = curl.pdf curl-config.pdf mk-ca-bundle.pdf -MANDISTPAGES = curl.1.dist curl-config.1.dist - -HTMLPAGES = $(GENHTMLPAGES) +CURLPAGES = curl-config.md mk-ca-bundle.md # Build targets in this file (.) before cmdline-opts to ensure that # the curl.1 rule below runs first -SUBDIRS = . cmdline-opts -DIST_SUBDIRS = $(SUBDIRS) examples libcurl +SUBDIRS = . cmdline-opts libcurl +DIST_SUBDIRS = $(SUBDIRS) examples -CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES) $(MANDISTPAGES) curl.1 +CLEANFILES = $(man_MANS) curl.1 curl-config.1 mk-ca-bundle.1 +nodist_MANS = $(CLEANFILES) EXTRA_DIST = \ - $(noinst_man_MANS) \ + $(CURLPAGES) \ ALTSVC.md \ BINDINGS.md \ BUFREF.md \ @@ -59,6 +56,7 @@ EXTRA_DIST = \ CONNECTION-FILTERS.md \ CONTRIBUTE.md \ CURL-DISABLE.md \ + CURLDOWN.md \ DEPRECATE.md \ DYNBUF.md \ EARLY-RELEASE.md \ @@ -98,9 +96,14 @@ EXTRA_DIST = \ VULN-DISCLOSURE-POLICY.md \ WEBSOCKET.md -MAN2HTML= roffit $< >$@ +CD2NROFF = $(top_srcdir)/scripts/cd2nroff $< >$@ -SUFFIXES = .1 .html .pdf +CD2 = $(CD2_$(V)) +CD2_0 = @echo " RENDER " $@; +CD2_1 = +CD2_ = $(CD2_0) + +SUFFIXES = .1 .md # $(abs_builddir) is to disable VPATH when searching for this file, which # would otherwise find the copy in $(srcdir) which breaks the $(HUGE) @@ -116,21 +119,10 @@ $(abs_builddir)/curl.1: && touch -r "$(srcdir)/curl.1" $@; fi cd cmdline-opts && $(MAKE) -html: $(HTMLPAGES) - cd libcurl && $(MAKE) html +.md.1: + $(CD2)$(CD2NROFF) -pdf: $(PDFPAGES) - cd libcurl && $(MAKE) pdf - -.1.html: - $(MAN2HTML) - -.1.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") +curl-config.1: curl-config.md distclean: rm -f $(CLEANFILES) diff --git a/docs/SSLCERTS.md b/docs/SSLCERTS.md index d10ce5291..7087e1eaf 100644 --- a/docs/SSLCERTS.md +++ b/docs/SSLCERTS.md @@ -116,10 +116,10 @@ server, do one of the following: 4. Windows Directory (e.g. C:\windows) 5. all directories along %PATH% - 5. Get a better/different/newer CA cert bundle! One option is to extract the - one a recent Firefox browser uses by running 'make ca-bundle' in the curl - build tree root, or possibly download a version that was generated this - way for you: [CA Extract](https://curl.se/docs/caextract.html) + 5. Get another CA cert bundle. One option is to extract the one a recent + Firefox browser uses by running 'make ca-bundle' in the curl build tree + root, or possibly download a version that was generated this way for you: + [CA Extract](https://curl.se/docs/caextract.html) Neglecting to use one of the above methods when dealing with a server using a certificate that is not signed by one of the certificates in the installed CA diff --git a/docs/curl-config.1 b/docs/curl-config.md similarity index 61% rename from docs/curl-config.1 rename to docs/curl-config.md index 65cd2c971..5fe46879e 100644 --- a/docs/curl-config.1 +++ b/docs/curl-config.md @@ -1,105 +1,124 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl-config 1 "25 Oct 2007" curl-config curl-config -.SH NAME -curl-config \- Get information about a libcurl installation -.SH SYNOPSIS -.B curl-config [options] -.SH DESCRIPTION -.B curl-config +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl-config +Section: 1 +Source: curl-config +See-also: + - curl (1) +--- + +# NAME + +curl-config - Get information about a libcurl installation + +# SYNOPSIS + +**curl-config [options]** + +# DESCRIPTION + +**curl-config** displays information about the curl and libcurl installation. -.SH OPTIONS -.IP "--ca" + +# OPTIONS + +## --ca + Displays the built-in path to the CA cert bundle this libcurl uses. -.IP "--cc" + +## --cc + Displays the compiler used to build libcurl. -.IP "--cflags" + +## --cflags + Set of compiler options (CFLAGS) to use when compiling files that use libcurl. Currently that is only the include path to the curl include files. -.IP "--checkfor [version]" + +## --checkfor [version] + Specify the oldest possible libcurl version string you want, and this script will return 0 if the current installation is new enough or it returns 1 and outputs a text saying that the current version is not new enough. (Added in 7.15.4) -.IP "--configure" + +## --configure + Displays the arguments given to configure when building curl. -.IP "--feature" + +## --feature + Lists what particular main features the installed libcurl was built with. At the time of writing, this list may include SSL, KRB4 or IPv6. Do not assume any particular order. The keywords will be separated by newlines. There may be none, one, or several keywords in the list. -.IP "--help" + +## --help + Displays the available options. -.IP "--libs" + +## --libs + Shows the complete set of libs and other linker options you will need in order to link your application with libcurl. -.IP "--prefix" + +## --prefix + This is the prefix used when libcurl was installed. Libcurl is then installed in $prefix/lib and its header files are installed in $prefix/include and so on. The prefix is set with "configure --prefix". -.IP "--protocols" + +## --protocols + Lists what particular protocols the installed libcurl was built to support. At the time of writing, this list may include HTTP, HTTPS, FTP, FTPS, FILE, TELNET, LDAP, DICT and many more. Do not assume any particular order. The protocols will be listed using uppercase and are separated by newlines. There may be none, one, or several protocols in the list. (Added in 7.13.0) -.IP "--ssl-backends" + +## --ssl-backends + Lists the SSL backends that were enabled when libcurl was built. It might be no, one or several names. If more than one name, they will appear comma-separated. (Added in 7.58.0) -.IP "--static-libs" + +## --static-libs + Shows the complete set of libs and other linker options you will need in order to link your application with libcurl statically. (Added in 7.17.1) -.IP "--version" + +## --version + Outputs version information about the installed libcurl. -.IP "--vernum" + +## --vernum + Outputs version information about the installed libcurl, in numerical mode. This outputs the version number, in hexadecimal, with 8 bits for each part: major, minor, and patch. So that libcurl 7.7.4 would appear as 070704 and libcurl 12.13.14 would appear as 0c0d0e... Note that the initial zero might be omitted. (This option was broken in the 7.15.0 release.) -.SH "EXAMPLES" + +# EXAMPLES + What linker options do I need when I link with libcurl? -.nf +~~~ $ curl-config --libs -.fi +~~~ What compiler options do I need when I compile using libcurl functions? -.nf +~~~ $ curl-config --cflags -.fi +~~~ How do I know if libcurl was built with SSL support? -.nf +~~~ $ curl-config --feature | grep SSL -.fi +~~~ What's the installed libcurl version? -.nf +~~~ $ curl-config --version -.fi +~~~ How do I build a single file with a one-line command? -.nf - $ `curl-config --cc --cflags` -o example example.c `curl-config --libs` -.fi -.SH "SEE ALSO" -.BR curl (1) +~~~ + $ `curl-config --cc --cflags` -o example source.c `curl-config --libs` +~~~ diff --git a/docs/libcurl/.gitignore b/docs/libcurl/.gitignore deleted file mode 100644 index fd35ad0fc..000000000 --- a/docs/libcurl/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) Daniel Stenberg, , et al. -# -# SPDX-License-Identifier: curl - -*.html -*.pdf -*.3.dist -libcurl-symbols.3 diff --git a/docs/libcurl/Makefile.am b/docs/libcurl/Makefile.am index 8d512a6c2..17b2bc80d 100644 --- a/docs/libcurl/Makefile.am +++ b/docs/libcurl/Makefile.am @@ -28,53 +28,27 @@ SUBDIRS = opts include Makefile.inc -man_DISTMANS = $(man_MANS:.3=.3.dist) - -HTMLPAGES = $(man_MANS:.3=.html) - -PDFPAGES = $(man_MANS:.3=.pdf) +CURLPAGES = $(man_MANS:.3=.md) m4macrodir = $(datadir)/aclocal dist_m4macro_DATA = libcurl.m4 -CLEANFILES = $(HTMLPAGES) $(PDFPAGES) $(TESTS) $(man_DISTMANS) \ - libcurl-symbols.3 +CLEANFILES = $(man_MANS) libcurl-symbols.md +nodist_MANS = $(man_MANS) -EXTRA_DIST = $(man_MANS) ABI.md symbols-in-versions symbols.pl \ +EXTRA_DIST = $(CURLPAGES) ABI.md symbols-in-versions symbols.pl \ mksymbolsmanpage.pl CMakeLists.txt -MAN2HTML= roffit --mandir=. $< >$@ -SUFFIXES = .3 .html +CD2NROFF = $(top_srcdir)/scripts/cd2nroff $< >$@ +CD2 = $(CD2_$(V)) +CD2_0 = @echo " RENDER " $@; +CD2_1 = +CD2_ = $(CD2_0) -libcurl-symbols.3: $(srcdir)/symbols-in-versions $(srcdir)/mksymbolsmanpage.pl - perl $(srcdir)/mksymbolsmanpage.pl < $(srcdir)/symbols-in-versions > $@ +SUFFIXES = .3 .md -html: $(HTMLPAGES) - cd opts && $(MAKE) html +libcurl-symbols.md: $(srcdir)/symbols-in-versions $(srcdir)/mksymbolsmanpage.pl + $(CD2)perl $(srcdir)/mksymbolsmanpage.pl < $(srcdir)/symbols-in-versions > $@ -.3.html: - $(MAN2HTML) - -pdf: $(PDFPAGES) - cd opts && $(MAKE) pdf - -.3.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") - -# Make sure each option man page is referenced in the main man page -TESTS = check-easy check-multi -LOG_COMPILER = $(PERL) -# The test fails if the log file contains any text -AM_LOG_FLAGS = -p -e 'die "$$_" if ($$_);' - -check-easy: $(srcdir)/curl_easy_setopt.3 $(srcdir)/opts/CURLOPT*.3 - OPTS="$$(ls $(srcdir)/opts/CURLOPT*.3 | $(SED) -e 's,^.*/,,' -e 's,\.3$$,,')" && \ - for opt in $$OPTS; do grep "^\.IP $$opt$$" $(srcdir)/curl_easy_setopt.3 >/dev/null || echo Missing $$opt; done > $@ - -check-multi: $(srcdir)/curl_multi_setopt.3 $(srcdir)/opts/CURLMOPT*.3 - OPTS="$$(ls $(srcdir)/opts/CURLMOPT*.3 | $(SED) -e 's,^.*/,,' -e 's,\.3$$,,')" && \ - for opt in $$OPTS; do grep "^\.IP $$opt$$" $(srcdir)/curl_multi_setopt.3 >/dev/null || echo Missing $$opt; done > $@ +.md.3: + $(CD2)$(CD2NROFF) diff --git a/docs/libcurl/curl_easy_cleanup.3 b/docs/libcurl/curl_easy_cleanup.3 deleted file mode 100644 index 9d54d2e25..000000000 --- a/docs/libcurl/curl_easy_cleanup.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_cleanup 3 "22 Aug 2007" "libcurl" "libcurl" -.SH NAME -curl_easy_cleanup - End a libcurl easy handle -.SH SYNOPSIS -.nf -#include - -void curl_easy_cleanup(CURL *handle); -.fi -.SH DESCRIPTION -This function is the opposite of \fIcurl_easy_init(3)\fP. It closes down and -frees all resources previously associated with this easy handle. - -This call closes all connections this handle has used and possibly has kept -open until now unless the easy handle was attached to a multi handle while -doing the transfers. Do not call this function if you intend to transfer more -files, reusing handles is a key to good performance with libcurl. - -Occasionally you may get your progress callback or header callback called from -within \fIcurl_easy_cleanup(3)\fP (if previously set for the handle using -\fIcurl_easy_setopt(3)\fP). Like if libcurl decides to shut down the -connection and the protocol is of a kind that requires a command/response -sequence before disconnect. Examples of such protocols are FTP, POP3 and IMAP. - -Any use of the easy \fBhandle\fP after this function has been called and have -returned, is illegal. - -To close an easy handle that has been used with the multi interface, make sure -to first call \fIcurl_multi_remove_handle(3)\fP to remove it from the multi -handle before it is closed. - -Passing in a NULL pointer in \fIhandle\fP makes this function return -immediately with no action. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res) - printf("error: %s\\n", curl_easy_strerror(res)); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.1 -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_easy_duphandle (3), -.BR curl_easy_init (3), -.BR curl_easy_reset (3), -.BR curl_multi_cleanup (3), -.BR curl_multi_remove_handle (3) diff --git a/docs/libcurl/curl_easy_cleanup.md b/docs/libcurl/curl_easy_cleanup.md new file mode 100644 index 000000000..bdbc05894 --- /dev/null +++ b/docs/libcurl/curl_easy_cleanup.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_cleanup +Section: 3 +Source: libcurl +See-also: + - curl_easy_duphandle (3) + - curl_easy_init (3) + - curl_easy_reset (3) + - curl_multi_cleanup (3) + - curl_multi_remove_handle (3) +--- + +# NAME + +curl_easy_cleanup - End a libcurl easy handle + +# SYNOPSIS + +~~~c +#include + +void curl_easy_cleanup(CURL *handle); +~~~ + +# DESCRIPTION + +This function is the opposite of curl_easy_init(3). It closes down and frees +all resources previously associated with this easy handle. + +This call closes all connections this handle has used and possibly has kept +open until now unless the easy handle was attached to a multi handle while +doing the transfers. Do not call this function if you intend to transfer more +files, reusing handles is a key to good performance with libcurl. + +Occasionally you may get your progress callback or header callback called from +within curl_easy_cleanup(3) (if previously set for the handle using +curl_easy_setopt(3)). Like if libcurl decides to shut down the connection and +the protocol is of a kind that requires a command/response sequence before +disconnect. Examples of such protocols are FTP, POP3 and IMAP. + +Any use of the easy **handle** after this function has been called and have +returned, is illegal. + +To close an easy handle that has been used with the multi interface, make sure +to first call curl_multi_remove_handle(3) to remove it from the multi handle +before it is closed. + +Passing in a NULL pointer in *handle* makes this function return immediately +with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res) + printf("error: %s\n", curl_easy_strerror(res)); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.1 + +# RETURN VALUE + +None diff --git a/docs/libcurl/curl_easy_duphandle.3 b/docs/libcurl/curl_easy_duphandle.3 deleted file mode 100644 index 545938654..000000000 --- a/docs/libcurl/curl_easy_duphandle.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_duphandle 3 "19 Sep 2014" "libcurl" "libcurl" -.SH NAME -curl_easy_duphandle - Clone a libcurl session handle -.SH SYNOPSIS -.nf -#include - -CURL *curl_easy_duphandle(CURL *handle); -.fi -.SH DESCRIPTION -This function returns a new curl handle, a duplicate, using all the options -previously set in the input curl \fIhandle\fP. Both handles can subsequently -be used independently and they must both be freed with -\fIcurl_easy_cleanup(3)\fP. - -Any options that the input handle has been told to point to (as opposed to -copy) with previous calls to \fIcurl_easy_setopt(3)\fP, are pointed to by the -new handle as well. You must therefore make sure to keep the data around until -both handles have been cleaned up. - -The new handle does \fBnot\fP inherit any state information, no connections, -no SSL sessions and no cookies. It also does not inherit any share object -states or options (created as if \fICURLOPT_SHARE(3)\fP was set to NULL). - -If the source handle has HSTS or alt-svc enabled, the duplicate gets data read -data from the main file name to populate the cache. - -In multi-threaded programs, this function must be called in a synchronous way, -the input handle may not be in use when cloned. -.SH EXAMPLE -.nf -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 -Added in 7.9 -.SH RETURN VALUE -If this function returns NULL, something went wrong and no valid handle was -returned. -.SH SEE ALSO -.BR curl_easy_cleanup (3), -.BR curl_easy_init (3), -.BR curl_easy_reset (3), -.BR curl_global_init (3) diff --git a/docs/libcurl/curl_easy_duphandle.md b/docs/libcurl/curl_easy_duphandle.md new file mode 100644 index 000000000..359e8d2b0 --- /dev/null +++ b/docs/libcurl/curl_easy_duphandle.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_duphandle +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_init (3) + - curl_easy_reset (3) + - curl_global_init (3) +--- + +# NAME + +curl_easy_duphandle - Clone a libcurl session handle + +# SYNOPSIS + +~~~c +#include + +CURL *curl_easy_duphandle(CURL *handle); +~~~ + +# DESCRIPTION + +This function returns a new curl handle, a duplicate, using all the options +previously set in the input curl *handle*. Both handles can subsequently be +used independently and they must both be freed with curl_easy_cleanup(3). + +Any options that the input handle has been told to point to (as opposed to +copy) with previous calls to curl_easy_setopt(3), are pointed to by the new +handle as well. You must therefore make sure to keep the data around until +both handles have been cleaned up. + +The new handle does **not** inherit any state information, no connections, no +SSL sessions and no cookies. It also does not inherit any share object states +or options (created as if CURLOPT_SHARE(3) was set to NULL). + +If the source handle has HSTS or alt-svc enabled, the duplicate gets data read +data from the main file name to populate the cache. + +In multi-threaded programs, this function must be called in a synchronous way, +the input handle may not be in use when cloned. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + CURL *nother; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + nother = curl_easy_duphandle(curl); + res = curl_easy_perform(nother); + curl_easy_cleanup(nother); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9 + +# RETURN VALUE + +If this function returns NULL, something went wrong and no valid handle was +returned. diff --git a/docs/libcurl/curl_easy_escape.3 b/docs/libcurl/curl_easy_escape.3 deleted file mode 100644 index 5aa01a964..000000000 --- a/docs/libcurl/curl_easy_escape.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_escape 3 "7 April 2006" "libcurl" "libcurl" -.SH NAME -curl_easy_escape - URL encodes the given string -.SH SYNOPSIS -.nf -#include - -char *curl_easy_escape(CURL *curl, const char *string, int length); -.fi -.SH DESCRIPTION -This function converts the given input \fIstring\fP to a URL encoded string -and returns that as a new allocated string. All input characters that are not -a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" -version (\fB%NN\fP where \fBNN\fP is a two-digit hexadecimal number). - -If \fIlength\fP is set to 0 (zero), \fIcurl_easy_escape(3)\fP uses strlen() on -the input \fIstring\fP to find out the size. This function does not accept -input strings longer than \fBCURL_MAX_INPUT_LENGTH\fP (8 MB). - -Since 7.82.0, the \fBcurl\fP parameter is ignored. Prior to that there was -per-handle character conversion support for some old operating systems such as -TPF, but it was otherwise ignored. - -You must \fIcurl_free(3)\fP the returned string when you are done with it. -.SH ENCODING -libcurl is typically not aware of, nor does it care about, character -encodings. \fIcurl_easy_escape(3)\fP encodes the data byte-by-byte into the -URL encoded version without knowledge or care for what particular character -encoding the application or the receiving server may assume that the data -uses. - -The caller of \fIcurl_easy_escape(3)\fP must make sure that the data passed in -to the function is encoded correctly. -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.15.4 and replaces the old \fIcurl_escape(3)\fP function. -.SH RETURN VALUE -A pointer to a null-terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_easy_unescape (3), -.BR curl_free (3) diff --git a/docs/libcurl/curl_easy_escape.md b/docs/libcurl/curl_easy_escape.md new file mode 100644 index 000000000..655dbb446 --- /dev/null +++ b/docs/libcurl/curl_easy_escape.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_escape +Section: 3 +Source: libcurl +See-also: + - curl_easy_unescape (3) + - curl_free (3) +--- + +# NAME + +curl_easy_escape - URL encodes the given string + +# SYNOPSIS + +~~~c +#include + +char *curl_easy_escape(CURL *curl, const char *string, int length); +~~~ + +# DESCRIPTION + +This function converts the given input *string* to a URL encoded string +and returns that as a new allocated string. All input characters that are not +a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" +version (**%NN** where **NN** is a two-digit hexadecimal number). + +If *length* is set to 0 (zero), curl_easy_escape(3) uses strlen() on +the input *string* to find out the size. This function does not accept +input strings longer than **CURL_MAX_INPUT_LENGTH** (8 MB). + +Since 7.82.0, the **curl** parameter is ignored. Prior to that there was +per-handle character conversion support for some old operating systems such as +TPF, but it was otherwise ignored. + +You must curl_free(3) the returned string when you are done with it. + +# ENCODING + +libcurl is typically not aware of, nor does it care about, character +encodings. curl_easy_escape(3) encodes the data byte-by-byte into the +URL encoded version without knowledge or care for what particular character +encoding the application or the receiving server may assume that the data +uses. + +The caller of curl_easy_escape(3) must make sure that the data passed in +to the function is encoded correctly. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + char *output = curl_easy_escape(curl, "data to convert", 15); + if(output) { + printf("Encoded: %s\n", output); + curl_free(output); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.4 and replaces the old curl_escape(3) function. + +# RETURN VALUE + +A pointer to a null-terminated string or NULL if it failed. diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3 deleted file mode 100644 index 1c12cf419..000000000 --- a/docs/libcurl/curl_easy_getinfo.3 +++ /dev/null @@ -1,336 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_getinfo 3 "11 Feb 2009" "libcurl" "libcurl" -.SH NAME -curl_easy_getinfo - extract information from a curl handle -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... ); -.fi -.SH DESCRIPTION -Get the \fIinfo\fP kept in the \fIcurl\fP handle. The third argument -\fBMUST\fP be pointing to the specific type of the used option which is -documented in each man page of the \fIinfo\fP option. The data is stored -accordingly and can be relied upon only if this function returns CURLE_OK. Use -this function after a performed transfer if you want to get transfer related -data. - -You should not free the memory returned by this function unless it is -explicitly mentioned below. -.SH AVAILABLE INFORMATION -The following information can be extracted: -.IP CURLINFO_EFFECTIVE_METHOD -Last used HTTP method. -See \fICURLINFO_EFFECTIVE_METHOD(3)\fP -.IP CURLINFO_EFFECTIVE_URL -Last used URL. -See \fICURLINFO_EFFECTIVE_URL(3)\fP -.IP CURLINFO_RESPONSE_CODE -Last received response code. -See \fICURLINFO_RESPONSE_CODE(3)\fP -.IP CURLINFO_REFERER -Referrer header. -See \fICURLINFO_REFERER(3)\fP -.IP CURLINFO_HTTP_CONNECTCODE -Last proxy CONNECT response code. -See \fICURLINFO_HTTP_CONNECTCODE(3)\fP -.IP CURLINFO_HTTP_VERSION -The http version used in the connection. -See \fICURLINFO_HTTP_VERSION(3)\fP -.IP CURLINFO_FILETIME -Remote time of the retrieved document. See \fICURLINFO_FILETIME(3)\fP -.IP CURLINFO_FILETIME_T -Remote time of the retrieved document. See \fICURLINFO_FILETIME_T(3)\fP -.IP CURLINFO_TOTAL_TIME -Total time of previous transfer. -See \fICURLINFO_TOTAL_TIME(3)\fP -.IP CURLINFO_TOTAL_TIME_T -Total time of previous transfer. -See \fICURLINFO_TOTAL_TIME_T(3)\fP -.IP CURLINFO_NAMELOOKUP_TIME -Time from start until name resolving completed. -See \fICURLINFO_NAMELOOKUP_TIME(3)\fP -.IP CURLINFO_NAMELOOKUP_TIME_T -Time from start until name resolving completed. -See \fICURLINFO_NAMELOOKUP_TIME_T(3)\fP -.IP CURLINFO_CONNECT_TIME -Time from start until remote host or proxy completed. -See \fICURLINFO_CONNECT_TIME(3)\fP -.IP CURLINFO_CONNECT_TIME_T -Time from start until remote host or proxy completed. -See \fICURLINFO_CONNECT_TIME_T(3)\fP -.IP CURLINFO_APPCONNECT_TIME -Time from start until SSL/SSH handshake completed. -See \fICURLINFO_APPCONNECT_TIME(3)\fP -.IP CURLINFO_APPCONNECT_TIME_T -Time from start until SSL/SSH handshake completed. -See \fICURLINFO_APPCONNECT_TIME_T(3)\fP -.IP CURLINFO_PRETRANSFER_TIME -Time from start until just before the transfer begins. -See \fICURLINFO_PRETRANSFER_TIME(3)\fP -.IP CURLINFO_PRETRANSFER_TIME_T -Time from start until just before the transfer begins. -See \fICURLINFO_PRETRANSFER_TIME_T(3)\fP -.IP CURLINFO_QUEUE_TIME_T -Time during which this transfer was held in a waiting queue. -See \fICURLINFO_QUEUE_TIME_T(3\fP -.IP CURLINFO_STARTTRANSFER_TIME -Time from start until just when the first byte is received. -See \fICURLINFO_STARTTRANSFER_TIME(3)\fP -.IP CURLINFO_STARTTRANSFER_TIME_T -Time from start until just when the first byte is received. -See \fICURLINFO_STARTTRANSFER_TIME_T(3)\fP -.IP CURLINFO_REDIRECT_TIME -Time taken for all redirect steps before the final transfer. -See \fICURLINFO_REDIRECT_TIME(3)\fP -.IP CURLINFO_REDIRECT_TIME_T -Time taken for all redirect steps before the final transfer. -See \fICURLINFO_REDIRECT_TIME_T(3)\fP -.IP CURLINFO_REDIRECT_COUNT -Total number of redirects that were followed. -See \fICURLINFO_REDIRECT_COUNT(3)\fP -.IP CURLINFO_REDIRECT_URL -URL a redirect would take you to, had you enabled redirects. -See \fICURLINFO_REDIRECT_URL(3)\fP -.IP CURLINFO_SIZE_UPLOAD -(Deprecated) Number of bytes uploaded. -See \fICURLINFO_SIZE_UPLOAD(3)\fP -.IP CURLINFO_SIZE_UPLOAD_T -Number of bytes uploaded. -See \fICURLINFO_SIZE_UPLOAD_T(3)\fP -.IP CURLINFO_SIZE_DOWNLOAD -(Deprecated) Number of bytes downloaded. -See \fICURLINFO_SIZE_DOWNLOAD(3)\fP -.IP CURLINFO_SIZE_DOWNLOAD_T -Number of bytes downloaded. -See \fICURLINFO_SIZE_DOWNLOAD_T(3)\fP -.IP CURLINFO_SPEED_DOWNLOAD -(Deprecated) Average download speed. -See \fICURLINFO_SPEED_DOWNLOAD(3)\fP -.IP CURLINFO_SPEED_DOWNLOAD_T -Average download speed. -See \fICURLINFO_SPEED_DOWNLOAD_T(3)\fP -.IP CURLINFO_SPEED_UPLOAD -(Deprecated) Average upload speed. -See \fICURLINFO_SPEED_UPLOAD(3)\fP -.IP CURLINFO_SPEED_UPLOAD_T -Average upload speed. -See \fICURLINFO_SPEED_UPLOAD_T(3)\fP -.IP CURLINFO_HEADER_SIZE -Number of bytes of all headers received. -See \fICURLINFO_HEADER_SIZE(3)\fP -.IP CURLINFO_REQUEST_SIZE -Number of bytes sent in the issued HTTP requests. -See \fICURLINFO_REQUEST_SIZE(3)\fP -.IP CURLINFO_SSL_VERIFYRESULT -Certificate verification result. -See \fICURLINFO_SSL_VERIFYRESULT(3)\fP -.IP CURLINFO_PROXY_ERROR -Detailed proxy error. -See \fICURLINFO_PROXY_ERROR(3)\fP -.IP CURLINFO_PROXY_SSL_VERIFYRESULT -Proxy certificate verification result. -See \fICURLINFO_PROXY_SSL_VERIFYRESULT(3)\fP -.IP CURLINFO_SSL_ENGINES -A list of OpenSSL crypto engines. -See \fICURLINFO_SSL_ENGINES(3)\fP -.IP CURLINFO_CONTENT_LENGTH_DOWNLOAD -(Deprecated) Content length from the Content-Length header. -See \fICURLINFO_CONTENT_LENGTH_DOWNLOAD(3)\fP -.IP CURLINFO_CONTENT_LENGTH_DOWNLOAD_T -Content length from the Content-Length header. -See \fICURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)\fP -.IP CURLINFO_CONTENT_LENGTH_UPLOAD -(Deprecated) Upload size. See \fICURLINFO_CONTENT_LENGTH_UPLOAD(3)\fP -.IP CURLINFO_CONTENT_LENGTH_UPLOAD_T -Upload size. See \fICURLINFO_CONTENT_LENGTH_UPLOAD_T(3)\fP -.IP CURLINFO_CONTENT_TYPE -Content type from the Content-Type header. -See \fICURLINFO_CONTENT_TYPE(3)\fP -.IP CURLINFO_RETRY_AFTER -The value from the Retry-After header. -See \fICURLINFO_RETRY_AFTER(3)\fP -.IP CURLINFO_PRIVATE -User's private data pointer. -See \fICURLINFO_PRIVATE(3)\fP -.IP CURLINFO_HTTPAUTH_AVAIL -Available HTTP authentication methods. -See \fICURLINFO_HTTPAUTH_AVAIL(3)\fP -.IP CURLINFO_PROXYAUTH_AVAIL -Available HTTP proxy authentication methods. -See \fICURLINFO_PROXYAUTH_AVAIL(3)\fP -.IP CURLINFO_OS_ERRNO -The errno from the last failure to connect. -See \fICURLINFO_OS_ERRNO(3)\fP -.IP CURLINFO_NUM_CONNECTS -Number of new successful connections used for previous transfer. -See \fICURLINFO_NUM_CONNECTS(3)\fP -.IP CURLINFO_PRIMARY_IP -Destination IP address of the last connection. -See \fICURLINFO_PRIMARY_IP(3)\fP -.IP CURLINFO_PRIMARY_PORT -Destination port of the last connection. -See \fICURLINFO_PRIMARY_PORT(3)\fP -.IP CURLINFO_LOCAL_IP -Source IP address of the last connection. -See \fICURLINFO_LOCAL_IP(3)\fP -.IP CURLINFO_LOCAL_PORT -Source port number of the last connection. -See \fICURLINFO_LOCAL_PORT(3)\fP -.IP CURLINFO_COOKIELIST -List of all known cookies. -See \fICURLINFO_COOKIELIST(3)\fP -.IP CURLINFO_LASTSOCKET -(Deprecated) Last socket used. -See \fICURLINFO_LASTSOCKET(3)\fP -.IP CURLINFO_ACTIVESOCKET -The session's active socket. -See \fICURLINFO_ACTIVESOCKET(3)\fP -.IP CURLINFO_FTP_ENTRY_PATH -The entry path after logging in to an FTP server. -See \fICURLINFO_FTP_ENTRY_PATH(3)\fP -.IP CURLINFO_CAPATH -Get the default value for \fICURLOPT_CAPATH(3)\fP. -See \fICURLINFO_CAPATH(3)\fP -.IP CURLINFO_CAINFO -Get the default value for \fICURLOPT_CAINFO(3)\fP. -See \fICURLINFO_CAINFO(3)\fP -.IP CURLINFO_CERTINFO -Certificate chain. -See \fICURLINFO_CERTINFO(3)\fP -.IP CURLINFO_TLS_SSL_PTR -TLS session info that can be used for further processing. -See \fICURLINFO_TLS_SSL_PTR(3)\fP -.IP CURLINFO_TLS_SESSION -TLS session info that can be used for further processing. See -\fICURLINFO_TLS_SESSION(3)\fP. Deprecated option, use -\fICURLINFO_TLS_SSL_PTR(3)\fP instead! -.IP CURLINFO_CONDITION_UNMET -Whether or not a time conditional was met or 304 HTTP response. -See \fICURLINFO_CONDITION_UNMET(3)\fP -.IP CURLINFO_RTSP_SESSION_ID -RTSP session ID. -See \fICURLINFO_RTSP_SESSION_ID(3)\fP -.IP CURLINFO_RTSP_CLIENT_CSEQ -The RTSP client CSeq that is expected next. -See \fICURLINFO_RTSP_CLIENT_CSEQ(3)\fP -.IP CURLINFO_RTSP_SERVER_CSEQ -The RTSP server CSeq that is expected next. -See \fICURLINFO_RTSP_SERVER_CSEQ(3)\fP -.IP CURLINFO_RTSP_CSEQ_RECV -RTSP CSeq last received. -See \fICURLINFO_RTSP_CSEQ_RECV(3)\fP -.IP CURLINFO_PROTOCOL -(Deprecated) The protocol used for the connection. (Added in 7.52.0) -See \fICURLINFO_PROTOCOL(3)\fP -.IP CURLINFO_SCHEME -The scheme used for the connection. (Added in 7.52.0) -See \fICURLINFO_SCHEME(3)\fP -.IP CURLINFO_CONN_ID -The ID of the last connection used by the transfer. (Added in 8.2.0) -See \fICURLINFO_CONN_ID(3)\fP -.IP CURLINFO_XFER_ID -The ID of the transfer. (Added in 8.2.0) -See \fICURLINFO_XFER_ID(3)\fP -.SH TIMES -An overview of the time values available from \fIcurl_easy_getinfo(3)\fP -.nf - -curl_easy_perform() - | - |--QUEUE_TIME - |--|--NAMELOOKUP - |--|--|--CONNECT - |--|--|--|--APPCONNECT - |--|--|--|--|--PRETRANSFER - |--|--|--|--|--|--STARTTRANSFER - |--|--|--|--|--|--|--TOTAL - |--|--|--|--|--|--|--REDIRECT -.fi -.IP "QUEUE_TIME" -\fICURLINFO_QUEUE_TIME_T(3\fP. The time during which the transfer was held in -a waiting queue before it could start for real. (Added in 8.6.0) -.IP NAMELOOKUP -\fICURLINFO_NAMELOOKUP_TIME(3)\fP and \fICURLINFO_NAMELOOKUP_TIME_T(3)\fP. -The time it took from the start until the name resolving was completed. -.IP CONNECT -\fICURLINFO_CONNECT_TIME(3)\fP and \fICURLINFO_CONNECT_TIME_T(3)\fP. The time -it took from the start until the connect to the remote host (or proxy) was -completed. -.IP APPCONNECT -\fICURLINFO_APPCONNECT_TIME(3)\fP and \fICURLINFO_APPCONNECT_TIME_T(3)\fP. -The time it took from the start until the SSL connect/handshake with the -remote host was completed. (Added in 7.19.0) The latter is the integer version -(measuring microseconds). (Added in 7.60.0) -.IP PRETRANSFER -\fICURLINFO_PRETRANSFER_TIME(3)\fP and \fICURLINFO_PRETRANSFER_TIME_T(3)\fP. -The time it took from the start until the file transfer is just about to -begin. This includes all pre-transfer commands and negotiations that are -specific to the particular protocol(s) involved. -.IP STARTTRANSFER -\fICURLINFO_STARTTRANSFER_TIME(3)\fP and -\fICURLINFO_STARTTRANSFER_TIME_T(3)\fP. The time it took from the start until -the first byte is received by libcurl. -.IP TOTAL -\fICURLINFO_TOTAL_TIME(3)\fP and \fICURLINFO_TOTAL_TIME_T(3)\fP. Total time -of the previous request. -.IP REDIRECT -\fICURLINFO_REDIRECT_TIME(3)\fP and \fICURLINFO_REDIRECT_TIME_T(3)\fP. The -time it took for all redirection steps include name lookup, connect, -pretransfer and transfer before final transaction was started. So, this is -zero if no redirection took place. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); - res = curl_easy_perform(curl); - - if(CURLE_OK == res) { - char *ct; - /* ask for the content-type */ - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - - if((CURLE_OK == res) && ct) - printf("We received Content-Type: %s\\n", ct); - } - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -If the operation was successful, CURLE_OK is returned. Otherwise an -appropriate error code is returned. -.SH "SEE ALSO" -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_getinfo.md b/docs/libcurl/curl_easy_getinfo.md new file mode 100644 index 000000000..3b98ea4eb --- /dev/null +++ b/docs/libcurl/curl_easy_getinfo.md @@ -0,0 +1,483 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_getinfo +Section: 3 +Source: libcurl +See-also: + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_getinfo - extract information from a curl handle + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... ); +~~~ + +# DESCRIPTION + +Get the *info* kept in the *curl* handle. The third argument **MUST** be +pointing to the specific type of the used option which is documented in each +man page of the *info* option. The data is stored accordingly and can be +relied upon only if this function returns CURLE_OK. Use this function after a +performed transfer if you want to get transfer related data. + +You should not free the memory returned by this function unless it is +explicitly mentioned below. + +# AVAILABLE INFORMATION + +The following information can be extracted: + +## CURLINFO_EFFECTIVE_METHOD + +Last used HTTP method. See CURLINFO_EFFECTIVE_METHOD(3) + +## CURLINFO_EFFECTIVE_URL + +Last used URL. See CURLINFO_EFFECTIVE_URL(3) + +## CURLINFO_RESPONSE_CODE + +Last received response code. See CURLINFO_RESPONSE_CODE(3) + +## CURLINFO_REFERER + +Referrer header. See CURLINFO_REFERER(3) + +## CURLINFO_HTTP_CONNECTCODE + +Last proxy CONNECT response code. See CURLINFO_HTTP_CONNECTCODE(3) + +## CURLINFO_HTTP_VERSION + +The http version used in the connection. See CURLINFO_HTTP_VERSION(3) + +## CURLINFO_FILETIME + +Remote time of the retrieved document. See CURLINFO_FILETIME(3) + +## CURLINFO_FILETIME_T + +Remote time of the retrieved document. See CURLINFO_FILETIME_T(3) + +## CURLINFO_TOTAL_TIME + +Total time of previous transfer. See CURLINFO_TOTAL_TIME(3) + +## CURLINFO_TOTAL_TIME_T + +Total time of previous transfer. See CURLINFO_TOTAL_TIME_T(3) + +## CURLINFO_NAMELOOKUP_TIME + +Time from start until name resolving completed. See +CURLINFO_NAMELOOKUP_TIME(3) + +## CURLINFO_NAMELOOKUP_TIME_T + +Time from start until name resolving completed. See +CURLINFO_NAMELOOKUP_TIME_T(3) + +## CURLINFO_CONNECT_TIME + +Time from start until remote host or proxy completed. +See CURLINFO_CONNECT_TIME(3) + +## CURLINFO_CONNECT_TIME_T + +Time from start until remote host or proxy completed. +See CURLINFO_CONNECT_TIME_T(3) + +## CURLINFO_APPCONNECT_TIME + +Time from start until SSL/SSH handshake completed. +See CURLINFO_APPCONNECT_TIME(3) + +## CURLINFO_APPCONNECT_TIME_T + +Time from start until SSL/SSH handshake completed. +See CURLINFO_APPCONNECT_TIME_T(3) + +## CURLINFO_PRETRANSFER_TIME + +Time from start until just before the transfer begins. +See CURLINFO_PRETRANSFER_TIME(3) + +## CURLINFO_PRETRANSFER_TIME_T + +Time from start until just before the transfer begins. +See CURLINFO_PRETRANSFER_TIME_T(3) + +## CURLINFO_QUEUE_TIME_T + +Time during which this transfer was held in a waiting queue. +See CURLINFO_QUEUE_TIME_T(3) + +## CURLINFO_STARTTRANSFER_TIME + +Time from start until just when the first byte is received. +See CURLINFO_STARTTRANSFER_TIME(3) + +## CURLINFO_STARTTRANSFER_TIME_T + +Time from start until just when the first byte is received. +See CURLINFO_STARTTRANSFER_TIME_T(3) + +## CURLINFO_REDIRECT_TIME + +Time taken for all redirect steps before the final transfer. +See CURLINFO_REDIRECT_TIME(3) + +## CURLINFO_REDIRECT_TIME_T + +Time taken for all redirect steps before the final transfer. +See CURLINFO_REDIRECT_TIME_T(3) + +## CURLINFO_REDIRECT_COUNT + +Total number of redirects that were followed. +See CURLINFO_REDIRECT_COUNT(3) + +## CURLINFO_REDIRECT_URL + +URL a redirect would take you to, had you enabled redirects. +See CURLINFO_REDIRECT_URL(3) + +## CURLINFO_SIZE_UPLOAD + +(Deprecated) Number of bytes uploaded. +See CURLINFO_SIZE_UPLOAD(3) + +## CURLINFO_SIZE_UPLOAD_T + +Number of bytes uploaded. +See CURLINFO_SIZE_UPLOAD_T(3) + +## CURLINFO_SIZE_DOWNLOAD + +(Deprecated) Number of bytes downloaded. +See CURLINFO_SIZE_DOWNLOAD(3) + +## CURLINFO_SIZE_DOWNLOAD_T + +Number of bytes downloaded. +See CURLINFO_SIZE_DOWNLOAD_T(3) + +## CURLINFO_SPEED_DOWNLOAD + +(Deprecated) Average download speed. +See CURLINFO_SPEED_DOWNLOAD(3) + +## CURLINFO_SPEED_DOWNLOAD_T + +Average download speed. +See CURLINFO_SPEED_DOWNLOAD_T(3) + +## CURLINFO_SPEED_UPLOAD + +(Deprecated) Average upload speed. +See CURLINFO_SPEED_UPLOAD(3) + +## CURLINFO_SPEED_UPLOAD_T + +Average upload speed. +See CURLINFO_SPEED_UPLOAD_T(3) + +## CURLINFO_HEADER_SIZE + +Number of bytes of all headers received. +See CURLINFO_HEADER_SIZE(3) + +## CURLINFO_REQUEST_SIZE + +Number of bytes sent in the issued HTTP requests. +See CURLINFO_REQUEST_SIZE(3) + +## CURLINFO_SSL_VERIFYRESULT + +Certificate verification result. +See CURLINFO_SSL_VERIFYRESULT(3) + +## CURLINFO_PROXY_ERROR + +Detailed proxy error. +See CURLINFO_PROXY_ERROR(3) + +## CURLINFO_PROXY_SSL_VERIFYRESULT + +Proxy certificate verification result. +See CURLINFO_PROXY_SSL_VERIFYRESULT(3) + +## CURLINFO_SSL_ENGINES + +A list of OpenSSL crypto engines. +See CURLINFO_SSL_ENGINES(3) + +## CURLINFO_CONTENT_LENGTH_DOWNLOAD + +(Deprecated) Content length from the Content-Length header. +See CURLINFO_CONTENT_LENGTH_DOWNLOAD(3) + +## CURLINFO_CONTENT_LENGTH_DOWNLOAD_T + +Content length from the Content-Length header. +See CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3) + +## CURLINFO_CONTENT_LENGTH_UPLOAD + +(Deprecated) Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD(3) + +## CURLINFO_CONTENT_LENGTH_UPLOAD_T + +Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) + +## CURLINFO_CONTENT_TYPE + +Content type from the Content-Type header. +See CURLINFO_CONTENT_TYPE(3) + +## CURLINFO_RETRY_AFTER + +The value from the Retry-After header. +See CURLINFO_RETRY_AFTER(3) + +## CURLINFO_PRIVATE + +User's private data pointer. +See CURLINFO_PRIVATE(3) + +## CURLINFO_HTTPAUTH_AVAIL + +Available HTTP authentication methods. +See CURLINFO_HTTPAUTH_AVAIL(3) + +## CURLINFO_PROXYAUTH_AVAIL + +Available HTTP proxy authentication methods. +See CURLINFO_PROXYAUTH_AVAIL(3) + +## CURLINFO_OS_ERRNO + +The errno from the last failure to connect. +See CURLINFO_OS_ERRNO(3) + +## CURLINFO_NUM_CONNECTS + +Number of new successful connections used for previous transfer. +See CURLINFO_NUM_CONNECTS(3) + +## CURLINFO_PRIMARY_IP + +Destination IP address of the last connection. +See CURLINFO_PRIMARY_IP(3) + +## CURLINFO_PRIMARY_PORT + +Destination port of the last connection. +See CURLINFO_PRIMARY_PORT(3) + +## CURLINFO_LOCAL_IP + +Source IP address of the last connection. +See CURLINFO_LOCAL_IP(3) + +## CURLINFO_LOCAL_PORT + +Source port number of the last connection. +See CURLINFO_LOCAL_PORT(3) + +## CURLINFO_COOKIELIST + +List of all known cookies. +See CURLINFO_COOKIELIST(3) + +## CURLINFO_LASTSOCKET + +(Deprecated) Last socket used. +See CURLINFO_LASTSOCKET(3) + +## CURLINFO_ACTIVESOCKET + +The session's active socket. +See CURLINFO_ACTIVESOCKET(3) + +## CURLINFO_FTP_ENTRY_PATH + +The entry path after logging in to an FTP server. +See CURLINFO_FTP_ENTRY_PATH(3) + +## CURLINFO_CAPATH + +Get the default value for CURLOPT_CAPATH(3). +See CURLINFO_CAPATH(3) + +## CURLINFO_CAINFO + +Get the default value for CURLOPT_CAINFO(3). +See CURLINFO_CAINFO(3) + +## CURLINFO_CERTINFO + +Certificate chain. +See CURLINFO_CERTINFO(3) + +## CURLINFO_TLS_SSL_PTR + +TLS session info that can be used for further processing. +See CURLINFO_TLS_SSL_PTR(3) + +## CURLINFO_TLS_SESSION + +TLS session info that can be used for further processing. See +CURLINFO_TLS_SESSION(3). Deprecated option, use +CURLINFO_TLS_SSL_PTR(3) instead! + +## CURLINFO_CONDITION_UNMET + +Whether or not a time conditional was met or 304 HTTP response. +See CURLINFO_CONDITION_UNMET(3) + +## CURLINFO_RTSP_SESSION_ID + +RTSP session ID. +See CURLINFO_RTSP_SESSION_ID(3) + +## CURLINFO_RTSP_CLIENT_CSEQ + +The RTSP client CSeq that is expected next. +See CURLINFO_RTSP_CLIENT_CSEQ(3) + +## CURLINFO_RTSP_SERVER_CSEQ + +The RTSP server CSeq that is expected next. +See CURLINFO_RTSP_SERVER_CSEQ(3) + +## CURLINFO_RTSP_CSEQ_RECV + +RTSP CSeq last received. +See CURLINFO_RTSP_CSEQ_RECV(3) + +## CURLINFO_PROTOCOL + +(Deprecated) The protocol used for the connection. (Added in 7.52.0) +See CURLINFO_PROTOCOL(3) + +## CURLINFO_SCHEME + +The scheme used for the connection. (Added in 7.52.0) +See CURLINFO_SCHEME(3) + +## CURLINFO_CONN_ID + +The ID of the last connection used by the transfer. (Added in 8.2.0) +See CURLINFO_CONN_ID(3) + +## CURLINFO_XFER_ID + +The ID of the transfer. (Added in 8.2.0) +See CURLINFO_XFER_ID(3) + +# TIMES + +An overview of the time values available from curl_easy_getinfo(3) + +~~~ +curl_easy_perform() + | + |--QUEUE_TIME + |--|--NAMELOOKUP + |--|--|--CONNECT + |--|--|--|--APPCONNECT + |--|--|--|--|--PRETRANSFER + |--|--|--|--|--|--STARTTRANSFER + |--|--|--|--|--|--|--TOTAL + |--|--|--|--|--|--|--REDIRECT +~~~ + +## QUEUE_TIME + +CURLINFO_QUEUE_TIME_T(3). The time during which the transfer was held in a +waiting queue before it could start for real. (Added in 8.6.0) + +## NAMELOOKUP + +CURLINFO_NAMELOOKUP_TIME(3) and CURLINFO_NAMELOOKUP_TIME_T(3). The time it +took from the start until the name resolving was completed. + +## CONNECT + +CURLINFO_CONNECT_TIME(3) and CURLINFO_CONNECT_TIME_T(3). The time it took from +the start until the connect to the remote host (or proxy) was completed. + +## APPCONNECT + +CURLINFO_APPCONNECT_TIME(3) and CURLINFO_APPCONNECT_TIME_T(3). The time it +took from the start until the SSL connect/handshake with the remote host was +completed. (Added in 7.19.0) The latter is the integer version (measuring +microseconds). (Added in 7.60.0) + +## PRETRANSFER + +CURLINFO_PRETRANSFER_TIME(3) and CURLINFO_PRETRANSFER_TIME_T(3). The time it +took from the start until the file transfer is just about to begin. This +includes all pre-transfer commands and negotiations that are specific to the +particular protocol(s) involved. + +## STARTTRANSFER + +CURLINFO_STARTTRANSFER_TIME(3) and CURLINFO_STARTTRANSFER_TIME_T(3). The time +it took from the start until the first byte is received by libcurl. + +## TOTAL + +CURLINFO_TOTAL_TIME(3) and CURLINFO_TOTAL_TIME_T(3). Total time +of the previous request. + +## REDIRECT + +CURLINFO_REDIRECT_TIME(3) and CURLINFO_REDIRECT_TIME_T(3). The time it took +for all redirection steps include name lookup, connect, pretransfer and +transfer before final transaction was started. So, this is zero if no +redirection took place. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); + res = curl_easy_perform(curl); + + if(CURLE_OK == res) { + char *ct; + /* ask for the content-type */ + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + + if((CURLE_OK == res) && ct) + printf("We received Content-Type: %s\n", ct); + } + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +If the operation was successful, CURLE_OK is returned. Otherwise an +appropriate error code is returned. diff --git a/docs/libcurl/curl_easy_header.3 b/docs/libcurl/curl_easy_header.md similarity index 51% rename from docs/libcurl/curl_easy_header.3 rename to docs/libcurl/curl_easy_header.md index 8cbd3e272..9c2d76cea 100644 --- a/docs/libcurl/curl_easy_header.3 +++ b/docs/libcurl/curl_easy_header.md @@ -1,31 +1,24 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_header 3 "13 March 2022" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_header +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_TYPE (3) + - CURLOPT_HEADERFUNCTION (3) + - curl_easy_nextheader (3) + - curl_easy_perform (3) + - libcurl-errors (3) +--- + +# NAME + curl_easy_header - get an HTTP header -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLHcode curl_easy_header(CURL *easy, @@ -34,24 +27,26 @@ CURLHcode curl_easy_header(CURL *easy, unsigned int origin, int request, struct curl_header **hout); -.fi -.SH DESCRIPTION -\fIcurl_easy_header(3)\fP returns a pointer to a "curl_header" struct in -\fBhout\fP with data for the HTTP response header \fIname\fP. The case -insensitive null-terminated header name should be specified without colon. +~~~ -\fIindex\fP 0 means asking for the first instance of the header. If the -returned header struct has \fBamount\fP set larger than 1, it means there are -more instances of the same header name available to get. Asking for a too big -index makes \fBCURLHE_BADINDEX\fP get returned. +# DESCRIPTION -The \fIorigin\fP argument is for specifying which headers to receive, as a -single HTTP transfer might provide headers from several different places and -they may then have different importance to the user and headers using the same -name might be used. The \fIorigin\fP is a bitmask for what header sources you -want. See the descriptions below. +curl_easy_header(3) returns a pointer to a "curl_header" struct in **hout** +with data for the HTTP response header *name*. The case insensitive +null-terminated header name should be specified without colon. -The \fIrequest\fP argument tells libcurl from which request you want headers +*index* 0 means asking for the first instance of the header. If the returned +header struct has **amount** set larger than 1, it means there are more +instances of the same header name available to get. Asking for a too big index +makes **CURLHE_BADINDEX** get returned. + +The *origin* argument is for specifying which headers to receive, as a single +HTTP transfer might provide headers from several different places and they may +then have different importance to the user and headers using the same name +might be used. The *origin* is a bitmask for what header sources you want. See +the descriptions below. + +The *request* argument tells libcurl from which request you want headers from. A single transfer might consist of a series of HTTP requests and this argument lets you specify which particular individual request you want the headers from. 0 being the first request and then the number increases for @@ -66,10 +61,10 @@ second, then only the first one is provided. An application using this API does not have to bother about multiple headers used wrongly. The memory for the returned struct is associated with the easy handle and -subsequent calls to \fIcurl_easy_header(3)\fP clobber the struct used in the +subsequent calls to curl_easy_header(3) clobber the struct used in the previous calls for the same easy handle. Applications need to copy the data if it wants to keep it around. The memory used for the struct gets freed with -calling \fIcurl_easy_cleanup(3)\fP of the easy handle. +calling curl_easy_cleanup(3) of the easy handle. The first line in an HTTP response is called the status line. It is not considered a header by this function. Headers are the "name: value" lines @@ -78,8 +73,10 @@ following the status. This function can be used before (all) headers have been received and is fine to call from within libcurl callbacks. It returns the state of the headers at the time it is called. -.SH "The header struct" -.nf + +# The header struct + +~~~c struct curl_header { char *name; char *value; @@ -88,45 +85,58 @@ struct curl_header { unsigned int origin; void *anchor; }; -.fi +~~~ -The data \fBname\fP field points to, is the same as the requested name, but +The data **name** field points to, is the same as the requested name, but might have a different case. -The data \fBvalue\fP field points to, comes exactly as delivered over the +The data **value** field points to, comes exactly as delivered over the network but with leading and trailing whitespace and newlines stripped off. The `value` data is null-terminated. For legacy HTTP/1 "folded headers", this API provides the full single value in an unfolded manner with a single whitespace between the lines. -\fBamount\fP is how many headers using this name that exist, within the origin +**amount** is how many headers using this name that exist, within the origin and request scope asked for. -\fBindex\fP is the zero based entry number of this particular header, which in +**index** is the zero based entry number of this particular header, which in case this header was used more than once in the requested scope can be larger -than 0 but is always less than \fBamount\fP. +than 0 but is always less than **amount**. -The \fBorigin\fP field in the "curl_header" struct has one of the origin bits +The **origin** field in the "curl_header" struct has one of the origin bits set, indicating where from the header originates. At the time of this writing, there are 5 bits with defined use. The undocumented 27 remaining bits are reserved for future use and must not be assumed to have any particular value. -\fBanchor\fP is a private handle used by libcurl internals. Do not modify. -.SH ORIGINS -.IP CURLH_HEADER +**anchor** is a private handle used by libcurl internals. Do not modify. + +# ORIGINS + +## CURLH_HEADER + The header arrived as a header from the server. -.IP CURLH_TRAILER + +## CURLH_TRAILER + The header arrived as a trailer. A header that arrives after the body. -.IP CURLH_CONNECT + +## CURLH_CONNECT + The header arrived in a CONNECT response. A CONNECT request is being done to setup a transfer "through" an HTTP(S) proxy. -.IP CURLH_1XX + +## CURLH_1XX + The header arrived in an HTTP 1xx response. A 1xx response is an "intermediate" response that might happen before the "real" response. -.IP CURLH_PSEUDO + +## CURLH_PSEUDO + The header is an HTTP/2 or HTTP/3 pseudo header -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { struct curl_header *type; @@ -139,14 +149,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.83.0. Officially supported since 7.84.0. -.SH RETURN VALUE + +# RETURN VALUE + This function returns a CURLHcode indicating success or error. -.SH "SEE ALSO" -.BR curl_easy_nextheader (3), -.BR curl_easy_perform (3), -.BR CURLINFO_CONTENT_TYPE (3), -.BR CURLOPT_HEADERFUNCTION (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_easy_init.3 b/docs/libcurl/curl_easy_init.3 deleted file mode 100644 index 238016986..000000000 --- a/docs/libcurl/curl_easy_init.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_init 3 "4 March 2002" "libcurl" "libcurl" -.SH NAME -curl_easy_init - Start a libcurl easy session -.SH SYNOPSIS -.nf -#include - -CURL *curl_easy_init(); -.fi -.SH DESCRIPTION -This function allocates and returns a CURL easy handle. Such a handle is used -as input to other functions in the easy interface. This call must have a -corresponding call to \fIcurl_easy_cleanup(3)\fP when the operation is -complete. - -The easy handle is used to hold and control a single network transfer. It is -encouraged to reuse easy handles for repeated transfers. - -An alternative way to get a new easy handle is to duplicate an already -existing one with \fIcurl_easy_duphandle(3)\fP, which has the upside that it -gets all the options that were set in the source handle set in the new copy as -well. - -If you did not already call \fIcurl_global_init(3)\fP before calling this -function, \fIcurl_easy_init(3)\fP does it automatically. This may be lethal in -multi-threaded cases, if \fIcurl_global_init(3)\fP is not thread-safe in your -system, and it may then result in resource problems because there is no -corresponding cleanup. - -You are strongly advised to not allow this automatic behavior, by calling -\fIcurl_global_init(3)\fP yourself properly. See the description in -\fBlibcurl\fP(3) of global environment requirements for details of how to use -this function. - -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -If this function returns NULL, something went wrong and you cannot use the -other curl functions. -.SH "SEE ALSO" -.BR curl_easy_cleanup (3), -.BR curl_easy_duphandle (3), -.BR curl_easy_perform (3), -.BR curl_easy_reset (3), -.BR curl_global_init (3), -.BR curl_multi_init (3) diff --git a/docs/libcurl/curl_easy_init.md b/docs/libcurl/curl_easy_init.md new file mode 100644 index 000000000..a7465547f --- /dev/null +++ b/docs/libcurl/curl_easy_init.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_init +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_duphandle (3) + - curl_easy_perform (3) + - curl_easy_reset (3) + - curl_global_init (3) + - curl_multi_init (3) +--- + +# NAME + +curl_easy_init - Start a libcurl easy session + +# SYNOPSIS + +~~~c +#include + +CURL *curl_easy_init(); +~~~ + +# DESCRIPTION + +This function allocates and returns a CURL easy handle. Such a handle is used +as input to other functions in the easy interface. This call must have a +corresponding call to curl_easy_cleanup(3) when the operation is complete. + +The easy handle is used to hold and control a single network transfer. It is +encouraged to reuse easy handles for repeated transfers. + +An alternative way to get a new easy handle is to duplicate an already +existing one with curl_easy_duphandle(3), which has the upside that it gets +all the options that were set in the source handle set in the new copy as +well. + +If you did not already call curl_global_init(3) before calling this function, +curl_easy_init(3) does it automatically. This may be lethal in multi-threaded +cases, if curl_global_init(3) is not thread-safe in your system, and it may +then result in resource problems because there is no corresponding cleanup. + +You are strongly advised to not allow this automatic behavior, by calling +curl_global_init(3) yourself properly. See the description in libcurl(3) of +global environment requirements for details of how to use this function. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +If this function returns NULL, something went wrong and you cannot use the +other curl functions. diff --git a/docs/libcurl/curl_easy_nextheader.3 b/docs/libcurl/curl_easy_nextheader.3 deleted file mode 100644 index 44262463d..000000000 --- a/docs/libcurl/curl_easy_nextheader.3 +++ /dev/null @@ -1,106 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_nextheader 3 "13 March 2022" "libcurl" "libcurl" -.SH NAME -curl_easy_nextheader - get the next HTTP header -.SH SYNOPSIS -.nf -#include - -struct curl_header *curl_easy_nextheader(CURL *easy, - unsigned int origin, - int request, - struct curl_header *prev); -.fi -.SH DESCRIPTION -This function lets an application iterate over all previously received HTTP -headers. - -The \fIorigin\fP argument is for specifying which headers to receive, as a -single HTTP transfer might provide headers from several different places and -they may then have different importance to the user and headers using the same -name might be used. The \fIorigin\fP is a bitmask for what header sources you -want. See the \fIcurl_easy_header(3)\fP man page for the origin descriptions. - -The \fIrequest\fP argument tells libcurl from which request you want headers -from. A single transfer might consist of a series of HTTP requests and this -argument lets you specify which particular individual request you want the -headers from. 0 being the first request and then the number increases for -further redirects or when multi-state authentication is used. Passing in -1 is -a shortcut to "the last" request in the series, independently of the actual -amount of requests used. - -It is suggested that you pass in the same \fBorigin\fP and \fBrequest\fP when -iterating over a range of headers as changing the value mid-loop might give -you unexpected results. - -If \fIprev\fP is NULL, this function returns a pointer to the first header -stored within the given scope (origin + request). - -If \fIprev\fP is a pointer to a previously returned header struct, -\fIcurl_easy_nextheader(3)\fP returns a pointer the next header stored within -the given scope. This way, an application can iterate over all available -headers. - -The memory for the struct this points to, is owned and managed by libcurl and -is associated with the easy handle. Applications must copy the data if they -want it to survive subsequent API calls or the life-time of the easy handle. -.SH EXAMPLE -.nf -int main(void) -{ - struct curl_header *prev = NULL; - struct curl_header *h; - - CURL *curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_perform(curl); - - /* extract the normal headers from the first request */ - while((h = curl_easy_nextheader(curl, CURLH_HEADER, 0, prev))) { - printf("%s: %s\\n", h->name, h->value); - prev = h; - } - - /* extract the normal headers + 1xx + trailers from the last request */ - unsigned int origin = CURLH_HEADER| CURLH_1XX | CURLH_TRAILER; - while((h = curl_easy_nextheader(curl, origin, -1, prev))) { - printf("%s: %s\\n", h->name, h->value); - prev = h; - } - } -} -.fi -.SH AVAILABILITY -Added in 7.83.0. Officially supported since 7.84.0. -.SH RETURN VALUE -This function returns the next header, or NULL when there are no more -(matching) headers or an error occurred. - -If this function returns NULL when \fIprev\fP was set to NULL, then there are -no headers available within the scope to return. -.SH "SEE ALSO" -.BR curl_easy_header (3), -.BR curl_easy_perform (3) diff --git a/docs/libcurl/curl_easy_nextheader.md b/docs/libcurl/curl_easy_nextheader.md new file mode 100644 index 000000000..7c7e151c3 --- /dev/null +++ b/docs/libcurl/curl_easy_nextheader.md @@ -0,0 +1,100 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_nextheader +Section: 3 +Source: libcurl +See-also: + - curl_easy_header (3) + - curl_easy_perform (3) +--- + +# NAME + +curl_easy_nextheader - get the next HTTP header + +# SYNOPSIS + +~~~c +#include + +struct curl_header *curl_easy_nextheader(CURL *easy, + unsigned int origin, + int request, + struct curl_header *prev); +~~~ + +# DESCRIPTION + +This function lets an application iterate over all previously received HTTP +headers. + +The *origin* argument is for specifying which headers to receive, as a single +HTTP transfer might provide headers from several different places and they may +then have different importance to the user and headers using the same name +might be used. The *origin* is a bitmask for what header sources you want. See +the curl_easy_header(3) man page for the origin descriptions. + +The *request* argument tells libcurl from which request you want headers +from. A single transfer might consist of a series of HTTP requests and this +argument lets you specify which particular individual request you want the +headers from. 0 being the first request and then the number increases for +further redirects or when multi-state authentication is used. Passing in -1 is +a shortcut to "the last" request in the series, independently of the actual +amount of requests used. + +It is suggested that you pass in the same **origin** and **request** when +iterating over a range of headers as changing the value mid-loop might give +you unexpected results. + +If *prev* is NULL, this function returns a pointer to the first header stored +within the given scope (origin + request). + +If *prev* is a pointer to a previously returned header struct, +curl_easy_nextheader(3) returns a pointer the next header stored within the +given scope. This way, an application can iterate over all available headers. + +The memory for the struct this points to, is owned and managed by libcurl and +is associated with the easy handle. Applications must copy the data if they +want it to survive subsequent API calls or the life-time of the easy handle. + +# EXAMPLE + +~~~c +int main(void) +{ + struct curl_header *prev = NULL; + struct curl_header *h; + + CURL *curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_perform(curl); + + /* extract the normal headers from the first request */ + while((h = curl_easy_nextheader(curl, CURLH_HEADER, 0, prev))) { + printf("%s: %s\n", h->name, h->value); + prev = h; + } + + /* extract the normal headers + 1xx + trailers from the last request */ + unsigned int origin = CURLH_HEADER| CURLH_1XX | CURLH_TRAILER; + while((h = curl_easy_nextheader(curl, origin, -1, prev))) { + printf("%s: %s\n", h->name, h->value); + prev = h; + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.83.0. Officially supported since 7.84.0. + +# RETURN VALUE + +This function returns the next header, or NULL when there are no more +(matching) headers or an error occurred. + +If this function returns NULL when *prev* was set to NULL, then there are no +headers available within the scope to return. diff --git a/docs/libcurl/curl_easy_option_by_id.3 b/docs/libcurl/curl_easy_option_by_id.3 deleted file mode 100644 index ded364bca..000000000 --- a/docs/libcurl/curl_easy_option_by_id.3 +++ /dev/null @@ -1,59 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_option_by_id 3 "27 Aug 2020" "libcurl" "libcurl" -.SH NAME -curl_easy_option_by_id - find an easy setopt option by id -.SH SYNOPSIS -.nf -#include - -const struct curl_easyoption *curl_easy_option_by_id(CURLoption id); -.fi -.SH DESCRIPTION -Given a \fICURLoption\fP \fBid\fP, this function returns a pointer to the -\fIcurl_easyoption\fP struct, holding information about the -\fIcurl_easy_setopt(3)\fP option using that id. The option id is the CURLOPT_ -prefix ones provided in the standard curl/curl.h header file. This function -returns the non-alias version of the cases where there is an alias function as -well. - -If libcurl has no option with the given id, this function returns NULL. -.SH EXAMPLE -.nf -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 -This function was added in libcurl 7.73.0 -.SH RETURN VALUE -A pointer to the \fIcurl_easyoption\fP struct for the option or NULL. -.SH "SEE ALSO" -.BR curl_easy_option_by_name (3), -.BR curl_easy_option_next (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_option_by_id.md b/docs/libcurl/curl_easy_option_by_id.md new file mode 100644 index 000000000..b1d6d421b --- /dev/null +++ b/docs/libcurl/curl_easy_option_by_id.md @@ -0,0 +1,54 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_option_by_id +Section: 3 +Source: libcurl +See-also: + - curl_easy_option_by_name (3) + - curl_easy_option_next (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_option_by_id - find an easy setopt option by id + +# SYNOPSIS + +~~~c +#include + +const struct curl_easyoption *curl_easy_option_by_id(CURLoption id); +~~~ + +# DESCRIPTION + +Given a *CURLoption* **id**, this function returns a pointer to the +*curl_easyoption* struct, holding information about the +curl_easy_setopt(3) option using that id. The option id is the CURLOPT_ +prefix ones provided in the standard curl/curl.h header file. This function +returns the non-alias version of the cases where there is an alias function as +well. + +If libcurl has no option with the given id, this function returns NULL. + +# EXAMPLE + +~~~c +int main(void) +{ + const struct curl_easyoption *opt = curl_easy_option_by_id(CURLOPT_URL); + if(opt) { + printf("This option wants type %x\n", opt->type); + } +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.73.0 + +# RETURN VALUE + +A pointer to the *curl_easyoption* struct for the option or NULL. diff --git a/docs/libcurl/curl_easy_option_by_name.3 b/docs/libcurl/curl_easy_option_by_name.3 deleted file mode 100644 index 87652e723..000000000 --- a/docs/libcurl/curl_easy_option_by_name.3 +++ /dev/null @@ -1,58 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_option_by_name 3 "27 Aug 2020" "libcurl" "libcurl" -.SH NAME -curl_easy_option_by_name - find an easy setopt option by name -.SH SYNOPSIS -.nf -#include - -const struct curl_easyoption *curl_easy_option_by_name(const char *name); -.fi -.SH DESCRIPTION -Given a \fBname\fP, this function returns a pointer to the -\fIcurl_easyoption\fP struct, holding information about the -\fIcurl_easy_setopt(3)\fP option using that name. The name should be specified -without the "CURLOPT_" prefix and the name comparison is made case -insensitive. - -If libcurl has no option with the given name, this function returns NULL. -.SH EXAMPLE -.nf -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 -This function was added in libcurl 7.73.0 -.SH RETURN VALUE -A pointer to the \fIcurl_easyoption\fP struct for the option or NULL. -.SH "SEE ALSO" -.BR curl_easy_option_by_id (3), -.BR curl_easy_option_next (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_option_by_name.md b/docs/libcurl/curl_easy_option_by_name.md new file mode 100644 index 000000000..86ccbd4da --- /dev/null +++ b/docs/libcurl/curl_easy_option_by_name.md @@ -0,0 +1,53 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_option_by_name +Section: 3 +Source: libcurl +See-also: + - curl_easy_option_by_id (3) + - curl_easy_option_next (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_option_by_name - find an easy setopt option by name + +# SYNOPSIS + +~~~c +#include + +const struct curl_easyoption *curl_easy_option_by_name(const char *name); +~~~ + +# DESCRIPTION + +Given a **name**, this function returns a pointer to the +*curl_easyoption* struct, holding information about the +curl_easy_setopt(3) option using that name. The name should be specified +without the "CURLOPT_" prefix and the name comparison is made case +insensitive. + +If libcurl has no option with the given name, this function returns NULL. + +# EXAMPLE + +~~~c +int main(void) +{ + const struct curl_easyoption *opt = curl_easy_option_by_name("URL"); + if(opt) { + printf("This option wants CURLoption %x\n", (int)opt->id); + } +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.73.0 + +# RETURN VALUE + +A pointer to the *curl_easyoption* struct for the option or NULL. diff --git a/docs/libcurl/curl_easy_option_next.3 b/docs/libcurl/curl_easy_option_next.3 deleted file mode 100644 index e2b35c522..000000000 --- a/docs/libcurl/curl_easy_option_next.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_option_next 3 "27 Aug 2020" "libcurl" "libcurl" -.SH NAME -curl_easy_option_next - iterate over easy setopt options -.SH SYNOPSIS -.nf -#include - -const struct curl_easyoption * -curl_easy_option_next(const struct curl_easyoption *prev); -.fi -.SH DESCRIPTION -This function returns a pointer to the first or the next \fIcurl_easyoption\fP -struct, providing an ability to iterate over all known options for -\fIcurl_easy_setopt(3)\fP in this instance of libcurl. - -Pass a \fBNULL\fP argument as \fBprev\fP to get the first option returned, or -pass in the current option to get the next one returned. If there is no more -option to return, \fIcurl_easy_option_next(3)\fP returns NULL. - -The options returned by this functions are the ones known to this libcurl and -information about what argument type they want. - -If the \fBCURLOT_FLAG_ALIAS\fP bit is set in the flags field, it means the -name is provided for backwards compatibility as an alias. -.SH struct -.nf -typedef enum { - CURLOT_LONG, /* long (a range of values) */ - CURLOT_VALUES, /* (a defined set or bitmask) */ - CURLOT_OFF_T, /* curl_off_t (a range of values) */ - CURLOT_OBJECT, /* pointer (void *) */ - CURLOT_STRING, /* (char * to null-terminated buffer) */ - CURLOT_SLIST, /* (struct curl_slist *) */ - CURLOT_CBPTR, /* (void * passed as-is to a callback) */ - CURLOT_BLOB, /* blob (struct curl_blob *) */ - CURLOT_FUNCTION /* function pointer */ -} curl_easytype; - -/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size - to use for curl_easy_setopt() for the given id */ -struct curl_easyoption { - const char *name; - CURLoption id; - curl_easytype type; - unsigned int flags; -}; -.fi -.SH EXAMPLE -.nf -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 -This function was added in libcurl 7.73.0 -.SH RETURN VALUE -A pointer to the \fIcurl_easyoption\fP struct for the next option or NULL if -no more options. -.SH "SEE ALSO" -.BR curl_easy_option_by_id (3), -.BR curl_easy_option_by_name (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_option_next.md b/docs/libcurl/curl_easy_option_next.md new file mode 100644 index 000000000..f5da17cfc --- /dev/null +++ b/docs/libcurl/curl_easy_option_next.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_option_next +Section: 3 +Source: libcurl +See-also: + - curl_easy_option_by_id (3) + - curl_easy_option_by_name (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_option_next - iterate over easy setopt options + +# SYNOPSIS + +~~~c +#include + +const struct curl_easyoption * +curl_easy_option_next(const struct curl_easyoption *prev); +~~~ + +# DESCRIPTION + +This function returns a pointer to the first or the next *curl_easyoption* +struct, providing an ability to iterate over all known options for +curl_easy_setopt(3) in this instance of libcurl. + +Pass a **NULL** argument as **prev** to get the first option returned, or +pass in the current option to get the next one returned. If there is no more +option to return, curl_easy_option_next(3) returns NULL. + +The options returned by this functions are the ones known to this libcurl and +information about what argument type they want. + +If the **CURLOT_FLAG_ALIAS** bit is set in the flags field, it means the +name is provided for backwards compatibility as an alias. + +# struct + +~~~c +typedef enum { + CURLOT_LONG, /* long (a range of values) */ + CURLOT_VALUES, /* (a defined set or bitmask) */ + CURLOT_OFF_T, /* curl_off_t (a range of values) */ + CURLOT_OBJECT, /* pointer (void *) */ + CURLOT_STRING, /* (char * to null-terminated buffer) */ + CURLOT_SLIST, /* (struct curl_slist *) */ + CURLOT_CBPTR, /* (void * passed as-is to a callback) */ + CURLOT_BLOB, /* blob (struct curl_blob *) */ + CURLOT_FUNCTION /* function pointer */ +} curl_easytype; + +/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size + to use for curl_easy_setopt() for the given id */ +struct curl_easyoption { + const char *name; + CURLoption id; + curl_easytype type; + unsigned int flags; +}; +~~~ + +# EXAMPLE + +~~~c +int main(void) +{ + /* iterate over all available options */ + const struct curl_easyoption *opt; + opt = curl_easy_option_next(NULL); + while(opt) { + printf("Name: %s\n", opt->name); + opt = curl_easy_option_next(opt); + } +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.73.0 + +# RETURN VALUE + +A pointer to the *curl_easyoption* struct for the next option or NULL if +no more options. diff --git a/docs/libcurl/curl_easy_pause.3 b/docs/libcurl/curl_easy_pause.md similarity index 63% rename from docs/libcurl/curl_easy_pause.3 rename to docs/libcurl/curl_easy_pause.md index e5ff8827d..03e6b917a 100644 --- a/docs/libcurl/curl_easy_pause.3 +++ b/docs/libcurl/curl_easy_pause.md @@ -1,84 +1,88 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_pause 3 "17 Dec 2007" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_pause +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_reset (3) +--- + +# NAME + curl_easy_pause - pause and unpause a connection -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_pause(CURL *handle, int bitmask ); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Using this function, you can explicitly mark a running connection to get paused, and you can unpause a connection that was previously paused. Unlike -most other libcurl functions, \fIcurl_easy_pause(3)\fP can be used from within +most other libcurl functions, curl_easy_pause(3) can be used from within callbacks. A connection can be paused by using this function or by letting the read or the write callbacks return the proper magic return code -(\fICURL_READFUNC_PAUSE\fP and \fICURL_WRITEFUNC_PAUSE\fP). A write callback +(*CURL_READFUNC_PAUSE* and *CURL_WRITEFUNC_PAUSE*). A write callback that returns pause signals to the library that it could not take care of any data at all, and that data is then delivered again to the callback when the transfer is unpaused. While it may feel tempting, take care and notice that you cannot call this function from another thread. To unpause, you may for example call it from the -progress callback (\fICURLOPT_PROGRESSFUNCTION(3)\fP). +progress callback (CURLOPT_PROGRESSFUNCTION(3)). When this function is called to unpause receiving, the write callback might get called before this function returns to deliver cached content. When libcurl delivers such cached data to the write callback, it is delivered as fast as possible, which may overstep the boundary set in -\fICURLOPT_MAX_RECV_SPEED_LARGE(3)\fP etc. +CURLOPT_MAX_RECV_SPEED_LARGE(3) etc. -The \fBhandle\fP argument identifies the transfer you want to pause or +The **handle** argument identifies the transfer you want to pause or unpause. A paused transfer is excluded from low speed cancels via the -\fICURLOPT_LOW_SPEED_LIMIT(3)\fP option and unpausing a transfer resets the +CURLOPT_LOW_SPEED_LIMIT(3) option and unpausing a transfer resets the time period required for the low speed limit to be met. -The \fBbitmask\fP argument is a set of bits that sets the new state of the +The **bitmask** argument is a set of bits that sets the new state of the connection. The following bits can be used: -.IP CURLPAUSE_RECV + +## CURLPAUSE_RECV + Pause receiving data. There is no data received on this connection until this function is called again without this bit set. Thus, the write callback -(\fICURLOPT_WRITEFUNCTION(3)\fP) is not called. -.IP CURLPAUSE_SEND +(CURLOPT_WRITEFUNCTION(3)) is not called. + +## CURLPAUSE_SEND + Pause sending data. There is no data sent on this connection until this function is called again without this bit set. Thus, the read callback -(\fICURLOPT_READFUNCTION(3)\fP) is not called. -.IP CURLPAUSE_ALL +(CURLOPT_READFUNCTION(3)) is not called. + +## CURLPAUSE_ALL + Convenience define that pauses both directions. -.IP CURLPAUSE_CONT + +## CURLPAUSE_CONT + Convenience define that unpauses both directions. -.SH LIMITATIONS + +# LIMITATIONS + The pausing of transfers does not work with protocols that work without network connectivity, like FILE://. Trying to pause such a transfer, in any direction, might cause problems or error. -.SH MULTIPLEXED + +# MULTIPLEXED + When a connection is used multiplexed, like for HTTP/2, and one of the transfers over the connection is paused and the others continue flowing, libcurl might end up buffering contents for the paused transfer. It has to do @@ -90,8 +94,10 @@ buffering 32 megabyte of data for a paused stream. When such a paused stream is unpaused again, any buffered data is delivered first. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -101,8 +107,10 @@ int main(void) } } -.fi -.SH "MEMORY USE" +~~~ + +# MEMORY USE + When pausing a download transfer by returning the magic return code from a write callback, the read data is already in libcurl's internal buffers so it has to keep it in an allocated buffer until the receiving is again unpaused @@ -113,19 +121,20 @@ automatically on download, libcurl continues to uncompress the entire downloaded chunk and it caches the data uncompressed. This has the side- effect that if you download something that is compressed a lot, it can result in a large data amount needing to be allocated to save the data during the -pause. consider not using paused receiving if you allow libcurl to uncompress +pause. Consider not using paused receiving if you allow libcurl to uncompress data automatically. If the download is done with HTTP/2 or HTTP/3, there is up to a stream window size worth of data that curl cannot stop but instead needs to cache while the transfer is paused. This means that if a window size of 64 MB is used, libcurl might end up having to cache 64 MB of data. -.SH AVAILABILITY + +# AVAILABILITY + Added in 7.18.0. -.SH RETURN VALUE + +# RETURN VALUE + CURLE_OK (zero) means that the option was set properly, and a non-zero return code means something wrong occurred after the new state was set. See the -\fIlibcurl-errors(3)\fP man page for the full list with descriptions. -.SH "SEE ALSO" -.BR curl_easy_cleanup (3), -.BR curl_easy_reset (3) +libcurl-errors(3) man page for the full list with descriptions. diff --git a/docs/libcurl/curl_easy_perform.3 b/docs/libcurl/curl_easy_perform.3 deleted file mode 100644 index 18430771a..000000000 --- a/docs/libcurl/curl_easy_perform.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_perform 3 "5 Mar 2001" "libcurl" "libcurl" -.SH NAME -curl_easy_perform - perform a blocking file transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_perform(CURL *easy_handle); -.fi -.SH DESCRIPTION -\fIcurl_easy_perform(3)\fP performs a network transfer in a blocking manner -and returns when done, or earlier if it fails. For non-blocking behavior, see -\fIcurl_multi_perform(3)\fP. - -Invoke this function after \fIcurl_easy_init(3)\fP and all the -\fIcurl_easy_setopt(3)\fP calls are made, and it performs the transfer as -described in the options. It must be called with the same \fBeasy_handle\fP as -input as the \fIcurl_easy_init(3)\fP call returned. - -You can do any amount of calls to \fIcurl_easy_perform(3)\fP while using the -same \fBeasy_handle\fP. If you intend to transfer more than one file, you are -even encouraged to do so. libcurl attempts to reuse existing connections for -the following transfers, thus making the operations faster, less CPU intense -and using less network resources. You probably want to use -\fIcurl_easy_setopt(3)\fP between the invokes to set options for the following -\fIcurl_easy_perform(3)\fP call. - -You must never call this function simultaneously from two places using the -same \fBeasy_handle\fP. Let the function return first before invoking it -another time. If you want parallel transfers, you must use several curl -easy_handles. - -A network transfer moves data to a peer or from a peer. An application tells -libcurl how to receive data by setting the \fICURLOPT_WRITEFUNCTION(3)\fP and -\fICURLOPT_WRITEDATA(3)\fP options. To tell libcurl what data to send, there -are a few more alternatives but two common ones are -\fICURLOPT_READFUNCTION(3)\fP and \fICURLOPT_POSTFIELDS(3)\fP. - -While the \fBeasy_handle\fP is added to a multi handle, it cannot be used by -\fIcurl_easy_perform(3)\fP. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -CURLE_OK (0) means everything was OK, non-zero means an error occurred as -.I -defines - see \fIlibcurl-errors(3)\fP. If the \fICURLOPT_ERRORBUFFER(3)\fP was -set with \fIcurl_easy_setopt(3)\fP there is a readable error message stored in -the error buffer when non-zero is returned. -.SH "SEE ALSO" -.BR curl_easy_init (3), -.BR curl_easy_setopt (3), -.BR curl_multi_add_handle (3), -.BR curl_multi_perform (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_easy_perform.md b/docs/libcurl/curl_easy_perform.md new file mode 100644 index 000000000..ff65a82ee --- /dev/null +++ b/docs/libcurl/curl_easy_perform.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_perform +Section: 3 +Source: libcurl +See-also: + - curl_easy_init (3) + - curl_easy_setopt (3) + - curl_multi_add_handle (3) + - curl_multi_perform (3) + - libcurl-errors (3) +--- + +# NAME + +curl_easy_perform - perform a blocking file transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_perform(CURL *easy_handle); +~~~ + +# DESCRIPTION + +curl_easy_perform(3) performs a network transfer in a blocking manner and +returns when done, or earlier if it fails. For non-blocking behavior, see +curl_multi_perform(3). + +Invoke this function after curl_easy_init(3) and all the curl_easy_setopt(3) +calls are made, and it performs the transfer as described in the options. It +must be called with the same **easy_handle** as input as the curl_easy_init(3) +call returned. + +You can do any amount of calls to curl_easy_perform(3) while using the same +**easy_handle**. If you intend to transfer more than one file, you are even +encouraged to do so. libcurl attempts to reuse existing connections for the +following transfers, thus making the operations faster, less CPU intense and +using less network resources. You probably want to use curl_easy_setopt(3) +between the invokes to set options for the following curl_easy_perform(3) +call. + +You must never call this function simultaneously from two places using the +same **easy_handle**. Let the function return first before invoking it another +time. If you want parallel transfers, you must use several curl easy_handles. + +A network transfer moves data to a peer or from a peer. An application tells +libcurl how to receive data by setting the CURLOPT_WRITEFUNCTION(3) and +CURLOPT_WRITEDATA(3) options. To tell libcurl what data to send, there are a +few more alternatives but two common ones are CURLOPT_READFUNCTION(3) and +CURLOPT_POSTFIELDS(3). + +While the **easy_handle** is added to a multi handle, it cannot be used by +curl_easy_perform(3). + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +CURLE_OK (0) means everything was OK, non-zero means an error occurred as +** defines - see libcurl-errors(3). If the CURLOPT_ERRORBUFFER(3) +was set with curl_easy_setopt(3) there is a readable error message stored in +the error buffer when non-zero is returned. diff --git a/docs/libcurl/curl_easy_recv.3 b/docs/libcurl/curl_easy_recv.3 deleted file mode 100644 index 5238f97b6..000000000 --- a/docs/libcurl/curl_easy_recv.3 +++ /dev/null @@ -1,109 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_recv 3 "29 April 2008" "libcurl" "libcurl" -.SH NAME -curl_easy_recv - receives raw data on an "easy" connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); -.fi -.SH DESCRIPTION -This function receives raw data from the established connection. You may use -it together with \fIcurl_easy_send(3)\fP to implement custom protocols using -libcurl. This functionality can be particularly useful if you use proxies -and/or SSL encryption: libcurl takes care of proxy negotiation and connection -setup. - -\fBbuffer\fP is a pointer to your buffer memory that gets populated by the -received data. \fBbuflen\fP is the maximum amount of data you can get in that -buffer. The variable \fBn\fP points to receives the number of received bytes. - -To establish the connection, set \fICURLOPT_CONNECT_ONLY(3)\fP option before -calling \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP. Note that -\fIcurl_easy_recv(3)\fP does not work on connections that were created without -this option. - -The call returns \fBCURLE_AGAIN\fP if there is no data to read - the socket is -used in non-blocking mode internally. When \fBCURLE_AGAIN\fP is returned, use -your operating system facilities like \fIselect(2)\fP to wait for data. The -socket may be obtained using \fIcurl_easy_getinfo(3)\fP with -\fICURLINFO_ACTIVESOCKET(3)\fP. - -Wait on the socket only if \fIcurl_easy_recv(3)\fP returns \fBCURLE_AGAIN\fP. -The reason for this is libcurl or the SSL library may internally cache some -data, therefore you should call \fIcurl_easy_recv(3)\fP until all data is -read which would include any cached data. - -Furthermore if you wait on the socket and it tells you there is data to read, -\fIcurl_easy_recv(3)\fP may return \fBCURLE_AGAIN\fP if the only data that was -read was for internal SSL processing, and no other data is available. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - /* Do not do the transfer - only connect to host */ - curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); - res = curl_easy_perform(curl); - - if(res == CURLE_OK) { - char buf[256]; - size_t nread; - long sockfd; - - /* Extract the socket from the curl handle - we need it for waiting. */ - res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd); - - /* read data */ - res = curl_easy_recv(curl, buf, sizeof(buf), &nread); - } - } -} -.fi -.SH AVAILABILITY -Added in 7.18.2. -.SH RETURN VALUE -On success, returns \fBCURLE_OK\fP, stores the received data into -\fBbuffer\fP, and the number of bytes it actually read into \fB*n\fP. - -On failure, returns the appropriate error code. - -The function may return \fBCURLE_AGAIN\fP. In this case, use your operating -system facilities to wait until data can be read, and retry. - -Reading exactly 0 bytes indicates a closed connection. - -If there is no socket available to use from the previous transfer, this function -returns \fBCURLE_UNSUPPORTED_PROTOCOL\fP. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_perform (3), -.BR curl_easy_send (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_recv.md b/docs/libcurl/curl_easy_recv.md new file mode 100644 index 000000000..df210f71a --- /dev/null +++ b/docs/libcurl/curl_easy_recv.md @@ -0,0 +1,103 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_recv +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_perform (3) + - curl_easy_send (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_recv - receives raw data on an "easy" connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); +~~~ + +# DESCRIPTION + +This function receives raw data from the established connection. You may use +it together with curl_easy_send(3) to implement custom protocols using +libcurl. This functionality can be particularly useful if you use proxies +and/or SSL encryption: libcurl takes care of proxy negotiation and connection +setup. + +**buffer** is a pointer to your buffer memory that gets populated by the +received data. **buflen** is the maximum amount of data you can get in that +buffer. The variable **n** points to receives the number of received bytes. + +To establish the connection, set CURLOPT_CONNECT_ONLY(3) option before +calling curl_easy_perform(3) or curl_multi_perform(3). Note that +curl_easy_recv(3) does not work on connections that were created without +this option. + +The call returns **CURLE_AGAIN** if there is no data to read - the socket is +used in non-blocking mode internally. When **CURLE_AGAIN** is returned, use +your operating system facilities like *select(2)* to wait for data. The +socket may be obtained using curl_easy_getinfo(3) with +CURLINFO_ACTIVESOCKET(3). + +Wait on the socket only if curl_easy_recv(3) returns **CURLE_AGAIN**. +The reason for this is libcurl or the SSL library may internally cache some +data, therefore you should call curl_easy_recv(3) until all data is +read which would include any cached data. + +Furthermore if you wait on the socket and it tells you there is data to read, +curl_easy_recv(3) may return **CURLE_AGAIN** if the only data that was +read was for internal SSL processing, and no other data is available. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + /* Do not do the transfer - only connect to host */ + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + res = curl_easy_perform(curl); + + if(res == CURLE_OK) { + char buf[256]; + size_t nread; + long sockfd; + + /* Extract the socket from the curl handle - we need it for waiting. */ + res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd); + + /* read data */ + res = curl_easy_recv(curl, buf, sizeof(buf), &nread); + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.18.2. + +# RETURN VALUE + +On success, returns **CURLE_OK**, stores the received data into +**buffer**, and the number of bytes it actually read into ***n**. + +On failure, returns the appropriate error code. + +The function may return **CURLE_AGAIN**. In this case, use your operating +system facilities to wait until data can be read, and retry. + +Reading exactly 0 bytes indicates a closed connection. + +If there is no socket available to use from the previous transfer, this function +returns **CURLE_UNSUPPORTED_PROTOCOL**. diff --git a/docs/libcurl/curl_easy_reset.3 b/docs/libcurl/curl_easy_reset.3 deleted file mode 100644 index 5fa9b13b3..000000000 --- a/docs/libcurl/curl_easy_reset.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_reset 3 "31 July 2004" "libcurl" "libcurl" -.SH NAME -curl_easy_reset - reset all options of a libcurl session handle -.SH SYNOPSIS -.nf -#include - -void curl_easy_reset(CURL *handle); -.fi -.SH DESCRIPTION -Re-initializes all options previously set on a specified CURL handle to the -default values. This puts back the handle to the same state as it was in when -it was just created with \fIcurl_easy_init(3)\fP. - -It does not change the following information kept in the handle: live -connections, the Session ID cache, the DNS cache, the cookies, the shares or -the alt-svc cache. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(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 -.SH RETURN VALUE -Nothing -.SH "SEE ALSO" -.BR curl_easy_cleanup (3), -.BR curl_easy_duphandle (3), -.BR curl_easy_init (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/curl_easy_reset.md b/docs/libcurl/curl_easy_reset.md new file mode 100644 index 000000000..c2aea6e10 --- /dev/null +++ b/docs/libcurl/curl_easy_reset.md @@ -0,0 +1,56 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_reset +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_duphandle (3) + - curl_easy_init (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_reset - reset all options of a libcurl session handle + +# SYNOPSIS + +~~~c +#include + +void curl_easy_reset(CURL *handle); +~~~ + +# DESCRIPTION + +Re-initializes all options previously set on a specified CURL handle to the +default values. This puts back the handle to the same state as it was in when +it was just created with curl_easy_init(3). + +It does not change the following information kept in the handle: live +connections, the Session ID cache, the DNS cache, the cookies, the shares or +the alt-svc cache. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + + /* ... the handle is used and options are set ... */ + curl_easy_reset(curl); + } +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.12.1 + +# RETURN VALUE + +Nothing diff --git a/docs/libcurl/curl_easy_send.3 b/docs/libcurl/curl_easy_send.3 deleted file mode 100644 index 820029ec0..000000000 --- a/docs/libcurl/curl_easy_send.3 +++ /dev/null @@ -1,101 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_send 3 "29 April 2008" "libcurl" "libcurl" -.SH NAME -curl_easy_send - sends raw data over an "easy" connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_send(CURL *curl, const void *buffer, - size_t buflen, size_t *n); -.fi -.SH DESCRIPTION -This function sends arbitrary data over the established connection. You may -use it together with \fIcurl_easy_recv(3)\fP to implement custom protocols -using libcurl. This functionality can be particularly useful if you use -proxies and/or SSL encryption: libcurl takes care of proxy negotiation and -connection setup. - -\fBbuffer\fP is a pointer to the data of length \fBbuflen\fP that you want -sent. The variable \fBn\fP points to receives the number of sent bytes. - -To establish the connection, set \fICURLOPT_CONNECT_ONLY(3)\fP option before -calling \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP. Note that -\fIcurl_easy_send(3)\fP does not work on connections that were created without -this option. - -The call returns \fBCURLE_AGAIN\fP if it's not possible to send data right now -- the socket is used in non-blocking mode internally. When \fBCURLE_AGAIN\fP -is returned, use your operating system facilities like \fIselect(2)\fP to wait -until the socket is writable. The socket may be obtained using -\fIcurl_easy_getinfo(3)\fP with \fICURLINFO_ACTIVESOCKET(3)\fP. - -Furthermore if you wait on the socket and it tells you it's writable, -\fIcurl_easy_send(3)\fP may return \fBCURLE_AGAIN\fP if the only data that was -sent was for internal SSL processing, and no other data could be sent. -.SH EXAMPLE -.nf -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) { - 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); - } - } -} -.fi -.SH AVAILABILITY -Added in 7.18.2. -.SH RETURN VALUE -On success, returns \fBCURLE_OK\fP and stores the number of bytes actually -sent into \fB*n\fP. Note that this may be less than the amount you wanted to -send. - -On failure, returns the appropriate error code. - -This function may return \fBCURLE_AGAIN\fP. In this case, use your operating -system facilities to wait until the socket is writable, and retry. - -If there is no socket available to use from the previous transfer, this function -returns \fBCURLE_UNSUPPORTED_PROTOCOL\fP. -.SH "SEE ALSO" -.BR curl_easy_setopt (3), -.BR curl_easy_perform (3), -.BR curl_easy_getinfo (3), -.BR curl_easy_recv (3) diff --git a/docs/libcurl/curl_easy_send.md b/docs/libcurl/curl_easy_send.md new file mode 100644 index 000000000..d94592845 --- /dev/null +++ b/docs/libcurl/curl_easy_send.md @@ -0,0 +1,95 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_send +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_perform (3) + - curl_easy_recv (3) + - curl_easy_setopt (3) +--- + +# NAME + +curl_easy_send - sends raw data over an "easy" connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_send(CURL *curl, const void *buffer, + size_t buflen, size_t *n); +~~~ + +# DESCRIPTION + +This function sends arbitrary data over the established connection. You may +use it together with curl_easy_recv(3) to implement custom protocols +using libcurl. This functionality can be particularly useful if you use +proxies and/or SSL encryption: libcurl takes care of proxy negotiation and +connection setup. + +**buffer** is a pointer to the data of length **buflen** that you want +sent. The variable **n** points to receives the number of sent bytes. + +To establish the connection, set CURLOPT_CONNECT_ONLY(3) option before +calling curl_easy_perform(3) or curl_multi_perform(3). Note that +curl_easy_send(3) does not work on connections that were created without +this option. + +The call returns **CURLE_AGAIN** if it's not possible to send data right now +- the socket is used in non-blocking mode internally. When **CURLE_AGAIN** +is returned, use your operating system facilities like *select(2)* to wait +until the socket is writable. The socket may be obtained using +curl_easy_getinfo(3) with CURLINFO_ACTIVESOCKET(3). + +Furthermore if you wait on the socket and it tells you it's writable, +curl_easy_send(3) may return **CURLE_AGAIN** if the only data that was +sent was for internal SSL processing, and no other data could be sent. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + /* Do not do the transfer - only connect to host */ + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + res = curl_easy_perform(curl); + + if(res == CURLE_OK) { + 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); + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.18.2. + +# RETURN VALUE + +On success, returns **CURLE_OK** and stores the number of bytes actually +sent into ***n**. Note that this may be less than the amount you wanted to +send. + +On failure, returns the appropriate error code. + +This function may return **CURLE_AGAIN**. In this case, use your operating +system facilities to wait until the socket is writable, and retry. + +If there is no socket available to use from the previous transfer, this function +returns **CURLE_UNSUPPORTED_PROTOCOL**. diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3 deleted file mode 100644 index d4a5dcb5c..000000000 --- a/docs/libcurl/curl_easy_setopt.3 +++ /dev/null @@ -1,751 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_setopt 3 "25 Jun 2014" "libcurl" "libcurl" -.SH NAME -curl_easy_setopt \- set options for a curl easy handle -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter); -.fi -.SH DESCRIPTION -\fIcurl_easy_setopt(3)\fP is used to tell libcurl how to behave. By setting -the appropriate options, the application can change libcurl's behavior. All -options are set with an \fIoption\fP followed by a \fIparameter\fP. That -parameter can be a \fBlong\fP, a \fBfunction pointer\fP, an \fBobject -pointer\fP or a \fBcurl_off_t\fP, depending on what the specific option -expects. Read this manual carefully as bad input values may cause libcurl to -behave badly! You can only set one option in each function call. A typical -application uses many \fIcurl_easy_setopt(3)\fP calls in the setup phase. - -Options set with this function call are valid for all forthcoming transfers -performed using this \fIhandle\fP. The options are not in any way reset -between transfers, so if you want subsequent transfers with different options, -you must change them between the transfers. You can optionally reset all -options back to internal default with \fIcurl_easy_reset(3)\fP. - -Strings passed to libcurl as 'char *' arguments, are copied by the library; -the string storage associated to the pointer argument may be discarded or -reused after \fIcurl_easy_setopt(3)\fP returns. The only exception to this -rule is really \fICURLOPT_POSTFIELDS(3)\fP, but the alternative that copies -the string \fICURLOPT_COPYPOSTFIELDS(3)\fP has some usage characteristics you -need to read up on. This function does not accept input strings longer than -\fBCURL_MAX_INPUT_LENGTH\fP (8 MB). - -The order in which the options are set does not matter. - -Before version 7.17.0, strings were not copied. Instead the user was forced -keep them available until libcurl no longer needed them. - -The \fIhandle\fP is the return code from a \fIcurl_easy_init(3)\fP or -\fIcurl_easy_duphandle(3)\fP call. -.SH BEHAVIOR OPTIONS -.IP CURLOPT_VERBOSE -Display verbose information. See \fICURLOPT_VERBOSE(3)\fP -.IP CURLOPT_HEADER -Include the header in the body output. See \fICURLOPT_HEADER(3)\fP -.IP CURLOPT_NOPROGRESS -Shut off the progress meter. See \fICURLOPT_NOPROGRESS(3)\fP -.IP CURLOPT_NOSIGNAL -Do not install signal handlers. See \fICURLOPT_NOSIGNAL(3)\fP -.IP CURLOPT_WILDCARDMATCH -Transfer multiple files according to a file name pattern. See \fICURLOPT_WILDCARDMATCH(3)\fP -.SH CALLBACK OPTIONS -.IP CURLOPT_WRITEFUNCTION -Callback for writing data. See \fICURLOPT_WRITEFUNCTION(3)\fP -.IP CURLOPT_WRITEDATA -Data pointer to pass to the write callback. See \fICURLOPT_WRITEDATA(3)\fP -.IP CURLOPT_READFUNCTION -Callback for reading data. See \fICURLOPT_READFUNCTION(3)\fP -.IP CURLOPT_READDATA -Data pointer to pass to the read callback. See \fICURLOPT_READDATA(3)\fP -.IP CURLOPT_IOCTLFUNCTION -\fBDeprecated option\fP Callback for I/O operations. -See \fICURLOPT_IOCTLFUNCTION(3)\fP -.IP CURLOPT_IOCTLDATA -\fBDeprecated option\fP Data pointer to pass to the I/O callback. -See \fICURLOPT_IOCTLDATA(3)\fP -.IP CURLOPT_SEEKFUNCTION -Callback for seek operations. See \fICURLOPT_SEEKFUNCTION(3)\fP -.IP CURLOPT_SEEKDATA -Data pointer to pass to the seek callback. See \fICURLOPT_SEEKDATA(3)\fP -.IP CURLOPT_SOCKOPTFUNCTION -Callback for sockopt operations. See \fICURLOPT_SOCKOPTFUNCTION(3)\fP -.IP CURLOPT_SOCKOPTDATA -Data pointer to pass to the sockopt callback. See \fICURLOPT_SOCKOPTDATA(3)\fP -.IP CURLOPT_OPENSOCKETFUNCTION -Callback for socket creation. See \fICURLOPT_OPENSOCKETFUNCTION(3)\fP -.IP CURLOPT_OPENSOCKETDATA -Data pointer to pass to the open socket callback. See \fICURLOPT_OPENSOCKETDATA(3)\fP -.IP CURLOPT_CLOSESOCKETFUNCTION -Callback for closing socket. See \fICURLOPT_CLOSESOCKETFUNCTION(3)\fP -.IP CURLOPT_CLOSESOCKETDATA -Data pointer to pass to the close socket callback. See \fICURLOPT_CLOSESOCKETDATA(3)\fP -.IP CURLOPT_PROGRESSFUNCTION -\fBOBSOLETE\fP callback for progress meter. -See \fICURLOPT_PROGRESSFUNCTION(3)\fP -.IP CURLOPT_PROGRESSDATA -Data pointer to pass to the progress meter callback. See \fICURLOPT_PROGRESSDATA(3)\fP -.IP CURLOPT_XFERINFOFUNCTION -Callback for progress meter. See \fICURLOPT_XFERINFOFUNCTION(3)\fP -.IP CURLOPT_XFERINFODATA -Data pointer to pass to the progress meter callback. See \fICURLOPT_XFERINFODATA(3)\fP -.IP CURLOPT_HEADERFUNCTION -Callback for writing received headers. See \fICURLOPT_HEADERFUNCTION(3)\fP -.IP CURLOPT_HEADERDATA -Data pointer to pass to the header callback. See \fICURLOPT_HEADERDATA(3)\fP -.IP CURLOPT_DEBUGFUNCTION -Callback for debug information. See \fICURLOPT_DEBUGFUNCTION(3)\fP -.IP CURLOPT_DEBUGDATA -Data pointer to pass to the debug callback. See \fICURLOPT_DEBUGDATA(3)\fP -.IP CURLOPT_SSL_CTX_FUNCTION -Callback for SSL context logic. See \fICURLOPT_SSL_CTX_FUNCTION(3)\fP -.IP CURLOPT_SSL_CTX_DATA -Data pointer to pass to the SSL context callback. See \fICURLOPT_SSL_CTX_DATA(3)\fP -.IP CURLOPT_CONV_TO_NETWORK_FUNCTION -\fBOBSOLETE\fP Callback for code base conversion. -See \fICURLOPT_CONV_TO_NETWORK_FUNCTION(3)\fP -.IP CURLOPT_CONV_FROM_NETWORK_FUNCTION -\fBOBSOLETE\fP Callback for code base conversion. -See \fICURLOPT_CONV_FROM_NETWORK_FUNCTION(3)\fP -.IP CURLOPT_CONV_FROM_UTF8_FUNCTION -\fBOBSOLETE\fP Callback for code base conversion. -See \fICURLOPT_CONV_FROM_UTF8_FUNCTION(3)\fP -.IP CURLOPT_INTERLEAVEFUNCTION -Callback for RTSP interleaved data. See \fICURLOPT_INTERLEAVEFUNCTION(3)\fP -.IP CURLOPT_INTERLEAVEDATA -Data pointer to pass to the RTSP interleave callback. See \fICURLOPT_INTERLEAVEDATA(3)\fP -.IP CURLOPT_CHUNK_BGN_FUNCTION -Callback for wildcard download start of chunk. See \fICURLOPT_CHUNK_BGN_FUNCTION(3)\fP -.IP CURLOPT_CHUNK_END_FUNCTION -Callback for wildcard download end of chunk. See \fICURLOPT_CHUNK_END_FUNCTION(3)\fP -.IP CURLOPT_CHUNK_DATA -Data pointer to pass to the chunk callbacks. See \fICURLOPT_CHUNK_DATA(3)\fP -.IP CURLOPT_FNMATCH_FUNCTION -Callback for wildcard matching. See \fICURLOPT_FNMATCH_FUNCTION(3)\fP -.IP CURLOPT_FNMATCH_DATA -Data pointer to pass to the wildcard matching callback. See \fICURLOPT_FNMATCH_DATA(3)\fP -.IP CURLOPT_SUPPRESS_CONNECT_HEADERS -Suppress proxy CONNECT response headers from user callbacks. See \fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP -.IP CURLOPT_RESOLVER_START_FUNCTION -Callback to be called before a new resolve request is started. See \fICURLOPT_RESOLVER_START_FUNCTION(3)\fP -.IP CURLOPT_RESOLVER_START_DATA -Data pointer to pass to resolver start callback. See \fICURLOPT_RESOLVER_START_DATA(3)\fP -.IP CURLOPT_PREREQFUNCTION -Callback to be called after a connection is established but before a request is made on that connection. See \fICURLOPT_PREREQFUNCTION(3)\fP -.IP CURLOPT_PREREQDATA -Data pointer to pass to the CURLOPT_PREREQFUNCTION callback. See \fICURLOPT_PREREQDATA(3)\fP -.SH ERROR OPTIONS -.IP CURLOPT_ERRORBUFFER -Error message buffer. See \fICURLOPT_ERRORBUFFER(3)\fP -.IP CURLOPT_STDERR -stderr replacement stream. See \fICURLOPT_STDERR(3)\fP -.IP CURLOPT_FAILONERROR -Fail on HTTP 4xx errors. \fICURLOPT_FAILONERROR(3)\fP -.IP CURLOPT_KEEP_SENDING_ON_ERROR -Keep sending on HTTP >= 300 errors. \fICURLOPT_KEEP_SENDING_ON_ERROR(3)\fP -.SH NETWORK OPTIONS -.IP CURLOPT_URL -URL to work on. See \fICURLOPT_URL(3)\fP -.IP CURLOPT_PATH_AS_IS -Disable squashing /../ and /./ sequences in the path. See \fICURLOPT_PATH_AS_IS(3)\fP -.IP CURLOPT_PROTOCOLS -\fBDeprecated option\fP Allowed protocols. See \fICURLOPT_PROTOCOLS(3)\fP -.IP CURLOPT_PROTOCOLS_STR -Allowed protocols. See \fICURLOPT_PROTOCOLS_STR(3)\fP -.IP CURLOPT_REDIR_PROTOCOLS -\fBDeprecated option\fP Protocols to allow redirects to. See -\fICURLOPT_REDIR_PROTOCOLS(3)\fP -.IP CURLOPT_REDIR_PROTOCOLS_STR -Protocols to allow redirects to. See \fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP -.IP CURLOPT_DEFAULT_PROTOCOL -Default protocol. See \fICURLOPT_DEFAULT_PROTOCOL(3)\fP -.IP CURLOPT_PROXY -Proxy to use. See \fICURLOPT_PROXY(3)\fP -.IP CURLOPT_PRE_PROXY -Socks proxy to use. See \fICURLOPT_PRE_PROXY(3)\fP -.IP CURLOPT_PROXYPORT -Proxy port to use. See \fICURLOPT_PROXYPORT(3)\fP -.IP CURLOPT_PROXYTYPE -Proxy type. See \fICURLOPT_PROXYTYPE(3)\fP -.IP CURLOPT_NOPROXY -Filter out hosts from proxy use. \fICURLOPT_NOPROXY(3)\fP -.IP CURLOPT_HTTPPROXYTUNNEL -Tunnel through the HTTP proxy. \fICURLOPT_HTTPPROXYTUNNEL(3)\fP -.IP CURLOPT_CONNECT_TO -Connect to a specific host and port. See \fICURLOPT_CONNECT_TO(3)\fP -.IP CURLOPT_SOCKS5_AUTH -Socks5 authentication methods. See \fICURLOPT_SOCKS5_AUTH(3)\fP -.IP CURLOPT_SOCKS5_GSSAPI_SERVICE -\fBDeprecated option\fP Socks5 GSSAPI service name. -See \fICURLOPT_SOCKS5_GSSAPI_SERVICE(3)\fP -.IP CURLOPT_SOCKS5_GSSAPI_NEC -Socks5 GSSAPI NEC mode. See \fICURLOPT_SOCKS5_GSSAPI_NEC(3)\fP -.IP CURLOPT_PROXY_SERVICE_NAME -Proxy authentication service name. \fICURLOPT_PROXY_SERVICE_NAME(3)\fP -.IP CURLOPT_HAPROXYPROTOCOL -Send an HAProxy PROXY protocol v1 header. See \fICURLOPT_HAPROXYPROTOCOL(3)\fP -.IP CURLOPT_HAPROXY_CLIENT_IP -Spoof the client IP in an HAProxy PROXY protocol v1 header. See \fICURLOPT_HAPROXY_CLIENT_IP(3)\fP -.IP CURLOPT_SERVICE_NAME -Authentication service name. \fICURLOPT_SERVICE_NAME(3)\fP -.IP CURLOPT_INTERFACE -Bind connection locally to this. See \fICURLOPT_INTERFACE(3)\fP -.IP CURLOPT_LOCALPORT -Bind connection locally to this port. See \fICURLOPT_LOCALPORT(3)\fP -.IP CURLOPT_LOCALPORTRANGE -Bind connection locally to port range. See \fICURLOPT_LOCALPORTRANGE(3)\fP -.IP CURLOPT_DNS_CACHE_TIMEOUT -Timeout for DNS cache. See \fICURLOPT_DNS_CACHE_TIMEOUT(3)\fP -.IP CURLOPT_DNS_USE_GLOBAL_CACHE -\fBOBSOLETE\fP Enable global DNS cache. -See \fICURLOPT_DNS_USE_GLOBAL_CACHE(3)\fP -.IP CURLOPT_DOH_URL -Use this DoH server for name resolves. See \fICURLOPT_DOH_URL(3)\fP -.IP CURLOPT_BUFFERSIZE -Ask for alternate buffer size. See \fICURLOPT_BUFFERSIZE(3)\fP -.IP CURLOPT_PORT -Port number to connect to. See \fICURLOPT_PORT(3)\fP -.IP CURLOPT_TCP_FASTOPEN -Enable TCP Fast Open. See \fICURLOPT_TCP_FASTOPEN(3)\fP -.IP CURLOPT_TCP_NODELAY -Disable the Nagle algorithm. See \fICURLOPT_TCP_NODELAY(3)\fP -.IP CURLOPT_ADDRESS_SCOPE -IPv6 scope for local addresses. See \fICURLOPT_ADDRESS_SCOPE(3)\fP -.IP CURLOPT_TCP_KEEPALIVE -Enable TCP keep-alive. See \fICURLOPT_TCP_KEEPALIVE(3)\fP -.IP CURLOPT_TCP_KEEPIDLE -Idle time before sending keep-alive. See \fICURLOPT_TCP_KEEPIDLE(3)\fP -.IP CURLOPT_TCP_KEEPINTVL -Interval between keep-alive probes. See \fICURLOPT_TCP_KEEPINTVL(3)\fP -.IP CURLOPT_UNIX_SOCKET_PATH -Path to a Unix domain socket. See \fICURLOPT_UNIX_SOCKET_PATH(3)\fP -.IP CURLOPT_ABSTRACT_UNIX_SOCKET -Path to an abstract Unix domain socket. See \fICURLOPT_ABSTRACT_UNIX_SOCKET(3)\fP -.SH NAMES and PASSWORDS OPTIONS (Authentication) -.IP CURLOPT_NETRC -Enable .netrc parsing. See \fICURLOPT_NETRC(3)\fP -.IP CURLOPT_NETRC_FILE -\&.netrc file name. See \fICURLOPT_NETRC_FILE(3)\fP -.IP CURLOPT_USERPWD -User name and password. See \fICURLOPT_USERPWD(3)\fP -.IP CURLOPT_PROXYUSERPWD -Proxy user name and password. See \fICURLOPT_PROXYUSERPWD(3)\fP -.IP CURLOPT_USERNAME -User name. See \fICURLOPT_USERNAME(3)\fP -.IP CURLOPT_PASSWORD -Password. See \fICURLOPT_PASSWORD(3)\fP -.IP CURLOPT_LOGIN_OPTIONS -Login options. See \fICURLOPT_LOGIN_OPTIONS(3)\fP -.IP CURLOPT_PROXYUSERNAME -Proxy user name. See \fICURLOPT_PROXYUSERNAME(3)\fP -.IP CURLOPT_PROXYPASSWORD -Proxy password. See \fICURLOPT_PROXYPASSWORD(3)\fP -.IP CURLOPT_HTTPAUTH -HTTP server authentication methods. See \fICURLOPT_HTTPAUTH(3)\fP -.IP CURLOPT_TLSAUTH_USERNAME -TLS authentication user name. See \fICURLOPT_TLSAUTH_USERNAME(3)\fP -.IP CURLOPT_PROXY_TLSAUTH_USERNAME -Proxy TLS authentication user name. See \fICURLOPT_PROXY_TLSAUTH_USERNAME(3)\fP -.IP CURLOPT_TLSAUTH_PASSWORD -TLS authentication password. See \fICURLOPT_TLSAUTH_PASSWORD(3)\fP -.IP CURLOPT_PROXY_TLSAUTH_PASSWORD -Proxy TLS authentication password. See \fICURLOPT_PROXY_TLSAUTH_PASSWORD(3)\fP -.IP CURLOPT_TLSAUTH_TYPE -TLS authentication methods. See \fICURLOPT_TLSAUTH_TYPE(3)\fP -.IP CURLOPT_PROXY_TLSAUTH_TYPE -Proxy TLS authentication methods. See \fICURLOPT_PROXY_TLSAUTH_TYPE(3)\fP -.IP CURLOPT_PROXYAUTH -HTTP proxy authentication methods. See \fICURLOPT_PROXYAUTH(3)\fP -.IP CURLOPT_SASL_AUTHZID -SASL authorization identity (identity to act as). See \fICURLOPT_SASL_AUTHZID(3)\fP -.IP CURLOPT_SASL_IR -Enable SASL initial response. See \fICURLOPT_SASL_IR(3)\fP -.IP CURLOPT_XOAUTH2_BEARER -OAuth2 bearer token. See \fICURLOPT_XOAUTH2_BEARER(3)\fP -.IP CURLOPT_DISALLOW_USERNAME_IN_URL -Do not allow username in URL. See \fICURLOPT_DISALLOW_USERNAME_IN_URL(3)\fP -.SH HTTP OPTIONS -.IP CURLOPT_AUTOREFERER -Automatically set Referer: header. See \fICURLOPT_AUTOREFERER(3)\fP -.IP CURLOPT_ACCEPT_ENCODING -Accept-Encoding and automatic decompressing data. See \fICURLOPT_ACCEPT_ENCODING(3)\fP -.IP CURLOPT_TRANSFER_ENCODING -Request Transfer-Encoding. See \fICURLOPT_TRANSFER_ENCODING(3)\fP -.IP CURLOPT_FOLLOWLOCATION -Follow HTTP redirects. See \fICURLOPT_FOLLOWLOCATION(3)\fP -.IP CURLOPT_UNRESTRICTED_AUTH -Do not restrict authentication to original host. \fICURLOPT_UNRESTRICTED_AUTH(3)\fP -.IP CURLOPT_MAXREDIRS -Maximum number of redirects to follow. See \fICURLOPT_MAXREDIRS(3)\fP -.IP CURLOPT_POSTREDIR -How to act on redirects after POST. See \fICURLOPT_POSTREDIR(3)\fP -.IP CURLOPT_PUT -\fBDeprecated option\fP Issue an HTTP PUT request. See \fICURLOPT_PUT(3)\fP -.IP CURLOPT_POST -Issue an HTTP POST request. See \fICURLOPT_POST(3)\fP -.IP CURLOPT_POSTFIELDS -Send a POST with this data. See \fICURLOPT_POSTFIELDS(3)\fP -.IP CURLOPT_POSTFIELDSIZE -The POST data is this big. See \fICURLOPT_POSTFIELDSIZE(3)\fP -.IP CURLOPT_POSTFIELDSIZE_LARGE -The POST data is this big. See \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP -.IP CURLOPT_COPYPOSTFIELDS -Send a POST with this data - and copy it. See \fICURLOPT_COPYPOSTFIELDS(3)\fP -.IP CURLOPT_HTTPPOST -\fBDeprecated option\fP Multipart formpost HTTP POST. -See \fICURLOPT_HTTPPOST(3)\fP -.IP CURLOPT_REFERER -Referer: header. See \fICURLOPT_REFERER(3)\fP -.IP CURLOPT_USERAGENT -User-Agent: header. See \fICURLOPT_USERAGENT(3)\fP -.IP CURLOPT_HTTPHEADER -Custom HTTP headers. See \fICURLOPT_HTTPHEADER(3)\fP -.IP CURLOPT_HEADEROPT -Control custom headers. See \fICURLOPT_HEADEROPT(3)\fP -.IP CURLOPT_PROXYHEADER -Custom HTTP headers sent to proxy. See \fICURLOPT_PROXYHEADER(3)\fP -.IP CURLOPT_HTTP200ALIASES -Alternative versions of 200 OK. See \fICURLOPT_HTTP200ALIASES(3)\fP -.IP CURLOPT_COOKIE -Cookie(s) to send. See \fICURLOPT_COOKIE(3)\fP -.IP CURLOPT_COOKIEFILE -File to read cookies from. See \fICURLOPT_COOKIEFILE(3)\fP -.IP CURLOPT_COOKIEJAR -File to write cookies to. See \fICURLOPT_COOKIEJAR(3)\fP -.IP CURLOPT_COOKIESESSION -Start a new cookie session. See \fICURLOPT_COOKIESESSION(3)\fP -.IP CURLOPT_COOKIELIST -Add or control cookies. See \fICURLOPT_COOKIELIST(3)\fP -.IP CURLOPT_ALTSVC -Specify the Alt-Svc: cache file name. See \fICURLOPT_ALTSVC(3)\fP -.IP CURLOPT_ALTSVC_CTRL -Enable and configure Alt-Svc: treatment. See \fICURLOPT_ALTSVC_CTRL(3)\fP -.IP CURLOPT_HSTS -Set HSTS cache file. See \fICURLOPT_HSTS(3)\fP -.IP CURLOPT_HSTS_CTRL -Enable HSTS. See \fICURLOPT_HSTS_CTRL(3)\fP -.IP CURLOPT_HSTSREADFUNCTION -Set HSTS read callback. See \fICURLOPT_HSTSREADFUNCTION(3)\fP -.IP CURLOPT_HSTSREADDATA -Pass pointer to the HSTS read callback. See \fICURLOPT_HSTSREADDATA(3)\fP -.IP CURLOPT_HSTSWRITEFUNCTION -Set HSTS write callback. See \fICURLOPT_HSTSWRITEFUNCTION(3)\fP -.IP CURLOPT_HSTSWRITEDATA -Pass pointer to the HSTS write callback. See \fICURLOPT_HSTSWRITEDATA(3)\fP -.IP CURLOPT_HTTPGET -Do an HTTP GET request. See \fICURLOPT_HTTPGET(3)\fP -.IP CURLOPT_REQUEST_TARGET -Set the request target. \fICURLOPT_REQUEST_TARGET(3)\fP -.IP CURLOPT_HTTP_VERSION -HTTP version to use. \fICURLOPT_HTTP_VERSION(3)\fP -.IP CURLOPT_HTTP09_ALLOWED -Allow HTTP/0.9 responses. \fICURLOPT_HTTP09_ALLOWED(3)\fP -.IP CURLOPT_IGNORE_CONTENT_LENGTH -Ignore Content-Length. See \fICURLOPT_IGNORE_CONTENT_LENGTH(3)\fP -.IP CURLOPT_HTTP_CONTENT_DECODING -Disable Content decoding. See \fICURLOPT_HTTP_CONTENT_DECODING(3)\fP -.IP CURLOPT_HTTP_TRANSFER_DECODING -Disable Transfer decoding. See \fICURLOPT_HTTP_TRANSFER_DECODING(3)\fP -.IP CURLOPT_EXPECT_100_TIMEOUT_MS -100-continue timeout. See \fICURLOPT_EXPECT_100_TIMEOUT_MS(3)\fP -.IP CURLOPT_TRAILERFUNCTION -Set callback for sending trailing headers. See -\fICURLOPT_TRAILERFUNCTION(3)\fP -.IP CURLOPT_TRAILERDATA -Custom pointer passed to the trailing headers callback. See -\fICURLOPT_TRAILERDATA(3)\fP -.IP CURLOPT_PIPEWAIT -Wait on connection to pipeline on it. See \fICURLOPT_PIPEWAIT(3)\fP -.IP CURLOPT_STREAM_DEPENDS -This HTTP/2 stream depends on another. See \fICURLOPT_STREAM_DEPENDS(3)\fP -.IP CURLOPT_STREAM_DEPENDS_E -This HTTP/2 stream depends on another exclusively. See -\fICURLOPT_STREAM_DEPENDS_E(3)\fP -.IP CURLOPT_STREAM_WEIGHT -Set this HTTP/2 stream's weight. See \fICURLOPT_STREAM_WEIGHT(3)\fP -.SH SMTP OPTIONS -.IP CURLOPT_MAIL_FROM -Address of the sender. See \fICURLOPT_MAIL_FROM(3)\fP -.IP CURLOPT_MAIL_RCPT -Address of the recipients. See \fICURLOPT_MAIL_RCPT(3)\fP -.IP CURLOPT_MAIL_AUTH -Authentication address. See \fICURLOPT_MAIL_AUTH(3)\fP -.IP CURLOPT_MAIL_RCPT_ALLOWFAILS -Allow RCPT TO command to fail for some recipients. See -\fICURLOPT_MAIL_RCPT_ALLOWFAILS(3)\fP -.SH TFTP OPTIONS -.IP CURLOPT_TFTP_BLKSIZE -TFTP block size. See \fICURLOPT_TFTP_BLKSIZE(3)\fP -.IP CURLOPT_TFTP_NO_OPTIONS -Do not send TFTP options requests. See \fICURLOPT_TFTP_NO_OPTIONS(3)\fP -.SH FTP OPTIONS -.IP CURLOPT_FTPPORT -Use active FTP. See \fICURLOPT_FTPPORT(3)\fP -.IP CURLOPT_QUOTE -Commands to run before transfer. See \fICURLOPT_QUOTE(3)\fP -.IP CURLOPT_POSTQUOTE -Commands to run after transfer. See \fICURLOPT_POSTQUOTE(3)\fP -.IP CURLOPT_PREQUOTE -Commands to run just before transfer. See \fICURLOPT_PREQUOTE(3)\fP -.IP CURLOPT_APPEND -Append to remote file. See \fICURLOPT_APPEND(3)\fP -.IP CURLOPT_FTP_USE_EPRT -Use EPRT. See \fICURLOPT_FTP_USE_EPRT(3)\fP -.IP CURLOPT_FTP_USE_EPSV -Use EPSV. See \fICURLOPT_FTP_USE_EPSV(3)\fP -.IP CURLOPT_FTP_USE_PRET -Use PRET. See \fICURLOPT_FTP_USE_PRET(3)\fP -.IP CURLOPT_FTP_CREATE_MISSING_DIRS -Create missing directories on the remote server. See \fICURLOPT_FTP_CREATE_MISSING_DIRS(3)\fP -.IP CURLOPT_SERVER_RESPONSE_TIMEOUT -Timeout for server responses. See \fICURLOPT_SERVER_RESPONSE_TIMEOUT(3)\fP -.IP CURLOPT_SERVER_RESPONSE_TIMEOUT_MS -Timeout for server responses. See \fICURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3)\fP -.IP CURLOPT_FTP_ALTERNATIVE_TO_USER -Alternative to USER. See \fICURLOPT_FTP_ALTERNATIVE_TO_USER(3)\fP -.IP CURLOPT_FTP_SKIP_PASV_IP -Ignore the IP address in the PASV response. See \fICURLOPT_FTP_SKIP_PASV_IP(3)\fP -.IP CURLOPT_FTPSSLAUTH -Control how to do TLS. See \fICURLOPT_FTPSSLAUTH(3)\fP -.IP CURLOPT_FTP_SSL_CCC -Back to non-TLS again after authentication. See \fICURLOPT_FTP_SSL_CCC(3)\fP -.IP CURLOPT_FTP_ACCOUNT -Send ACCT command. See \fICURLOPT_FTP_ACCOUNT(3)\fP -.IP CURLOPT_FTP_FILEMETHOD -Specify how to reach files. See \fICURLOPT_FTP_FILEMETHOD(3)\fP -.SH RTSP OPTIONS -.IP CURLOPT_RTSP_REQUEST -RTSP request. See \fICURLOPT_RTSP_REQUEST(3)\fP -.IP CURLOPT_RTSP_SESSION_ID -RTSP session-id. See \fICURLOPT_RTSP_SESSION_ID(3)\fP -.IP CURLOPT_RTSP_STREAM_URI -RTSP stream URI. See \fICURLOPT_RTSP_STREAM_URI(3)\fP -.IP CURLOPT_RTSP_TRANSPORT -RTSP Transport: header. See \fICURLOPT_RTSP_TRANSPORT(3)\fP -.IP CURLOPT_RTSP_CLIENT_CSEQ -Client CSEQ number. See \fICURLOPT_RTSP_CLIENT_CSEQ(3)\fP -.IP CURLOPT_RTSP_SERVER_CSEQ -CSEQ number for RTSP Server->Client request. See \fICURLOPT_RTSP_SERVER_CSEQ(3)\fP -.IP CURLOPT_AWS_SIGV4 -AWS HTTP V4 Signature. See \fICURLOPT_AWS_SIGV4(3)\fP -.SH PROTOCOL OPTIONS -.IP CURLOPT_TRANSFERTEXT -Use text transfer. See \fICURLOPT_TRANSFERTEXT(3)\fP -.IP CURLOPT_PROXY_TRANSFER_MODE -Add transfer mode to URL over proxy. See \fICURLOPT_PROXY_TRANSFER_MODE(3)\fP -.IP CURLOPT_CRLF -Convert newlines. See \fICURLOPT_CRLF(3)\fP -.IP CURLOPT_RANGE -Range requests. See \fICURLOPT_RANGE(3)\fP -.IP CURLOPT_RESUME_FROM -Resume a transfer. See \fICURLOPT_RESUME_FROM(3)\fP -.IP CURLOPT_RESUME_FROM_LARGE -Resume a transfer. See \fICURLOPT_RESUME_FROM_LARGE(3)\fP -.IP CURLOPT_CURLU -Set URL to work on with a URL handle. See \fICURLOPT_CURLU(3)\fP -.IP CURLOPT_CUSTOMREQUEST -Custom request/method. See \fICURLOPT_CUSTOMREQUEST(3)\fP -.IP CURLOPT_FILETIME -Request file modification date and time. See \fICURLOPT_FILETIME(3)\fP -.IP CURLOPT_DIRLISTONLY -List only. See \fICURLOPT_DIRLISTONLY(3)\fP -.IP CURLOPT_NOBODY -Do not get the body contents. See \fICURLOPT_NOBODY(3)\fP -.IP CURLOPT_INFILESIZE -Size of file to send. \fICURLOPT_INFILESIZE(3)\fP -.IP CURLOPT_INFILESIZE_LARGE -Size of file to send. \fICURLOPT_INFILESIZE_LARGE(3)\fP -.IP CURLOPT_UPLOAD -Upload data. See \fICURLOPT_UPLOAD(3)\fP -.IP CURLOPT_UPLOAD_BUFFERSIZE -Set upload buffer size. See \fICURLOPT_UPLOAD_BUFFERSIZE(3)\fP -.IP CURLOPT_MIMEPOST -Post/send MIME data. See \fICURLOPT_MIMEPOST(3)\fP -.IP CURLOPT_MIME_OPTIONS -Set MIME option flags. See \fICURLOPT_MIME_OPTIONS(3)\fP -.IP CURLOPT_MAXFILESIZE -Maximum file size to get. See \fICURLOPT_MAXFILESIZE(3)\fP -.IP CURLOPT_MAXFILESIZE_LARGE -Maximum file size to get. See \fICURLOPT_MAXFILESIZE_LARGE(3)\fP -.IP CURLOPT_TIMECONDITION -Make a time conditional request. See \fICURLOPT_TIMECONDITION(3)\fP -.IP CURLOPT_TIMEVALUE -Time value for the time conditional request. See \fICURLOPT_TIMEVALUE(3)\fP -.IP CURLOPT_TIMEVALUE_LARGE -Time value for the time conditional request. See \fICURLOPT_TIMEVALUE_LARGE(3)\fP -.SH CONNECTION OPTIONS -.IP CURLOPT_TIMEOUT -Timeout for the entire request. See \fICURLOPT_TIMEOUT(3)\fP -.IP CURLOPT_TIMEOUT_MS -Millisecond timeout for the entire request. See \fICURLOPT_TIMEOUT_MS(3)\fP -.IP CURLOPT_LOW_SPEED_LIMIT -Low speed limit to abort transfer. See \fICURLOPT_LOW_SPEED_LIMIT(3)\fP -.IP CURLOPT_LOW_SPEED_TIME -Time to be below the speed to trigger low speed abort. See \fICURLOPT_LOW_SPEED_TIME(3)\fP -.IP CURLOPT_MAX_SEND_SPEED_LARGE -Cap the upload speed to this. See \fICURLOPT_MAX_SEND_SPEED_LARGE(3)\fP -.IP CURLOPT_MAX_RECV_SPEED_LARGE -Cap the download speed to this. See \fICURLOPT_MAX_RECV_SPEED_LARGE(3)\fP -.IP CURLOPT_MAXCONNECTS -Maximum number of connections in the connection pool. See \fICURLOPT_MAXCONNECTS(3)\fP -.IP CURLOPT_FRESH_CONNECT -Use a new connection. \fICURLOPT_FRESH_CONNECT(3)\fP -.IP CURLOPT_FORBID_REUSE -Prevent subsequent connections from reusing this. See \fICURLOPT_FORBID_REUSE(3)\fP -.IP CURLOPT_MAXAGE_CONN -Limit the age (idle time) of connections for reuse. See \fICURLOPT_MAXAGE_CONN(3)\fP -.IP CURLOPT_MAXLIFETIME_CONN -Limit the age (since creation) of connections for reuse. See \fICURLOPT_MAXLIFETIME_CONN(3)\fP -.IP CURLOPT_CONNECTTIMEOUT -Timeout for the connection phase. See \fICURLOPT_CONNECTTIMEOUT(3)\fP -.IP CURLOPT_CONNECTTIMEOUT_MS -Millisecond timeout for the connection phase. See \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP -.IP CURLOPT_IPRESOLVE -IP version to use. See \fICURLOPT_IPRESOLVE(3)\fP -.IP CURLOPT_CONNECT_ONLY -Only connect, nothing else. See \fICURLOPT_CONNECT_ONLY(3)\fP -.IP CURLOPT_USE_SSL -Use TLS/SSL. See \fICURLOPT_USE_SSL(3)\fP -.IP CURLOPT_RESOLVE -Provide fixed/fake name resolves. See \fICURLOPT_RESOLVE(3)\fP -.IP CURLOPT_DNS_INTERFACE -Bind name resolves to this interface. See \fICURLOPT_DNS_INTERFACE(3)\fP -.IP CURLOPT_DNS_LOCAL_IP4 -Bind name resolves to this IP4 address. See \fICURLOPT_DNS_LOCAL_IP4(3)\fP -.IP CURLOPT_DNS_LOCAL_IP6 -Bind name resolves to this IP6 address. See \fICURLOPT_DNS_LOCAL_IP6(3)\fP -.IP CURLOPT_DNS_SERVERS -Preferred DNS servers. See \fICURLOPT_DNS_SERVERS(3)\fP -.IP CURLOPT_DNS_SHUFFLE_ADDRESSES -Shuffle addresses before use. See \fICURLOPT_DNS_SHUFFLE_ADDRESSES(3)\fP -.IP CURLOPT_ACCEPTTIMEOUT_MS -Timeout for waiting for the server's connect back to be accepted. See \fICURLOPT_ACCEPTTIMEOUT_MS(3)\fP -.IP CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS -Timeout for happy eyeballs. See \fICURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3)\fP -.IP CURLOPT_UPKEEP_INTERVAL_MS -Sets the interval at which connection upkeep are performed. See -\fICURLOPT_UPKEEP_INTERVAL_MS(3)\fP -.SH SSL and SECURITY OPTIONS -.IP CURLOPT_SSLCERT -Client cert. See \fICURLOPT_SSLCERT(3)\fP -.IP CURLOPT_SSLCERT_BLOB -Client cert memory buffer. See \fICURLOPT_SSLCERT_BLOB(3)\fP -.IP CURLOPT_PROXY_SSLCERT -Proxy client cert. See \fICURLOPT_PROXY_SSLCERT(3)\fP -.IP CURLOPT_PROXY_SSLCERT_BLOB -Proxy client cert memory buffer. See \fICURLOPT_PROXY_SSLCERT_BLOB(3)\fP -.IP CURLOPT_SSLCERTTYPE -Client cert type. See \fICURLOPT_SSLCERTTYPE(3)\fP -.IP CURLOPT_PROXY_SSLCERTTYPE -Proxy client cert type. See \fICURLOPT_PROXY_SSLCERTTYPE(3)\fP -.IP CURLOPT_SSLKEY -Client key. See \fICURLOPT_SSLKEY(3)\fP -.IP CURLOPT_SSLKEY_BLOB -Client key memory buffer. See \fICURLOPT_SSLKEY_BLOB(3)\fP -.IP CURLOPT_PROXY_SSLKEY -Proxy client key. See \fICURLOPT_PROXY_SSLKEY(3)\fP -.IP CURLOPT_PROXY_SSLKEY_BLOB -Proxy client key. See \fICURLOPT_PROXY_SSLKEY_BLOB(3)\fP -.IP CURLOPT_SSLKEYTYPE -Client key type. See \fICURLOPT_SSLKEYTYPE(3)\fP -.IP CURLOPT_PROXY_SSLKEYTYPE -Proxy client key type. See \fICURLOPT_PROXY_SSLKEYTYPE(3)\fP -.IP CURLOPT_KEYPASSWD -Client key password. See \fICURLOPT_KEYPASSWD(3)\fP -.IP CURLOPT_PROXY_KEYPASSWD -Proxy client key password. See \fICURLOPT_PROXY_KEYPASSWD(3)\fP -.IP CURLOPT_SSL_EC_CURVES -Set key exchange curves. See \fICURLOPT_SSL_EC_CURVES(3)\fP -.IP CURLOPT_SSL_ENABLE_ALPN -Enable use of ALPN. See \fICURLOPT_SSL_ENABLE_ALPN(3)\fP -.IP CURLOPT_SSL_ENABLE_NPN -\fBOBSOLETE\fP Enable use of NPN. See \fICURLOPT_SSL_ENABLE_NPN(3)\fP -.IP CURLOPT_SSLENGINE -Use identifier with SSL engine. See \fICURLOPT_SSLENGINE(3)\fP -.IP CURLOPT_SSLENGINE_DEFAULT -Default SSL engine. See \fICURLOPT_SSLENGINE_DEFAULT(3)\fP -.IP CURLOPT_SSL_FALSESTART -Enable TLS False Start. See \fICURLOPT_SSL_FALSESTART(3)\fP -.IP CURLOPT_SSLVERSION -SSL version to use. See \fICURLOPT_SSLVERSION(3)\fP -.IP CURLOPT_PROXY_SSLVERSION -Proxy SSL version to use. See \fICURLOPT_PROXY_SSLVERSION(3)\fP -.IP CURLOPT_SSL_VERIFYHOST -Verify the host name in the SSL certificate. See \fICURLOPT_SSL_VERIFYHOST(3)\fP -.IP CURLOPT_DOH_SSL_VERIFYHOST -Verify the host name in the DoH (DNS-over-HTTPS) SSL certificate. See -\fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP -.IP CURLOPT_PROXY_SSL_VERIFYHOST -Verify the host name in the proxy SSL certificate. See \fICURLOPT_PROXY_SSL_VERIFYHOST(3)\fP -.IP CURLOPT_SSL_VERIFYPEER -Verify the SSL certificate. See \fICURLOPT_SSL_VERIFYPEER(3)\fP -.IP CURLOPT_DOH_SSL_VERIFYPEER -Verify the DoH (DNS-over-HTTPS) SSL certificate. See -\fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP -.IP CURLOPT_PROXY_SSL_VERIFYPEER -Verify the proxy SSL certificate. See \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP -.IP CURLOPT_SSL_VERIFYSTATUS -Verify the SSL certificate's status. See \fICURLOPT_SSL_VERIFYSTATUS(3)\fP -.IP CURLOPT_DOH_SSL_VERIFYSTATUS -Verify the DoH (DNS-over-HTTPS) SSL certificate's status. See -\fICURLOPT_DOH_SSL_VERIFYSTATUS(3)\fP -.IP CURLOPT_CAINFO -CA cert bundle. See \fICURLOPT_CAINFO(3)\fP -.IP CURLOPT_CAINFO_BLOB -CA cert bundle memory buffer. See \fICURLOPT_CAINFO_BLOB(3)\fP -.IP CURLOPT_PROXY_CAINFO -Proxy CA cert bundle. See \fICURLOPT_PROXY_CAINFO(3)\fP -.IP CURLOPT_PROXY_CAINFO_BLOB -Proxy CA cert bundle memory buffer. See \fICURLOPT_PROXY_CAINFO_BLOB(3)\fP -.IP CURLOPT_ISSUERCERT -Issuer certificate. See \fICURLOPT_ISSUERCERT(3)\fP -.IP CURLOPT_ISSUERCERT_BLOB -Issuer certificate memory buffer. See \fICURLOPT_ISSUERCERT_BLOB(3)\fP -.IP CURLOPT_PROXY_ISSUERCERT -Proxy issuer certificate. See \fICURLOPT_PROXY_ISSUERCERT(3)\fP -.IP CURLOPT_PROXY_ISSUERCERT_BLOB -Proxy issuer certificate memory buffer. See \fICURLOPT_PROXY_ISSUERCERT_BLOB(3)\fP -.IP CURLOPT_CAPATH -Path to CA cert bundle. See \fICURLOPT_CAPATH(3)\fP -.IP CURLOPT_PROXY_CAPATH -Path to proxy CA cert bundle. See \fICURLOPT_PROXY_CAPATH(3)\fP -.IP CURLOPT_CRLFILE -Certificate Revocation List. See \fICURLOPT_CRLFILE(3)\fP -.IP CURLOPT_PROXY_CRLFILE -Proxy Certificate Revocation List. See \fICURLOPT_PROXY_CRLFILE(3)\fP -.IP CURLOPT_CA_CACHE_TIMEOUT -Timeout for CA cache. See \fICURLOPT_CA_CACHE_TIMEOUT(3)\fP -.IP CURLOPT_CERTINFO -Extract certificate info. See \fICURLOPT_CERTINFO(3)\fP -.IP CURLOPT_PINNEDPUBLICKEY -Set pinned SSL public key . See \fICURLOPT_PINNEDPUBLICKEY(3)\fP -.IP CURLOPT_PROXY_PINNEDPUBLICKEY -Set the proxy's pinned SSL public key. See -\fICURLOPT_PROXY_PINNEDPUBLICKEY(3)\fP -.IP CURLOPT_RANDOM_FILE -\fBOBSOLETE\fP Provide source for entropy random data. -See \fICURLOPT_RANDOM_FILE(3)\fP -.IP CURLOPT_EGDSOCKET -\fBOBSOLETE\fP Identify EGD socket for entropy. See \fICURLOPT_EGDSOCKET(3)\fP -.IP CURLOPT_SSL_CIPHER_LIST -Ciphers to use. See \fICURLOPT_SSL_CIPHER_LIST(3)\fP -.IP CURLOPT_PROXY_SSL_CIPHER_LIST -Proxy ciphers to use. See \fICURLOPT_PROXY_SSL_CIPHER_LIST(3)\fP -.IP CURLOPT_TLS13_CIPHERS -TLS 1.3 cipher suites to use. See \fICURLOPT_TLS13_CIPHERS(3)\fP -.IP CURLOPT_PROXY_TLS13_CIPHERS -Proxy TLS 1.3 cipher suites to use. See \fICURLOPT_PROXY_TLS13_CIPHERS(3)\fP -.IP CURLOPT_SSL_SESSIONID_CACHE -Disable SSL session-id cache. See \fICURLOPT_SSL_SESSIONID_CACHE(3)\fP -.IP CURLOPT_SSL_OPTIONS -Control SSL behavior. See \fICURLOPT_SSL_OPTIONS(3)\fP -.IP CURLOPT_PROXY_SSL_OPTIONS -Control proxy SSL behavior. See \fICURLOPT_PROXY_SSL_OPTIONS(3)\fP -.IP CURLOPT_KRBLEVEL -Kerberos security level. See \fICURLOPT_KRBLEVEL(3)\fP -.IP CURLOPT_GSSAPI_DELEGATION -Disable GSS-API delegation. See \fICURLOPT_GSSAPI_DELEGATION(3)\fP -.SH SSH OPTIONS -.IP CURLOPT_SSH_AUTH_TYPES -SSH authentication types. See \fICURLOPT_SSH_AUTH_TYPES(3)\fP -.IP CURLOPT_SSH_COMPRESSION -Enable SSH compression. See \fICURLOPT_SSH_COMPRESSION(3)\fP -.IP CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 -MD5 of host's public key. See \fICURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)\fP -.IP CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 -SHA256 of host's public key. See \fICURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3)\fP -.IP CURLOPT_SSH_PUBLIC_KEYFILE -File name of public key. See \fICURLOPT_SSH_PUBLIC_KEYFILE(3)\fP -.IP CURLOPT_SSH_PRIVATE_KEYFILE -File name of private key. See \fICURLOPT_SSH_PRIVATE_KEYFILE(3)\fP -.IP CURLOPT_SSH_KNOWNHOSTS -File name with known hosts. See \fICURLOPT_SSH_KNOWNHOSTS(3)\fP -.IP CURLOPT_SSH_KEYFUNCTION -Callback for known hosts handling. See \fICURLOPT_SSH_KEYFUNCTION(3)\fP -.IP CURLOPT_SSH_KEYDATA -Custom pointer to pass to ssh key callback. See \fICURLOPT_SSH_KEYDATA(3)\fP -.IP CURLOPT_SSH_HOSTKEYFUNCTION -Callback for checking host key handling. See \fICURLOPT_SSH_HOSTKEYFUNCTION(3)\fP -.IP CURLOPT_SSH_HOSTKEYDATA -Custom pointer to pass to ssh host key callback. See \fICURLOPT_SSH_HOSTKEYDATA(3)\fP -.SH WEBSOCKET -.IP CURLOPT_WS_OPTIONS -Set WebSocket options. See \fICURLOPT_WS_OPTIONS(3)\fP -.SH OTHER OPTIONS -.IP CURLOPT_PRIVATE -Private pointer to store. See \fICURLOPT_PRIVATE(3)\fP -.IP CURLOPT_SHARE -Share object to use. See \fICURLOPT_SHARE(3)\fP -.IP CURLOPT_NEW_FILE_PERMS -Mode for creating new remote files. See \fICURLOPT_NEW_FILE_PERMS(3)\fP -.IP CURLOPT_NEW_DIRECTORY_PERMS -Mode for creating new remote directories. See \fICURLOPT_NEW_DIRECTORY_PERMS(3)\fP -.IP CURLOPT_QUICK_EXIT -To be set by toplevel tools like "curl" to skip lengthy cleanups when they are about to call exit() anyway. See \fICURLOPT_QUICK_EXIT(3)\fP -.SH TELNET OPTIONS -.IP CURLOPT_TELNETOPTIONS -TELNET options. See \fICURLOPT_TELNETOPTIONS(3)\fP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -\fICURLE_OK\fP (zero) means that the option was set properly, non-zero means an -error occurred as \fI\fP defines. See the \fIlibcurl-errors(3)\fP -man page for the full list with descriptions. - -Strings passed on to libcurl must be shorter than 8000000 bytes, otherwise -\fIcurl_easy_setopt(3)\fP returns \fBCURLE_BAD_FUNCTION_ARGUMENT\fP (added in -7.65.0). - -\fBCURLE_BAD_FUNCTION_ARGUMENT\fP is returned when the argument to an option -is invalid, like perhaps out of range. - -If you try to set an option that libcurl does not know about, perhaps because -the library is too old to support it or the option was removed in a recent -version, this function returns \fICURLE_UNKNOWN_OPTION\fP. If support for the -option was disabled at compile-time, it returns \fICURLE_NOT_BUILT_IN\fP. -.SH "SEE ALSO" -.BR curl_easy_cleanup (3), -.BR curl_easy_getinfo (3), -.BR curl_easy_init (3), -.BR curl_easy_option_by_id (3), -.BR curl_easy_option_by_name (3), -.BR curl_easy_option_next (3), -.BR curl_easy_reset (3), -.BR curl_multi_setopt (3) diff --git a/docs/libcurl/curl_easy_setopt.md b/docs/libcurl/curl_easy_setopt.md new file mode 100644 index 000000000..a57798829 --- /dev/null +++ b/docs/libcurl/curl_easy_setopt.md @@ -0,0 +1,1381 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_setopt +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_getinfo (3) + - curl_easy_init (3) + - curl_easy_option_by_id (3) + - curl_easy_option_by_name (3) + - curl_easy_option_next (3) + - curl_easy_reset (3) + - curl_multi_setopt (3) +--- + +# NAME + +curl_easy_setopt - set options for a curl easy handle + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter); +~~~ + +# DESCRIPTION + +curl_easy_setopt(3) is used to tell libcurl how to behave. By setting the +appropriate options, the application can change libcurl's behavior. All +options are set with an *option* followed by a *parameter*. That parameter can +be a **long**, a **function pointer**, an **object pointer** or a +**curl_off_t**, depending on what the specific option expects. Read this +manual carefully as bad input values may cause libcurl to behave badly! You +can only set one option in each function call. A typical application uses many +curl_easy_setopt(3) calls in the setup phase. + +Options set with this function call are valid for all forthcoming transfers +performed using this *handle*. The options are not in any way reset between +transfers, so if you want subsequent transfers with different options, you +must change them between the transfers. You can optionally reset all options +back to internal default with curl_easy_reset(3). + +Strings passed to libcurl as 'char *' arguments, are copied by the library; +the string storage associated to the pointer argument may be discarded or +reused after curl_easy_setopt(3) returns. The only exception to this rule is +really CURLOPT_POSTFIELDS(3), but the alternative that copies the string +CURLOPT_COPYPOSTFIELDS(3) has some usage characteristics you need to read up +on. This function does not accept input strings longer than +**CURL_MAX_INPUT_LENGTH** (8 MB). + +The order in which the options are set does not matter. + +Before version 7.17.0, strings were not copied. Instead the user was forced +keep them available until libcurl no longer needed them. + +The *handle* is the return code from a curl_easy_init(3) or +curl_easy_duphandle(3) call. + +# BEHAVIOR OPTIONS + +## CURLOPT_VERBOSE + +Display verbose information. See CURLOPT_VERBOSE(3) + +## CURLOPT_HEADER + +Include the header in the body output. See CURLOPT_HEADER(3) + +## CURLOPT_NOPROGRESS + +Shut off the progress meter. See CURLOPT_NOPROGRESS(3) + +## CURLOPT_NOSIGNAL + +Do not install signal handlers. See CURLOPT_NOSIGNAL(3) + +## CURLOPT_WILDCARDMATCH + +Transfer multiple files according to a file name pattern. See +CURLOPT_WILDCARDMATCH(3) + +# CALLBACK OPTIONS + +## CURLOPT_WRITEFUNCTION + +Callback for writing data. See CURLOPT_WRITEFUNCTION(3) + +## CURLOPT_WRITEDATA + +Data pointer to pass to the write callback. See CURLOPT_WRITEDATA(3) + +## CURLOPT_READFUNCTION + +Callback for reading data. See CURLOPT_READFUNCTION(3) + +## CURLOPT_READDATA + +Data pointer to pass to the read callback. See CURLOPT_READDATA(3) + +## CURLOPT_IOCTLFUNCTION + +**Deprecated option** Callback for I/O operations. +See CURLOPT_IOCTLFUNCTION(3) + +## CURLOPT_IOCTLDATA + +**Deprecated option** Data pointer to pass to the I/O callback. +See CURLOPT_IOCTLDATA(3) + +## CURLOPT_SEEKFUNCTION + +Callback for seek operations. See CURLOPT_SEEKFUNCTION(3) + +## CURLOPT_SEEKDATA + +Data pointer to pass to the seek callback. See CURLOPT_SEEKDATA(3) + +## CURLOPT_SOCKOPTFUNCTION + +Callback for sockopt operations. See CURLOPT_SOCKOPTFUNCTION(3) + +## CURLOPT_SOCKOPTDATA + +Data pointer to pass to the sockopt callback. See CURLOPT_SOCKOPTDATA(3) + +## CURLOPT_OPENSOCKETFUNCTION + +Callback for socket creation. See CURLOPT_OPENSOCKETFUNCTION(3) + +## CURLOPT_OPENSOCKETDATA + +Data pointer to pass to the open socket callback. See CURLOPT_OPENSOCKETDATA(3) + +## CURLOPT_CLOSESOCKETFUNCTION + +Callback for closing socket. See CURLOPT_CLOSESOCKETFUNCTION(3) + +## CURLOPT_CLOSESOCKETDATA + +Data pointer to pass to the close socket callback. See CURLOPT_CLOSESOCKETDATA(3) + +## CURLOPT_PROGRESSFUNCTION + +**OBSOLETE** callback for progress meter. +See CURLOPT_PROGRESSFUNCTION(3) + +## CURLOPT_PROGRESSDATA + +Data pointer to pass to the progress meter callback. See CURLOPT_PROGRESSDATA(3) + +## CURLOPT_XFERINFOFUNCTION + +Callback for progress meter. See CURLOPT_XFERINFOFUNCTION(3) + +## CURLOPT_XFERINFODATA + +Data pointer to pass to the progress meter callback. See CURLOPT_XFERINFODATA(3) + +## CURLOPT_HEADERFUNCTION + +Callback for writing received headers. See CURLOPT_HEADERFUNCTION(3) + +## CURLOPT_HEADERDATA + +Data pointer to pass to the header callback. See CURLOPT_HEADERDATA(3) + +## CURLOPT_DEBUGFUNCTION + +Callback for debug information. See CURLOPT_DEBUGFUNCTION(3) + +## CURLOPT_DEBUGDATA + +Data pointer to pass to the debug callback. See CURLOPT_DEBUGDATA(3) + +## CURLOPT_SSL_CTX_FUNCTION + +Callback for SSL context logic. See CURLOPT_SSL_CTX_FUNCTION(3) + +## CURLOPT_SSL_CTX_DATA + +Data pointer to pass to the SSL context callback. See CURLOPT_SSL_CTX_DATA(3) + +## CURLOPT_CONV_TO_NETWORK_FUNCTION + +**OBSOLETE** Callback for code base conversion. +See CURLOPT_CONV_TO_NETWORK_FUNCTION(3) + +## CURLOPT_CONV_FROM_NETWORK_FUNCTION + +**OBSOLETE** Callback for code base conversion. +See CURLOPT_CONV_FROM_NETWORK_FUNCTION(3) + +## CURLOPT_CONV_FROM_UTF8_FUNCTION + +**OBSOLETE** Callback for code base conversion. +See CURLOPT_CONV_FROM_UTF8_FUNCTION(3) + +## CURLOPT_INTERLEAVEFUNCTION + +Callback for RTSP interleaved data. See CURLOPT_INTERLEAVEFUNCTION(3) + +## CURLOPT_INTERLEAVEDATA + +Data pointer to pass to the RTSP interleave callback. See CURLOPT_INTERLEAVEDATA(3) + +## CURLOPT_CHUNK_BGN_FUNCTION + +Callback for wildcard download start of chunk. See CURLOPT_CHUNK_BGN_FUNCTION(3) + +## CURLOPT_CHUNK_END_FUNCTION + +Callback for wildcard download end of chunk. See CURLOPT_CHUNK_END_FUNCTION(3) + +## CURLOPT_CHUNK_DATA + +Data pointer to pass to the chunk callbacks. See CURLOPT_CHUNK_DATA(3) + +## CURLOPT_FNMATCH_FUNCTION + +Callback for wildcard matching. See CURLOPT_FNMATCH_FUNCTION(3) + +## CURLOPT_FNMATCH_DATA + +Data pointer to pass to the wildcard matching callback. See CURLOPT_FNMATCH_DATA(3) + +## CURLOPT_SUPPRESS_CONNECT_HEADERS + +Suppress proxy CONNECT response headers from user callbacks. See +CURLOPT_SUPPRESS_CONNECT_HEADERS(3) + +## CURLOPT_RESOLVER_START_FUNCTION + +Callback to be called before a new resolve request is started. See +CURLOPT_RESOLVER_START_FUNCTION(3) + +## CURLOPT_RESOLVER_START_DATA + +Data pointer to pass to resolver start callback. See CURLOPT_RESOLVER_START_DATA(3) + +## CURLOPT_PREREQFUNCTION + +Callback to be called after a connection is established but before a request +is made on that connection. See CURLOPT_PREREQFUNCTION(3) + +## CURLOPT_PREREQDATA + +Data pointer to pass to the CURLOPT_PREREQFUNCTION callback. See +CURLOPT_PREREQDATA(3) + +# ERROR OPTIONS + +## CURLOPT_ERRORBUFFER + +Error message buffer. See CURLOPT_ERRORBUFFER(3) + +## CURLOPT_STDERR + +stderr replacement stream. See CURLOPT_STDERR(3) + +## CURLOPT_FAILONERROR + +Fail on HTTP 4xx errors. CURLOPT_FAILONERROR(3) + +## CURLOPT_KEEP_SENDING_ON_ERROR + +Keep sending on HTTP >= 300 errors. CURLOPT_KEEP_SENDING_ON_ERROR(3) + +# NETWORK OPTIONS + +## CURLOPT_URL + +URL to work on. See CURLOPT_URL(3) + +## CURLOPT_PATH_AS_IS + +Disable squashing /../ and /./ sequences in the path. See CURLOPT_PATH_AS_IS(3) + +## CURLOPT_PROTOCOLS + +**Deprecated option** Allowed protocols. See CURLOPT_PROTOCOLS(3) + +## CURLOPT_PROTOCOLS_STR + +Allowed protocols. See CURLOPT_PROTOCOLS_STR(3) + +## CURLOPT_REDIR_PROTOCOLS + +**Deprecated option** Protocols to allow redirects to. See +CURLOPT_REDIR_PROTOCOLS(3) + +## CURLOPT_REDIR_PROTOCOLS_STR + +Protocols to allow redirects to. See CURLOPT_REDIR_PROTOCOLS_STR(3) + +## CURLOPT_DEFAULT_PROTOCOL + +Default protocol. See CURLOPT_DEFAULT_PROTOCOL(3) + +## CURLOPT_PROXY + +Proxy to use. See CURLOPT_PROXY(3) + +## CURLOPT_PRE_PROXY + +Socks proxy to use. See CURLOPT_PRE_PROXY(3) + +## CURLOPT_PROXYPORT + +Proxy port to use. See CURLOPT_PROXYPORT(3) + +## CURLOPT_PROXYTYPE + +Proxy type. See CURLOPT_PROXYTYPE(3) + +## CURLOPT_NOPROXY + +Filter out hosts from proxy use. CURLOPT_NOPROXY(3) + +## CURLOPT_HTTPPROXYTUNNEL + +Tunnel through the HTTP proxy. CURLOPT_HTTPPROXYTUNNEL(3) + +## CURLOPT_CONNECT_TO + +Connect to a specific host and port. See CURLOPT_CONNECT_TO(3) + +## CURLOPT_SOCKS5_AUTH + +Socks5 authentication methods. See CURLOPT_SOCKS5_AUTH(3) + +## CURLOPT_SOCKS5_GSSAPI_SERVICE + +**Deprecated option** Socks5 GSSAPI service name. +See CURLOPT_SOCKS5_GSSAPI_SERVICE(3) + +## CURLOPT_SOCKS5_GSSAPI_NEC + +Socks5 GSSAPI NEC mode. See CURLOPT_SOCKS5_GSSAPI_NEC(3) + +## CURLOPT_PROXY_SERVICE_NAME + +Proxy authentication service name. CURLOPT_PROXY_SERVICE_NAME(3) + +## CURLOPT_HAPROXYPROTOCOL + +Send an HAProxy PROXY protocol v1 header. See CURLOPT_HAPROXYPROTOCOL(3) + +## CURLOPT_HAPROXY_CLIENT_IP + +Spoof the client IP in an HAProxy PROXY protocol v1 header. See +CURLOPT_HAPROXY_CLIENT_IP(3) + +## CURLOPT_SERVICE_NAME + +Authentication service name. CURLOPT_SERVICE_NAME(3) + +## CURLOPT_INTERFACE + +Bind connection locally to this. See CURLOPT_INTERFACE(3) + +## CURLOPT_LOCALPORT + +Bind connection locally to this port. See CURLOPT_LOCALPORT(3) + +## CURLOPT_LOCALPORTRANGE + +Bind connection locally to port range. See CURLOPT_LOCALPORTRANGE(3) + +## CURLOPT_DNS_CACHE_TIMEOUT + +Timeout for DNS cache. See CURLOPT_DNS_CACHE_TIMEOUT(3) + +## CURLOPT_DNS_USE_GLOBAL_CACHE + +**OBSOLETE** Enable global DNS cache. +See CURLOPT_DNS_USE_GLOBAL_CACHE(3) + +## CURLOPT_DOH_URL + +Use this DoH server for name resolves. See CURLOPT_DOH_URL(3) + +## CURLOPT_BUFFERSIZE + +Ask for alternate buffer size. See CURLOPT_BUFFERSIZE(3) + +## CURLOPT_PORT + +Port number to connect to. See CURLOPT_PORT(3) + +## CURLOPT_TCP_FASTOPEN + +Enable TCP Fast Open. See CURLOPT_TCP_FASTOPEN(3) + +## CURLOPT_TCP_NODELAY + +Disable the Nagle algorithm. See CURLOPT_TCP_NODELAY(3) + +## CURLOPT_ADDRESS_SCOPE + +IPv6 scope for local addresses. See CURLOPT_ADDRESS_SCOPE(3) + +## CURLOPT_TCP_KEEPALIVE + +Enable TCP keep-alive. See CURLOPT_TCP_KEEPALIVE(3) + +## CURLOPT_TCP_KEEPIDLE + +Idle time before sending keep-alive. See CURLOPT_TCP_KEEPIDLE(3) + +## CURLOPT_TCP_KEEPINTVL + +Interval between keep-alive probes. See CURLOPT_TCP_KEEPINTVL(3) + +## CURLOPT_UNIX_SOCKET_PATH + +Path to a Unix domain socket. See CURLOPT_UNIX_SOCKET_PATH(3) + +## CURLOPT_ABSTRACT_UNIX_SOCKET + +Path to an abstract Unix domain socket. See CURLOPT_ABSTRACT_UNIX_SOCKET(3) + +# NAMES and PASSWORDS OPTIONS (Authentication) + +## CURLOPT_NETRC + +Enable .netrc parsing. See CURLOPT_NETRC(3) + +## CURLOPT_NETRC_FILE + +&.netrc file name. See CURLOPT_NETRC_FILE(3) + +## CURLOPT_USERPWD + +User name and password. See CURLOPT_USERPWD(3) + +## CURLOPT_PROXYUSERPWD + +Proxy user name and password. See CURLOPT_PROXYUSERPWD(3) + +## CURLOPT_USERNAME + +User name. See CURLOPT_USERNAME(3) + +## CURLOPT_PASSWORD + +Password. See CURLOPT_PASSWORD(3) + +## CURLOPT_LOGIN_OPTIONS + +Login options. See CURLOPT_LOGIN_OPTIONS(3) + +## CURLOPT_PROXYUSERNAME + +Proxy user name. See CURLOPT_PROXYUSERNAME(3) + +## CURLOPT_PROXYPASSWORD + +Proxy password. See CURLOPT_PROXYPASSWORD(3) + +## CURLOPT_HTTPAUTH + +HTTP server authentication methods. See CURLOPT_HTTPAUTH(3) + +## CURLOPT_TLSAUTH_USERNAME + +TLS authentication user name. See CURLOPT_TLSAUTH_USERNAME(3) + +## CURLOPT_PROXY_TLSAUTH_USERNAME + +Proxy TLS authentication user name. See CURLOPT_PROXY_TLSAUTH_USERNAME(3) + +## CURLOPT_TLSAUTH_PASSWORD + +TLS authentication password. See CURLOPT_TLSAUTH_PASSWORD(3) + +## CURLOPT_PROXY_TLSAUTH_PASSWORD + +Proxy TLS authentication password. See CURLOPT_PROXY_TLSAUTH_PASSWORD(3) + +## CURLOPT_TLSAUTH_TYPE + +TLS authentication methods. See CURLOPT_TLSAUTH_TYPE(3) + +## CURLOPT_PROXY_TLSAUTH_TYPE + +Proxy TLS authentication methods. See CURLOPT_PROXY_TLSAUTH_TYPE(3) + +## CURLOPT_PROXYAUTH + +HTTP proxy authentication methods. See CURLOPT_PROXYAUTH(3) + +## CURLOPT_SASL_AUTHZID + +SASL authorization identity (identity to act as). See CURLOPT_SASL_AUTHZID(3) + +## CURLOPT_SASL_IR + +Enable SASL initial response. See CURLOPT_SASL_IR(3) + +## CURLOPT_XOAUTH2_BEARER + +OAuth2 bearer token. See CURLOPT_XOAUTH2_BEARER(3) + +## CURLOPT_DISALLOW_USERNAME_IN_URL + +Do not allow username in URL. See CURLOPT_DISALLOW_USERNAME_IN_URL(3) + +# HTTP OPTIONS + +## CURLOPT_AUTOREFERER + +Automatically set Referer: header. See CURLOPT_AUTOREFERER(3) + +## CURLOPT_ACCEPT_ENCODING + +Accept-Encoding and automatic decompressing data. See CURLOPT_ACCEPT_ENCODING(3) + +## CURLOPT_TRANSFER_ENCODING + +Request Transfer-Encoding. See CURLOPT_TRANSFER_ENCODING(3) + +## CURLOPT_FOLLOWLOCATION + +Follow HTTP redirects. See CURLOPT_FOLLOWLOCATION(3) + +## CURLOPT_UNRESTRICTED_AUTH + +Do not restrict authentication to original host. CURLOPT_UNRESTRICTED_AUTH(3) + +## CURLOPT_MAXREDIRS + +Maximum number of redirects to follow. See CURLOPT_MAXREDIRS(3) + +## CURLOPT_POSTREDIR + +How to act on redirects after POST. See CURLOPT_POSTREDIR(3) + +## CURLOPT_PUT + +**Deprecated option** Issue an HTTP PUT request. See CURLOPT_PUT(3) + +## CURLOPT_POST + +Issue an HTTP POST request. See CURLOPT_POST(3) + +## CURLOPT_POSTFIELDS + +Send a POST with this data. See CURLOPT_POSTFIELDS(3) + +## CURLOPT_POSTFIELDSIZE + +The POST data is this big. See CURLOPT_POSTFIELDSIZE(3) + +## CURLOPT_POSTFIELDSIZE_LARGE + +The POST data is this big. See CURLOPT_POSTFIELDSIZE_LARGE(3) + +## CURLOPT_COPYPOSTFIELDS + +Send a POST with this data - and copy it. See CURLOPT_COPYPOSTFIELDS(3) + +## CURLOPT_HTTPPOST + +**Deprecated option** Multipart formpost HTTP POST. +See CURLOPT_HTTPPOST(3) + +## CURLOPT_REFERER + +Referer: header. See CURLOPT_REFERER(3) + +## CURLOPT_USERAGENT + +User-Agent: header. See CURLOPT_USERAGENT(3) + +## CURLOPT_HTTPHEADER + +Custom HTTP headers. See CURLOPT_HTTPHEADER(3) + +## CURLOPT_HEADEROPT + +Control custom headers. See CURLOPT_HEADEROPT(3) + +## CURLOPT_PROXYHEADER + +Custom HTTP headers sent to proxy. See CURLOPT_PROXYHEADER(3) + +## CURLOPT_HTTP200ALIASES + +Alternative versions of 200 OK. See CURLOPT_HTTP200ALIASES(3) + +## CURLOPT_COOKIE + +Cookie(s) to send. See CURLOPT_COOKIE(3) + +## CURLOPT_COOKIEFILE + +File to read cookies from. See CURLOPT_COOKIEFILE(3) + +## CURLOPT_COOKIEJAR + +File to write cookies to. See CURLOPT_COOKIEJAR(3) + +## CURLOPT_COOKIESESSION + +Start a new cookie session. See CURLOPT_COOKIESESSION(3) + +## CURLOPT_COOKIELIST + +Add or control cookies. See CURLOPT_COOKIELIST(3) + +## CURLOPT_ALTSVC + +Specify the Alt-Svc: cache file name. See CURLOPT_ALTSVC(3) + +## CURLOPT_ALTSVC_CTRL + +Enable and configure Alt-Svc: treatment. See CURLOPT_ALTSVC_CTRL(3) + +## CURLOPT_HSTS + +Set HSTS cache file. See CURLOPT_HSTS(3) + +## CURLOPT_HSTS_CTRL + +Enable HSTS. See CURLOPT_HSTS_CTRL(3) + +## CURLOPT_HSTSREADFUNCTION + +Set HSTS read callback. See CURLOPT_HSTSREADFUNCTION(3) + +## CURLOPT_HSTSREADDATA + +Pass pointer to the HSTS read callback. See CURLOPT_HSTSREADDATA(3) + +## CURLOPT_HSTSWRITEFUNCTION + +Set HSTS write callback. See CURLOPT_HSTSWRITEFUNCTION(3) + +## CURLOPT_HSTSWRITEDATA + +Pass pointer to the HSTS write callback. See CURLOPT_HSTSWRITEDATA(3) + +## CURLOPT_HTTPGET + +Do an HTTP GET request. See CURLOPT_HTTPGET(3) + +## CURLOPT_REQUEST_TARGET + +Set the request target. CURLOPT_REQUEST_TARGET(3) + +## CURLOPT_HTTP_VERSION + +HTTP version to use. CURLOPT_HTTP_VERSION(3) + +## CURLOPT_HTTP09_ALLOWED + +Allow HTTP/0.9 responses. CURLOPT_HTTP09_ALLOWED(3) + +## CURLOPT_IGNORE_CONTENT_LENGTH + +Ignore Content-Length. See CURLOPT_IGNORE_CONTENT_LENGTH(3) + +## CURLOPT_HTTP_CONTENT_DECODING + +Disable Content decoding. See CURLOPT_HTTP_CONTENT_DECODING(3) + +## CURLOPT_HTTP_TRANSFER_DECODING + +Disable Transfer decoding. See CURLOPT_HTTP_TRANSFER_DECODING(3) + +## CURLOPT_EXPECT_100_TIMEOUT_MS + +100-continue timeout. See CURLOPT_EXPECT_100_TIMEOUT_MS(3) + +## CURLOPT_TRAILERFUNCTION + +Set callback for sending trailing headers. See +CURLOPT_TRAILERFUNCTION(3) + +## CURLOPT_TRAILERDATA + +Custom pointer passed to the trailing headers callback. See +CURLOPT_TRAILERDATA(3) + +## CURLOPT_PIPEWAIT + +Wait on connection to pipeline on it. See CURLOPT_PIPEWAIT(3) + +## CURLOPT_STREAM_DEPENDS + +This HTTP/2 stream depends on another. See CURLOPT_STREAM_DEPENDS(3) + +## CURLOPT_STREAM_DEPENDS_E + +This HTTP/2 stream depends on another exclusively. See +CURLOPT_STREAM_DEPENDS_E(3) + +## CURLOPT_STREAM_WEIGHT + +Set this HTTP/2 stream's weight. See CURLOPT_STREAM_WEIGHT(3) + +# SMTP OPTIONS + +## CURLOPT_MAIL_FROM + +Address of the sender. See CURLOPT_MAIL_FROM(3) + +## CURLOPT_MAIL_RCPT + +Address of the recipients. See CURLOPT_MAIL_RCPT(3) + +## CURLOPT_MAIL_AUTH + +Authentication address. See CURLOPT_MAIL_AUTH(3) + +## CURLOPT_MAIL_RCPT_ALLOWFAILS + +Allow RCPT TO command to fail for some recipients. See +CURLOPT_MAIL_RCPT_ALLOWFAILS(3) + +# TFTP OPTIONS + +## CURLOPT_TFTP_BLKSIZE + +TFTP block size. See CURLOPT_TFTP_BLKSIZE(3) + +## CURLOPT_TFTP_NO_OPTIONS + +Do not send TFTP options requests. See CURLOPT_TFTP_NO_OPTIONS(3) + +# FTP OPTIONS + +## CURLOPT_FTPPORT + +Use active FTP. See CURLOPT_FTPPORT(3) + +## CURLOPT_QUOTE + +Commands to run before transfer. See CURLOPT_QUOTE(3) + +## CURLOPT_POSTQUOTE + +Commands to run after transfer. See CURLOPT_POSTQUOTE(3) + +## CURLOPT_PREQUOTE + +Commands to run just before transfer. See CURLOPT_PREQUOTE(3) + +## CURLOPT_APPEND + +Append to remote file. See CURLOPT_APPEND(3) + +## CURLOPT_FTP_USE_EPRT + +Use EPRT. See CURLOPT_FTP_USE_EPRT(3) + +## CURLOPT_FTP_USE_EPSV + +Use EPSV. See CURLOPT_FTP_USE_EPSV(3) + +## CURLOPT_FTP_USE_PRET + +Use PRET. See CURLOPT_FTP_USE_PRET(3) + +## CURLOPT_FTP_CREATE_MISSING_DIRS + +Create missing directories on the remote server. See CURLOPT_FTP_CREATE_MISSING_DIRS(3) + +## CURLOPT_SERVER_RESPONSE_TIMEOUT + +Timeout for server responses. See CURLOPT_SERVER_RESPONSE_TIMEOUT(3) + +## CURLOPT_SERVER_RESPONSE_TIMEOUT_MS + +Timeout for server responses. See CURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3) + +## CURLOPT_FTP_ALTERNATIVE_TO_USER + +Alternative to USER. See CURLOPT_FTP_ALTERNATIVE_TO_USER(3) + +## CURLOPT_FTP_SKIP_PASV_IP + +Ignore the IP address in the PASV response. See CURLOPT_FTP_SKIP_PASV_IP(3) + +## CURLOPT_FTPSSLAUTH + +Control how to do TLS. See CURLOPT_FTPSSLAUTH(3) + +## CURLOPT_FTP_SSL_CCC + +Back to non-TLS again after authentication. See CURLOPT_FTP_SSL_CCC(3) + +## CURLOPT_FTP_ACCOUNT + +Send ACCT command. See CURLOPT_FTP_ACCOUNT(3) + +## CURLOPT_FTP_FILEMETHOD + +Specify how to reach files. See CURLOPT_FTP_FILEMETHOD(3) + +# RTSP OPTIONS + +## CURLOPT_RTSP_REQUEST + +RTSP request. See CURLOPT_RTSP_REQUEST(3) + +## CURLOPT_RTSP_SESSION_ID + +RTSP session-id. See CURLOPT_RTSP_SESSION_ID(3) + +## CURLOPT_RTSP_STREAM_URI + +RTSP stream URI. See CURLOPT_RTSP_STREAM_URI(3) + +## CURLOPT_RTSP_TRANSPORT + +RTSP Transport: header. See CURLOPT_RTSP_TRANSPORT(3) + +## CURLOPT_RTSP_CLIENT_CSEQ + +Client CSEQ number. See CURLOPT_RTSP_CLIENT_CSEQ(3) + +## CURLOPT_RTSP_SERVER_CSEQ + +CSEQ number for RTSP Server->Client request. See CURLOPT_RTSP_SERVER_CSEQ(3) + +## CURLOPT_AWS_SIGV4 + +AWS HTTP V4 Signature. See CURLOPT_AWS_SIGV4(3) + +# PROTOCOL OPTIONS + +## CURLOPT_TRANSFERTEXT + +Use text transfer. See CURLOPT_TRANSFERTEXT(3) + +## CURLOPT_PROXY_TRANSFER_MODE + +Add transfer mode to URL over proxy. See CURLOPT_PROXY_TRANSFER_MODE(3) + +## CURLOPT_CRLF + +Convert newlines. See CURLOPT_CRLF(3) + +## CURLOPT_RANGE + +Range requests. See CURLOPT_RANGE(3) + +## CURLOPT_RESUME_FROM + +Resume a transfer. See CURLOPT_RESUME_FROM(3) + +## CURLOPT_RESUME_FROM_LARGE + +Resume a transfer. See CURLOPT_RESUME_FROM_LARGE(3) + +## CURLOPT_CURLU + +Set URL to work on with a URL handle. See CURLOPT_CURLU(3) + +## CURLOPT_CUSTOMREQUEST + +Custom request/method. See CURLOPT_CUSTOMREQUEST(3) + +## CURLOPT_FILETIME + +Request file modification date and time. See CURLOPT_FILETIME(3) + +## CURLOPT_DIRLISTONLY + +List only. See CURLOPT_DIRLISTONLY(3) + +## CURLOPT_NOBODY + +Do not get the body contents. See CURLOPT_NOBODY(3) + +## CURLOPT_INFILESIZE + +Size of file to send. CURLOPT_INFILESIZE(3) + +## CURLOPT_INFILESIZE_LARGE + +Size of file to send. CURLOPT_INFILESIZE_LARGE(3) + +## CURLOPT_UPLOAD + +Upload data. See CURLOPT_UPLOAD(3) + +## CURLOPT_UPLOAD_BUFFERSIZE + +Set upload buffer size. See CURLOPT_UPLOAD_BUFFERSIZE(3) + +## CURLOPT_MIMEPOST + +Post/send MIME data. See CURLOPT_MIMEPOST(3) + +## CURLOPT_MIME_OPTIONS + +Set MIME option flags. See CURLOPT_MIME_OPTIONS(3) + +## CURLOPT_MAXFILESIZE + +Maximum file size to get. See CURLOPT_MAXFILESIZE(3) + +## CURLOPT_MAXFILESIZE_LARGE + +Maximum file size to get. See CURLOPT_MAXFILESIZE_LARGE(3) + +## CURLOPT_TIMECONDITION + +Make a time conditional request. See CURLOPT_TIMECONDITION(3) + +## CURLOPT_TIMEVALUE + +Time value for the time conditional request. See CURLOPT_TIMEVALUE(3) + +## CURLOPT_TIMEVALUE_LARGE + +Time value for the time conditional request. See CURLOPT_TIMEVALUE_LARGE(3) + +# CONNECTION OPTIONS + +## CURLOPT_TIMEOUT + +Timeout for the entire request. See CURLOPT_TIMEOUT(3) + +## CURLOPT_TIMEOUT_MS + +Millisecond timeout for the entire request. See CURLOPT_TIMEOUT_MS(3) + +## CURLOPT_LOW_SPEED_LIMIT + +Low speed limit to abort transfer. See CURLOPT_LOW_SPEED_LIMIT(3) + +## CURLOPT_LOW_SPEED_TIME + +Time to be below the speed to trigger low speed abort. See CURLOPT_LOW_SPEED_TIME(3) + +## CURLOPT_MAX_SEND_SPEED_LARGE + +Cap the upload speed to this. See CURLOPT_MAX_SEND_SPEED_LARGE(3) + +## CURLOPT_MAX_RECV_SPEED_LARGE + +Cap the download speed to this. See CURLOPT_MAX_RECV_SPEED_LARGE(3) + +## CURLOPT_MAXCONNECTS + +Maximum number of connections in the connection pool. See CURLOPT_MAXCONNECTS(3) + +## CURLOPT_FRESH_CONNECT + +Use a new connection. CURLOPT_FRESH_CONNECT(3) + +## CURLOPT_FORBID_REUSE + +Prevent subsequent connections from reusing this. See CURLOPT_FORBID_REUSE(3) + +## CURLOPT_MAXAGE_CONN + +Limit the age (idle time) of connections for reuse. See CURLOPT_MAXAGE_CONN(3) + +## CURLOPT_MAXLIFETIME_CONN + +Limit the age (since creation) of connections for reuse. See +CURLOPT_MAXLIFETIME_CONN(3) + +## CURLOPT_CONNECTTIMEOUT + +Timeout for the connection phase. See CURLOPT_CONNECTTIMEOUT(3) + +## CURLOPT_CONNECTTIMEOUT_MS + +Millisecond timeout for the connection phase. See CURLOPT_CONNECTTIMEOUT_MS(3) + +## CURLOPT_IPRESOLVE + +IP version to use. See CURLOPT_IPRESOLVE(3) + +## CURLOPT_CONNECT_ONLY + +Only connect, nothing else. See CURLOPT_CONNECT_ONLY(3) + +## CURLOPT_USE_SSL + +Use TLS/SSL. See CURLOPT_USE_SSL(3) + +## CURLOPT_RESOLVE + +Provide fixed/fake name resolves. See CURLOPT_RESOLVE(3) + +## CURLOPT_DNS_INTERFACE + +Bind name resolves to this interface. See CURLOPT_DNS_INTERFACE(3) + +## CURLOPT_DNS_LOCAL_IP4 + +Bind name resolves to this IP4 address. See CURLOPT_DNS_LOCAL_IP4(3) + +## CURLOPT_DNS_LOCAL_IP6 + +Bind name resolves to this IP6 address. See CURLOPT_DNS_LOCAL_IP6(3) + +## CURLOPT_DNS_SERVERS + +Preferred DNS servers. See CURLOPT_DNS_SERVERS(3) + +## CURLOPT_DNS_SHUFFLE_ADDRESSES + +Shuffle addresses before use. See CURLOPT_DNS_SHUFFLE_ADDRESSES(3) + +## CURLOPT_ACCEPTTIMEOUT_MS + +Timeout for waiting for the server's connect back to be accepted. See +CURLOPT_ACCEPTTIMEOUT_MS(3) + +## CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS + +Timeout for happy eyeballs. See CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3) + +## CURLOPT_UPKEEP_INTERVAL_MS + +Sets the interval at which connection upkeep are performed. See +CURLOPT_UPKEEP_INTERVAL_MS(3) + +# SSL and SECURITY OPTIONS + +## CURLOPT_SSLCERT + +Client cert. See CURLOPT_SSLCERT(3) + +## CURLOPT_SSLCERT_BLOB + +Client cert memory buffer. See CURLOPT_SSLCERT_BLOB(3) + +## CURLOPT_PROXY_SSLCERT + +Proxy client cert. See CURLOPT_PROXY_SSLCERT(3) + +## CURLOPT_PROXY_SSLCERT_BLOB + +Proxy client cert memory buffer. See CURLOPT_PROXY_SSLCERT_BLOB(3) + +## CURLOPT_SSLCERTTYPE + +Client cert type. See CURLOPT_SSLCERTTYPE(3) + +## CURLOPT_PROXY_SSLCERTTYPE + +Proxy client cert type. See CURLOPT_PROXY_SSLCERTTYPE(3) + +## CURLOPT_SSLKEY + +Client key. See CURLOPT_SSLKEY(3) + +## CURLOPT_SSLKEY_BLOB + +Client key memory buffer. See CURLOPT_SSLKEY_BLOB(3) + +## CURLOPT_PROXY_SSLKEY + +Proxy client key. See CURLOPT_PROXY_SSLKEY(3) + +## CURLOPT_PROXY_SSLKEY_BLOB + +Proxy client key. See CURLOPT_PROXY_SSLKEY_BLOB(3) + +## CURLOPT_SSLKEYTYPE + +Client key type. See CURLOPT_SSLKEYTYPE(3) + +## CURLOPT_PROXY_SSLKEYTYPE + +Proxy client key type. See CURLOPT_PROXY_SSLKEYTYPE(3) + +## CURLOPT_KEYPASSWD + +Client key password. See CURLOPT_KEYPASSWD(3) + +## CURLOPT_PROXY_KEYPASSWD + +Proxy client key password. See CURLOPT_PROXY_KEYPASSWD(3) + +## CURLOPT_SSL_EC_CURVES + +Set key exchange curves. See CURLOPT_SSL_EC_CURVES(3) + +## CURLOPT_SSL_ENABLE_ALPN + +Enable use of ALPN. See CURLOPT_SSL_ENABLE_ALPN(3) + +## CURLOPT_SSL_ENABLE_NPN + +**OBSOLETE** Enable use of NPN. See CURLOPT_SSL_ENABLE_NPN(3) + +## CURLOPT_SSLENGINE + +Use identifier with SSL engine. See CURLOPT_SSLENGINE(3) + +## CURLOPT_SSLENGINE_DEFAULT + +Default SSL engine. See CURLOPT_SSLENGINE_DEFAULT(3) + +## CURLOPT_SSL_FALSESTART + +Enable TLS False Start. See CURLOPT_SSL_FALSESTART(3) + +## CURLOPT_SSLVERSION + +SSL version to use. See CURLOPT_SSLVERSION(3) + +## CURLOPT_PROXY_SSLVERSION + +Proxy SSL version to use. See CURLOPT_PROXY_SSLVERSION(3) + +## CURLOPT_SSL_VERIFYHOST + +Verify the host name in the SSL certificate. See CURLOPT_SSL_VERIFYHOST(3) + +## CURLOPT_DOH_SSL_VERIFYHOST + +Verify the host name in the DoH (DNS-over-HTTPS) SSL certificate. See +CURLOPT_DOH_SSL_VERIFYHOST(3) + +## CURLOPT_PROXY_SSL_VERIFYHOST + +Verify the host name in the proxy SSL certificate. See +CURLOPT_PROXY_SSL_VERIFYHOST(3) + +## CURLOPT_SSL_VERIFYPEER + +Verify the SSL certificate. See CURLOPT_SSL_VERIFYPEER(3) + +## CURLOPT_DOH_SSL_VERIFYPEER + +Verify the DoH (DNS-over-HTTPS) SSL certificate. See +CURLOPT_DOH_SSL_VERIFYPEER(3) + +## CURLOPT_PROXY_SSL_VERIFYPEER + +Verify the proxy SSL certificate. See CURLOPT_PROXY_SSL_VERIFYPEER(3) + +## CURLOPT_SSL_VERIFYSTATUS + +Verify the SSL certificate's status. See CURLOPT_SSL_VERIFYSTATUS(3) + +## CURLOPT_DOH_SSL_VERIFYSTATUS + +Verify the DoH (DNS-over-HTTPS) SSL certificate's status. See +CURLOPT_DOH_SSL_VERIFYSTATUS(3) + +## CURLOPT_CAINFO + +CA cert bundle. See CURLOPT_CAINFO(3) + +## CURLOPT_CAINFO_BLOB + +CA cert bundle memory buffer. See CURLOPT_CAINFO_BLOB(3) + +## CURLOPT_PROXY_CAINFO + +Proxy CA cert bundle. See CURLOPT_PROXY_CAINFO(3) + +## CURLOPT_PROXY_CAINFO_BLOB + +Proxy CA cert bundle memory buffer. See CURLOPT_PROXY_CAINFO_BLOB(3) + +## CURLOPT_ISSUERCERT + +Issuer certificate. See CURLOPT_ISSUERCERT(3) + +## CURLOPT_ISSUERCERT_BLOB + +Issuer certificate memory buffer. See CURLOPT_ISSUERCERT_BLOB(3) + +## CURLOPT_PROXY_ISSUERCERT + +Proxy issuer certificate. See CURLOPT_PROXY_ISSUERCERT(3) + +## CURLOPT_PROXY_ISSUERCERT_BLOB + +Proxy issuer certificate memory buffer. See CURLOPT_PROXY_ISSUERCERT_BLOB(3) + +## CURLOPT_CAPATH + +Path to CA cert bundle. See CURLOPT_CAPATH(3) + +## CURLOPT_PROXY_CAPATH + +Path to proxy CA cert bundle. See CURLOPT_PROXY_CAPATH(3) + +## CURLOPT_CRLFILE + +Certificate Revocation List. See CURLOPT_CRLFILE(3) + +## CURLOPT_PROXY_CRLFILE + +Proxy Certificate Revocation List. See CURLOPT_PROXY_CRLFILE(3) + +## CURLOPT_CA_CACHE_TIMEOUT + +Timeout for CA cache. See CURLOPT_CA_CACHE_TIMEOUT(3) + +## CURLOPT_CERTINFO + +Extract certificate info. See CURLOPT_CERTINFO(3) + +## CURLOPT_PINNEDPUBLICKEY + +Set pinned SSL public key . See CURLOPT_PINNEDPUBLICKEY(3) + +## CURLOPT_PROXY_PINNEDPUBLICKEY + +Set the proxy's pinned SSL public key. See +CURLOPT_PROXY_PINNEDPUBLICKEY(3) + +## CURLOPT_RANDOM_FILE + +**OBSOLETE** Provide source for entropy random data. +See CURLOPT_RANDOM_FILE(3) + +## CURLOPT_EGDSOCKET + +**OBSOLETE** Identify EGD socket for entropy. See CURLOPT_EGDSOCKET(3) + +## CURLOPT_SSL_CIPHER_LIST + +Ciphers to use. See CURLOPT_SSL_CIPHER_LIST(3) + +## CURLOPT_PROXY_SSL_CIPHER_LIST + +Proxy ciphers to use. See CURLOPT_PROXY_SSL_CIPHER_LIST(3) + +## CURLOPT_TLS13_CIPHERS + +TLS 1.3 cipher suites to use. See CURLOPT_TLS13_CIPHERS(3) + +## CURLOPT_PROXY_TLS13_CIPHERS + +Proxy TLS 1.3 cipher suites to use. See CURLOPT_PROXY_TLS13_CIPHERS(3) + +## CURLOPT_SSL_SESSIONID_CACHE + +Disable SSL session-id cache. See CURLOPT_SSL_SESSIONID_CACHE(3) + +## CURLOPT_SSL_OPTIONS + +Control SSL behavior. See CURLOPT_SSL_OPTIONS(3) + +## CURLOPT_PROXY_SSL_OPTIONS + +Control proxy SSL behavior. See CURLOPT_PROXY_SSL_OPTIONS(3) + +## CURLOPT_KRBLEVEL + +Kerberos security level. See CURLOPT_KRBLEVEL(3) + +## CURLOPT_GSSAPI_DELEGATION + +Disable GSS-API delegation. See CURLOPT_GSSAPI_DELEGATION(3) + +# SSH OPTIONS + +## CURLOPT_SSH_AUTH_TYPES + +SSH authentication types. See CURLOPT_SSH_AUTH_TYPES(3) + +## CURLOPT_SSH_COMPRESSION + +Enable SSH compression. See CURLOPT_SSH_COMPRESSION(3) + +## CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 + +MD5 of host's public key. See CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3) + +## CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 + +SHA256 of host's public key. See CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3) + +## CURLOPT_SSH_PUBLIC_KEYFILE + +File name of public key. See CURLOPT_SSH_PUBLIC_KEYFILE(3) + +## CURLOPT_SSH_PRIVATE_KEYFILE + +File name of private key. See CURLOPT_SSH_PRIVATE_KEYFILE(3) + +## CURLOPT_SSH_KNOWNHOSTS + +File name with known hosts. See CURLOPT_SSH_KNOWNHOSTS(3) + +## CURLOPT_SSH_KEYFUNCTION + +Callback for known hosts handling. See CURLOPT_SSH_KEYFUNCTION(3) + +## CURLOPT_SSH_KEYDATA + +Custom pointer to pass to ssh key callback. See CURLOPT_SSH_KEYDATA(3) + +## CURLOPT_SSH_HOSTKEYFUNCTION + +Callback for checking host key handling. See CURLOPT_SSH_HOSTKEYFUNCTION(3) + +## CURLOPT_SSH_HOSTKEYDATA + +Custom pointer to pass to ssh host key callback. See CURLOPT_SSH_HOSTKEYDATA(3) + +# WEBSOCKET + +## CURLOPT_WS_OPTIONS + +Set WebSocket options. See CURLOPT_WS_OPTIONS(3) + +# OTHER OPTIONS + +## CURLOPT_PRIVATE + +Private pointer to store. See CURLOPT_PRIVATE(3) + +## CURLOPT_SHARE + +Share object to use. See CURLOPT_SHARE(3) + +## CURLOPT_NEW_FILE_PERMS + +Mode for creating new remote files. See CURLOPT_NEW_FILE_PERMS(3) + +## CURLOPT_NEW_DIRECTORY_PERMS + +Mode for creating new remote directories. See CURLOPT_NEW_DIRECTORY_PERMS(3) + +## CURLOPT_QUICK_EXIT + +To be set by toplevel tools like "curl" to skip lengthy cleanups when they are +about to call exit() anyway. See CURLOPT_QUICK_EXIT(3) + +# TELNET OPTIONS + +## CURLOPT_TELNETOPTIONS + +TELNET options. See CURLOPT_TELNETOPTIONS(3) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +*CURLE_OK* (zero) means that the option was set properly, non-zero means an +error occurred as ** defines. See the libcurl-errors(3) man page +for the full list with descriptions. + +Strings passed on to libcurl must be shorter than 8000000 bytes, otherwise +curl_easy_setopt(3) returns **CURLE_BAD_FUNCTION_ARGUMENT** (added in 7.65.0). + +**CURLE_BAD_FUNCTION_ARGUMENT** is returned when the argument to an option is +invalid, like perhaps out of range. + +If you try to set an option that libcurl does not know about, perhaps because +the library is too old to support it or the option was removed in a recent +version, this function returns *CURLE_UNKNOWN_OPTION*. If support for the +option was disabled at compile-time, it returns *CURLE_NOT_BUILT_IN*. diff --git a/docs/libcurl/curl_easy_strerror.3 b/docs/libcurl/curl_easy_strerror.3 deleted file mode 100644 index 87a8f77b9..000000000 --- a/docs/libcurl/curl_easy_strerror.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_easy_strerror 3 "26 Apr 2004" "libcurl" "libcurl" -.SH NAME -curl_easy_strerror - return string describing error code -.SH SYNOPSIS -.nf -#include - -const char *curl_easy_strerror(CURLcode errornum); -.fi -.SH DESCRIPTION -The \fIcurl_easy_strerror(3)\fP function returns a string describing the -CURLcode error code passed in the argument \fIerrornum\fP. - -Typically applications also appreciate \fICURLOPT_ERRORBUFFER(3)\fP for more -specific error descriptions generated at runtime. -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -A pointer to a null-terminated string. -.SH "SEE ALSO" -.BR libcurl-errors (3), -.BR curl_multi_strerror (3), -.BR curl_share_strerror (3), -.BR curl_url_strerror (3) diff --git a/docs/libcurl/curl_easy_strerror.md b/docs/libcurl/curl_easy_strerror.md new file mode 100644 index 000000000..218601a44 --- /dev/null +++ b/docs/libcurl/curl_easy_strerror.md @@ -0,0 +1,59 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_strerror +Section: 3 +Source: libcurl +See-also: + - curl_multi_strerror (3) + - curl_share_strerror (3) + - curl_url_strerror (3) + - libcurl-errors (3) +--- + +# NAME + +curl_easy_strerror - return string describing error code + +# SYNOPSIS + +~~~c +#include + +const char *curl_easy_strerror(CURLcode errornum); +~~~ + +# DESCRIPTION + +The curl_easy_strerror(3) function returns a string describing the +CURLcode error code passed in the argument *errornum*. + +Typically applications also appreciate CURLOPT_ERRORBUFFER(3) for more +specific error descriptions generated at runtime. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + /* set options */ + /* Perform the entire transfer */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + } +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.12.0 + +# RETURN VALUE + +A pointer to a null-terminated string. diff --git a/docs/libcurl/curl_easy_unescape.3 b/docs/libcurl/curl_easy_unescape.3 deleted file mode 100644 index 9c52cbfa5..000000000 --- a/docs/libcurl/curl_easy_unescape.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_unescape 3 "7 April 2006" "libcurl" "libcurl" -.SH NAME -curl_easy_unescape - URL decodes the given string -.SH SYNOPSIS -.nf -#include - -char *curl_easy_unescape(CURL *curl, const char *input, - int inlength, int *outlength); -.fi -.SH DESCRIPTION -This function converts the URL encoded string \fBinput\fP to a "plain string" -and returns that in an allocated memory area. All input characters that are URL -encoded (%XX where XX is a two-digit hexadecimal number) are converted to their -binary versions. - -If the \fBlength\fP argument is set to 0 (zero), \fIcurl_easy_unescape(3)\fP -uses strlen() on \fBinput\fP to find out the size. - -If \fBoutlength\fP is non-NULL, the function writes the length of the returned -string in the integer it points to. This allows proper handling even for -strings containing %00. Since this is a pointer to an \fIint\fP type, it can -only return a value up to \fIINT_MAX\fP so no longer string can be returned in -this parameter. - -Since 7.82.0, the \fBcurl\fP parameter is ignored. Prior to that there was -per-handle character conversion support for some old operating systems such as -TPF, but it was otherwise ignored. - -You must \fIcurl_free(3)\fP the returned string when you are done with it. -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.15.4 and replaces the old \fIcurl_unescape(3)\fP function. -.SH RETURN VALUE -A pointer to a null-terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_easy_escape (3), -.BR curl_free (3) diff --git a/docs/libcurl/curl_easy_unescape.md b/docs/libcurl/curl_easy_unescape.md new file mode 100644 index 000000000..4f9262b34 --- /dev/null +++ b/docs/libcurl/curl_easy_unescape.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_unescape +Section: 3 +Source: libcurl +See-also: + - curl_easy_escape (3) + - curl_free (3) +--- + +# NAME + +curl_easy_unescape - URL decodes the given string + +# SYNOPSIS + +~~~c +#include + +char *curl_easy_unescape(CURL *curl, const char *input, + int inlength, int *outlength); +~~~ + +# DESCRIPTION + +This function converts the URL encoded string **input** to a "plain string" +and returns that in an allocated memory area. All input characters that are URL +encoded (%XX where XX is a two-digit hexadecimal number) are converted to their +binary versions. + +If the **length** argument is set to 0 (zero), curl_easy_unescape(3) +uses strlen() on **input** to find out the size. + +If **outlength** is non-NULL, the function writes the length of the returned +string in the integer it points to. This allows proper handling even for +strings containing %00. Since this is a pointer to an *int* type, it can +only return a value up to *INT_MAX* so no longer string can be returned in +this parameter. + +Since 7.82.0, the **curl** parameter is ignored. Prior to that there was +per-handle character conversion support for some old operating systems such as +TPF, but it was otherwise ignored. + +You must curl_free(3) the returned string when you are done with it. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + int decodelen; + char *decoded = curl_easy_unescape(curl, "%63%75%72%6c", 12, &decodelen); + if(decoded) { + /* do not assume printf() works on the decoded data! */ + printf("Decoded: "); + /* ... */ + curl_free(decoded); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.4 and replaces the old curl_unescape(3) function. + +# RETURN VALUE + +A pointer to a null-terminated string or NULL if it failed. diff --git a/docs/libcurl/curl_easy_upkeep.3 b/docs/libcurl/curl_easy_upkeep.3 deleted file mode 100644 index b4d35716f..000000000 --- a/docs/libcurl/curl_easy_upkeep.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_upkeep 3 "31 Oct 2018" "libcurl" "libcurl" -.SH NAME -curl_easy_upkeep - Perform any connection upkeep checks. -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_upkeep(CURL *handle); -.fi -.SH DESCRIPTION - -Some protocols have "connection upkeep" mechanisms. These mechanisms usually -send some traffic on existing connections in order to keep them alive; this -can prevent connections from being closed due to overzealous firewalls, for -example. - -Currently the only protocol with a connection upkeep mechanism is HTTP/2: when -the connection upkeep interval is exceeded and \fIcurl_easy_upkeep(3)\fP -is called, an HTTP/2 PING frame is sent on the connection. - -This function must be explicitly called in order to perform the upkeep work. -The connection upkeep interval is set with -\fICURLOPT_UPKEEP_INTERVAL_MS(3)\fP. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - /* Make a connection to an HTTP/2 server. */ - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Set the interval to 30000ms / 30s */ - curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L); - - curl_easy_perform(curl); - - /* Perform more work here. */ - - /* While the connection is being held open, curl_easy_upkeep() can be - called. If curl_easy_upkeep() is called and the time since the last - upkeep exceeds the interval, then an HTTP/2 PING is sent. */ - curl_easy_upkeep(curl); - - /* Perform more work here. */ - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.62.0. -.SH RETURN VALUE -On success, returns \fBCURLE_OK\fP. - -On failure, returns the appropriate error code. -.SH SEE ALSO -.BR CURLOPT_TCP_KEEPALIVE "(3), " -.BR CURLOPT_TCP_KEEPIDLE "(3), " diff --git a/docs/libcurl/curl_easy_upkeep.md b/docs/libcurl/curl_easy_upkeep.md new file mode 100644 index 000000000..2ad89d3bb --- /dev/null +++ b/docs/libcurl/curl_easy_upkeep.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_easy_upkeep +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TCP_KEEPALIVE (3) + - CURLOPT_TCP_KEEPIDLE (3) +--- + +# NAME + +curl_easy_upkeep - Perform any connection upkeep checks. + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_upkeep(CURL *handle); +~~~ + +# DESCRIPTION + +Some protocols have "connection upkeep" mechanisms. These mechanisms usually +send some traffic on existing connections in order to keep them alive; this +can prevent connections from being closed due to overzealous firewalls, for +example. + +Currently the only protocol with a connection upkeep mechanism is HTTP/2: when +the connection upkeep interval is exceeded and curl_easy_upkeep(3) +is called, an HTTP/2 PING frame is sent on the connection. + +This function must be explicitly called in order to perform the upkeep work. +The connection upkeep interval is set with +CURLOPT_UPKEEP_INTERVAL_MS(3). + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + /* Make a connection to an HTTP/2 server. */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Set the interval to 30000ms / 30s */ + curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L); + + curl_easy_perform(curl); + + /* Perform more work here. */ + + /* While the connection is being held open, curl_easy_upkeep() can be + called. If curl_easy_upkeep() is called and the time since the last + upkeep exceeds the interval, then an HTTP/2 PING is sent. */ + curl_easy_upkeep(curl); + + /* Perform more work here. */ + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.62.0. + +# RETURN VALUE + +On success, returns **CURLE_OK**. + +On failure, returns the appropriate error code. diff --git a/docs/libcurl/curl_escape.3 b/docs/libcurl/curl_escape.3 deleted file mode 100644 index 1cd262540..000000000 --- a/docs/libcurl/curl_escape.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_escape 3 "6 March 2002" "libcurl" "libcurl" -.SH NAME -curl_escape - URL encodes the given string -.SH SYNOPSIS -.nf -#include - -char *curl_escape(const char *string, int length); -.fi -.SH DESCRIPTION -Obsolete function. Use \fIcurl_easy_escape(3)\fP instead! - -This function converts the given input \fBstring\fP to a URL encoded string -and return that as a new allocated string. All input characters that are not -a-z, A-Z or 0-9 are converted to their "URL escaped" version (\fB%NN\fP where -\fBNN\fP is a two-digit hexadecimal number). - -If the \fBlength\fP argument is set to 0, \fIcurl_escape(3)\fP uses strlen() -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 -int main(void) -{ - char *output = curl_escape("data to convert", 15); - if(output) { - printf("Encoded: %s\\n", output); - curl_free(output); - } -} -.fi -.SH AVAILABILITY -Since 7.15.4, \fIcurl_easy_escape(3)\fP should be used. This function might be -removed in a future release. -.SH RETURN VALUE -A pointer to a null-terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_unescape (3), -.BR curl_free (3) diff --git a/docs/libcurl/curl_escape.md b/docs/libcurl/curl_escape.md new file mode 100644 index 000000000..e5e7e92b7 --- /dev/null +++ b/docs/libcurl/curl_escape.md @@ -0,0 +1,58 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_escape +Section: 3 +Source: libcurl +See-also: + - curl_free (3) + - curl_unescape (3) +--- + +# NAME + +curl_escape - URL encodes the given string + +# SYNOPSIS + +~~~c +#include + +char *curl_escape(const char *string, int length); +~~~ + +# DESCRIPTION + +Obsolete function. Use curl_easy_escape(3) instead! + +This function converts the given input **string** to a URL encoded string +and return that as a new allocated string. All input characters that are not +a-z, A-Z or 0-9 are converted to their "URL escaped" version (**%NN** where +**NN** is a two-digit hexadecimal number). + +If the **length** argument is set to 0, curl_escape(3) uses strlen() +on **string** to find out the size. + +You must curl_free(3) the returned string when you are done with it. + +# EXAMPLE + +~~~c +int main(void) +{ + char *output = curl_escape("data to convert", 15); + if(output) { + printf("Encoded: %s\n", output); + curl_free(output); + } +} +~~~ + +# AVAILABILITY + +Since 7.15.4, curl_easy_escape(3) should be used. This function might be +removed in a future release. + +# RETURN VALUE + +A pointer to a null-terminated string or NULL if it failed. diff --git a/docs/libcurl/curl_formadd.3 b/docs/libcurl/curl_formadd.md similarity index 59% rename from docs/libcurl/curl_formadd.3 rename to docs/libcurl/curl_formadd.md index 8d8e91d89..901c24c3b 100644 --- a/docs/libcurl/curl_formadd.3 +++ b/docs/libcurl/curl_formadd.md @@ -1,55 +1,48 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_formadd 3 "24 June 2002" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_formadd +Section: 3 +Source: libcurl +See-also: + - curl_easy_setopt (3) + - curl_formfree (3) + - curl_mime_init (3) +--- + +# NAME + curl_formadd - add a section to a multipart form POST -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLFORMcode curl_formadd(struct curl_httppost **firstitem, struct curl_httppost **lastitem, ...); -.fi -.SH DESCRIPTION -\fBThis function is deprecated.\fP Use \fIcurl_mime_init(3)\fP instead. +~~~ + +# DESCRIPTION + +**This function is deprecated.** Use curl_mime_init(3) instead. curl_formadd() is used to append sections when building a multipart form post. Append one section at a time until you have added all the sections you -want included and then you pass the \fIfirstitem\fP pointer as parameter to -\fICURLOPT_HTTPPOST(3)\fP. \fIlastitem\fP is set after each -\fIcurl_formadd(3)\fP call and on repeated invokes it should be left as set to -allow repeated invokes to find the end of the list faster. +want included and then you pass the *firstitem* pointer as parameter to +CURLOPT_HTTPPOST(3). *lastitem* is set after each curl_formadd(3) call and +on repeated invokes it should be left as set to allow repeated invokes to find +the end of the list faster. -After the \fIlastitem\fP pointer follow the real arguments. +After the *lastitem* pointer follow the real arguments. -The pointers \fIfirstitem\fP and \fIlastitem\fP should both be pointing to +The pointers *firstitem* and *lastitem* should both be pointing to NULL in the first call to this function. All list-data is allocated by the -function itself. You must call \fIcurl_formfree(3)\fP on the \fIfirstitem\fP +function itself. You must call curl_formfree(3) on the *firstitem* after the form post has been done to free the resources. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP as usual. +You can disable this header with CURLOPT_HTTPHEADER(3) as usual. First, there are some basics you need to understand about multipart form posts. Each part consists of at least a NAME and a CONTENTS part. If the part @@ -58,123 +51,158 @@ Below, we discuss what options you use to set these properties in the parts you want to add to your post. The options listed first are for making normal parts. The options from -\fICURLFORM_FILE\fP through \fICURLFORM_BUFFERLENGTH\fP are for file upload +*CURLFORM_FILE* through *CURLFORM_BUFFERLENGTH* are for file upload parts. -.SH OPTIONS -.IP CURLFORM_COPYNAME -followed by a string which provides the \fIname\fP of this part. libcurl + +# OPTIONS + +## CURLFORM_COPYNAME + +followed by a string which provides the *name* of this part. libcurl copies the string so your application does not need to keep it around after this function call. If the name is not null-terminated, you must set its -length with \fBCURLFORM_NAMELENGTH\fP. The \fIname\fP is not allowed to -contain zero-valued bytes. The copied data is freed by \fIcurl_formfree(3)\fP. -.IP CURLFORM_PTRNAME -followed by a string which provides the \fIname\fP of this part. libcurl uses -the pointer and refer to the data in your application, so you must make sure -it remains until curl no longer needs it. If the name is not null-terminated, -you must set its length with \fBCURLFORM_NAMELENGTH\fP. The \fIname\fP is not -allowed to contain zero-valued bytes. -.IP CURLFORM_COPYCONTENTS +length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to +contain zero-valued bytes. The copied data is freed by curl_formfree(3). + +## CURLFORM_PTRNAME + +followed by a string which provides the *name* of this part. libcurl uses the +pointer and refer to the data in your application, so you must make sure it +remains until curl no longer needs it. If the name is not null-terminated, you +must set its length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to +contain zero-valued bytes. + +## CURLFORM_COPYCONTENTS + followed by a pointer to the contents of this part, the actual data to send away. libcurl copies the provided data, so your application does not need to keep it around after this function call. If the data is not null terminated, or if you would like it to contain zero bytes, you must set the length of the -name with \fBCURLFORM_CONTENTSLENGTH\fP. The copied data is freed by -\fIcurl_formfree(3)\fP. -.IP CURLFORM_PTRCONTENTS +name with **CURLFORM_CONTENTSLENGTH**. The copied data is freed by +curl_formfree(3). + +## CURLFORM_PTRCONTENTS + followed by a pointer to the contents of this part, the actual data to send away. libcurl uses the pointer and refer to the data in your application, so -you must make sure it remains until curl no longer needs it. If the data is +you must make sure it remains until curl no longer needs it. If the data is not null-terminated, or if you would like it to contain zero bytes, you must -set its length with \fBCURLFORM_CONTENTSLENGTH\fP. -.IP CURLFORM_CONTENTLEN +set its length with **CURLFORM_CONTENTSLENGTH**. + +## CURLFORM_CONTENTLEN + followed by a curl_off_t value giving the length of the contents. Note that -for \fICURLFORM_STREAM\fP contents, this option is mandatory. +for *CURLFORM_STREAM* contents, this option is mandatory. If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents to figure out the size. If you really want to send a zero byte content then you must make sure strlen() on the data pointer returns zero. (Option added in 7.46.0) -.IP CURLFORM_CONTENTSLENGTH -(This option is deprecated. Use \fICURLFORM_CONTENTLEN\fP instead!) + +## CURLFORM_CONTENTSLENGTH + +(This option is deprecated. Use *CURLFORM_CONTENTLEN* instead!) followed by a long giving the length of the contents. Note that for -\fICURLFORM_STREAM\fP contents, this option is mandatory. +*CURLFORM_STREAM* contents, this option is mandatory. If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents to figure out the size. If you really want to send a zero byte content then you must make sure strlen() on the data pointer returns zero. -.IP CURLFORM_FILECONTENT + +## CURLFORM_FILECONTENT + followed by a filename, causes that file to be read and its contents used -as data in this part. This part does \fInot\fP automatically become a file +as data in this part. This part does *not* automatically become a file upload part simply because its data was read from a file. The specified file needs to kept around until the associated transfer is done. -.IP CURLFORM_FILE + +## CURLFORM_FILE + followed by a filename, makes this part a file upload part. It sets the -\fIfilename\fP field to the basename of the provided filename, it reads the +*filename* field to the basename of the provided filename, it reads the contents of the file and passes them as data and sets the content-type if the given file match one of the internally known file extensions. For -\fBCURLFORM_FILE\fP the user may send one or more files in one part by -providing multiple \fBCURLFORM_FILE\fP arguments each followed by the filename -(and each \fICURLFORM_FILE\fP is allowed to have a -\fICURLFORM_CONTENTTYPE\fP). +**CURLFORM_FILE** the user may send one or more files in one part by +providing multiple **CURLFORM_FILE** arguments each followed by the filename +(and each *CURLFORM_FILE* is allowed to have a +*CURLFORM_CONTENTTYPE*). The given upload file has to exist in its full in the file system already when the upload starts, as libcurl needs to read the correct file size beforehand. The specified file needs to kept around until the associated transfer is done. -.IP CURLFORM_CONTENTTYPE -is used in combination with \fICURLFORM_FILE\fP. Followed by a pointer to a + +## CURLFORM_CONTENTTYPE + +is used in combination with *CURLFORM_FILE*. Followed by a pointer to a string which provides the content-type for this part, possibly instead of an internally chosen one. -.IP CURLFORM_FILENAME -is used in combination with \fICURLFORM_FILE\fP. Followed by a pointer to a -string, it tells libcurl to use the given string as the \fIfilename\fP in the + +## CURLFORM_FILENAME + +is used in combination with *CURLFORM_FILE*. Followed by a pointer to a +string, it tells libcurl to use the given string as the *filename* in the file upload part instead of the actual file name. -.IP CURLFORM_BUFFER -is used for custom file upload parts without use of \fICURLFORM_FILE\fP. It + +## CURLFORM_BUFFER + +is used for custom file upload parts without use of *CURLFORM_FILE*. It tells libcurl that the file contents are already present in a buffer. The -parameter is a string which provides the \fIfilename\fP field in the content +parameter is a string which provides the *filename* field in the content header. -.IP CURLFORM_BUFFERPTR -is used in combination with \fICURLFORM_BUFFER\fP. The parameter is a pointer + +## CURLFORM_BUFFERPTR + +is used in combination with *CURLFORM_BUFFER*. The parameter is a pointer to the buffer to be uploaded. This buffer must not be freed until after -\fIcurl_easy_cleanup(3)\fP is called. You must also use -\fICURLFORM_BUFFERLENGTH\fP to set the number of bytes in the buffer. -.IP CURLFORM_BUFFERLENGTH -is used in combination with \fICURLFORM_BUFFER\fP. The parameter is a +curl_easy_cleanup(3) is called. You must also use +*CURLFORM_BUFFERLENGTH* to set the number of bytes in the buffer. + +## CURLFORM_BUFFERLENGTH + +is used in combination with *CURLFORM_BUFFER*. The parameter is a long which gives the length of the buffer. -.IP CURLFORM_STREAM -Tells libcurl to use the \fICURLOPT_READFUNCTION(3)\fP callback to get -data. The parameter you pass to \fICURLFORM_STREAM\fP is the pointer passed on + +## CURLFORM_STREAM + +Tells libcurl to use the CURLOPT_READFUNCTION(3) callback to get +data. The parameter you pass to *CURLFORM_STREAM* is the pointer passed on to the read callback's fourth argument. If you want the part to look like a -file upload one, set the \fICURLFORM_FILENAME\fP parameter as well. Note that -when using \fICURLFORM_STREAM\fP, \fICURLFORM_CONTENTSLENGTH\fP must also be +file upload one, set the *CURLFORM_FILENAME* parameter as well. Note that +when using *CURLFORM_STREAM*, *CURLFORM_CONTENTSLENGTH* must also be set with the total expected length of the part unless the formpost is sent chunked encoded. (Option added in libcurl 7.18.2) -.IP CURLFORM_ARRAY + +## CURLFORM_ARRAY + Another possibility to send options to curl_formadd() is the -\fBCURLFORM_ARRAY\fP option, that passes a struct curl_forms array pointer as -its value. Each curl_forms structure element has a \fICURLformoption\fP and a +**CURLFORM_ARRAY** option, that passes a struct curl_forms array pointer as +its value. Each curl_forms structure element has a *CURLformoption* and a char pointer. The final element in the array must be a CURLFORM_END. All available options can be used in an array, except the CURLFORM_ARRAY option -itself. The last argument in such an array must always be \fBCURLFORM_END\fP. -.IP CURLFORM_CONTENTHEADER +itself. The last argument in such an array must always be **CURLFORM_END**. + +## CURLFORM_CONTENTHEADER + specifies extra headers for the form POST section. This takes a curl_slist -prepared in the usual way using \fBcurl_slist_append\fP and appends the list +prepared in the usual way using **curl_slist_append** and appends the list of headers to those libcurl automatically generates. The list must exist while the POST occurs, if you free it before the post completes you may experience problems. -When you have passed the \fIstruct curl_httppost\fP pointer to -\fIcurl_easy_setopt(3)\fP (using the \fICURLOPT_HTTPPOST(3)\fP option), you -must not free the list until after you have called \fIcurl_easy_cleanup(3)\fP +When you have passed the *struct curl_httppost* pointer to +curl_easy_setopt(3) (using the CURLOPT_HTTPPOST(3) option), you +must not free the list until after you have called curl_easy_cleanup(3) for the curl handle. See example below. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include /* for strlen */ static const char record[]="data in a buffer"; @@ -196,7 +224,7 @@ int main(void) /* add null character into htmlbuffer, to demonstrate that transfers of buffers containing null characters actually work */ - htmlbuffer[8] = '\\0'; + htmlbuffer[8] = '\0'; /* Add simple name/content section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "name", @@ -267,19 +295,19 @@ int main(void) curl_formfree(post); } } -.fi -.SH AVAILABILITY +~~~ + +# 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 discouraged although still supported, but data is not read before being actually sent: the effective data size can then not be automatically determined, resulting in a chunked encoding transfer. Backslashes and double quotes in field and file names are now escaped before transmission. -.SH RETURN VALUE + +# RETURN VALUE + 0 means everything was OK, non-zero means an error occurred corresponding to a CURL_FORMADD_* constant defined in -.I -.SH "SEE ALSO" -.BR curl_easy_setopt (3), -.BR curl_formfree (3), -.BR curl_mime_init (3) +** diff --git a/docs/libcurl/curl_formfree.3 b/docs/libcurl/curl_formfree.3 deleted file mode 100644 index b3166745e..000000000 --- a/docs/libcurl/curl_formfree.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_formfree 3 "6 April 2001" "libcurl" "libcurl" -.SH NAME -curl_formfree - free a previously build multipart form post chain -.SH SYNOPSIS -.nf -#include - -void curl_formfree(struct curl_httppost *form); -.fi -.SH DESCRIPTION -This function is deprecated. Do not use. See \fIcurl_mime_init(3)\fP instead! - -curl_formfree() is used to clean up data previously built/appended with -\fIcurl_formadd(3)\fP. This must be called when the data has been used, which -typically means after \fIcurl_easy_perform(3)\fP has been called. - -The pointer to free is the same pointer you passed to the -\fICURLOPT_HTTPPOST(3)\fP option, which is the \fIfirstitem\fP pointer from -the \fIcurl_formadd(3)\fP invoke(s). - -\fBform\fP is the pointer as returned from a previous call to -\fIcurl_formadd(3)\fP and may be NULL. - -Passing in a NULL pointer in \fIform\fP makes this function return immediately -with no action. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - struct curl_httppost *formpost; - struct curl_httppost *lastptr; - - /* Fill in a file upload field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "file", - CURLFORM_FILE, "nice-image.jpg", - CURLFORM_END); - - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); - - curl_easy_perform(curl); - - /* then cleanup the formpost chain */ - curl_formfree(formpost); - } -} -.fi -.SH AVAILABILITY -Deprecated in 7.56.0. -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_formadd (3), -.BR curl_mime_init (3), -.BR curl_mime_free (3) diff --git a/docs/libcurl/curl_formfree.md b/docs/libcurl/curl_formfree.md new file mode 100644 index 000000000..d2f90c03f --- /dev/null +++ b/docs/libcurl/curl_formfree.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_formfree +Section: 3 +Source: libcurl +See-also: + - curl_formadd (3) + - curl_mime_free (3) + - curl_mime_init (3) +--- + +# NAME + +curl_formfree - free a previously build multipart form post chain + +# SYNOPSIS + +~~~c +#include + +void curl_formfree(struct curl_httppost *form); +~~~ + +# DESCRIPTION + +This function is deprecated. Do not use. See curl_mime_init(3) instead! + +curl_formfree() is used to clean up data previously built/appended with +curl_formadd(3). This must be called when the data has been used, which +typically means after curl_easy_perform(3) has been called. + +The pointer to free is the same pointer you passed to the +CURLOPT_HTTPPOST(3) option, which is the *firstitem* pointer from +the curl_formadd(3) invoke(s). + +**form** is the pointer as returned from a previous call to +curl_formadd(3) and may be NULL. + +Passing in a NULL pointer in *form* makes this function return immediately +with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + struct curl_httppost *formpost; + struct curl_httppost *lastptr; + + /* Fill in a file upload field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "file", + CURLFORM_FILE, "nice-image.jpg", + CURLFORM_END); + + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + + curl_easy_perform(curl); + + /* then cleanup the formpost chain */ + curl_formfree(formpost); + } +} +~~~ + +# AVAILABILITY + +Deprecated in 7.56.0. + +# RETURN VALUE + +None diff --git a/docs/libcurl/curl_formget.3 b/docs/libcurl/curl_formget.3 deleted file mode 100644 index 583092169..000000000 --- a/docs/libcurl/curl_formget.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_formget 3 "20 June 2006" "libcurl" "libcurl" -.SH NAME -curl_formget - serialize a previously built multipart form POST chain -.SH SYNOPSIS -.nf -#include - -int curl_formget(struct curl_httppost * form, void *userp, - curl_formget_callback append); -.fi -.SH DESCRIPTION -curl_formget() serializes data previously built with \fIcurl_formadd(3)\fP. It -accepts a void pointer as second argument named \fIuserp\fP which is passed as -the first argument to the curl_formget_callback function. - -.nf - typedef size_t (*curl_formget_callback)(void *userp, const char *buf, - size_t len);" -.fi - -The curl_formget_callback is invoked for each part of the HTTP POST chain. The -character buffer passed to the callback must not be freed. The callback should -return the buffer length passed to it on success. - -If the \fBCURLFORM_STREAM\fP option is used in the formpost, it prevents -\fIcurl_formget(3)\fP from working until you have performed the actual HTTP -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(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. -.SH RETURN VALUE -0 means everything was OK, non-zero means an error occurred -.SH "SEE ALSO" -.BR curl_formadd (3), -.BR curl_mime_init (3) diff --git a/docs/libcurl/curl_formget.md b/docs/libcurl/curl_formget.md new file mode 100644 index 000000000..7130ee937 --- /dev/null +++ b/docs/libcurl/curl_formget.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_formget +Section: 3 +Source: libcurl +See-also: + - curl_formadd (3) + - curl_mime_init (3) +--- + +# NAME + +curl_formget - serialize a previously built multipart form POST chain + +# SYNOPSIS + +~~~c +#include + +int curl_formget(struct curl_httppost * form, void *userp, + curl_formget_callback append); +~~~ + +# DESCRIPTION + +curl_formget() serializes data previously built with curl_formadd(3). It +accepts a void pointer as second argument named *userp* which is passed as +the first argument to the curl_formget_callback function. + +~~~c + typedef size_t (*curl_formget_callback)(void *userp, const char *buf, + size_t len);" +~~~ + +The curl_formget_callback is invoked for each part of the HTTP POST chain. The +character buffer passed to the callback must not be freed. The callback should +return the buffer length passed to it on success. + +If the **CURLFORM_STREAM** option is used in the formpost, it prevents +curl_formget(3) from working until you have performed the actual HTTP +request. This, because first then does libcurl known which actual read +callback to use! + +# EXAMPLE + +~~~c +size_t print_httppost_callback(void *arg, const char *buf, size_t len) +{ + fwrite(buf, len, 1, stdout); + (*(size_t *) arg) += len; + return len; +} + +size_t print_httppost(struct curl_httppost *post) +{ + size_t total_size = 0; + if(curl_formget(post, &total_size, print_httppost_callback)) { + return (size_t) -1; + } + return total_size; +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.15.5. The form API is deprecated in +libcurl 7.56.0. + +# RETURN VALUE + +0 means everything was OK, non-zero means an error occurred diff --git a/docs/libcurl/curl_free.3 b/docs/libcurl/curl_free.3 deleted file mode 100644 index f29d8f1e1..000000000 --- a/docs/libcurl/curl_free.3 +++ /dev/null @@ -1,57 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_free 3 "12 Aug 2003" "libcurl" "libcurl" -.SH NAME -curl_free - reclaim memory that has been obtained through a libcurl call -.SH SYNOPSIS -.nf -#include - -void curl_free(void *ptr); -.fi -.SH DESCRIPTION -curl_free reclaims memory that has been obtained through a libcurl call. Use -\fIcurl_free(3)\fP instead of free() to avoid anomalies that can result from -differences in memory management between your application and libcurl. - -Passing in a NULL pointer in \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 -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_easy_escape (3), -.BR curl_easy_unescape (3) diff --git a/docs/libcurl/curl_free.md b/docs/libcurl/curl_free.md new file mode 100644 index 000000000..696394055 --- /dev/null +++ b/docs/libcurl/curl_free.md @@ -0,0 +1,52 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_free +Section: 3 +Source: libcurl +See-also: + - curl_easy_escape (3) + - curl_easy_unescape (3) +--- + +# NAME + +curl_free - reclaim memory that has been obtained through a libcurl call + +# SYNOPSIS + +~~~c +#include + +void curl_free(void *ptr); +~~~ + +# DESCRIPTION + +curl_free reclaims memory that has been obtained through a libcurl call. Use +curl_free(3) instead of free() to avoid anomalies that can result from +differences in memory management between your application and libcurl. + +Passing in a NULL pointer in *ptr* makes this function return immediately +with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + char *width = curl_getenv("COLUMNS"); + if(width) { + /* it was set! */ + curl_free(width); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +None diff --git a/docs/libcurl/curl_getdate.3 b/docs/libcurl/curl_getdate.md similarity index 65% rename from docs/libcurl/curl_getdate.3 rename to docs/libcurl/curl_getdate.md index 91c55235f..e4fbf0394 100644 --- a/docs/libcurl/curl_getdate.3 +++ b/docs/libcurl/curl_getdate.md @@ -1,70 +1,77 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_getdate 3 "12 Aug 2005" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_getdate +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TIMECONDITION (3) + - CURLOPT_TIMEVALUE (3) + - curl_easy_escape (3) + - curl_easy_unescape (3) +--- + +# NAME + curl_getdate - Convert a date string to number of seconds -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include time_t curl_getdate(const char *datestring, const time_t *now); -.fi -.SH DESCRIPTION -\fIcurl_getdate(3)\fP returns the number of seconds since the Epoch, January +~~~ + +# DESCRIPTION + +curl_getdate(3) returns the number of seconds since the Epoch, January 1st 1970 00:00:00 in the UTC time zone, for the date and time that the -\fIdatestring\fP parameter specifies. The \fInow\fP parameter is not used, +*datestring* parameter specifies. The *now* parameter is not used, pass a NULL there. This function works with valid dates and does not always detect and reject wrong dates, such as February 30. -.SH PARSING DATES AND TIMES +# PARSING DATES AND TIMES + A "date" is a string containing several items separated by whitespace. The order of the items is immaterial. A date string may contain many flavors of items: -.IP "calendar date items" + +## calendar date items + Can be specified several ways. Month names can only be three-letter English abbreviations, numbers can be zero-prefixed and the year may use 2 or 4 -digits. Examples: 06 Nov 1994, 06-Nov-94 and Nov-94 6. -.IP "time of the day items" +digits. Examples: 06 Nov 1994, 06-Nov-94 and Nov-94 6. + +## time of the day items + This string specifies the time on a given day. You must specify it with 6 digits with two colons: HH:MM:SS. If there is no time given in a provided date string, 00:00:00 is assumed. Example: 18:19:21. -.IP "time zone items" + +## time zone items + Specifies international time zone. There are a few acronyms supported, but in general you should instead use the specific relative time compared to UTC. Supported formats include: -1200, MST, +0100. -.IP "day of the week items" + +## day of the week items + Specifies a day of the week. Days of the week may be spelled out in full (using English): `Sunday', `Monday', etc or they may be abbreviated to their first three letters. This is usually not info that adds anything. -.IP "pure numbers" + +## pure numbers + If a decimal number of the form YYYYMMDD appears, then YYYY is read as the year, MM as the month number and DD as the day of the month, for the specified calendar date. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { time_t t; @@ -91,16 +98,22 @@ int main(void) t = curl_getdate("20040912 15:05:58 -0700", NULL); t = curl_getdate("20040911 +0200", NULL); } -.fi -.SH STANDARDS +~~~ + +# STANDARDS + This parser handles date formats specified in RFC 822 (including the update in RFC 1123) using time zone name or time zone delta and RFC 850 (obsoleted by -RFC 1036) and ANSI C's \fIasctime()\fP format. +RFC 1036) and ANSI C's *asctime()* format. These formats are the only ones RFC 7231 says HTTP applications may use. -.SH AVAILABILITY + +# AVAILABILITY + Always -.SH RETURN VALUE + +# RETURN VALUE + This function returns -1 when it fails to parse the date string. Otherwise it returns the number of seconds as described. @@ -113,8 +126,3 @@ less than 1970, this function returns -1. On systems with 64 bit time_t: if the year is less than 1583, this function returns -1. (The Gregorian calendar was first introduced 1582 so no "real" dates in this way of doing dates existed before then.) -.SH "SEE ALSO" -.BR curl_easy_escape (3), -.BR curl_easy_unescape (3), -.BR CURLOPT_TIMECONDITION (3), -.BR CURLOPT_TIMEVALUE (3) diff --git a/docs/libcurl/curl_getenv.3 b/docs/libcurl/curl_getenv.3 deleted file mode 100644 index a13d59671..000000000 --- a/docs/libcurl/curl_getenv.3 +++ /dev/null @@ -1,60 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_getenv 3 "30 April 2004" "libcurl" "libcurl" -.SH NAME -curl_getenv - return value for environment name -.SH SYNOPSIS -.nf -#include - -char *curl_getenv(const char *name); -.fi -.SH DESCRIPTION -curl_getenv() is a portable wrapper for the getenv() function, meant to -emulate its behavior and provide an identical interface for all operating -systems libcurl builds on (including 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 -.SH RETURN VALUE -A pointer to a null-terminated string or NULL if it failed to find the -specified name. -.SH NOTE -Under unix operating systems, there is no point in returning an allocated -memory, although other systems does not work properly if this is not done. The -unix implementation thus suffers slightly from the drawbacks of other systems. -.SH "SEE ALSO" -.BR getenv (3C) diff --git a/docs/libcurl/curl_getenv.md b/docs/libcurl/curl_getenv.md new file mode 100644 index 000000000..dbf326d11 --- /dev/null +++ b/docs/libcurl/curl_getenv.md @@ -0,0 +1,57 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_getenv +Section: 3 +Source: libcurl +See-also: + - getenv (3C) +--- + +# NAME + +curl_getenv - return value for environment name + +# SYNOPSIS + +~~~c +#include + +char *curl_getenv(const char *name); +~~~ + +# DESCRIPTION + +curl_getenv() is a portable wrapper for the getenv() function, meant to +emulate its behavior and provide an identical interface for all operating +systems libcurl builds on (including win32). + +You must curl_free(3) the returned string when you are done with it. + +# EXAMPLE + +~~~c +int main(void) +{ + char *width = curl_getenv("COLUMNS"); + if(width) { + /* it was set! */ + curl_free(width); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +A pointer to a null-terminated string or NULL if it failed to find the +specified name. + +# NOTE + +Under unix operating systems, there is no point in returning an allocated +memory, although other systems does not work properly if this is not done. The +unix implementation thus suffers slightly from the drawbacks of other systems. diff --git a/docs/libcurl/curl_global_cleanup.3 b/docs/libcurl/curl_global_cleanup.3 deleted file mode 100644 index 75a0a01ac..000000000 --- a/docs/libcurl/curl_global_cleanup.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_global_cleanup 3 "17 Feb 2006" "libcurl" "libcurl" -.SH NAME -curl_global_cleanup - global libcurl cleanup -.SH SYNOPSIS -.nf -#include - -void curl_global_cleanup(void); -.fi -.SH DESCRIPTION -This function releases resources acquired by \fIcurl_global_init(3)\fP. - -You should call \fIcurl_global_cleanup(3)\fP once for each call you make to -\fIcurl_global_init(3)\fP, after you are done using libcurl. - -This function is thread-safe since libcurl 7.84.0 if -\fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set -(most platforms). - -If this is not thread-safe, you must not call this function when any other -thread in the program (i.e. a thread sharing the same memory) is running. -This does not just mean no other thread that is using libcurl. Because -\fIcurl_global_cleanup(3)\fP calls functions of other libraries that are -similarly thread unsafe, it could conflict with any other thread that uses -these other libraries. - -See the description in \fIlibcurl(3)\fP of global environment requirements for -details of how to use this function. -.SH CAUTION -\fIcurl_global_cleanup(3)\fP does not block waiting for any libcurl-created -threads to terminate (such as threads used for name resolving). If a module -containing libcurl is dynamically unloaded while libcurl-created threads are -still running then your program may crash or other corruption may occur. We -recommend you do not run libcurl from any module that may be unloaded -dynamically. This behavior may be addressed in the future. -.SH EXAMPLE -.nf -int main(void) -{ - curl_global_init(CURL_GLOBAL_DEFAULT); - - /* use libcurl, then before exiting... */ - - curl_global_cleanup(); -} -.fi -.SH AVAILABILITY -Added in 7.8 -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_global_init (3), -.BR libcurl (3), -.BR libcurl-thread (3) diff --git a/docs/libcurl/curl_global_cleanup.md b/docs/libcurl/curl_global_cleanup.md new file mode 100644 index 000000000..5502e718d --- /dev/null +++ b/docs/libcurl/curl_global_cleanup.md @@ -0,0 +1,74 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_global_cleanup +Section: 3 +Source: libcurl +See-also: + - curl_global_init (3) + - libcurl (3) + - libcurl-thread (3) +--- + +# NAME + +curl_global_cleanup - global libcurl cleanup + +# SYNOPSIS + +~~~c +#include + +void curl_global_cleanup(void); +~~~ + +# DESCRIPTION + +This function releases resources acquired by curl_global_init(3). + +You should call curl_global_cleanup(3) once for each call you make to +curl_global_init(3), after you are done using libcurl. + +This function is thread-safe since libcurl 7.84.0 if +curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set +(most platforms). + +If this is not thread-safe, you must not call this function when any other +thread in the program (i.e. a thread sharing the same memory) is running. +This does not just mean no other thread that is using libcurl. Because +curl_global_cleanup(3) calls functions of other libraries that are +similarly thread unsafe, it could conflict with any other thread that uses +these other libraries. + +See the description in libcurl(3) of global environment requirements for +details of how to use this function. + +# CAUTION + +curl_global_cleanup(3) does not block waiting for any libcurl-created +threads to terminate (such as threads used for name resolving). If a module +containing libcurl is dynamically unloaded while libcurl-created threads are +still running then your program may crash or other corruption may occur. We +recommend you do not run libcurl from any module that may be unloaded +dynamically. This behavior may be addressed in the future. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_global_init(CURL_GLOBAL_DEFAULT); + + /* use libcurl, then before exiting... */ + + curl_global_cleanup(); +} +~~~ + +# AVAILABILITY + +Added in 7.8 + +# RETURN VALUE + +None diff --git a/docs/libcurl/curl_global_init.3 b/docs/libcurl/curl_global_init.md similarity index 59% rename from docs/libcurl/curl_global_init.3 rename to docs/libcurl/curl_global_init.md index b76999100..5c00e862d 100644 --- a/docs/libcurl/curl_global_init.3 +++ b/docs/libcurl/curl_global_init.md @@ -1,36 +1,32 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_global_init 3 "11 May 2004" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_global_init +Section: 3 +Source: libcurl +See-also: + - curl_easy_init (3) + - curl_global_cleanup (3) + - curl_global_init_mem (3) + - curl_global_sslset (3) + - curl_global_trace (3) + - libcurl (3) +--- + +# NAME + curl_global_init - Global libcurl initialization -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLcode curl_global_init(long flags); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This function sets up the program environment that libcurl needs. Think of it as an extension of the library loader. @@ -47,28 +43,32 @@ value unless you are familiar with it and mean to control internal operations of libcurl. This function is thread-safe since libcurl 7.84.0 if -\fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set +curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set (most platforms). If this is not thread-safe, you must not call this function when any other thread in the program (i.e. a thread sharing the same memory) is running. This does not just mean no other thread that is using libcurl. Because -\fIcurl_global_init(3)\fP calls functions of other libraries that are +curl_global_init(3) calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. If you are initializing libcurl from a Windows DLL you should not initialize -it from \fIDllMain\fP or a static initializer because Windows holds the loader +it from *DllMain* or a static initializer because Windows holds the loader lock during that time and it could cause a deadlock. -See the description in \fIlibcurl(3)\fP of global environment requirements for +See the description in libcurl(3) of global environment requirements for details of how to use this function. -.SH FLAGS -.IP CURL_GLOBAL_ALL -Initialize everything possible. This sets all known bits except -\fBCURL_GLOBAL_ACK_EINTR\fP. -.IP CURL_GLOBAL_SSL +# FLAGS + +## CURL_GLOBAL_ALL + +Initialize everything possible. This sets all known bits except +**CURL_GLOBAL_ACK_EINTR**. + +## CURL_GLOBAL_SSL + (This flag's presence or absence serves no meaning since 7.57.0. The description below is for older libcurl versions.) @@ -81,26 +81,36 @@ backend libcurl uses. Doing TLS based transfers without having the TLS layer initialized may lead to unexpected behaviors. -.IP CURL_GLOBAL_WIN32 + +## CURL_GLOBAL_WIN32 + Initialize the Win32 socket libraries. The implication here is that if this bit is not set, the initialization of winsock has to be done by the application or you risk getting undefined behaviors. This option exists for when the initialization is handled outside of libcurl so there is no need for libcurl to do it again. -.IP CURL_GLOBAL_NOTHING + +## CURL_GLOBAL_NOTHING + Initialize nothing extra. This sets no bit. -.IP CURL_GLOBAL_DEFAULT + +## CURL_GLOBAL_DEFAULT + A sensible default. It initializes both SSL and Win32. Right now, this equals -the functionality of the \fBCURL_GLOBAL_ALL\fP mask. -.IP CURL_GLOBAL_ACK_EINTR +the functionality of the **CURL_GLOBAL_ALL** mask. + +## CURL_GLOBAL_ACK_EINTR + This bit has no point since 7.69.0 but its behavior is instead the default. Before 7.69.0: when this flag is set, curl acknowledges EINTR condition when connecting or when waiting for data. Otherwise, curl waits until full timeout elapses. (Added in 7.30.0) -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { curl_global_init(CURL_GLOBAL_DEFAULT); @@ -109,16 +119,13 @@ int main(void) curl_global_cleanup(); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.8 -.SH RETURN VALUE + +# RETURN VALUE + If this function returns non-zero, something went wrong and you cannot use the other curl functions. -.SH "SEE ALSO" -.BR curl_easy_init (3), -.BR curl_global_cleanup (3), -.BR curl_global_init_mem (3), -.BR curl_global_sslset (3), -.BR curl_global_trace (3), -.BR libcurl (3) diff --git a/docs/libcurl/curl_global_init_mem.3 b/docs/libcurl/curl_global_init_mem.3 deleted file mode 100644 index b41087531..000000000 --- a/docs/libcurl/curl_global_init_mem.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_global_init_mem 3 "10 May 2004" "libcurl" "libcurl" -.SH NAME -curl_global_init_mem - Global libcurl initialization with memory callbacks -.SH SYNOPSIS -.nf -#include - -CURLcode curl_global_init_mem(long flags, - curl_malloc_callback m, - curl_free_callback f, - curl_realloc_callback r, - curl_strdup_callback s, - curl_calloc_callback c); -.fi -.SH DESCRIPTION -This function works exactly as \fIcurl_global_init(3)\fP with one addition: it -allows the application to set callbacks to replace the otherwise used internal -memory functions. - -If you are using libcurl from multiple threads or libcurl was built with the -threaded resolver option then the callback functions must be thread safe. The -threaded resolver is a common build option to enable (and in some cases the -default) so we strongly urge you to make your callback functions thread safe. - -All callback arguments must be set to valid function pointers. The -prototypes for the given callbacks must match these: -.IP "void *malloc_callback(size_t size);" -To replace malloc() -.IP "void free_callback(void *ptr);" -To replace free() -.IP "void *realloc_callback(void *ptr, size_t size);" -To replace realloc() -.IP "char *strdup_callback(const char *str);" -To replace strdup() -.IP "void *calloc_callback(size_t nmemb, size_t size);" -To replace calloc() - -This function is otherwise the same as \fIcurl_global_init(3)\fP, please refer -to that man page for documentation. -.SH CAUTION -Manipulating these gives considerable powers to the application to severely -screw things up for libcurl. Take care! -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -CURLE_OK (0) means everything was OK, non-zero means an error occurred as -\fI\fP defines - see \fIlibcurl-errors(3)\fP. -.SH "SEE ALSO" -.BR curl_global_init (3), -.BR curl_global_cleanup (3) diff --git a/docs/libcurl/curl_global_init_mem.md b/docs/libcurl/curl_global_init_mem.md new file mode 100644 index 000000000..3bf468f18 --- /dev/null +++ b/docs/libcurl/curl_global_init_mem.md @@ -0,0 +1,95 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_global_init_mem +Section: 3 +Source: libcurl +See-also: + - curl_global_cleanup (3) + - curl_global_init (3) +--- + +# NAME + +curl_global_init_mem - Global libcurl initialization with memory callbacks + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_global_init_mem(long flags, + curl_malloc_callback m, + curl_free_callback f, + curl_realloc_callback r, + curl_strdup_callback s, + curl_calloc_callback c); +~~~ + +# DESCRIPTION + +This function works exactly as curl_global_init(3) with one addition: it +allows the application to set callbacks to replace the otherwise used internal +memory functions. + +If you are using libcurl from multiple threads or libcurl was built with the +threaded resolver option then the callback functions must be thread safe. The +threaded resolver is a common build option to enable (and in some cases the +default) so we strongly urge you to make your callback functions thread safe. + +All callback arguments must be set to valid function pointers. The +prototypes for the given callbacks must match these: + +## void *malloc_callback(size_t size); + +To replace malloc() + +## void free_callback(void *ptr); + +To replace free() + +## void *realloc_callback(void *ptr, size_t size); + +To replace realloc() + +## char *strdup_callback(const char *str); + +To replace strdup() + +## void *calloc_callback(size_t nmemb, size_t size); + +To replace calloc() + +This function is otherwise the same as curl_global_init(3), please refer +to that man page for documentation. + +# CAUTION + +Manipulating these gives considerable powers to the application to severely +screw things up for libcurl. Take care! + +# EXAMPLE + +~~~c +extern void *malloc_cb(size_t); +extern void free_cb(void *); +extern void *realloc_cb(void *, size_t); +extern char *strdup_cb(const char *); +extern void *calloc_cb(size_t, size_t); + +int main(void) +{ + curl_global_init_mem(CURL_GLOBAL_DEFAULT, malloc_cb, + free_cb, realloc_cb, + strdup_cb, calloc_cb); +} +~~~ + +# AVAILABILITY + +Added in 7.12.0 + +# RETURN VALUE + +CURLE_OK (0) means everything was OK, non-zero means an error occurred as +** defines - see libcurl-errors(3). diff --git a/docs/libcurl/curl_global_sslset.3 b/docs/libcurl/curl_global_sslset.3 deleted file mode 100644 index 3384b551a..000000000 --- a/docs/libcurl/curl_global_sslset.3 +++ /dev/null @@ -1,139 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_global_sslset 3 "15 July 2017" "libcurl" "libcurl" -.SH NAME -curl_global_sslset - Select SSL backend to use with libcurl -.SH SYNOPSIS -.nf -#include - -CURLsslset curl_global_sslset(curl_sslbackend id, - const char *name, - const curl_ssl_backend ***avail); -.fi -.SH DESCRIPTION -This function configures at runtime which SSL backend to use with -libcurl. This function can only be used to select an SSL backend once, and it -must be called \fBbefore\fP \fIcurl_global_init(3)\fP. - -The backend can be identified by the \fIid\fP -(e.g. \fBCURLSSLBACKEND_OPENSSL\fP). The backend can also be specified via the -\fIname\fP parameter for a case insensitive match (passing -\fBCURLSSLBACKEND_NONE\fP as \fIid\fP). If both \fIid\fP and \fIname\fP are -specified, the \fIname\fP is ignored. - -If neither \fIid\fP nor \fPname\fP are specified, the function fails with -\fBCURLSSLSET_UNKNOWN_BACKEND\fP and set the \fIavail\fP pointer to the -NULL-terminated list of available backends. The available backends are those -that this particular build of libcurl supports. - -Since libcurl 7.60.0, the \fIavail\fP pointer is always set to the list of -alternatives if non-NULL. - -Upon success, the function returns \fBCURLSSLSET_OK\fP. - -If the specified SSL backend is not available, the function returns -\fBCURLSSLSET_UNKNOWN_BACKEND\fP and sets the \fIavail\fP pointer to a -NULL-terminated list of available SSL backends. In this case, you may call the -function again to try to select a different backend. - -The SSL backend can be set only once. If it has already been set, a subsequent -attempt to change it results in a \fBCURLSSLSET_TOO_LATE\fP getting returned. - -This function is thread-safe since libcurl 7.84.0 if -\fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set -(most platforms). - -If this is not thread-safe, you must not call this function when any other -thread in the program (i.e. a thread sharing the same memory) is running. -This does not just mean no other thread that is using libcurl. -.SH OpenSSL -The name "OpenSSL" is used for all versions of OpenSSL and its associated -forks/flavors in this function. OpenSSL, BoringSSL, libressl, quictls and -AmiSSL are all supported by libcurl, but in the eyes of -\fIcurl_global_sslset(3)\fP they are all just "OpenSSL". They all mostly -provide the same API. - -\fIcurl_version_info(3)\fP can return more specific info about the exact -OpenSSL flavor and version number is use. -.SH struct -.nf -typedef struct { - curl_sslbackend id; - const char *name; -} curl_ssl_backend; - -typedef enum { - CURLSSLBACKEND_NONE = 0, - CURLSSLBACKEND_OPENSSL = 1, /* or one of its forks */ - CURLSSLBACKEND_GNUTLS = 2, - CURLSSLBACKEND_NSS = 3, - CURLSSLBACKEND_GSKIT = 5, /* deprecated */ - CURLSSLBACKEND_POLARSSL = 6, /* deprecated */ - CURLSSLBACKEND_WOLFSSL = 7, - CURLSSLBACKEND_SCHANNEL = 8, - CURLSSLBACKEND_SECURETRANSPORT = 9, - CURLSSLBACKEND_AXTLS = 10, /* deprecated */ - CURLSSLBACKEND_MBEDTLS = 11, - CURLSSLBACKEND_MESALINK = 12, /* deprecated */ - CURLSSLBACKEND_BEARSSL = 13, - CURLSSLBACKEND_RUSTLS = 14 -} curl_sslbackend; -.fi -.SH EXAMPLE -.nf -int main(void) -{ - int i; - /* choose a specific backend */ - curl_global_sslset(CURLSSLBACKEND_WOLFSSL, NULL, NULL); - - /* list the available ones */ - const curl_ssl_backend **list; - curl_global_sslset(CURLSSLBACKEND_NONE, NULL, &list); - - for(i = 0; list[i]; i++) - printf("SSL backend #%d: '%s' (ID: %d)\\n", - i, list[i]->name, list[i]->id); -} -.fi -.SH AVAILABILITY -This function was added in libcurl 7.56.0. Before this version, there was no -support for choosing SSL backends at runtime. -.SH RETURN VALUE -If this function returns \fICURLSSLSET_OK\fP, the backend was successfully -selected. - -If the chosen backend is unknown (or support for the chosen backend has not -been compiled into libcurl), the function returns -\fICURLSSLSET_UNKNOWN_BACKEND\fP. - -If the backend had been configured previously, or if \fIcurl_global_init(3)\fP -has already been called, the function returns \fICURLSSLSET_TOO_LATE\fP. - -If this libcurl was built completely without SSL support, with no backends at -all, this function returns \fICURLSSLSET_NO_BACKENDS\fP. -.SH "SEE ALSO" -.BR curl_global_init (3), -.BR libcurl (3) diff --git a/docs/libcurl/curl_global_sslset.md b/docs/libcurl/curl_global_sslset.md new file mode 100644 index 000000000..6f50867a1 --- /dev/null +++ b/docs/libcurl/curl_global_sslset.md @@ -0,0 +1,138 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_global_sslset +Section: 3 +Source: libcurl +See-also: + - curl_global_init (3) + - libcurl (3) +--- + +# NAME + +curl_global_sslset - Select SSL backend to use with libcurl + +# SYNOPSIS + +~~~c +#include + +CURLsslset curl_global_sslset(curl_sslbackend id, + const char *name, + const curl_ssl_backend ***avail); +~~~ + +# DESCRIPTION + +This function configures at runtime which SSL backend to use with +libcurl. This function can only be used to select an SSL backend once, and it +must be called **before** curl_global_init(3). + +The backend can be identified by the *id* +(e.g. **CURLSSLBACKEND_OPENSSL**). The backend can also be specified via the +*name* parameter for a case insensitive match (passing +**CURLSSLBACKEND_NONE** as *id*). If both *id* and *name* are +specified, the *name* is ignored. + +If neither *id* nor *name* are specified, the function fails with +**CURLSSLSET_UNKNOWN_BACKEND** and set the *avail* pointer to the +NULL-terminated list of available backends. The available backends are those +that this particular build of libcurl supports. + +Since libcurl 7.60.0, the *avail* pointer is always set to the list of +alternatives if non-NULL. + +Upon success, the function returns **CURLSSLSET_OK**. + +If the specified SSL backend is not available, the function returns +**CURLSSLSET_UNKNOWN_BACKEND** and sets the *avail* pointer to a +NULL-terminated list of available SSL backends. In this case, you may call the +function again to try to select a different backend. + +The SSL backend can be set only once. If it has already been set, a subsequent +attempt to change it results in a **CURLSSLSET_TOO_LATE** getting returned. + +This function is thread-safe since libcurl 7.84.0 if +curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set +(most platforms). + +If this is not thread-safe, you must not call this function when any other +thread in the program (i.e. a thread sharing the same memory) is running. +This does not just mean no other thread that is using libcurl. + +# OpenSSL + +The name "OpenSSL" is used for all versions of OpenSSL and its associated +forks/flavors in this function. OpenSSL, BoringSSL, libressl, quictls and +AmiSSL are all supported by libcurl, but in the eyes of +curl_global_sslset(3) they are all just "OpenSSL". They all mostly +provide the same API. + +curl_version_info(3) can return more specific info about the exact +OpenSSL flavor and version number is use. + +# struct + +~~~c +typedef struct { + curl_sslbackend id; + const char *name; +} curl_ssl_backend; + +typedef enum { + CURLSSLBACKEND_NONE = 0, + CURLSSLBACKEND_OPENSSL = 1, /* or one of its forks */ + CURLSSLBACKEND_GNUTLS = 2, + CURLSSLBACKEND_NSS = 3, + CURLSSLBACKEND_GSKIT = 5, /* deprecated */ + CURLSSLBACKEND_POLARSSL = 6, /* deprecated */ + CURLSSLBACKEND_WOLFSSL = 7, + CURLSSLBACKEND_SCHANNEL = 8, + CURLSSLBACKEND_SECURETRANSPORT = 9, + CURLSSLBACKEND_AXTLS = 10, /* deprecated */ + CURLSSLBACKEND_MBEDTLS = 11, + CURLSSLBACKEND_MESALINK = 12, /* deprecated */ + CURLSSLBACKEND_BEARSSL = 13, + CURLSSLBACKEND_RUSTLS = 14 +} curl_sslbackend; +~~~ + +# EXAMPLE + +~~~c +int main(void) +{ + int i; + /* choose a specific backend */ + curl_global_sslset(CURLSSLBACKEND_WOLFSSL, NULL, NULL); + + /* list the available ones */ + const curl_ssl_backend **list; + curl_global_sslset(CURLSSLBACKEND_NONE, NULL, &list); + + for(i = 0; list[i]; i++) + printf("SSL backend #%d: '%s' (ID: %d)\n", + i, list[i]->name, list[i]->id); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.56.0. Before this version, there was no +support for choosing SSL backends at runtime. + +# RETURN VALUE + +If this function returns *CURLSSLSET_OK*, the backend was successfully +selected. + +If the chosen backend is unknown (or support for the chosen backend has not +been compiled into libcurl), the function returns +*CURLSSLSET_UNKNOWN_BACKEND*. + +If the backend had been configured previously, or if curl_global_init(3) +has already been called, the function returns *CURLSSLSET_TOO_LATE*. + +If this libcurl was built completely without SSL support, with no backends at +all, this function returns *CURLSSLSET_NO_BACKENDS*. diff --git a/docs/libcurl/curl_global_trace.3 b/docs/libcurl/curl_global_trace.md similarity index 61% rename from docs/libcurl/curl_global_trace.3 rename to docs/libcurl/curl_global_trace.md index 926a86b1d..fe9c12c1b 100644 --- a/docs/libcurl/curl_global_trace.3 +++ b/docs/libcurl/curl_global_trace.md @@ -1,36 +1,28 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_global_trace 3 "01 August 2023" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_global_trace +Section: 3 +Source: libcurl +See-also: + - curl_global_init (3) + - libcurl (3) +--- + +# NAME + curl_global_trace - Global libcurl logging configuration -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLcode curl_global_trace(const char *config); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This function configures the logging behavior, allowing to make some parts of curl more verbose or silent than others. @@ -42,21 +34,21 @@ Calling this function after transfers have been started is undefined. On some platforms/architectures it might take effect, on others not. This function is thread-safe since libcurl 8.3.0 if -\fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set +curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set (most platforms). If this is not thread-safe, you must not call this function when any other thread in the program (i.e. a thread sharing the same memory) is running. This does not just mean no other thread that is using libcurl. Because -\fIcurl_global_init(3)\fP may call functions of other libraries that are +curl_global_init(3) may call functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. If you are initializing libcurl from a Windows DLL you should not initialize -it from \fIDllMain\fP or a static initializer because Windows holds the loader +it from *DllMain* or a static initializer because Windows holds the loader lock during that time and it could cause a deadlock. -The \fIconfig\fP string is a list of comma-separated component names. Names +The *config* string is a list of comma-separated component names. Names are case-insensitive and unknown names are ignored. The special name "all" applies to all components. Names may be prefixed with '+' or '-' to enable or disable detailed logging for a component. @@ -68,19 +60,29 @@ upgrading libcurl. Given that, some names can be expected to be fairly stable and are listed below for easy reference. Note that log configuration applies only to transfers where debug logging -is enabled. See \fICURLOPT_VERBOSE(3)\fP or \fICURLOPT_DEBUGFUNCTION(3)\fP +is enabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control that. -.SH TRACE COMPONENTS -.IP tcp +# TRACE COMPONENTS + +## tcp + Tracing of TCP socket handling: connect, reads, writes. -.IP ssl + +## ssl + Tracing of SSL/TLS operations, whichever SSL backend is used in your build. -.IP http/2 + +## http/2 + Details about HTTP/2 handling: frames, events, I/O, etc. -.IP http/3 + +## http/3 + Details about HTTP/3 handling: connect, frames, events, I/O etc. -.IP http-proxy + +## http-proxy + Involved when transfers are tunneled through a HTTP proxy. "h1-proxy" or "h2-proxy" are also involved, depending on the HTTP version negotiated with the proxy. @@ -89,8 +91,9 @@ In order to find out all components involved in a transfer, run it with "all" configured. You can then see all names involved in your libcurl version in the trace. -.SH EXAMPLE -.nf +# EXAMPLE + +~~~c int main(void) { /* log details of HTTP/2 and SSL handling */ @@ -99,23 +102,23 @@ int main(void) /* 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 of an enabled component appears at the beginning in brackets. -.nf +~~~ * [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/ -\&... +... * [HTTP/2] [h2sid=1] FRAME[HEADERS] * [HTTP/2] [h2sid=1] 249 header bytes -\&... -.fi +... +~~~ + +# AVAILABILITY -.SH AVAILABILITY Added in 8.3 -.SH RETURN VALUE + +# RETURN VALUE + If this function returns non-zero, something went wrong and the configuration may not have any effects or may only been applied partially. -.SH "SEE ALSO" -.BR curl_global_init (3), -.BR libcurl (3) diff --git a/docs/libcurl/curl_mime_addpart.3 b/docs/libcurl/curl_mime_addpart.3 deleted file mode 100644 index c9eccf55b..000000000 --- a/docs/libcurl/curl_mime_addpart.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_addpart 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_addpart - append a new empty part to a mime structure -.SH SYNOPSIS -.nf -#include - -curl_mimepart *curl_mime_addpart(curl_mime *mime); -.fi -.SH DESCRIPTION -\fIcurl_mime_addpart(3)\fP creates and appends a new empty part to the given -mime structure and returns a handle to it. The returned part handle can -subsequently be populated using functions from the mime API. - -\fImime\fP is the handle of the mime structure in which the new part must be -appended. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* continue and set name + data to the part */ - curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); - curl_mime_name(part, "data"); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -A mime part structure handle, or NULL upon failure. -.SH "SEE ALSO" -.BR curl_mime_data (3), -.BR curl_mime_data_cb (3), -.BR curl_mime_encoder (3), -.BR curl_mime_filedata (3), -.BR curl_mime_filename (3), -.BR curl_mime_headers (3), -.BR curl_mime_init (3), -.BR curl_mime_name (3), -.BR curl_mime_subparts (3), -.BR curl_mime_type (3) diff --git a/docs/libcurl/curl_mime_addpart.md b/docs/libcurl/curl_mime_addpart.md new file mode 100644 index 000000000..f641abbcf --- /dev/null +++ b/docs/libcurl/curl_mime_addpart.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_addpart +Section: 3 +Source: libcurl +See-also: + - curl_mime_data (3) + - curl_mime_data_cb (3) + - curl_mime_encoder (3) + - curl_mime_filedata (3) + - curl_mime_filename (3) + - curl_mime_headers (3) + - curl_mime_init (3) + - curl_mime_name (3) + - curl_mime_subparts (3) + - curl_mime_type (3) +--- + +# NAME + +curl_mime_addpart - append a new empty part to a mime structure + +# SYNOPSIS + +~~~c +#include + +curl_mimepart *curl_mime_addpart(curl_mime *mime); +~~~ + +# DESCRIPTION + +curl_mime_addpart(3) creates and appends a new empty part to the given +mime structure and returns a handle to it. The returned part handle can +subsequently be populated using functions from the mime API. + +*mime* is the handle of the mime structure in which the new part must be +appended. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* continue and set name + data to the part */ + curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +A mime part structure handle, or NULL upon failure. diff --git a/docs/libcurl/curl_mime_data.3 b/docs/libcurl/curl_mime_data.3 deleted file mode 100644 index 71042daa1..000000000 --- a/docs/libcurl/curl_mime_data.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_data 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_data - set a mime part's body data from memory -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_data(curl_mimepart *part, const char *data, - size_t datasize); -.fi -.SH DESCRIPTION -\fIcurl_mime_data(3)\fP sets a mime part's body content from memory data. - -\fIpart\fP is the mime part to assign contents to, created with -\fIcurl_mime_addpart(3)\fP. - -\fIdata\fP points to the data that gets copied by this function. The storage -may safely be reused after the call. - -\fIdatasize\fP is the number of bytes \fIdata\fP points to. It can be set to -\fICURL_ZERO_TERMINATED\fP to indicate \fIdata\fP is a null-terminated -character string. - -Setting a part's contents multiple times is valid: only the value set by the -last call is retained. It is possible to unassign part's contents by setting -\fIdata\fP to NULL. - -Setting large data is memory consuming: one might consider using -\fIcurl_mime_data_cb(3)\fP in such a case. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* add data to the part */ - curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_data_cb (3), -.BR curl_mime_name (3), -.BR curl_mime_type (3) diff --git a/docs/libcurl/curl_mime_data.md b/docs/libcurl/curl_mime_data.md new file mode 100644 index 000000000..15a1d2707 --- /dev/null +++ b/docs/libcurl/curl_mime_data.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_data +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_data_cb (3) + - curl_mime_name (3) + - curl_mime_type (3) +--- + +# NAME + +curl_mime_data - set a mime part's body data from memory + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_data(curl_mimepart *part, const char *data, + size_t datasize); +~~~ + +# DESCRIPTION + +curl_mime_data(3) sets a mime part's body content from memory data. + +*part* is the mime part to assign contents to, created with +curl_mime_addpart(3). + +*data* points to the data that gets copied by this function. The storage +may safely be reused after the call. + +*datasize* is the number of bytes *data* points to. It can be set to +*CURL_ZERO_TERMINATED* to indicate *data* is a null-terminated +character string. + +Setting a part's contents multiple times is valid: only the value set by the +last call is retained. It is possible to unassign part's contents by setting +*data* to NULL. + +Setting large data is memory consuming: one might consider using +curl_mime_data_cb(3) in such a case. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* add data to the part */ + curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_data_cb.3 b/docs/libcurl/curl_mime_data_cb.md similarity index 58% rename from docs/libcurl/curl_mime_data_cb.3 rename to docs/libcurl/curl_mime_data_cb.md index 8ca3df3e3..bd3c77ac5 100644 --- a/docs/libcurl/curl_mime_data_cb.3 +++ b/docs/libcurl/curl_mime_data_cb.md @@ -1,31 +1,23 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_data_cb 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_data_cb +Section: 3 +Source: libcurl +See-also: + - curl_easy_duphandle (3) + - curl_mime_addpart (3) + - curl_mime_data (3) + - curl_mime_name (3) +--- + +# NAME + curl_mime_data_cb - set a callback-based data source for a mime part's body -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include size_t readfunc(char *buffer, size_t size, size_t nitems, void *arg); @@ -38,32 +30,34 @@ CURLcode curl_mime_data_cb(curl_mimepart *part, curl_off_t datasize, curl_read_callback readfunc, curl_seek_callback seekfunc, curl_free_callback freefunc, void *arg); -.fi -.SH DESCRIPTION -\fIcurl_mime_data_cb(3)\fP sets the data source of a mime part's body content +~~~ + +# DESCRIPTION + +curl_mime_data_cb(3) sets the data source of a mime part's body content from a data read callback function. -\fIpart\fP is the part's to assign contents to. +*part* is the part's to assign contents to. -\fIreadfunc\fP is a pointer to a data read callback function, with a signature +*readfunc* is a pointer to a data read callback function, with a signature as shown by the above prototype. It may not be set to NULL. -\fIseekfunc\fP is a pointer to a seek callback function, with a signature as +*seekfunc* is a pointer to a seek callback function, with a signature as shown by the above prototype. This function is used when resending data (i.e.: after a redirect); this pointer may be set to NULL, in which case a resend might not be not possible. -\fIfreefunc\fP is a pointer to a user resource freeing callback function, with +*freefunc* is a pointer to a user resource freeing callback function, with a signature as shown by the above prototype. If no resource is to be freed, it may safely be set to NULL. This function is called upon mime structure freeing. -\fIarg\fP is a user defined argument to callback functions. +*arg* is a user defined argument to callback functions. The read callback function gets called by libcurl as soon as it needs to read data in order to send it to the peer - like if you ask it to upload or -post data to the server. The data area pointed at by the pointer \fIbuffer\fP -should be filled up with at most \fIsize\fP multiplied with \fInitems\fP number +post data to the server. The data area pointed at by the pointer *buffer* +should be filled up with at most *size* multiplied with *nitems* number of bytes by your function. Your read function must then return the actual number of bytes that it stored @@ -75,35 +69,37 @@ the server expected it, like when you have said you intend to upload N bytes and yet you upload less than N bytes), you may experience that the server "hangs" waiting for the rest of the data that does not come. -The read callback may return \fICURL_READFUNC_ABORT\fP to stop the current -operation immediately, resulting in a \fICURLE_ABORTED_BY_CALLBACK\fP error +The read callback may return *CURL_READFUNC_ABORT* to stop the current +operation immediately, resulting in a *CURLE_ABORTED_BY_CALLBACK* error code from the transfer. -The callback can return \fICURL_READFUNC_PAUSE\fP to cause reading from this -connection to pause. See \fIcurl_easy_pause(3)\fP for further details. +The callback can return *CURL_READFUNC_PAUSE* to cause reading from this +connection to pause. See curl_easy_pause(3) for further details. The seek function gets called by libcurl to rewind input stream data or to seek to a certain position. The function shall work like fseek(3) or lseek(3) -and it gets SEEK_SET, SEEK_CUR or SEEK_END as argument for \fIorigin\fP, +and it gets SEEK_SET, SEEK_CUR or SEEK_END as argument for *origin*, although libcurl currently only passes SEEK_SET. -The callback function must return \fICURL_SEEKFUNC_OK\fP on success, -\fICURL_SEEKFUNC_FAIL\fP to cause the upload operation to fail or -\fICURL_SEEKFUNC_CANTSEEK\fP to indicate that while the seek failed, libcurl +The callback function must return *CURL_SEEKFUNC_OK* on success, +*CURL_SEEKFUNC_FAIL* to cause the upload operation to fail or +*CURL_SEEKFUNC_CANTSEEK* to indicate that while the seek failed, libcurl is free to work around the problem if possible. The latter can sometimes be done by instead reading from the input or similar. Care must be taken if the part is bound to a curl easy handle that is later -duplicated: the \fIarg\fP pointer argument is also duplicated, resulting in +duplicated: the *arg* pointer argument is also duplicated, resulting in the pointed item to be shared between the original and the copied handle. In -particular, special attention should be given to the \fIfreefunc\fP procedure +particular, special attention should be given to the *freefunc* procedure code since it then gets called twice with the same argument. -.SH EXAMPLE + +# EXAMPLE + Sending a huge data string causes the same amount of memory to be allocated: to avoid overhead resources consumption, one might want to use a callback source to avoid data duplication. In this case, original data must be retained until after the transfer terminates. -.nf +~~~c #include /* for memcpy */ char hugedata[512000]; @@ -161,13 +157,12 @@ int main(void) &hugectl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE + +# RETURN VALUE + CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_easy_duphandle (3), -.BR curl_mime_addpart (3), -.BR curl_mime_data (3), -.BR curl_mime_name (3) diff --git a/docs/libcurl/curl_mime_encoder.3 b/docs/libcurl/curl_mime_encoder.3 deleted file mode 100644 index f6eaa2ec6..000000000 --- a/docs/libcurl/curl_mime_encoder.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_encoder 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_encoder - set a mime part's encoder and content transfer encoding -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_encoder(curl_mimepart *part, const char *encoding); -.fi -.SH DESCRIPTION -curl_mime_encoder() requests a mime part's content to be encoded before being -transmitted. - -\fIpart\fP is the part's handle to assign an encoder. -\fIencoding\fP is a pointer to a null-terminated encoding scheme. It may be -set to NULL to disable an encoder previously attached to the part. The encoding -scheme storage may safely be reused after this function returns. - -Setting a part's encoder multiple times is valid: only the value set by the -last call is retained. - -Upon multipart rendering, the part's content is encoded according to the -pertaining scheme and a corresponding \fI"Content-Transfer-Encoding"\fP header -is added to the part. - -Supported encoding schemes are: - -"\fIbinary\fP": the data is left unchanged, the header is added. - -"\fI8bit\fP": header added, no data change. - -"\fI7bit\fP": the data is unchanged, but is each byte is checked -to be a 7-bit value; if not, a read error occurs. - -"\fIbase64\fP": Data is converted to base64 encoding, then split in -CRLF-terminated lines of at most 76 characters. - -"\fIquoted-printable\fP": data is encoded in quoted printable lines of -at most 76 characters. Since the resulting size of the final data cannot be -determined prior to reading the original data, it is left as unknown, causing -chunked transfer in HTTP. For the same reason, this encoder may not be used -with IMAP. This encoder targets text data that is mostly ASCII and should -not be used with other types of data. - -If the original data is already encoded in such a scheme, a custom -\fIContent-Transfer-Encoding\fP header should be added with -\fIcurl_mime_headers(3)\fP instead of setting a part encoder. - -Encoding should not be applied to multiparts, thus the use of this function on -a part with content set with \fIcurl_mime_subparts(3)\fP is strongly -discouraged. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* send a file */ - curl_mime_filedata(part, "image.png"); - - /* encode file data in base64 for transfer */ - curl_mime_encoder(part, "base64"); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_headers (3), -.BR curl_mime_subparts (3) diff --git a/docs/libcurl/curl_mime_encoder.md b/docs/libcurl/curl_mime_encoder.md new file mode 100644 index 000000000..85dc3ac11 --- /dev/null +++ b/docs/libcurl/curl_mime_encoder.md @@ -0,0 +1,100 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_encoder +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_headers (3) + - curl_mime_subparts (3) +--- + +# NAME + +curl_mime_encoder - set a mime part's encoder and content transfer encoding + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_encoder(curl_mimepart *part, const char *encoding); +~~~ + +# DESCRIPTION + +curl_mime_encoder() requests a mime part's content to be encoded before being +transmitted. + +*part* is the part's handle to assign an encoder. +*encoding* is a pointer to a null-terminated encoding scheme. It may be +set to NULL to disable an encoder previously attached to the part. The encoding +scheme storage may safely be reused after this function returns. + +Setting a part's encoder multiple times is valid: only the value set by the +last call is retained. + +Upon multipart rendering, the part's content is encoded according to the +pertaining scheme and a corresponding *"Content-Transfer-Encoding"* header +is added to the part. + +Supported encoding schemes are: + +"*binary*": the data is left unchanged, the header is added. + +"*8bit*": header added, no data change. + +"*7bit*": the data is unchanged, but is each byte is checked +to be a 7-bit value; if not, a read error occurs. + +"*base64*": Data is converted to base64 encoding, then split in +CRLF-terminated lines of at most 76 characters. + +"*quoted-printable*": data is encoded in quoted printable lines of +at most 76 characters. Since the resulting size of the final data cannot be +determined prior to reading the original data, it is left as unknown, causing +chunked transfer in HTTP. For the same reason, this encoder may not be used +with IMAP. This encoder targets text data that is mostly ASCII and should +not be used with other types of data. + +If the original data is already encoded in such a scheme, a custom +*Content-Transfer-Encoding* header should be added with +curl_mime_headers(3) instead of setting a part encoder. + +Encoding should not be applied to multiparts, thus the use of this function on +a part with content set with curl_mime_subparts(3) is strongly +discouraged. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* send a file */ + curl_mime_filedata(part, "image.png"); + + /* encode file data in base64 for transfer */ + curl_mime_encoder(part, "base64"); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_filedata.3 b/docs/libcurl/curl_mime_filedata.3 deleted file mode 100644 index cb20fea42..000000000 --- a/docs/libcurl/curl_mime_filedata.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_filedata 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_filedata - set a mime part's body data from a file contents -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_filedata(curl_mimepart *part, - const char *filename); -.fi -.SH DESCRIPTION -\fIcurl_mime_filedata(3)\fP sets a mime part's body content from the named -file's contents. This is an alternative to \fIcurl_mime_data(3)\fP for setting -data to a mime part. - -\fIpart\fP is the part's to assign contents to. - -\fIfilename\fP points to the null-terminated file's path name. The pointer can -be NULL to detach the previous part contents settings. Filename storage can -be safely be reused after this call. - -As a side effect, the part's remote file name is set to the base name of the -given \fIfilename\fP if it is a valid named file. This can be undone or -overridden by a subsequent call to \fIcurl_mime_filename(3)\fP. - -The contents of the file is read during the file transfer in a streaming -manner to allow huge files to get transferred without using much memory. It -therefore requires that the file is kept intact during the entire request. - -If the file size cannot be determined before actually reading it (such as for -a character device or named pipe), the whole mime structure containing the -part is transferred using chunks by HTTP but is rejected by IMAP. - -Setting a part's contents multiple times is valid: only the value set by the -last call is retained. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* send data from this file */ - curl_mime_filedata(part, "image.png"); - - /* set name */ - curl_mime_name(part, "data"); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. CURLE_READ_ERROR is only an -indication that the file is not yet readable: it can be safely ignored at -this time, but the file must be made readable before the pertaining -easy handle is performed. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_data (3), -.BR curl_mime_filename (3), -.BR curl_mime_name (3) diff --git a/docs/libcurl/curl_mime_filedata.md b/docs/libcurl/curl_mime_filedata.md new file mode 100644 index 000000000..2440e56b3 --- /dev/null +++ b/docs/libcurl/curl_mime_filedata.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_filedata +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_data (3) + - curl_mime_filename (3) + - curl_mime_name (3) +--- + +# NAME + +curl_mime_filedata - set a mime part's body data from a file contents + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_filedata(curl_mimepart *part, + const char *filename); +~~~ + +# DESCRIPTION + +curl_mime_filedata(3) sets a mime part's body content from the named +file's contents. This is an alternative to curl_mime_data(3) for setting +data to a mime part. + +*part* is the part's to assign contents to. + +*filename* points to the null-terminated file's path name. The pointer can +be NULL to detach the previous part contents settings. Filename storage can +be safely be reused after this call. + +As a side effect, the part's remote file name is set to the base name of the +given *filename* if it is a valid named file. This can be undone or +overridden by a subsequent call to curl_mime_filename(3). + +The contents of the file is read during the file transfer in a streaming +manner to allow huge files to get transferred without using much memory. It +therefore requires that the file is kept intact during the entire request. + +If the file size cannot be determined before actually reading it (such as for +a character device or named pipe), the whole mime structure containing the +part is transferred using chunks by HTTP but is rejected by IMAP. + +Setting a part's contents multiple times is valid: only the value set by the +last call is retained. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* send data from this file */ + curl_mime_filedata(part, "image.png"); + + /* set name */ + curl_mime_name(part, "data"); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. CURLE_READ_ERROR is only an +indication that the file is not yet readable: it can be safely ignored at +this time, but the file must be made readable before the pertaining +easy handle is performed. diff --git a/docs/libcurl/curl_mime_filename.3 b/docs/libcurl/curl_mime_filename.3 deleted file mode 100644 index a10bf803e..000000000 --- a/docs/libcurl/curl_mime_filename.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_filename 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_filename - set a mime part's remote file name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_filename(curl_mimepart *part, - const char *filename); -.fi -.SH DESCRIPTION -\fIcurl_mime_filename(3)\fP sets a mime part's remote file name. When remote -file name is set, content data is processed as a file, whatever is the part's -content source. A part's remote file name is transmitted to the server in the -associated Content-Disposition generated header. - -\fIpart\fP is the part's handle to assign the remote file name to. - -\fIfilename\fP points to the null-terminated file name string; it may be set -to NULL to remove a previously attached remote file name. - -The remote file name string is copied into the part, thus the associated -storage may safely be released or reused after call. Setting a part's file -name multiple times is valid: only the value set by the last call is retained. -.SH EXAMPLE -.nf - -static char imagebuf[]="imagedata"; - -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* send image data from memory */ - curl_mime_data(part, imagebuf, sizeof(imagebuf)); - - /* set a file name to make it look like a file upload */ - curl_mime_filename(part, "image.png"); - - /* set name */ - curl_mime_name(part, "data"); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_data (3), -.BR curl_mime_filedata (3) diff --git a/docs/libcurl/curl_mime_filename.md b/docs/libcurl/curl_mime_filename.md new file mode 100644 index 000000000..5f0711491 --- /dev/null +++ b/docs/libcurl/curl_mime_filename.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_filename +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_data (3) + - curl_mime_filedata (3) +--- + +# NAME + +curl_mime_filename - set a mime part's remote file name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_filename(curl_mimepart *part, + const char *filename); +~~~ + +# DESCRIPTION + +curl_mime_filename(3) sets a mime part's remote file name. When remote +file name is set, content data is processed as a file, whatever is the part's +content source. A part's remote file name is transmitted to the server in the +associated Content-Disposition generated header. + +*part* is the part's handle to assign the remote file name to. + +*filename* points to the null-terminated file name string; it may be set +to NULL to remove a previously attached remote file name. + +The remote file name string is copied into the part, thus the associated +storage may safely be released or reused after call. Setting a part's file +name multiple times is valid: only the value set by the last call is retained. + +# EXAMPLE + +~~~c + +static char imagebuf[]="imagedata"; + +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* send image data from memory */ + curl_mime_data(part, imagebuf, sizeof(imagebuf)); + + /* set a file name to make it look like a file upload */ + curl_mime_filename(part, "image.png"); + + /* set name */ + curl_mime_name(part, "data"); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_free.3 b/docs/libcurl/curl_mime_free.3 deleted file mode 100644 index b37b15803..000000000 --- a/docs/libcurl/curl_mime_free.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_free 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_free - free a previously built mime structure -.SH SYNOPSIS -.nf -#include - -void curl_mime_free(curl_mime *mime); -.fi -.SH DESCRIPTION -\fIcurl_mime_free(3)\fP is used to clean up data previously built/appended -with \fIcurl_mime_addpart(3)\fP and other mime-handling functions. This must -be called when the data has been used, which typically means after -\fIcurl_easy_perform(3)\fP has been called. - -The handle to free is the one you passed to the \fICURLOPT_MIMEPOST(3)\fP -option: attached sub part mime structures must not be explicitly freed as they -are by the top structure freeing. - -\fBmime\fP is the handle as returned from a previous call to -\fIcurl_mime_init(3)\fP and may be NULL. - -Passing in a NULL pointer in \fImime\fP makes this function return immediately -with no action. -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_free (3), -.BR curl_mime_init (3) diff --git a/docs/libcurl/curl_mime_free.md b/docs/libcurl/curl_mime_free.md new file mode 100644 index 000000000..5aa5b6aa1 --- /dev/null +++ b/docs/libcurl/curl_mime_free.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_free +Section: 3 +Source: libcurl +See-also: + - curl_free (3) + - curl_mime_init (3) +--- + +# NAME + +curl_mime_free - free a previously built mime structure + +# SYNOPSIS + +~~~c +#include + +void curl_mime_free(curl_mime *mime); +~~~ + +# DESCRIPTION + +curl_mime_free(3) is used to clean up data previously built/appended +with curl_mime_addpart(3) and other mime-handling functions. This must +be called when the data has been used, which typically means after +curl_easy_perform(3) has been called. + +The handle to free is the one you passed to the CURLOPT_MIMEPOST(3) +option: attached sub part mime structures must not be explicitly freed as they +are by the top structure freeing. + +**mime** is the handle as returned from a previous call to +curl_mime_init(3) and may be NULL. + +Passing in a NULL pointer in *mime* makes this function return immediately +with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + /* Build the mime message. */ + curl_mime *mime = curl_mime_init(curl); + + /* send off the transfer */ + + /* Free multipart message. */ + curl_mime_free(mime); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +None diff --git a/docs/libcurl/curl_mime_headers.3 b/docs/libcurl/curl_mime_headers.3 deleted file mode 100644 index 109663c38..000000000 --- a/docs/libcurl/curl_mime_headers.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_headers 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_headers - set a mime part's custom headers -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_headers(curl_mimepart *part, - struct curl_slist *headers, int take_ownership); -.fi -.SH DESCRIPTION -\fIcurl_mime_headers(3)\fP sets a mime part's custom headers. - -\fIpart\fP is the part's handle to assign the custom headers list to. - -\fIheaders\fP is the head of a list of custom headers; it may be set to NULL -to remove a previously attached custom header list. - -\fItake_ownership\fP: when non-zero, causes the list to be freed upon -replacement or mime structure deletion; in this case the list must not be -freed explicitly. - -Setting a part's custom headers list multiple times is valid: only the value -set by the last call is retained. -.SH EXAMPLE -.nf -int main(void) -{ - struct curl_slist *headers = NULL; - CURL *easy = curl_easy_init(); - curl_mime *mime; - curl_mimepart *part; - - headers = curl_slist_append(headers, "Custom-Header: mooo"); - - mime = curl_mime_init(easy); - part = curl_mime_addpart(mime); - - /* use these headers in the part, takes ownership */ - curl_mime_headers(part, headers, 1); - - /* pass on this data */ - curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED); - - /* set name */ - curl_mime_name(part, "numbers"); - - /* Post and send it. */ - curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime); - curl_easy_setopt(easy, CURLOPT_URL, "https://example.com"); - curl_easy_perform(easy); -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_name (3) diff --git a/docs/libcurl/curl_mime_headers.md b/docs/libcurl/curl_mime_headers.md new file mode 100644 index 000000000..4f6421abd --- /dev/null +++ b/docs/libcurl/curl_mime_headers.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_headers +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_name (3) +--- + +# NAME + +curl_mime_headers - set a mime part's custom headers + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_headers(curl_mimepart *part, + struct curl_slist *headers, int take_ownership); +~~~ + +# DESCRIPTION + +curl_mime_headers(3) sets a mime part's custom headers. + +*part* is the part's handle to assign the custom headers list to. + +*headers* is the head of a list of custom headers; it may be set to NULL +to remove a previously attached custom header list. + +*take_ownership*: when non-zero, causes the list to be freed upon +replacement or mime structure deletion; in this case the list must not be +freed explicitly. + +Setting a part's custom headers list multiple times is valid: only the value +set by the last call is retained. + +# EXAMPLE + +~~~c +int main(void) +{ + struct curl_slist *headers = NULL; + CURL *easy = curl_easy_init(); + curl_mime *mime; + curl_mimepart *part; + + headers = curl_slist_append(headers, "Custom-Header: mooo"); + + mime = curl_mime_init(easy); + part = curl_mime_addpart(mime); + + /* use these headers in the part, takes ownership */ + curl_mime_headers(part, headers, 1); + + /* pass on this data */ + curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED); + + /* set name */ + curl_mime_name(part, "numbers"); + + /* Post and send it. */ + curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime); + curl_easy_setopt(easy, CURLOPT_URL, "https://example.com"); + curl_easy_perform(easy); +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_init.3 b/docs/libcurl/curl_mime_init.3 deleted file mode 100644 index dc93fd15f..000000000 --- a/docs/libcurl/curl_mime_init.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_init 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_init - create a mime handle -.SH SYNOPSIS -.nf -#include - -curl_mime *curl_mime_init(CURL *easy_handle); -.fi -.SH DESCRIPTION -\fIcurl_mime_init(3)\fP creates a handle to a new empty mime structure. -This mime structure can be subsequently filled using the mime API, then -attached to some easy handle using option \fICURLOPT_MIMEPOST(3)\fP within -a \fIcurl_easy_setopt(3)\fP call or added as a multipart in another mime -handle's part using \fIcurl_mime_subparts(3)\fP. - -\fIeasy_handle\fP is used for part separator randomization and error -reporting. Since 7.87.0, it does not need to be the final target handle. - -Using a mime handle is the recommended way to post an HTTP form, format and -send a multi-part email with SMTP or upload such an email to an IMAP server. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *easy = curl_easy_init(); - curl_mime *mime; - curl_mimepart *part; - - /* Build an HTTP form with a single field named "data", */ - mime = curl_mime_init(easy); - part = curl_mime_addpart(mime); - curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); - curl_mime_name(part, "data"); - - /* Post and send it. */ - curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime); - curl_easy_setopt(easy, CURLOPT_URL, "https://example.com"); - curl_easy_perform(easy); - - /* Clean-up. */ - curl_easy_cleanup(easy); - curl_mime_free(mime); -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -A mime struct handle, or NULL upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_free (3), -.BR curl_mime_subparts (3), -.BR CURLOPT_MIMEPOST (3) diff --git a/docs/libcurl/curl_mime_init.md b/docs/libcurl/curl_mime_init.md new file mode 100644 index 000000000..0811bb3d8 --- /dev/null +++ b/docs/libcurl/curl_mime_init.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_init +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MIMEPOST (3) + - curl_mime_addpart (3) + - curl_mime_free (3) + - curl_mime_subparts (3) +--- + +# NAME + +curl_mime_init - create a mime handle + +# SYNOPSIS + +~~~c +#include + +curl_mime *curl_mime_init(CURL *easy_handle); +~~~ + +# DESCRIPTION + +curl_mime_init(3) creates a handle to a new empty mime structure. +This mime structure can be subsequently filled using the mime API, then +attached to some easy handle using option CURLOPT_MIMEPOST(3) within +a curl_easy_setopt(3) call or added as a multipart in another mime +handle's part using curl_mime_subparts(3). + +*easy_handle* is used for part separator randomization and error +reporting. Since 7.87.0, it does not need to be the final target handle. + +Using a mime handle is the recommended way to post an HTTP form, format and +send a multi-part email with SMTP or upload such an email to an IMAP server. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *easy = curl_easy_init(); + curl_mime *mime; + curl_mimepart *part; + + /* Build an HTTP form with a single field named "data", */ + mime = curl_mime_init(easy); + part = curl_mime_addpart(mime); + curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); + + /* Post and send it. */ + curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime); + curl_easy_setopt(easy, CURLOPT_URL, "https://example.com"); + curl_easy_perform(easy); + + /* Clean-up. */ + curl_easy_cleanup(easy); + curl_mime_free(mime); +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +A mime struct handle, or NULL upon failure. diff --git a/docs/libcurl/curl_mime_name.3 b/docs/libcurl/curl_mime_name.3 deleted file mode 100644 index 52953e548..000000000 --- a/docs/libcurl/curl_mime_name.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_name 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_name - set a mime part's name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_name(curl_mimepart *part, const char *name); -.fi -.SH DESCRIPTION -\fIcurl_mime_name(3)\fP sets a mime part's name. This is the way HTTP form -fields are named. - -\fIpart\fP is the part's handle to assign a name to. - -\fIname\fP points to the null-terminated name string. - -The name string is copied into the part, thus the associated storage may -safely be released or reused after call. Setting a part's name multiple times -is valid: only the value set by the last call is retained. It is possible to -reset the name of a part by setting \fIname\fP to NULL. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* give the part a name */ - curl_mime_name(part, "shoe_size"); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_data (3), -.BR curl_mime_type (3) diff --git a/docs/libcurl/curl_mime_name.md b/docs/libcurl/curl_mime_name.md new file mode 100644 index 000000000..bd2503397 --- /dev/null +++ b/docs/libcurl/curl_mime_name.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_name +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_data (3) + - curl_mime_type (3) +--- + +# NAME + +curl_mime_name - set a mime part's name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_name(curl_mimepart *part, const char *name); +~~~ + +# DESCRIPTION + +curl_mime_name(3) sets a mime part's name. This is the way HTTP form +fields are named. + +*part* is the part's handle to assign a name to. + +*name* points to the null-terminated name string. + +The name string is copied into the part, thus the associated storage may +safely be released or reused after call. Setting a part's name multiple times +is valid: only the value set by the last call is retained. It is possible to +reset the name of a part by setting *name* to NULL. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* give the part a name */ + curl_mime_name(part, "shoe_size"); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_subparts.3 b/docs/libcurl/curl_mime_subparts.3 deleted file mode 100644 index 459f3cdcc..000000000 --- a/docs/libcurl/curl_mime_subparts.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_subparts 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_subparts - set sub-parts of a multipart mime part -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts); -.fi -.SH DESCRIPTION -\fIcurl_mime_subparts(3)\fP sets a multipart mime part's content from a mime -structure. - -\fIpart\fP is a handle to the multipart part. - -\fIsubparts\fP is a mime structure handle holding the sub-parts. After -\fIcurl_mime_subparts(3)\fP succeeds, the mime structure handle belongs to the -multipart part and must not be freed explicitly. It may however be updated by -subsequent calls to mime API functions. - -Setting a part's contents multiple times is valid: only the value set by the -last call is retained. It is possible to unassign previous part's contents by -setting \fIsubparts\fP to NULL. -.SH EXAMPLE -.nf - -static char *inline_html = "example"; -static char *inline_text = "once upon the time"; - -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - struct curl_slist *slist; - - /* The inline part is an alternative proposing the html and the text - versions of the email. */ - curl_mime *alt = curl_mime_init(curl); - curl_mimepart *part; - - /* HTML message. */ - part = curl_mime_addpart(alt); - curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED); - curl_mime_type(part, "text/html"); - - /* Text message. */ - part = curl_mime_addpart(alt); - curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED); - - /* Create the inline part. */ - part = curl_mime_addpart(alt); - curl_mime_subparts(part, alt); - curl_mime_type(part, "multipart/alternative"); - slist = curl_slist_append(NULL, "Content-Disposition: inline"); - curl_mime_headers(part, slist, 1); - } -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_init (3) diff --git a/docs/libcurl/curl_mime_subparts.md b/docs/libcurl/curl_mime_subparts.md new file mode 100644 index 000000000..4136a1b2a --- /dev/null +++ b/docs/libcurl/curl_mime_subparts.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_subparts +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_init (3) +--- + +# NAME + +curl_mime_subparts - set sub-parts of a multipart mime part + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts); +~~~ + +# DESCRIPTION + +curl_mime_subparts(3) sets a multipart mime part's content from a mime +structure. + +*part* is a handle to the multipart part. + +*subparts* is a mime structure handle holding the sub-parts. After +curl_mime_subparts(3) succeeds, the mime structure handle belongs to the +multipart part and must not be freed explicitly. It may however be updated by +subsequent calls to mime API functions. + +Setting a part's contents multiple times is valid: only the value set by the +last call is retained. It is possible to unassign previous part's contents by +setting *subparts* to NULL. + +# EXAMPLE + +~~~c + +static char *inline_html = "example"; +static char *inline_text = "once upon the time"; + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + struct curl_slist *slist; + + /* The inline part is an alternative proposing the html and the text + versions of the email. */ + curl_mime *alt = curl_mime_init(curl); + curl_mimepart *part; + + /* HTML message. */ + part = curl_mime_addpart(alt); + curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED); + curl_mime_type(part, "text/html"); + + /* Text message. */ + part = curl_mime_addpart(alt); + curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED); + + /* Create the inline part. */ + part = curl_mime_addpart(alt); + curl_mime_subparts(part, alt); + curl_mime_type(part, "multipart/alternative"); + slist = curl_slist_append(NULL, "Content-Disposition: inline"); + curl_mime_headers(part, slist, 1); + } +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mime_type.3 b/docs/libcurl/curl_mime_type.3 deleted file mode 100644 index 3e4ac822b..000000000 --- a/docs/libcurl/curl_mime_type.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_mime_type 3 "22 August 2017" "libcurl" "libcurl" -.SH NAME -curl_mime_type - set a mime part's content type -.SH SYNOPSIS -.nf -#include - -CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype); -.fi -.SH DESCRIPTION -\fIcurl_mime_type(3)\fP sets a mime part's content type. - -\fIpart\fP is the part's handle to assign the content type to. - -\fImimetype\fP points to the null-terminated file mime type string; it may be -set to NULL to remove a previously attached mime type. - -The mime type string is copied into the part, thus the associated storage may -safely be released or reused after call. Setting a part's type multiple times -is valid: only the value set by the last call is retained. - -In the absence of a mime type and if needed by the protocol specifications, -a default mime type is determined by the context: - -- If set as a custom header, use this value. - -- application/form-data for an HTTP form post. - -- If a remote file name is set, the mime type is taken from the file name -extension, or application/octet-stream by default. - -- For a multipart part, multipart/mixed. - -- text/plain in other cases. -.SH EXAMPLE -.nf -int main(void) -{ - curl_mime *mime; - curl_mimepart *part; - - CURL *curl = curl_easy_init(); - if(curl) { - /* create a mime handle */ - mime = curl_mime_init(curl); - - /* add a part */ - part = curl_mime_addpart(mime); - - /* get data from this file */ - curl_mime_filedata(part, "image.png"); - - /* content-type for this part */ - curl_mime_type(part, "image/png"); - - /* set name */ - curl_mime_name(part, "image"); -} -} -.fi -.SH AVAILABILITY -As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. -.SH RETURN VALUE -CURLE_OK or a CURL error code upon failure. -.SH "SEE ALSO" -.BR curl_mime_addpart (3), -.BR curl_mime_data (3), -.BR curl_mime_name (3) diff --git a/docs/libcurl/curl_mime_type.md b/docs/libcurl/curl_mime_type.md new file mode 100644 index 000000000..fcdb77f4c --- /dev/null +++ b/docs/libcurl/curl_mime_type.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_mime_type +Section: 3 +Source: libcurl +See-also: + - curl_mime_addpart (3) + - curl_mime_data (3) + - curl_mime_name (3) +--- + +# NAME + +curl_mime_type - set a mime part's content type + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype); +~~~ + +# DESCRIPTION + +curl_mime_type(3) sets a mime part's content type. + +*part* is the part's handle to assign the content type to. + +*mimetype* points to the null-terminated file mime type string; it may be +set to NULL to remove a previously attached mime type. + +The mime type string is copied into the part, thus the associated storage may +safely be released or reused after call. Setting a part's type multiple times +is valid: only the value set by the last call is retained. + +In the absence of a mime type and if needed by the protocol specifications, +a default mime type is determined by the context: + +- If set as a custom header, use this value. + +- application/form-data for an HTTP form post. + +- If a remote file name is set, the mime type is taken from the file name +extension, or application/octet-stream by default. + +- For a multipart part, multipart/mixed. + +- text/plain in other cases. + +# EXAMPLE + +~~~c +int main(void) +{ + curl_mime *mime; + curl_mimepart *part; + + CURL *curl = curl_easy_init(); + if(curl) { + /* create a mime handle */ + mime = curl_mime_init(curl); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* get data from this file */ + curl_mime_filedata(part, "image.png"); + + /* content-type for this part */ + curl_mime_type(part, "image/png"); + + /* set name */ + curl_mime_name(part, "image"); +} +} +~~~ + +# AVAILABILITY + +As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. + +# RETURN VALUE + +CURLE_OK or a CURL error code upon failure. diff --git a/docs/libcurl/curl_mprintf.3 b/docs/libcurl/curl_mprintf.md similarity index 56% rename from docs/libcurl/curl_mprintf.3 rename to docs/libcurl/curl_mprintf.md index ac746cbea..5aca9e3f6 100644 --- a/docs/libcurl/curl_mprintf.3 +++ b/docs/libcurl/curl_mprintf.md @@ -1,33 +1,25 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_printf 3 "30 April 2004" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_printf +Section: 3 +Source: libcurl +See-also: + - fprintf (3) + - printf (3) + - sprintf (3) + - vprintf (3) +--- + +# NAME + curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf, curl_mvsprintf - formatted output conversion -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include int curl_mprintf(const char *format, ...); @@ -41,8 +33,10 @@ int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args); char *curl_maprintf(const char *format , ...); char *curl_mvaprintf(const char *format, va_list args); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + These functions produce output according to the format string and given arguments. They are mostly clones of the well-known C-style functions but there are slight differences in behavior. @@ -50,41 +44,43 @@ there are slight differences in behavior. We discourage users from using any of these functions in new applications. Functions in the curl_mprintf() family produce output according to a format as -described below. The functions \fBcurl_mprintf()\fP and \fBcurl_mvprintf()\fP -write output to stdout, the standard output stream; \fBcurl_mfprintf()\fP and -\fBcurl_mvfprintf()\fP write output to the given output stream; -\fBcurl_msprintf()\fP, \fBcurl_msnprintf()\fP, \fBcurl_mvsprintf()\fP, and -\fBcurl_mvsnprintf()\fP write to the character string \fBbuffer\fP. +described below. The functions **curl_mprintf()** and **curl_mvprintf()** +write output to stdout, the standard output stream; **curl_mfprintf()** and +**curl_mvfprintf()** write output to the given output stream; +**curl_msprintf()**, **curl_msnprintf()**, **curl_mvsprintf()**, and +**curl_mvsnprintf()** write to the character string **buffer**. -The functions \fBcurl_msnprintf()\fP and \fBcurl_mvsnprintf()\fP write at most -\fImaxlength\fP bytes (including the terminating null byte ('\\0')) to -\fIbuffer\fP. +The functions **curl_msnprintf()** and **curl_mvsnprintf()** write at most +*maxlength* bytes (including the terminating null byte ('0')) to +*buffer*. -The functions \fBcurl_mvprintf()\fP, \fBcurl_mvfprintf()\fP, -\fBcurl_mvsprintf()\fP, \fBcurl_mvsnprintf()\fP are equivalent to the -functions \fBcurl_mprintf()\fP, \fBcurl_mfprintf()\fP, \fBcurl_msprintf()\fP, -\fBcurl_msnprintf()\fP, respectively, except that they are called with a -\fIva_list\fP instead of a variable number of arguments. These functions do -not call the \fIva_end\fP macro. Because they invoke the \fIva_arg\fP macro, -the value of \fIap\fP is undefined after the call. +The functions **curl_mvprintf()**, **curl_mvfprintf()**, +**curl_mvsprintf()**, **curl_mvsnprintf()** are equivalent to the +functions **curl_mprintf()**, **curl_mfprintf()**, **curl_msprintf()**, +**curl_msnprintf()**, respectively, except that they are called with a +*va_list* instead of a variable number of arguments. These functions do +not call the *va_end* macro. Because they invoke the *va_arg* macro, +the value of *ap* is undefined after the call. -The functions \fBcurl_maprintf()\fP and \fBcurl_mvaprintf()\fP return the +The functions **curl_maprintf()** and **curl_mvaprintf()** return the output string as pointer to a newly allocated memory area. The returned string -must be \fIcurl_free(3)\fPed by the receiver. +must be curl_free(3)ed by the receiver. All of these functions write the output under the control of a format string that specifies how subsequent arguments are converted for output. -.SH FORMAT STRING +# FORMAT STRING + The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character %, and ends with a conversion specifier. In between there may be (in this order) zero -or more \fIflags\fP, an optional minimum \fIfield width\fP, an optional -\fIprecision\fP and an optional \fIlength modifier\fP. +or more *flags*, an optional minimum *field width*, an optional +*precision* and an optional *length modifier*. + +# The $ modifier -.SH "The $ modifier" The arguments must correspond properly with the conversion specifier. By default, the arguments are used in the order given, where each '*' (see Field width and Precision below) and each conversion specifier asks for the next @@ -93,13 +89,13 @@ can also specify explicitly which argument is taken, at each place where an argument is required, by writing "%m$" instead of '%' and "*m$" instead of '*', where the decimal integer m denotes the position in the argument list of the desired argument, indexed starting from 1. Thus, -.nf +~~~c curl_mprintf("%*d", width, num); -.fi +~~~ and -.nf +~~~c curl_mprintf("%2$*1$d", width, num); -.fi +~~~ are equivalent. The second style allows repeated references to the same argument. @@ -110,130 +106,183 @@ the numbers of arguments specified using '$'; for example, if arguments 1 and 3 are specified, argument 2 must also be specified somewhere in the format string. -.SH "Flag characters" +# Flag characters + The character % is followed by zero or more of the following flags: -.IP # +## # + The value should be converted to its "alternate form". -.IP 0 + +## 0 + The value should be zero padded. -.IP - -The converted value is to be left adjusted on the field boundary. (The -default is right justification.) The converted value is padded on the right -with blanks, rather than on the left with blanks or zeros. A '-' overrides a -\&'0' if both are given. -.IP ' ' -(a space) A blank should be left before a positive number (or empty string) -produced by a signed conversion. -.IP + + +## - + +The converted value is to be left adjusted on the field boundary. (The default +is right justification.) The converted value is padded on the right with +blanks, rather than on the left with blanks or zeros. A '-' overrides a &'0' +if both are given. + +## (space) + +(a space: ' ') A blank should be left before a positive number (or empty +string) produced by a signed conversion. + +## + + A sign (+ or -) should always be placed before a number produced by a signed conversion. By default, a sign is used only for negative numbers. A '+' overrides a space if both are used. -.SH "Field width" + +# Field width + An optional decimal digit string (with nonzero first digit) specifying a minimum field width. If the converted value has fewer characters than the field width, it gets padded with spaces on the left (or right, if the left-adjustment flag has been given). Instead of a decimal digit string one may write "*" or "*m$" (for some decimal integer m) to specify that the field -width is given in the next argument, or in the \fIm-th\fP argument, +width is given in the next argument, or in the *m-th* argument, respectively, which must be of type int. A negative field width is taken as a '-' flag followed by a positive field width. In no case does a nonexistent or small field width cause truncation of a field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. -.SH "Precision" + +# Precision + An optional precision in the form of a period ('.') followed by an optional decimal digit string. Instead of a decimal digit string one may write "*" or "*m$" (for some decimal integer m) to specify that the precision is given in -the next argument, or in the \fIm-th\fP argument, respectively, which must be of +the next argument, or in the *m-th* argument, respectively, which must be of type int. If the precision is given as just '.', the precision is taken to be zero. A negative precision is taken as if the precision were omitted. This -gives the minimum number of digits to appear for \fBd\fP, \fBi\fP, \fBo\fP, -\fBu\fP, \fBx\fP, and \fBX\fP conversions, the number of digits to appear -after the radix character for \fBa\fP, \fBA\fP, \fBe\fP, \fBE\fP, \fBf\fP, and -\fBF\fP conversions, the maximum number of significant digits for \fBg\fP and -\fBG\fP conversions, or the maximum number of characters to be printed from a -string for \fBs\fP and \fBS\fP conversions. -.SH "Length modifier" -.IP h -A following integer conversion corresponds to a \fIshort\fP or \fIunsigned -short\fP argument. -.IP l -(ell) A following integer conversion corresponds to a \fIlong\fP or -\fIunsigned long\fP argument, or a following n conversion corresponds to a +gives the minimum number of digits to appear for **d**, **i**, **o**, +**u**, **x**, and **X** conversions, the number of digits to appear +after the radix character for **a**, **A**, **e**, **E**, **f**, and +**F** conversions, the maximum number of significant digits for **g** and +**G** conversions, or the maximum number of characters to be printed from a +string for **s** and **S** conversions. + +# Length modifier + +## h + +A following integer conversion corresponds to a *short* or *unsigned short* +argument. + +## l + +(ell) A following integer conversion corresponds to a *long* or +*unsigned long* argument, or a following n conversion corresponds to a pointer to a long argument -.IP ll -(ell-ell). A following integer conversion corresponds to a \fIlong long\fP or -\fIunsigned long long\fP argument, or a following n conversion corresponds to + +## ll + +(ell-ell). A following integer conversion corresponds to a *long long* or +*unsigned long long* argument, or a following n conversion corresponds to a pointer to a long long argument. -.IP q -A synonym for \fBll\fP. -.IP L + +## q + +A synonym for **ll**. + +## L + A following a, A, e, E, f, F, g, or G conversion corresponds to a long double argument. -.IP z -A following integer conversion corresponds to a \fIsize_t\fP or \fIssize_t\fP + +## z + +A following integer conversion corresponds to a *size_t* or *ssize_t* argument. -.SH "Conversion specifiers" + +# Conversion specifiers + A character that specifies the type of conversion to be applied. The conversion specifiers and their meanings are: -.IP "d, i" + +## d, i + The int argument is converted to signed decimal notation. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty. -.IP "o, u, x, X" + +## o, u, x, X + The unsigned int argument is converted to unsigned octal (o), unsigned decimal -(u), or unsigned hexadecimal (\fBx\fP and \fBX\fP) notation. The letters -\fIabcdef\fP are used for \fBx\fP conversions; the letters \fIABCDEF\fP are -used for \fBX\fP conversions. The precision, if any, gives the minimum number +(u), or unsigned hexadecimal (**x** and **X**) notation. The letters +*abcdef* are used for **x** conversions; the letters *ABCDEF* are +used for **X** conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty. -.IP "e, E" -The double argument is rounded and output in the style \fB"[-]d.ddde±dd"\fP -.IP "f, F" + +## e, E + +The double argument is rounded and output in the style **"[-]d.ddde±dd"** + +## f, F + The double argument is rounded and output to decimal notation in the style -\fB"[-]ddd.ddd"\fP. -.IP "g, G" +**"[-]ddd.ddd"**. + +## g, G + The double argument is converted in style f or e. -.IP "c" + +## c + The int argument is converted to an unsigned char, and the resulting character is written. -.IP "s" -The \fIconst char *\fP argument is expected to be a pointer to an array of + +## s + +The *const char ** argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (but not including) a terminating null byte. If a precision is specified, no more than the number specified are written. If a precision is given, no null byte need be present; if the precision is not specified, or is greater than the size of the array, the array must contain a terminating null byte. -.IP "p" -The \fIvoid *\fP pointer argument is printed in hexadecimal. -.IP "n" + +## p + +The *void ** pointer argument is printed in hexadecimal. + +## n + The number of characters written so far is stored into the integer pointed to by the corresponding argument. -.IP "%" + +## % + A '%' symbol is written. No argument is converted. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c const char *name = "John"; int main(void) { - curl_mprintf("My name is %s\\n", name); - curl_mprintf("Pi is almost %f\\n", (double)25.0/8); + curl_mprintf("My name is %s\n", name); + curl_mprintf("Pi is almost %f\n", (double)25.0/8); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + These functions might be removed from the public libcurl API in the future. Do not use them in new programs or projects. -.SH RETURN VALUE -The \fBcurl_maprintf\fP and \fBcurl_mvaprintf\fP functions return a pointer to + +# RETURN VALUE + +The **curl_maprintf** and **curl_mvaprintf** functions return a pointer to a newly allocated string, or NULL if it failed. All other functions return the number of characters actually printed (excluding the null byte used to end output to strings). Note that this sometimes differ from how the POSIX versions of these functions work. -.SH "SEE ALSO" -.BR printf "(3), " sprintf "(3), " fprintf "(3), " vprintf "(3) " diff --git a/docs/libcurl/curl_multi_add_handle.3 b/docs/libcurl/curl_multi_add_handle.3 deleted file mode 100644 index 749b24e67..000000000 --- a/docs/libcurl/curl_multi_add_handle.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_add_handle 3 "4 March 2002" "libcurl" "libcurl" -.SH NAME -curl_multi_add_handle - add an easy handle to a multi session -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle); -.fi -.SH DESCRIPTION -Adds the \fIeasy handle\fP to the \fImulti_handle\fP. - -While an easy handle is added to a multi stack, you cannot and you must not -use \fIcurl_easy_perform(3)\fP on that handle. After having removed the easy -handle from the multi stack again, it is perfectly fine to use it with the -easy interface again. - -If the easy handle is not set to use a shared (\fICURLOPT_SHARE(3)\fP) cache, -it is made to use a DNS cache that is shared between all easy handles within -the multi handle when \fIcurl_multi_add_handle(3)\fP is called. - -When an easy interface is added to a multi handle, it is set to use a shared -connection cache owned by the multi handle. Removing and adding new easy -handles does not affect the pool of connections or the ability to do -connection reuse. - -If you have \fICURLMOPT_TIMERFUNCTION(3)\fP set in the multi handle (as you -should if you are working event-based with \fIcurl_multi_socket_action(3)\fP -and friends), that callback is called from within this function to ask for an -updated timer so that your main event loop gets the activity on this handle to -get started. - -The easy handle remains added to the multi handle until you remove it again -with \fIcurl_multi_remove_handle(3)\fP - even when a transfer with that -specific easy handle is completed. - -You should remove the easy handle from the multi stack before you terminate -first the easy handle and then the multi handle: - -1 - \fIcurl_multi_remove_handle(3)\fP - -2 - \fIcurl_easy_cleanup(3)\fP - -3 - \fIcurl_multi_cleanup(3)\fP -.SH EXAMPLE -.nf -int main(void) -{ - /* init a multi stack */ - CURLM *multi = curl_multi_init(); - - /* create two easy handles */ - CURL *http_handle = curl_easy_init(); - CURL *http_handle2 = curl_easy_init(); - - /* add individual transfers */ - curl_multi_add_handle(multi, http_handle); - curl_multi_add_handle(multi, http_handle2); -} -.fi -.SH AVAILABILITY -Added in 7.9.6 -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_get_handles (3), -.BR curl_multi_init (3), -.BR curl_multi_setopt (3), -.BR curl_multi_socket_action (3) diff --git a/docs/libcurl/curl_multi_add_handle.md b/docs/libcurl/curl_multi_add_handle.md new file mode 100644 index 000000000..3d6ba81fb --- /dev/null +++ b/docs/libcurl/curl_multi_add_handle.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_add_handle +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_get_handles (3) + - curl_multi_init (3) + - curl_multi_setopt (3) + - curl_multi_socket_action (3) +--- + +# NAME + +curl_multi_add_handle - add an easy handle to a multi session + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle); +~~~ + +# DESCRIPTION + +Adds the *easy handle* to the *multi_handle*. + +While an easy handle is added to a multi stack, you cannot and you must not +use curl_easy_perform(3) on that handle. After having removed the easy +handle from the multi stack again, it is perfectly fine to use it with the +easy interface again. + +If the easy handle is not set to use a shared (CURLOPT_SHARE(3)) cache, +it is made to use a DNS cache that is shared between all easy handles within +the multi handle when curl_multi_add_handle(3) is called. + +When an easy interface is added to a multi handle, it is set to use a shared +connection cache owned by the multi handle. Removing and adding new easy +handles does not affect the pool of connections or the ability to do +connection reuse. + +If you have CURLMOPT_TIMERFUNCTION(3) set in the multi handle (as you +should if you are working event-based with curl_multi_socket_action(3) +and friends), that callback is called from within this function to ask for an +updated timer so that your main event loop gets the activity on this handle to +get started. + +The easy handle remains added to the multi handle until you remove it again +with curl_multi_remove_handle(3) - even when a transfer with that +specific easy handle is completed. + +You should remove the easy handle from the multi stack before you terminate +first the easy handle and then the multi handle: + +1 - curl_multi_remove_handle(3) + +2 - curl_easy_cleanup(3) + +3 - curl_multi_cleanup(3) + +# EXAMPLE + +~~~c +int main(void) +{ + /* init a multi stack */ + CURLM *multi = curl_multi_init(); + + /* create two easy handles */ + CURL *http_handle = curl_easy_init(); + CURL *http_handle2 = curl_easy_init(); + + /* add individual transfers */ + curl_multi_add_handle(multi, http_handle); + curl_multi_add_handle(multi, http_handle2); +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. diff --git a/docs/libcurl/curl_multi_assign.3 b/docs/libcurl/curl_multi_assign.3 deleted file mode 100644 index 5b6170536..000000000 --- a/docs/libcurl/curl_multi_assign.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_assign 3 "9 Jul 2006" "libcurl" "libcurl" -.SH NAME -curl_multi_assign \- set data to associate with an internal socket -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, - void *sockptr); -.fi -.SH DESCRIPTION -This function creates an association in the multi handle between the given -socket and a private pointer of the application. This is designed for -\fIcurl_multi_socket_action(3)\fP uses. - -When set, the \fIsockptr\fP pointer is passed to all future socket callbacks -for the specific \fIsockfd\fP socket. - -If the given \fIsockfd\fP is not already in use by libcurl, this function -returns an error. - -libcurl only keeps one single pointer associated with a socket, so calling -this function several times for the same socket makes the last set pointer get -used. - -The idea here being that this association (socket to private pointer) is -something that just about every application that uses this API needs and then -libcurl can just as well do it since it already has the necessary -functionality. - -It is acceptable to call this function from your multi callback functions. -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -The standard CURLMcode for multi interface error codes. -.SH TYPICAL USAGE -In a typical application you allocate a struct or at least use some kind of -semi-dynamic data for each socket that we must wait for action on when using -the \fIcurl_multi_socket_action(3)\fP approach. - -When our socket-callback gets called by libcurl and we get to know about yet -another socket to wait for, we can use \fIcurl_multi_assign(3)\fP to point out -the particular data so that when we get updates about this same socket again, -we do not have to find the struct associated with this socket by ourselves. -.SH "SEE ALSO" -.BR curl_multi_setopt (3), -.BR curl_multi_socket_action (3) diff --git a/docs/libcurl/curl_multi_assign.md b/docs/libcurl/curl_multi_assign.md new file mode 100644 index 000000000..3f01349cd --- /dev/null +++ b/docs/libcurl/curl_multi_assign.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_assign +Section: 3 +Source: libcurl +See-also: + - curl_multi_setopt (3) + - curl_multi_socket_action (3) +--- + +# NAME + +curl_multi_assign - set data to associate with an internal socket + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, + void *sockptr); +~~~ + +# DESCRIPTION + +This function creates an association in the multi handle between the given +socket and a private pointer of the application. This is designed for +curl_multi_socket_action(3) uses. + +When set, the *sockptr* pointer is passed to all future socket callbacks +for the specific *sockfd* socket. + +If the given *sockfd* is not already in use by libcurl, this function +returns an error. + +libcurl only keeps one single pointer associated with a socket, so calling +this function several times for the same socket makes the last set pointer get +used. + +The idea here being that this association (socket to private pointer) is +something that just about every application that uses this API needs and then +libcurl can just as well do it since it already has the necessary +functionality. + +It is acceptable to call this function from your multi callback functions. + +# EXAMPLE + +~~~c +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)); +} +~~~ + +# AVAILABILITY + +Added in 7.15.5 + +# RETURN VALUE + +The standard CURLMcode for multi interface error codes. + +# TYPICAL USAGE + +In a typical application you allocate a struct or at least use some kind of +semi-dynamic data for each socket that we must wait for action on when using +the curl_multi_socket_action(3) approach. + +When our socket-callback gets called by libcurl and we get to know about yet +another socket to wait for, we can use curl_multi_assign(3) to point out +the particular data so that when we get updates about this same socket again, +we do not have to find the struct associated with this socket by ourselves. diff --git a/docs/libcurl/curl_multi_cleanup.3 b/docs/libcurl/curl_multi_cleanup.3 deleted file mode 100644 index 5b4aae26c..000000000 --- a/docs/libcurl/curl_multi_cleanup.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_cleanup 3 "1 March 2002" "libcurl" "libcurl" -.SH NAME -curl_multi_cleanup - close down a multi session -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_cleanup(CURLM *multi_handle); -.fi -.SH DESCRIPTION -Cleans up and removes a whole multi stack. It does not free or touch any -individual easy handles in any way - they still need to be closed -individually, using the usual \fIcurl_easy_cleanup(3)\fP way. The order of -cleaning up should be: - -1 - \fIcurl_multi_remove_handle(3)\fP before any easy handles are cleaned up - -2 - \fIcurl_easy_cleanup(3)\fP can now be called independently since the easy -handle is no longer connected to the multi handle - -3 - \fIcurl_multi_cleanup(3)\fP should be called when all easy handles are -removed - -Passing in a NULL pointer in \fImulti_handle\fP makes this function return -CURLM_BAD_HANDLE immediately with no other action. -.SH EXAMPLE -.nf -int main(void) -{ - CURLM *multi = curl_multi_init(); - - /* when the multi transfer is done ... */ - - /* remove all easy handles, then: */ - curl_multi_cleanup(multi); -} -.fi -.SH AVAILABILITY -Added in 7.9.6 -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. On success, -CURLM_OK is returned. -.SH "SEE ALSO" -.BR curl_easy_cleanup (3), -.BR curl_multi_get_handles (3), -.BR curl_easy_init (3), -.BR curl_multi_init (3) diff --git a/docs/libcurl/curl_multi_cleanup.md b/docs/libcurl/curl_multi_cleanup.md new file mode 100644 index 000000000..9aa64a85c --- /dev/null +++ b/docs/libcurl/curl_multi_cleanup.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_cleanup +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_init (3) + - curl_multi_get_handles (3) + - curl_multi_init (3) +--- + +# NAME + +curl_multi_cleanup - close down a multi session + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_cleanup(CURLM *multi_handle); +~~~ + +# DESCRIPTION + +Cleans up and removes a whole multi stack. It does not free or touch any +individual easy handles in any way - they still need to be closed +individually, using the usual curl_easy_cleanup(3) way. The order of +cleaning up should be: + +1 - curl_multi_remove_handle(3) before any easy handles are cleaned up + +2 - curl_easy_cleanup(3) can now be called independently since the easy +handle is no longer connected to the multi handle + +3 - curl_multi_cleanup(3) should be called when all easy handles are +removed + +Passing in a NULL pointer in *multi_handle* makes this function return +CURLM_BAD_HANDLE immediately with no other action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *multi = curl_multi_init(); + + /* when the multi transfer is done ... */ + + /* remove all easy handles, then: */ + curl_multi_cleanup(multi); +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. On success, +CURLM_OK is returned. diff --git a/docs/libcurl/curl_multi_fdset.3 b/docs/libcurl/curl_multi_fdset.3 deleted file mode 100644 index 0afbe9a3c..000000000 --- a/docs/libcurl/curl_multi_fdset.3 +++ /dev/null @@ -1,124 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_fdset 3 "2 Jan 2006" "libcurl" "libcurl" -.SH NAME -curl_multi_fdset - extracts file descriptor information from a multi handle -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_fdset(CURLM *multi_handle, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *exc_fd_set, - int *max_fd); -.fi -.SH DESCRIPTION -This function extracts file descriptor information from a given multi_handle. -libcurl returns its \fIfd_set\fP sets. The application can use these to -select() on, but be sure to \fIFD_ZERO\fP them before calling this function as -\fIcurl_multi_fdset(3)\fP only adds its own descriptors, it does not zero or -otherwise remove any others. The \fIcurl_multi_perform(3)\fP function should -be called as soon as one of them is ready to be read from or written to. - -The \fIread_fd_set\fP argument should point to an object of type \fBfd_set\fP -that on returns specifies the file descriptors to be checked for being ready -to read. - -The \fIwrite_fd_set\fP argument should point to an object of type \fBfd_set\fP -that on return specifies the file descriptors to be checked for being ready to -write. - -The \fIexc_fd_set\fP argument should point to an object of type \fBfd_set\fP -that on return specifies the file descriptors to be checked for error -conditions. - -If no file descriptors are set by libcurl, \fImax_fd\fP contain -1 when this -function returns. Otherwise it contains the highest descriptor number libcurl -set. When libcurl returns -1 in \fImax_fd\fP, it is because libcurl currently -does something that is not possible for your application to monitor with a -socket and unfortunately you can then not know exactly when the current action -is completed using select(). You then need to wait a while before you proceed -and call \fIcurl_multi_perform(3)\fP anyway. How long to wait? Unless -\fIcurl_multi_timeout(3)\fP gives you a lower number, we suggest 100 -milliseconds or so, but you may want to test it out in your own particular -conditions to find a suitable value. - -When doing select(), you should use \fIcurl_multi_timeout(3)\fP to figure out -how long to wait for action. Call \fIcurl_multi_perform(3)\fP even if no -activity has been seen on the \fBfd_sets\fP after the timeout expires as -otherwise internal retries and timeouts may not work as you would think and -want. - -If one of the sockets used by libcurl happens to be larger than what can be -set in an \fBfd_set\fP, which on POSIX systems means that the file descriptor -is larger than \fBFD_SETSIZE\fP, then libcurl tries to not set it. Setting a -too large file descriptor in an \fBfd_set\fP implies an out of bounds write -which can cause crashes, or worse. The effect of NOT storing it might possibly -save you from the crash, but makes your program NOT wait for sockets it should -wait for... -.SH EXAMPLE -.nf -int main(void) -{ - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd; - int rc; - CURLMcode mc; - struct timeval timeout = {1, 0}; - - CURLM *multi = curl_multi_init(); - - do { - - /* call curl_multi_perform() */ - - /* 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 -.SH RETURN VALUE -\fBCURLMcode\fP type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_init (3), -.BR curl_multi_perform (3), -.BR curl_multi_timeout (3), -.BR curl_multi_wait (3), -.BR select (2) diff --git a/docs/libcurl/curl_multi_fdset.md b/docs/libcurl/curl_multi_fdset.md new file mode 100644 index 000000000..37d5959d1 --- /dev/null +++ b/docs/libcurl/curl_multi_fdset.md @@ -0,0 +1,119 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_fdset +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_init (3) + - curl_multi_perform (3) + - curl_multi_timeout (3) + - curl_multi_wait (3) + - select (2) +--- + +# NAME + +curl_multi_fdset - extracts file descriptor information from a multi handle + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_fdset(CURLM *multi_handle, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *exc_fd_set, + int *max_fd); +~~~ + +# DESCRIPTION + +This function extracts file descriptor information from a given multi_handle. +libcurl returns its *fd_set* sets. The application can use these to +select() on, but be sure to *FD_ZERO* them before calling this function as +curl_multi_fdset(3) only adds its own descriptors, it does not zero or +otherwise remove any others. The curl_multi_perform(3) function should +be called as soon as one of them is ready to be read from or written to. + +The *read_fd_set* argument should point to an object of type **fd_set** +that on returns specifies the file descriptors to be checked for being ready +to read. + +The *write_fd_set* argument should point to an object of type **fd_set** +that on return specifies the file descriptors to be checked for being ready to +write. + +The *exc_fd_set* argument should point to an object of type **fd_set** +that on return specifies the file descriptors to be checked for error +conditions. + +If no file descriptors are set by libcurl, *max_fd* contain -1 when this +function returns. Otherwise it contains the highest descriptor number libcurl +set. When libcurl returns -1 in *max_fd*, it is because libcurl currently +does something that is not possible for your application to monitor with a +socket and unfortunately you can then not know exactly when the current action +is completed using select(). You then need to wait a while before you proceed +and call curl_multi_perform(3) anyway. How long to wait? Unless +curl_multi_timeout(3) gives you a lower number, we suggest 100 +milliseconds or so, but you may want to test it out in your own particular +conditions to find a suitable value. + +When doing select(), you should use curl_multi_timeout(3) to figure out +how long to wait for action. Call curl_multi_perform(3) even if no +activity has been seen on the **fd_sets** after the timeout expires as +otherwise internal retries and timeouts may not work as you would think and +want. + +If one of the sockets used by libcurl happens to be larger than what can be +set in an **fd_set**, which on POSIX systems means that the file descriptor +is larger than **FD_SETSIZE**, then libcurl tries to not set it. Setting a +too large file descriptor in an **fd_set** implies an out of bounds write +which can cause crashes, or worse. The effect of NOT storing it might possibly +save you from the crash, but makes your program NOT wait for sockets it should +wait for... + +# EXAMPLE + +~~~c +int main(void) +{ + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd; + int rc; + CURLMcode mc; + struct timeval timeout = {1, 0}; + + CURLM *multi = curl_multi_init(); + + do { + + /* call curl_multi_perform() */ + + /* get file descriptors from the transfers */ + mc = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); + + if(mc != CURLM_OK) { + fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc); + break; + } + + /* wait for activity on one of the sockets */ + rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); + + } while(!mc); +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +**CURLMcode** type, general libcurl multi interface error code. See +libcurl-errors(3) diff --git a/docs/libcurl/curl_multi_get_handles.3 b/docs/libcurl/curl_multi_get_handles.3 deleted file mode 100644 index 060c6e651..000000000 --- a/docs/libcurl/curl_multi_get_handles.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_get_handles 3 "28 August 2023" "libcurl" "libcurl" -.SH NAME -curl_multi_get_handles - returns all added easy handles -.SH SYNOPSIS -.nf -#include - -CURL **curl_multi_get_handles(CURLM *multi_handle); -.fi -.SH DESCRIPTION -Returns an array with pointers to all added easy handles. The end of the list -is marked with a NULL pointer. - -Even if there is not a single easy handle added, this still returns an array -but with only a single NULL pointer entry. - -The returned array contains all the handles that are present at the time of -the call. As soon as a handle has been removed from or a handle has been added -to the multi handle after the handle array was returned, the two data points -are out of sync. - -The order of the easy handles within the array is not guaranteed. - -The returned array must be freed with a call to \fIcurl_free(3)\fP after use. -.SH EXAMPLE -.nf -int main(void) -{ - /* init a multi stack */ - CURLM *multi = curl_multi_init(); - CURL *curl = curl_easy_init(); - - if(curl) { - /* add the transfer */ - curl_multi_add_handle(multi, curl); - - /* extract all added handles */ - CURL **list = curl_multi_get_handles(multi); - - if(list) { - int i; - /* remove all added handles */ - for(i = 0; list[i]; i++) { - curl_multi_remove_handle(multi, list[i]); - } - curl_free(list); - } - } -} -.fi -.SH AVAILABILITY -Added in 8.4.0 -.SH RETURN VALUE -Returns NULL on failure. Otherwise it returns a pointer to an allocated array. -.SH "SEE ALSO" -.BR curl_multi_add_handle (3), -.BR curl_multi_cleanup (3), -.BR curl_multi_init (3), -.BR curl_multi_remove_handle (3) diff --git a/docs/libcurl/curl_multi_get_handles.md b/docs/libcurl/curl_multi_get_handles.md new file mode 100644 index 000000000..0a7ff67ca --- /dev/null +++ b/docs/libcurl/curl_multi_get_handles.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_get_handles +Section: 3 +Source: libcurl +See-also: + - curl_multi_add_handle (3) + - curl_multi_cleanup (3) + - curl_multi_init (3) + - curl_multi_remove_handle (3) +--- + +# NAME + +curl_multi_get_handles - returns all added easy handles + +# SYNOPSIS + +~~~c +#include + +CURL **curl_multi_get_handles(CURLM *multi_handle); +~~~ + +# DESCRIPTION + +Returns an array with pointers to all added easy handles. The end of the list +is marked with a NULL pointer. + +Even if there is not a single easy handle added, this still returns an array +but with only a single NULL pointer entry. + +The returned array contains all the handles that are present at the time of +the call. As soon as a handle has been removed from or a handle has been added +to the multi handle after the handle array was returned, the two data points +are out of sync. + +The order of the easy handles within the array is not guaranteed. + +The returned array must be freed with a call to curl_free(3) after use. + +# EXAMPLE + +~~~c +int main(void) +{ + /* init a multi stack */ + CURLM *multi = curl_multi_init(); + CURL *curl = curl_easy_init(); + + if(curl) { + /* add the transfer */ + curl_multi_add_handle(multi, curl); + + /* extract all added handles */ + CURL **list = curl_multi_get_handles(multi); + + if(list) { + int i; + /* remove all added handles */ + for(i = 0; list[i]; i++) { + curl_multi_remove_handle(multi, list[i]); + } + curl_free(list); + } + } +} +~~~ + +# AVAILABILITY + +Added in 8.4.0 + +# RETURN VALUE + +Returns NULL on failure. Otherwise it returns a pointer to an allocated array. diff --git a/docs/libcurl/curl_multi_info_read.3 b/docs/libcurl/curl_multi_info_read.md similarity index 51% rename from docs/libcurl/curl_multi_info_read.3 rename to docs/libcurl/curl_multi_info_read.md index c833548c8..23d515d8f 100644 --- a/docs/libcurl/curl_multi_info_read.3 +++ b/docs/libcurl/curl_multi_info_read.md @@ -1,36 +1,29 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_info_read 3 "18 Dec 2004" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_info_read +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_init (3) + - curl_multi_perform (3) +--- + +# NAME + curl_multi_info_read - read multi stack information -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Ask the multi handle if there are any messages from the individual transfers. Messages may include information such as an error code from the transfer or just the fact that a transfer is completed. More details on these @@ -38,7 +31,7 @@ should be written down as well. Repeated calls to this function returns a new struct each time, until a NULL is returned as a signal that there is no more to get at this point. The -integer pointed to with \fImsgs_in_queue\fP contains the number of remaining +integer pointed to with *msgs_in_queue* contains the number of remaining messages after this function was called. When you fetch a message using this function, it is removed from the internal @@ -46,16 +39,16 @@ queue so calling this function again does not return the same message again. It instead returns new messages at each new invoke until the queue is emptied. -\fBWARNING:\fP The data the returned pointer points to does not survive -calling \fIcurl_multi_cleanup(3)\fP, \fIcurl_multi_remove_handle(3)\fP or -\fIcurl_easy_cleanup(3)\fP. +**WARNING:** The data the returned pointer points to does not survive +calling curl_multi_cleanup(3), curl_multi_remove_handle(3) or +curl_easy_cleanup(3). -The \fICURLMsg\fP struct is simple and only contains basic information. If +The *CURLMsg* struct is simple and only contains basic information. If more involved information is wanted, the particular "easy handle" is present in that struct and can be used in subsequent regular -\fIcurl_easy_getinfo(3)\fP calls (or similar): +curl_easy_getinfo(3) calls (or similar): -.nf +~~~c struct CURLMsg { CURLMSG msg; /* what this message means */ CURL *easy_handle; /* the handle it concerns */ @@ -64,14 +57,16 @@ in that struct and can be used in subsequent regular CURLcode result; /* return code for transfer */ } data; }; -.fi -When \fBmsg\fP is \fICURLMSG_DONE\fP, the message identifies a transfer that -is done, and then \fBresult\fP contains the return code for the easy handle +~~~ +When **msg** is *CURLMSG_DONE*, the message identifies a transfer that +is done, and then **result** contains the return code for the easy handle that just completed. -At this point, there are no other \fBmsg\fP types defined. -.SH EXAMPLE -.nf +At this point, there are no other **msg** types defined. + +# EXAMPLE + +~~~c int main(void) { CURLM *multi = curl_multi_init(); @@ -94,14 +89,14 @@ int main(void) } while(m); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.9.6 -.SH RETURN VALUE + +# RETURN VALUE + A pointer to a filled-in struct, or NULL if it failed or ran out of structs. It also writes the number of messages left in the queue (after this read) in the integer the second argument points to. -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_init (3), -.BR curl_multi_perform (3) diff --git a/docs/libcurl/curl_multi_init.3 b/docs/libcurl/curl_multi_init.3 deleted file mode 100644 index 4501a0031..000000000 --- a/docs/libcurl/curl_multi_init.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_init 3 "1 March 2002" "libcurl" "libcurl" -.SH NAME -curl_multi_init - create a multi handle -.SH SYNOPSIS -.nf -#include - -CURLM *curl_multi_init(); -.fi -.SH DESCRIPTION -This function returns a pointer to a \fICURLM\fP handle to be used as input to -all the other multi-functions, sometimes referred to as a multi handle in some -places in the documentation. This init call MUST have a corresponding call to -\fIcurl_multi_cleanup(3)\fP when the operation is complete. -.SH EXAMPLE -.nf -int main(void) -{ - /* init a multi stack */ - CURLM *multi = curl_multi_init(); - CURL *curl = curl_easy_init(); - CURL *curl2 = curl_easy_init(); - - /* add individual transfers */ - curl_multi_add_handle(multi, curl); - curl_multi_add_handle(multi, curl2); -} -.fi -.SH AVAILABILITY -Added in 7.9.6 -.SH RETURN VALUE -If this function returns NULL, something went wrong and you cannot use the -other curl functions. -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_add_handle (3), -.BR curl_multi_get_handles (3), -.BR curl_global_init (3), -.BR curl_easy_init (3) diff --git a/docs/libcurl/curl_multi_init.md b/docs/libcurl/curl_multi_init.md new file mode 100644 index 000000000..0e91b57c1 --- /dev/null +++ b/docs/libcurl/curl_multi_init.md @@ -0,0 +1,57 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_init +Section: 3 +Source: libcurl +See-also: + - curl_easy_init (3) + - curl_global_init (3) + - curl_multi_add_handle (3) + - curl_multi_cleanup (3) + - curl_multi_get_handles (3) +--- + +# NAME + +curl_multi_init - create a multi handle + +# SYNOPSIS + +~~~c +#include + +CURLM *curl_multi_init(); +~~~ + +# DESCRIPTION + +This function returns a pointer to a *CURLM* handle to be used as input to +all the other multi-functions, sometimes referred to as a multi handle in some +places in the documentation. This init call MUST have a corresponding call to +curl_multi_cleanup(3) when the operation is complete. + +# EXAMPLE + +~~~c +int main(void) +{ + /* init a multi stack */ + CURLM *multi = curl_multi_init(); + CURL *curl = curl_easy_init(); + CURL *curl2 = curl_easy_init(); + + /* add individual transfers */ + curl_multi_add_handle(multi, curl); + curl_multi_add_handle(multi, curl2); +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +If this function returns NULL, something went wrong and you cannot use the +other curl functions. diff --git a/docs/libcurl/curl_multi_perform.3 b/docs/libcurl/curl_multi_perform.3 deleted file mode 100644 index 8088c433e..000000000 --- a/docs/libcurl/curl_multi_perform.3 +++ /dev/null @@ -1,110 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_perform 3 "1 March 2002" "libcurl" "libcurl" -.SH NAME -curl_multi_perform - reads/writes available data from easy handles -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); -.fi -.SH DESCRIPTION -This function performs transfers on all the added handles that need attention -in a non-blocking fashion. The easy handles have previously been added to the -multi handle with \fIcurl_multi_add_handle(3)\fP. - -When an application has found out there is data available for the multi_handle -or a timeout has elapsed, the application should call this function to -read/write whatever there is to read or write right now etc. -\fIcurl_multi_perform(3)\fP returns as soon as the reads/writes are done. This -function does not require that there actually is any data available for -reading or that data can be written, it can be called just in case. It stores -the number of handles that still transfer data in the second argument's -integer-pointer. - -If the amount of \fIrunning_handles\fP is changed from the previous call (or -is less than the amount of easy handles you have added to the multi handle), -you know that there is one or more transfers less "running". You can then call -\fIcurl_multi_info_read(3)\fP to get information about each individual -completed transfer, and that returned info includes CURLcode and more. If an -added handle fails quickly, it may never be counted as a running_handle. You -could use \fIcurl_multi_info_read(3)\fP to track actual status of the added -handles in that case. - -When \fIrunning_handles\fP is set to zero (0) on the return of this function, -there is no longer any transfers in progress. - -When this function returns error, the state of all transfers are uncertain and -they cannot be continued. \fIcurl_multi_perform(3)\fP should not be called -again on the same multi handle after an error has been returned, unless first -removing all the handles and adding new ones. -.SH EXAMPLE -.nf -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, NULL, 0, 1000, NULL); - - if(mc) { - fprintf(stderr, "curl_multi_poll() failed, code %d.\\n", (int)mc); - break; - } - - /* if there are still transfers, loop! */ - } while(still_running); - } -} -.fi -.SH AVAILABILITY -Added in 7.9.6 -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. - -This function returns errors regarding the whole multi stack. Problems on -individual transfers may have occurred even when this function returns -\fICURLM_OK\fP. Use \fIcurl_multi_info_read(3)\fP to figure out how individual -transfers did. -.SH "TYPICAL USAGE" -Most applications use \fIcurl_multi_poll(3)\fP to make libcurl wait for -activity on any of the ongoing transfers. As soon as one or more file -descriptor has activity or the function times out, the application calls -\fIcurl_multi_perform(3)\fP. -.SH "SEE ALSO" -.BR curl_multi_add_handle (3), -.BR curl_multi_cleanup (3), -.BR curl_multi_fdset (3), -.BR curl_multi_info_read (3), -.BR curl_multi_init (3), -.BR curl_multi_wait (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_multi_perform.md b/docs/libcurl/curl_multi_perform.md new file mode 100644 index 000000000..ecad22edf --- /dev/null +++ b/docs/libcurl/curl_multi_perform.md @@ -0,0 +1,107 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_perform +Section: 3 +Source: libcurl +See-also: + - curl_multi_add_handle (3) + - curl_multi_cleanup (3) + - curl_multi_fdset (3) + - curl_multi_info_read (3) + - curl_multi_init (3) + - curl_multi_wait (3) + - libcurl-errors (3) +--- + +# NAME + +curl_multi_perform - reads/writes available data from easy handles + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); +~~~ + +# DESCRIPTION + +This function performs transfers on all the added handles that need attention +in a non-blocking fashion. The easy handles have previously been added to the +multi handle with curl_multi_add_handle(3). + +When an application has found out there is data available for the multi_handle +or a timeout has elapsed, the application should call this function to +read/write whatever there is to read or write right now etc. +curl_multi_perform(3) returns as soon as the reads/writes are done. This +function does not require that there actually is any data available for +reading or that data can be written, it can be called just in case. It stores +the number of handles that still transfer data in the second argument's +integer-pointer. + +If the amount of *running_handles* is changed from the previous call (or +is less than the amount of easy handles you have added to the multi handle), +you know that there is one or more transfers less "running". You can then call +curl_multi_info_read(3) to get information about each individual +completed transfer, and that returned info includes CURLcode and more. If an +added handle fails quickly, it may never be counted as a running_handle. You +could use curl_multi_info_read(3) to track actual status of the added +handles in that case. + +When *running_handles* is set to zero (0) on the return of this function, +there is no longer any transfers in progress. + +When this function returns error, the state of all transfers are uncertain and +they cannot be continued. curl_multi_perform(3) should not be called +again on the same multi handle after an error has been returned, unless first +removing all the handles and adding new ones. + +# EXAMPLE + +~~~c +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, NULL, 0, 1000, NULL); + + if(mc) { + fprintf(stderr, "curl_multi_poll() failed, code %d.\n", (int)mc); + break; + } + + /* if there are still transfers, loop! */ + } while(still_running); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. + +This function returns errors regarding the whole multi stack. Problems on +individual transfers may have occurred even when this function returns +*CURLM_OK*. Use curl_multi_info_read(3) to figure out how individual +transfers did. + +# TYPICAL USAGE + +Most applications use curl_multi_poll(3) to make libcurl wait for +activity on any of the ongoing transfers. As soon as one or more file +descriptor has activity or the function times out, the application calls +curl_multi_perform(3). diff --git a/docs/libcurl/curl_multi_poll.3 b/docs/libcurl/curl_multi_poll.md similarity index 50% rename from docs/libcurl/curl_multi_poll.3 rename to docs/libcurl/curl_multi_poll.md index dfc5bbd55..b239f2836 100644 --- a/docs/libcurl/curl_multi_poll.3 +++ b/docs/libcurl/curl_multi_poll.md @@ -1,31 +1,23 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_poll 3 "29 Jul 2019" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_poll +Section: 3 +Source: libcurl +See-also: + - curl_multi_fdset (3) + - curl_multi_perform (3) + - curl_multi_wait (3) + - curl_multi_wakeup (3) +--- + +# NAME + curl_multi_poll - polls on all easy handles in a multi handle -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLMcode curl_multi_poll(CURLM *multi_handle, @@ -33,56 +25,68 @@ CURLMcode curl_multi_poll(CURLM *multi_handle, unsigned int extra_nfds, int timeout_ms, int *numfds); -.fi -.SH DESCRIPTION -\fIcurl_multi_poll(3)\fP polls all file descriptors used by the curl easy +~~~ + +# DESCRIPTION + +curl_multi_poll(3) polls all file descriptors used by the curl easy handles contained in the given multi handle set. It blocks until activity is -detected on at least one of the handles or \fItimeout_ms\fP has passed. +detected on at least one of the handles or *timeout_ms* has passed. Alternatively, if the multi handle has a pending internal timeout that has a -shorter expiry time than \fItimeout_ms\fP, that shorter time is used instead +shorter expiry time than *timeout_ms*, that shorter time is used instead to make sure timeout accuracy is reasonably kept. The calling application may pass additional curl_waitfd structures which are -similar to \fIpoll(2)\fP's \fIpollfd\fP structure to be waited on in the same +similar to *poll(2)*'s *pollfd* structure to be waited on in the same call. -On completion, if \fInumfds\fP is non-NULL, it gets populated with the total +On completion, if *numfds* is non-NULL, it gets populated with the total number of file descriptors on which interesting events occurred. This number can include both libcurl internal descriptors as well as descriptors provided -in \fIextra_fds\fP. +in *extra_fds*. -The \fIcurl_multi_wakeup(3)\fP function can be used from another thread to +The curl_multi_wakeup(3) function can be used from another thread to wake up this function and return faster. This is one of the details -that makes this function different than \fIcurl_multi_wait(3)\fP which cannot +that makes this function different than curl_multi_wait(3) which cannot be woken up this way. If no extra file descriptors are provided and libcurl has no file descriptor -to offer to wait for, this function instead waits during \fItimeout_ms\fP +to offer to wait for, this function instead waits during *timeout_ms* milliseconds (or shorter if an internal timer indicates so). This is the other -detail that makes this function different than \fIcurl_multi_wait(3)\fP. +detail that makes this function different than curl_multi_wait(3). This function is encouraged to be used instead of select(3) when using the multi interface to allow applications to easier circumvent the common problem with 1024 maximum file descriptors. -.SH curl_waitfd -.nf + +# curl_waitfd + +~~~c struct curl_waitfd { curl_socket_t fd; short events; short revents; }; -.fi -.IP CURL_WAIT_POLLIN +~~~ + +## CURL_WAIT_POLLIN + Bit flag to curl_waitfd.events indicating the socket should poll on read events such as new data received. -.IP CURL_WAIT_POLLPRI + +## CURL_WAIT_POLLPRI + Bit flag to curl_waitfd.events indicating the socket should poll on high priority read events such as out of band data. -.IP CURL_WAIT_POLLOUT + +## CURL_WAIT_POLLOUT + Bit flag to curl_waitfd.events indicating the socket should poll on write events such as the socket being clear to write without blocking. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *easy_handle; @@ -104,7 +108,7 @@ int main(void) } if(mc != CURLM_OK) { - fprintf(stderr, "curl_multi failed, code %d.\\n", mc); + fprintf(stderr, "curl_multi failed, code %d.\n", mc); break; } @@ -112,14 +116,13 @@ int main(void) curl_multi_remove_handle(multi_handle, easy_handle); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.66.0. -.SH RETURN VALUE + +# RETURN VALUE + CURLMcode type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH "SEE ALSO" -.BR curl_multi_fdset (3), -.BR curl_multi_perform (3), -.BR curl_multi_wait (3), -.BR curl_multi_wakeup (3) +libcurl-errors(3) diff --git a/docs/libcurl/curl_multi_remove_handle.3 b/docs/libcurl/curl_multi_remove_handle.3 deleted file mode 100644 index eb2aaf399..000000000 --- a/docs/libcurl/curl_multi_remove_handle.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_remove_handle 3 "6 March 2002" "libcurl" "libcurl" -.SH NAME -curl_multi_remove_handle - remove an easy handle from a multi session -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle); -.fi -.SH DESCRIPTION -Removes a given \fIeasy_handle\fP from the \fImulti_handle\fP. This makes the -specified easy handle be removed from this multi handle's control. - -When the easy handle has been removed from a multi stack, it is again -perfectly legal to invoke \fIcurl_easy_perform(3)\fP on this easy handle. - -Removing an easy handle while being in use is perfectly legal and effectively -halts the transfer in progress involving that easy handle. All other easy -handles and transfers remain unaffected. - -It is fine to remove a handle at any time during a transfer, just not from -within any libcurl callback function. - -Removing an easy handle from the multi handle before the corresponding -transfer is complete might cause libcurl to close the connection - if the -state of it and the internal protocol handler deem it necessary. Otherwise -libcurl keeps the connection alive in the connection pool associated with the -multi handle, ready to get reused for a future transfer using this multi -handle. -.SH EXAMPLE -.nf -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 -.SH AVAILABILITY -Added in 7.9.6 -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_add_handle (3), -.BR curl_multi_cleanup (3), -.BR curl_multi_init (3) diff --git a/docs/libcurl/curl_multi_remove_handle.md b/docs/libcurl/curl_multi_remove_handle.md new file mode 100644 index 000000000..bb8ee1c7d --- /dev/null +++ b/docs/libcurl/curl_multi_remove_handle.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_remove_handle +Section: 3 +Source: libcurl +See-also: + - curl_multi_add_handle (3) + - curl_multi_cleanup (3) + - curl_multi_init (3) +--- + +# NAME + +curl_multi_remove_handle - remove an easy handle from a multi session + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle); +~~~ + +# DESCRIPTION + +Removes a given *easy_handle* from the *multi_handle*. This makes the +specified easy handle be removed from this multi handle's control. + +When the easy handle has been removed from a multi stack, it is again +perfectly legal to invoke curl_easy_perform(3) on this easy handle. + +Removing an easy handle while being in use is perfectly legal and effectively +halts the transfer in progress involving that easy handle. All other easy +handles and transfers remain unaffected. + +It is fine to remove a handle at any time during a transfer, just not from +within any libcurl callback function. + +Removing an easy handle from the multi handle before the corresponding +transfer is complete might cause libcurl to close the connection - if the +state of it and the internal protocol handler deem it necessary. Otherwise +libcurl keeps the connection alive in the connection pool associated with the +multi handle, ready to get reused for a future transfer using this multi +handle. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *multi = curl_multi_init(); + int queued = 0; + + /* when an easy handle has completed, remove it */ + CURLMsg *msg = curl_multi_info_read(multi, &queued); + if(msg) { + if(msg->msg == CURLMSG_DONE) { + /* a transfer ended */ + fprintf(stderr, "Transfer completed\n"); + curl_multi_remove_handle(multi, msg->easy_handle); + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.6 + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. diff --git a/docs/libcurl/curl_multi_setopt.3 b/docs/libcurl/curl_multi_setopt.3 deleted file mode 100644 index 1752fe4fd..000000000 --- a/docs/libcurl/curl_multi_setopt.3 +++ /dev/null @@ -1,98 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_setopt 3 "4 Nov 2014" "libcurl" "libcurl" -.SH NAME -curl_multi_setopt \- set options for a curl multi handle -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option, parameter); -.fi -.SH DESCRIPTION -\fIcurl_multi_setopt(3)\fP is used to tell a libcurl multi handle how to -behave. By using the appropriate options to \fIcurl_multi_setopt(3)\fP, you -can change libcurl's behavior when using that multi handle. All options are -set with the \fIoption\fP followed by the \fIparameter\fP. That parameter can -be a \fBlong\fP, a \fBfunction pointer\fP, an \fBobject pointer\fP or a -\fBcurl_off_t\fP type, depending on what the specific option expects. Read -this manual carefully as bad input values may cause libcurl to behave -badly. You can only set one option in each function call. - -.SH OPTIONS -.IP CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE -See \fICURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)\fP -.IP CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE -See \fICURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)\fP -.IP CURLMOPT_MAX_HOST_CONNECTIONS -See \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP -.IP CURLMOPT_MAX_PIPELINE_LENGTH -See \fICURLMOPT_MAX_PIPELINE_LENGTH(3)\fP -.IP CURLMOPT_MAX_TOTAL_CONNECTIONS -See \fICURLMOPT_MAX_TOTAL_CONNECTIONS(3)\fP -.IP CURLMOPT_MAXCONNECTS -See \fICURLMOPT_MAXCONNECTS(3)\fP -.IP CURLMOPT_PIPELINING -See \fICURLMOPT_PIPELINING(3)\fP -.IP CURLMOPT_PIPELINING_SITE_BL -See \fICURLMOPT_PIPELINING_SITE_BL(3)\fP -.IP CURLMOPT_PIPELINING_SERVER_BL -See \fICURLMOPT_PIPELINING_SERVER_BL(3)\fP -.IP CURLMOPT_PUSHFUNCTION -See \fICURLMOPT_PUSHFUNCTION(3)\fP -.IP CURLMOPT_PUSHDATA -See \fICURLMOPT_PUSHDATA(3)\fP -.IP CURLMOPT_SOCKETFUNCTION -See \fICURLMOPT_SOCKETFUNCTION(3)\fP -.IP CURLMOPT_SOCKETDATA -See \fICURLMOPT_SOCKETDATA(3)\fP -.IP CURLMOPT_TIMERFUNCTION -See \fICURLMOPT_TIMERFUNCTION(3)\fP -.IP CURLMOPT_TIMERDATA -See \fICURLMOPT_TIMERDATA(3)\fP -.IP CURLMOPT_MAX_CONCURRENT_STREAMS -See \fICURLMOPT_MAX_CONCURRENT_STREAMS(3)\fP -.SH EXAMPLE -.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 -The standard CURLMcode for multi interface error codes. Note that it returns a -CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl -does not know of. -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_info_read (3), -.BR curl_multi_init (3), -.BR curl_multi_socket (3) diff --git a/docs/libcurl/curl_multi_setopt.md b/docs/libcurl/curl_multi_setopt.md new file mode 100644 index 000000000..c0c8a3e6e --- /dev/null +++ b/docs/libcurl/curl_multi_setopt.md @@ -0,0 +1,125 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_setopt +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_info_read (3) + - curl_multi_init (3) + - curl_multi_socket (3) +--- + +# NAME + +curl_multi_setopt - set options for a curl multi handle + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option, parameter); +~~~ + +# DESCRIPTION + +curl_multi_setopt(3) is used to tell a libcurl multi handle how to +behave. By using the appropriate options to curl_multi_setopt(3), you +can change libcurl's behavior when using that multi handle. All options are +set with the *option* followed by the *parameter*. That parameter can +be a **long**, a **function pointer**, an **object pointer** or a +**curl_off_t** type, depending on what the specific option expects. Read +this manual carefully as bad input values may cause libcurl to behave +badly. You can only set one option in each function call. + +# OPTIONS + +## CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE + +See CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3) + +## CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE + +See CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3) + +## CURLMOPT_MAX_HOST_CONNECTIONS + +See CURLMOPT_MAX_HOST_CONNECTIONS(3) + +## CURLMOPT_MAX_PIPELINE_LENGTH + +See CURLMOPT_MAX_PIPELINE_LENGTH(3) + +## CURLMOPT_MAX_TOTAL_CONNECTIONS + +See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) + +## CURLMOPT_MAXCONNECTS + +See CURLMOPT_MAXCONNECTS(3) + +## CURLMOPT_PIPELINING + +See CURLMOPT_PIPELINING(3) + +## CURLMOPT_PIPELINING_SITE_BL + +See CURLMOPT_PIPELINING_SITE_BL(3) + +## CURLMOPT_PIPELINING_SERVER_BL + +See CURLMOPT_PIPELINING_SERVER_BL(3) + +## CURLMOPT_PUSHFUNCTION + +See CURLMOPT_PUSHFUNCTION(3) + +## CURLMOPT_PUSHDATA + +See CURLMOPT_PUSHDATA(3) + +## CURLMOPT_SOCKETFUNCTION + +See CURLMOPT_SOCKETFUNCTION(3) + +## CURLMOPT_SOCKETDATA + +See CURLMOPT_SOCKETDATA(3) + +## CURLMOPT_TIMERFUNCTION + +See CURLMOPT_TIMERFUNCTION(3) + +## CURLMOPT_TIMERDATA + +See CURLMOPT_TIMERDATA(3) + +## CURLMOPT_MAX_CONCURRENT_STREAMS + +See CURLMOPT_MAX_CONCURRENT_STREAMS(3) + +# EXAMPLE + +~~~c + +#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); +} +~~~ + +# AVAILABILITY + +Added in 7.15.4 + +# RETURN VALUE + +The standard CURLMcode for multi interface error codes. Note that it returns a +CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl +does not know of. diff --git a/docs/libcurl/curl_multi_socket.3 b/docs/libcurl/curl_multi_socket.3 deleted file mode 100644 index e4759eb2d..000000000 --- a/docs/libcurl/curl_multi_socket.3 +++ /dev/null @@ -1,100 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_socket 3 "9 Jul 2006" "libcurl" "libcurl" -.SH NAME -curl_multi_socket \- reads/writes available data -.SH SYNOPSIS -.nf -#include -CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd, - int *running_handles); - -CURLMcode curl_multi_socket_all(CURLM *multi_handle, - int *running_handles); -.fi -.SH DESCRIPTION -These functions are deprecated. Do not use. See -\fIcurl_multi_socket_action(3)\fP instead. - -At return, the integer \fBrunning_handles\fP points to contains the number of -still running easy handles within the multi handle. When this number reaches -zero, all transfers are complete/done. Note that when you call -\fIcurl_multi_socket_action(3)\fP on a specific socket and the counter -decreases by one, it DOES NOT necessarily mean that this exact socket/transfer -is the one that completed. Use \fIcurl_multi_info_read(3)\fP to figure out -which easy handle that completed. - -The \fIcurl_multi_socket_action(3)\fP functions inform the application about -updates in the socket (file descriptor) status by doing none, one, or multiple -calls to the socket callback function set with the -\fICURLMOPT_SOCKETFUNCTION(3)\fP option to \fIcurl_multi_setopt(3)\fP. They -update the status with changes since the previous time the callback was -called. - -Get the timeout time by setting the \fICURLMOPT_TIMERFUNCTION(3)\fP option -with \fIcurl_multi_setopt(3)\fP. Your application then gets called with -information on how long to wait for socket actions at most before doing the -timeout action: call the \fIcurl_multi_socket_action(3)\fP function with the -\fBsockfd\fP argument set to CURL_SOCKET_TIMEOUT. You can also use the -\fIcurl_multi_timeout(3)\fP function to poll the value at any given time, but -for an event-based system using the callback is far better than relying on -polling the timeout value. - -Usage of \fIcurl_multi_socket(3)\fP is deprecated, whereas the function is -equivalent to \fIcurl_multi_socket_action(3)\fP with \fBev_bitmask\fP set to -0. - -Force libcurl to (re-)check all its internal sockets and transfers instead of -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 -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 -7.16.0. - -\fIcurl_multi_socket(3)\fP is deprecated, use -\fIcurl_multi_socket_action(3)\fP instead! -.SH "RETURN VALUE" -CURLMcode type, general libcurl multi interface error code. - -The return code is for the whole multi stack. Problems still might have -occurred on individual transfers even when one of these functions return OK. -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_init (3), -.BR curl_multi_fdset (3), -.BR curl_multi_info_read (3), -.BR the hiperfifo.c example diff --git a/docs/libcurl/curl_multi_socket.md b/docs/libcurl/curl_multi_socket.md new file mode 100644 index 000000000..ff465c359 --- /dev/null +++ b/docs/libcurl/curl_multi_socket.md @@ -0,0 +1,95 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_socket +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_fdset (3) + - curl_multi_info_read (3) + - curl_multi_init (3) + - the hiperfifo.c example +--- + +# NAME + +curl_multi_socket - reads/writes available data + +# SYNOPSIS + +~~~c +#include +CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd, + int *running_handles); + +CURLMcode curl_multi_socket_all(CURLM *multi_handle, + int *running_handles); +~~~ + +# DESCRIPTION + +These functions are deprecated. Do not use. See +curl_multi_socket_action(3) instead. + +At return, the integer **running_handles** points to contains the number of +still running easy handles within the multi handle. When this number reaches +zero, all transfers are complete/done. Note that when you call +curl_multi_socket_action(3) on a specific socket and the counter +decreases by one, it DOES NOT necessarily mean that this exact socket/transfer +is the one that completed. Use curl_multi_info_read(3) to figure out +which easy handle that completed. + +The curl_multi_socket_action(3) functions inform the application about +updates in the socket (file descriptor) status by doing none, one, or multiple +calls to the socket callback function set with the +CURLMOPT_SOCKETFUNCTION(3) option to curl_multi_setopt(3). They +update the status with changes since the previous time the callback was +called. + +Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option +with curl_multi_setopt(3). Your application then gets called with +information on how long to wait for socket actions at most before doing the +timeout action: call the curl_multi_socket_action(3) function with the +**sockfd** argument set to CURL_SOCKET_TIMEOUT. You can also use the +curl_multi_timeout(3) function to poll the value at any given time, but +for an event-based system using the callback is far better than relying on +polling the timeout value. + +Usage of curl_multi_socket(3) is deprecated, whereas the function is +equivalent to curl_multi_socket_action(3) with **ev_bitmask** set to +0. + +Force libcurl to (re-)check all its internal sockets and transfers instead of +just a single one by calling curl_multi_socket_all(3). Note that there +should not be any reason to use this function. + +# EXAMPLE + +~~~c +int main(void) +{ + /* the event-library gets told when there activity on the socket 'fd', + which we translate to a call to curl_multi_socket_action() */ + int running; + int rc; + int fd; + CURLM *multi; + rc = curl_multi_socket(multi, fd, &running); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.15.4, and is deemed stable since +7.16.0. + +curl_multi_socket(3) is deprecated, use +curl_multi_socket_action(3) instead! + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. + +The return code is for the whole multi stack. Problems still might have +occurred on individual transfers even when one of these functions return OK. diff --git a/docs/libcurl/curl_multi_socket_action.3 b/docs/libcurl/curl_multi_socket_action.3 deleted file mode 100644 index 445ac2c8d..000000000 --- a/docs/libcurl/curl_multi_socket_action.3 +++ /dev/null @@ -1,123 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_socket_action 3 "9 Jul 2006" "libcurl" "libcurl" -.SH NAME -curl_multi_socket_action \- reads/writes available data given an action -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_socket_action(CURLM *multi_handle, - curl_socket_t sockfd, - int ev_bitmask, - int *running_handles); -.fi -.SH DESCRIPTION -When the application has detected action on a socket handled by libcurl, it -should call \fIcurl_multi_socket_action(3)\fP with the \fBsockfd\fP argument -set to the socket with the action. When the events on a socket are known, they -can be passed as an events bitmask \fBev_bitmask\fP by first setting -\fBev_bitmask\fP to 0, and then adding using bitwise OR (|) any combination of -events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or -CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and -libcurl tests the descriptor internally. It is also permissible to pass -CURL_SOCKET_TIMEOUT to the \fBsockfd\fP parameter in order to initiate the -whole process or when a timeout occurs. - -At return, \fBrunning_handles\fP points to the number of running easy handles -within the multi handle. When this number reaches zero, all transfers are -complete/done. When you call \fIcurl_multi_socket_action(3)\fP on a specific -socket and the counter decreases by one, it DOES NOT necessarily mean that -this exact socket/transfer is the one that completed. Use -\fIcurl_multi_info_read(3)\fP to figure out which easy handle that completed. - -The \fIcurl_multi_socket_action(3)\fP function informs the application about -updates in the socket (file descriptor) status by doing none, one, or multiple -calls to the socket callback function set with the -\fICURLMOPT_SOCKETFUNCTION(3)\fP option to \fIcurl_multi_setopt(3)\fP. They -update the status with changes since the previous time the callback was -called. - -Get the timeout time by setting the \fICURLMOPT_TIMERFUNCTION(3)\fP option -with \fIcurl_multi_setopt(3)\fP. Your application then gets called with -information on how long to wait for socket actions at most before doing the -timeout action: call the \fIcurl_multi_socket_action(3)\fP function with the -\fBsockfd\fP argument set to CURL_SOCKET_TIMEOUT. You can also use the -\fIcurl_multi_timeout(3)\fP function to poll the value at any given time, but -for an event-based system using the callback is far better than relying on -polling the timeout value. - -When this function returns error, the state of all transfers are uncertain and -they cannot be continued. \fIcurl_multi_socket_action(3)\fP should not be -called again on the same multi handle after an error has been returned, unless -first removing all the handles and adding new ones. -.SH "TYPICAL USAGE" -1. Create a multi handle - -2. Set the socket callback with \fICURLMOPT_SOCKETFUNCTION(3)\fP - -3. Set the timeout callback with \fICURLMOPT_TIMERFUNCTION(3)\fP, to get to -know what timeout value to use when waiting for socket activities. - -4. Add easy handles with curl_multi_add_handle() - -5. Provide some means to manage the sockets libcurl is using, so you can check -them for activity. This can be done through your application code, or by way -of an external library such as libevent or glib. - -6. Call curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0, ...) -to kickstart everything. To get one or more callbacks called. - -7. Wait for activity on any of libcurl's sockets, use the timeout value your -callback has been told. - -8, When activity is detected, call curl_multi_socket_action() for the -socket(s) that got action. If no activity is detected and the timeout expires, -call \fIcurl_multi_socket_action(3)\fP with \fICURL_SOCKET_TIMEOUT\fP. -.SH EXAMPLE -.nf -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. -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH "SEE ALSO" -.BR curl_multi_cleanup (3), -.BR curl_multi_fdset (3), -.BR curl_multi_info_read (3), -.BR curl_multi_init (3), -.BR the hiperfifo.c example diff --git a/docs/libcurl/curl_multi_socket_action.md b/docs/libcurl/curl_multi_socket_action.md new file mode 100644 index 000000000..8af17c83f --- /dev/null +++ b/docs/libcurl/curl_multi_socket_action.md @@ -0,0 +1,120 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_socket_action +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_fdset (3) + - curl_multi_info_read (3) + - curl_multi_init (3) + - the hiperfifo.c example +--- + +# NAME + +curl_multi_socket_action - reads/writes available data given an action + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_socket_action(CURLM *multi_handle, + curl_socket_t sockfd, + int ev_bitmask, + int *running_handles); +~~~ + +# DESCRIPTION + +When the application has detected action on a socket handled by libcurl, it +should call curl_multi_socket_action(3) with the **sockfd** argument +set to the socket with the action. When the events on a socket are known, they +can be passed as an events bitmask **ev_bitmask** by first setting +**ev_bitmask** to 0, and then adding using bitwise OR (|) any combination of +events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or +CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and +libcurl tests the descriptor internally. It is also permissible to pass +CURL_SOCKET_TIMEOUT to the **sockfd** parameter in order to initiate the +whole process or when a timeout occurs. + +At return, **running_handles** points to the number of running easy handles +within the multi handle. When this number reaches zero, all transfers are +complete/done. When you call curl_multi_socket_action(3) on a specific +socket and the counter decreases by one, it DOES NOT necessarily mean that +this exact socket/transfer is the one that completed. Use +curl_multi_info_read(3) to figure out which easy handle that completed. + +The curl_multi_socket_action(3) function informs the application about +updates in the socket (file descriptor) status by doing none, one, or multiple +calls to the socket callback function set with the +CURLMOPT_SOCKETFUNCTION(3) option to curl_multi_setopt(3). They +update the status with changes since the previous time the callback was +called. + +Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option +with curl_multi_setopt(3). Your application then gets called with +information on how long to wait for socket actions at most before doing the +timeout action: call the curl_multi_socket_action(3) function with the +**sockfd** argument set to CURL_SOCKET_TIMEOUT. You can also use the +curl_multi_timeout(3) function to poll the value at any given time, but +for an event-based system using the callback is far better than relying on +polling the timeout value. + +When this function returns error, the state of all transfers are uncertain and +they cannot be continued. curl_multi_socket_action(3) should not be +called again on the same multi handle after an error has been returned, unless +first removing all the handles and adding new ones. + +# TYPICAL USAGE + +1. Create a multi handle + +2. Set the socket callback with CURLMOPT_SOCKETFUNCTION(3) + +3. Set the timeout callback with CURLMOPT_TIMERFUNCTION(3), to get to +know what timeout value to use when waiting for socket activities. + +4. Add easy handles with curl_multi_add_handle() + +5. Provide some means to manage the sockets libcurl is using, so you can check +them for activity. This can be done through your application code, or by way +of an external library such as libevent or glib. + +6. Call curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0, ...) +to kickstart everything. To get one or more callbacks called. + +7. Wait for activity on any of libcurl's sockets, use the timeout value your +callback has been told. + +8, When activity is detected, call curl_multi_socket_action() for the +socket(s) that got action. If no activity is detected and the timeout expires, +call curl_multi_socket_action(3) with *CURL_SOCKET_TIMEOUT*. + +# EXAMPLE + +~~~c +int main(void) +{ + /* the event-library gets told when there activity on the socket 'fd', + which we translate to a call to curl_multi_socket_action() */ + int running; + 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)); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0. + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. See +libcurl-errors(3) diff --git a/docs/libcurl/curl_multi_socket_all.3 b/docs/libcurl/curl_multi_socket_all.3 deleted file mode 100644 index 428dd06f9..000000000 --- a/docs/libcurl/curl_multi_socket_all.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/curl_multi_socket.3 diff --git a/docs/libcurl/curl_multi_socket_all.md b/docs/libcurl/curl_multi_socket_all.md new file mode 100644 index 000000000..ff465c359 --- /dev/null +++ b/docs/libcurl/curl_multi_socket_all.md @@ -0,0 +1,95 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_socket +Section: 3 +Source: libcurl +See-also: + - curl_multi_cleanup (3) + - curl_multi_fdset (3) + - curl_multi_info_read (3) + - curl_multi_init (3) + - the hiperfifo.c example +--- + +# NAME + +curl_multi_socket - reads/writes available data + +# SYNOPSIS + +~~~c +#include +CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd, + int *running_handles); + +CURLMcode curl_multi_socket_all(CURLM *multi_handle, + int *running_handles); +~~~ + +# DESCRIPTION + +These functions are deprecated. Do not use. See +curl_multi_socket_action(3) instead. + +At return, the integer **running_handles** points to contains the number of +still running easy handles within the multi handle. When this number reaches +zero, all transfers are complete/done. Note that when you call +curl_multi_socket_action(3) on a specific socket and the counter +decreases by one, it DOES NOT necessarily mean that this exact socket/transfer +is the one that completed. Use curl_multi_info_read(3) to figure out +which easy handle that completed. + +The curl_multi_socket_action(3) functions inform the application about +updates in the socket (file descriptor) status by doing none, one, or multiple +calls to the socket callback function set with the +CURLMOPT_SOCKETFUNCTION(3) option to curl_multi_setopt(3). They +update the status with changes since the previous time the callback was +called. + +Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option +with curl_multi_setopt(3). Your application then gets called with +information on how long to wait for socket actions at most before doing the +timeout action: call the curl_multi_socket_action(3) function with the +**sockfd** argument set to CURL_SOCKET_TIMEOUT. You can also use the +curl_multi_timeout(3) function to poll the value at any given time, but +for an event-based system using the callback is far better than relying on +polling the timeout value. + +Usage of curl_multi_socket(3) is deprecated, whereas the function is +equivalent to curl_multi_socket_action(3) with **ev_bitmask** set to +0. + +Force libcurl to (re-)check all its internal sockets and transfers instead of +just a single one by calling curl_multi_socket_all(3). Note that there +should not be any reason to use this function. + +# EXAMPLE + +~~~c +int main(void) +{ + /* the event-library gets told when there activity on the socket 'fd', + which we translate to a call to curl_multi_socket_action() */ + int running; + int rc; + int fd; + CURLM *multi; + rc = curl_multi_socket(multi, fd, &running); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.15.4, and is deemed stable since +7.16.0. + +curl_multi_socket(3) is deprecated, use +curl_multi_socket_action(3) instead! + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. + +The return code is for the whole multi stack. Problems still might have +occurred on individual transfers even when one of these functions return OK. diff --git a/docs/libcurl/curl_multi_strerror.3 b/docs/libcurl/curl_multi_strerror.3 deleted file mode 100644 index 598767910..000000000 --- a/docs/libcurl/curl_multi_strerror.3 +++ /dev/null @@ -1,56 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_strerror 3 "26 Apr 2004" "libcurl" "libcurl" -.SH NAME -curl_multi_strerror - return string describing error code -.SH SYNOPSIS -.nf -#include - -const char *curl_multi_strerror(CURLMcode errornum); -.fi -.SH DESCRIPTION -This function returns a string describing the \fICURLMcode\fP error code -passed in the argument \fIerrornum\fP. -.SH EXAMPLE -.nf -int main(void) -{ - int still_running; - CURLM *multi = curl_multi_init(); - - CURLMcode mc = curl_multi_perform(multi, &still_running); - if(mc) - printf("error: %s\\n", curl_multi_strerror(mc)); -} -.fi -.SH AVAILABILITY -This function was added in libcurl 7.12.0 -.SH RETURN VALUE -A pointer to a null-terminated string. -.SH "SEE ALSO" -.BR curl_easy_strerror (3), -.BR curl_share_strerror (3), -.BR curl_url_strerror (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_multi_strerror.md b/docs/libcurl/curl_multi_strerror.md new file mode 100644 index 000000000..5429e0e34 --- /dev/null +++ b/docs/libcurl/curl_multi_strerror.md @@ -0,0 +1,51 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_strerror +Section: 3 +Source: libcurl +See-also: + - curl_easy_strerror (3) + - curl_share_strerror (3) + - curl_url_strerror (3) + - libcurl-errors (3) +--- + +# NAME + +curl_multi_strerror - return string describing error code + +# SYNOPSIS + +~~~c +#include + +const char *curl_multi_strerror(CURLMcode errornum); +~~~ + +# DESCRIPTION + +This function returns a string describing the *CURLMcode* error code +passed in the argument *errornum*. + +# EXAMPLE + +~~~c +int main(void) +{ + int still_running; + CURLM *multi = curl_multi_init(); + + CURLMcode mc = curl_multi_perform(multi, &still_running); + if(mc) + printf("error: %s\n", curl_multi_strerror(mc)); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.12.0 + +# RETURN VALUE + +A pointer to a null-terminated string. diff --git a/docs/libcurl/curl_multi_timeout.3 b/docs/libcurl/curl_multi_timeout.3 deleted file mode 100644 index 1951282ee..000000000 --- a/docs/libcurl/curl_multi_timeout.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_timeout 3 "2 Jan 2006" "libcurl" "libcurl" -.SH NAME -curl_multi_timeout \- how long to wait for action before proceeding -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout); -.fi -.SH DESCRIPTION - -An application using the libcurl multi interface should call -\fIcurl_multi_timeout(3)\fP to figure out how long it should wait for socket -actions \- at most \- before proceeding. - -Proceeding means either doing the socket-style timeout action: call the -\fIcurl_multi_socket_action(3)\fP function with the \fBsockfd\fP argument set -to CURL_SOCKET_TIMEOUT, or call \fIcurl_multi_perform(3)\fP if you are using -the simpler and older multi interface approach. - -The timeout value returned in the long \fBtimeout\fP points to, is in number -of milliseconds at this moment. If 0, it means you should proceed immediately -without waiting for anything. If it returns -1, there is no timeout at all set. - -An application that uses the multi_socket API SHOULD NOT use this function, -but SHOULD instead use the \fICURLMOPT_TIMERFUNCTION(3)\fP option for proper -and desired behavior. - -Note: if libcurl returns a -1 timeout here, it just means that libcurl -currently has no stored timeout value. You must not wait too long (more than a -few seconds perhaps) before you call \fIcurl_multi_perform(3)\fP again. -.SH EXAMPLE -.nf -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, &timeo); - if(timeo < 0) - /* no set timeout, use a default */ - timeo = 980; - - timeout.tv_sec = timeo / 1000; - timeout.tv_usec = (timeo % 1000) * 1000; - - /* wait for activities no longer than the set timeout */ - select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); -} -.fi -.SH TYPICAL USAGE -Call \fIcurl_multi_timeout(3)\fP, then wait for action on the sockets. Figure -out which sockets to wait for by calling \fIcurl_multi_fdset(3)\fP. - -When there is activity or timeout, call \fIcurl_multi_perform(3)\fP and then -loop - until all transfers are complete. -.SH AVAILABILITY -This function was added in libcurl 7.15.4. -.SH RETURN VALUE -The standard CURLMcode for multi interface error codes. -.SH "SEE ALSO" -.BR curl_multi_fdset (3), -.BR curl_multi_info_read (3), -.BR curl_multi_setopt (3), -.BR curl_multi_socket (3) diff --git a/docs/libcurl/curl_multi_timeout.md b/docs/libcurl/curl_multi_timeout.md new file mode 100644 index 000000000..83bad3845 --- /dev/null +++ b/docs/libcurl/curl_multi_timeout.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_timeout +Section: 3 +Source: libcurl +See-also: + - curl_multi_fdset (3) + - curl_multi_info_read (3) + - curl_multi_setopt (3) + - curl_multi_socket (3) +--- + +# NAME + +curl_multi_timeout - how long to wait for action before proceeding + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout); +~~~ + +# DESCRIPTION + +An application using the libcurl multi interface should call +curl_multi_timeout(3) to figure out how long it should wait for socket +actions - at most - before proceeding. + +Proceeding means either doing the socket-style timeout action: call the +curl_multi_socket_action(3) function with the **sockfd** argument set +to CURL_SOCKET_TIMEOUT, or call curl_multi_perform(3) if you are using +the simpler and older multi interface approach. + +The timeout value returned in the long **timeout** points to, is in number +of milliseconds at this moment. If 0, it means you should proceed immediately +without waiting for anything. If it returns -1, there is no timeout at all set. + +An application that uses the *multi_socket* API should not use this function. +It should instead use the CURLMOPT_TIMERFUNCTION(3) option for proper and +desired behavior. + +Note: if libcurl returns a -1 timeout here, it just means that libcurl +currently has no stored timeout value. You must not wait too long (more than a +few seconds perhaps) before you call curl_multi_perform(3) again. + +# EXAMPLE + +~~~c +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, &timeo); + if(timeo < 0) + /* no set timeout, use a default */ + timeo = 980; + + timeout.tv_sec = timeo / 1000; + timeout.tv_usec = (timeo % 1000) * 1000; + + /* wait for activities no longer than the set timeout */ + select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); +} +~~~ + +# TYPICAL USAGE + +Call curl_multi_timeout(3), then wait for action on the sockets. Figure +out which sockets to wait for by calling curl_multi_fdset(3). + +When there is activity or timeout, call curl_multi_perform(3) and then +loop - until all transfers are complete. + +# AVAILABILITY + +This function was added in libcurl 7.15.4. + +# RETURN VALUE + +The standard CURLMcode for multi interface error codes. diff --git a/docs/libcurl/curl_multi_wait.3 b/docs/libcurl/curl_multi_wait.3 deleted file mode 100644 index 1f73dc354..000000000 --- a/docs/libcurl/curl_multi_wait.3 +++ /dev/null @@ -1,118 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_wait 3 "12 Jul 2012" "libcurl" "libcurl" -.SH NAME -curl_multi_wait - polls on all easy handles in a multi handle -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_wait(CURLM *multi_handle, - struct curl_waitfd extra_fds[], - unsigned int extra_nfds, - int timeout_ms, - int *numfds); -.fi -.SH DESCRIPTION -\fIcurl_multi_wait(3)\fP polls all file descriptors used by the curl easy -handles contained in the given multi handle set. It blocks until activity is -detected on at least one of the handles or \fItimeout_ms\fP has passed. -Alternatively, if the multi handle has a pending internal timeout that has a -shorter expiry time than \fItimeout_ms\fP, that shorter time is be used -instead to make sure timeout accuracy is reasonably kept. - -The calling application may pass additional \fIcurl_waitfd\fP structures which -are similar to \fIpoll(2)\fP's \fIpollfd\fP structure to be waited on in the -same call. - -On completion, if \fInumfds\fP is non-NULL, it gets populated with the total -number of file descriptors on which interesting events occurred. This number -can include both libcurl internal descriptors as well as descriptors provided -in \fIextra_fds\fP. - -If no extra file descriptors are provided and libcurl has no file descriptor -to offer to wait for, this function returns immediately. (Consider using -\fIcurl_multi_poll(3)\fP to avoid this behavior.) - -This function is encouraged to be used instead of select(3) when using the -multi interface to allow applications to easier circumvent the common problem -with 1024 maximum file descriptors. -.SH curl_waitfd -.nf -struct curl_waitfd { - curl_socket_t fd; - short events; - short revents; -}; -.fi -.IP CURL_WAIT_POLLIN -Bit flag to \fIcurl_waitfd.events\fP indicating the socket should poll on read -events such as new data received. -.IP CURL_WAIT_POLLPRI -Bit flag to \fIcurl_waitfd.events\fP indicating the socket should poll on high -priority read events such as out of band data. -.IP CURL_WAIT_POLLOUT -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 -int main(void) -{ - CURL *easy; - CURLM *multi = curl_multi_init(); - int still_running; - - /* add the individual easy handle */ - curl_multi_add_handle(multi, easy); - - do { - CURLMcode mc; - int numfds; - - mc = curl_multi_perform(multi, &still_running); - - if(mc == CURLM_OK) { - /* wait for activity, timeout or "nothing" */ - mc = curl_multi_wait(multi, NULL, 0, 1000, &numfds); - } - - if(mc != CURLM_OK) { - fprintf(stderr, "curl_multi failed, code %d.\\n", mc); - break; - } - - } while(still_running); - - curl_multi_remove_handle(multi, easy); -} -.fi -.SH AVAILABILITY -This function was added in libcurl 7.28.0. -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH "SEE ALSO" -.BR curl_multi_fdset (3), -.BR curl_multi_perform (3), -.BR curl_multi_poll (3) diff --git a/docs/libcurl/curl_multi_wait.md b/docs/libcurl/curl_multi_wait.md new file mode 100644 index 000000000..094ace386 --- /dev/null +++ b/docs/libcurl/curl_multi_wait.md @@ -0,0 +1,121 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_wait +Section: 3 +Source: libcurl +See-also: + - curl_multi_fdset (3) + - curl_multi_perform (3) + - curl_multi_poll (3) +--- + +# NAME + +curl_multi_wait - polls on all easy handles in a multi handle + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_wait(CURLM *multi_handle, + struct curl_waitfd extra_fds[], + unsigned int extra_nfds, + int timeout_ms, + int *numfds); +~~~ + +# DESCRIPTION + +curl_multi_wait(3) polls all file descriptors used by the curl easy +handles contained in the given multi handle set. It blocks until activity is +detected on at least one of the handles or *timeout_ms* has passed. +Alternatively, if the multi handle has a pending internal timeout that has a +shorter expiry time than *timeout_ms*, that shorter time is be used +instead to make sure timeout accuracy is reasonably kept. + +The calling application may pass additional *curl_waitfd* structures which +are similar to *poll(2)*'s *pollfd* structure to be waited on in the +same call. + +On completion, if *numfds* is non-NULL, it gets populated with the total +number of file descriptors on which interesting events occurred. This number +can include both libcurl internal descriptors as well as descriptors provided +in *extra_fds*. + +If no extra file descriptors are provided and libcurl has no file descriptor +to offer to wait for, this function returns immediately. (Consider using +curl_multi_poll(3) to avoid this behavior.) + +This function is encouraged to be used instead of select(3) when using the +multi interface to allow applications to easier circumvent the common problem +with 1024 maximum file descriptors. + +# curl_waitfd + +~~~c +struct curl_waitfd { + curl_socket_t fd; + short events; + short revents; +}; +~~~ + +## CURL_WAIT_POLLIN + +Bit flag to *curl_waitfd.events* indicating the socket should poll on read +events such as new data received. + +## CURL_WAIT_POLLPRI + +Bit flag to *curl_waitfd.events* indicating the socket should poll on high +priority read events such as out of band data. + +## CURL_WAIT_POLLOUT + +Bit flag to *curl_waitfd.events* indicating the socket should poll on +write events such as the socket being clear to write without blocking. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *easy; + CURLM *multi = curl_multi_init(); + int still_running; + + /* add the individual easy handle */ + curl_multi_add_handle(multi, easy); + + do { + CURLMcode mc; + int numfds; + + mc = curl_multi_perform(multi, &still_running); + + if(mc == CURLM_OK) { + /* wait for activity, timeout or "nothing" */ + mc = curl_multi_wait(multi, NULL, 0, 1000, &numfds); + } + + if(mc != CURLM_OK) { + fprintf(stderr, "curl_multi failed, code %d.\n", mc); + break; + } + + } while(still_running); + + curl_multi_remove_handle(multi, easy); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.28.0. + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. See +libcurl-errors(3) diff --git a/docs/libcurl/curl_multi_wakeup.3 b/docs/libcurl/curl_multi_wakeup.3 deleted file mode 100644 index 980923279..000000000 --- a/docs/libcurl/curl_multi_wakeup.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_multi_wakeup 3 "17 Nov 2019" "libcurl" "libcurl" -.SH NAME -curl_multi_wakeup - wakes up a sleeping curl_multi_poll call -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_wakeup(CURLM *multi_handle); -.fi -.SH DESCRIPTION -This function can be called from any thread and it wakes up a sleeping -\fIcurl_multi_poll(3)\fP call that is currently (or is about to be) waiting -for activity or a timeout. - -If the function is called when there is no \fIcurl_multi_poll(3)\fP call, it -causes the next call to return immediately. - -Calling this function only guarantees to wake up the current (or the next if -there is no current) \fIcurl_multi_poll(3)\fP call, which means it is possible -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 -extern int time_to_die(void); -extern int set_something_to_signal_thread_1_to_exit(void); -extern int decide_to_stop_thread1(); - -int main(void) -{ - CURL *easy; - CURLM *multi; - int still_running; - - /* add the individual easy handle */ - curl_multi_add_handle(multi, easy); - - /* this is thread 1 */ - do { - CURLMcode mc; - int numfds; - - mc = curl_multi_perform(multi, &still_running); - - if(mc == CURLM_OK) { - /* wait for activity, timeout or wakeup */ - mc = curl_multi_poll(multi, NULL, 0, 10000, &numfds); - } - - if(time_to_die()) - return 1; - - } while(still_running); - - curl_multi_remove_handle(multi, easy); - - /* this is thread 2 */ - - if(decide_to_stop_thread1()) { - - set_something_to_signal_thread_1_to_exit(); - - curl_multi_wakeup(multi); - } -} -.fi -.SH AVAILABILITY -Added in 7.68.0 -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_poll (3), -.BR curl_multi_wait (3) diff --git a/docs/libcurl/curl_multi_wakeup.md b/docs/libcurl/curl_multi_wakeup.md new file mode 100644 index 000000000..f6200c41e --- /dev/null +++ b/docs/libcurl/curl_multi_wakeup.md @@ -0,0 +1,91 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_multi_wakeup +Section: 3 +Source: libcurl +See-also: + - curl_multi_poll (3) + - curl_multi_wait (3) +--- + +# NAME + +curl_multi_wakeup - wakes up a sleeping curl_multi_poll call + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_wakeup(CURLM *multi_handle); +~~~ + +# DESCRIPTION + +This function can be called from any thread and it wakes up a sleeping +curl_multi_poll(3) call that is currently (or is about to be) waiting +for activity or a timeout. + +If the function is called when there is no curl_multi_poll(3) call, it +causes the next call to return immediately. + +Calling this function only guarantees to wake up the current (or the next if +there is no current) curl_multi_poll(3) call, which means it is possible +that multiple calls to this function wake up the same waiting operation. + +This function has no effect on curl_multi_wait(3) calls. + +# EXAMPLE + +~~~c +extern int time_to_die(void); +extern int set_something_to_signal_thread_1_to_exit(void); +extern int decide_to_stop_thread1(); + +int main(void) +{ + CURL *easy; + CURLM *multi; + int still_running; + + /* add the individual easy handle */ + curl_multi_add_handle(multi, easy); + + /* this is thread 1 */ + do { + CURLMcode mc; + int numfds; + + mc = curl_multi_perform(multi, &still_running); + + if(mc == CURLM_OK) { + /* wait for activity, timeout or wakeup */ + mc = curl_multi_poll(multi, NULL, 0, 10000, &numfds); + } + + if(time_to_die()) + return 1; + + } while(still_running); + + curl_multi_remove_handle(multi, easy); + + /* this is thread 2 */ + + if(decide_to_stop_thread1()) { + + set_something_to_signal_thread_1_to_exit(); + + curl_multi_wakeup(multi); + } +} +~~~ + +# AVAILABILITY + +Added in 7.68.0 + +# RETURN VALUE + +CURLMcode type, general libcurl multi interface error code. diff --git a/docs/libcurl/curl_pushheader_byname.3 b/docs/libcurl/curl_pushheader_byname.md similarity index 50% rename from docs/libcurl/curl_pushheader_byname.3 rename to docs/libcurl/curl_pushheader_byname.md index ad8459c36..ecb031f9e 100644 --- a/docs/libcurl/curl_pushheader_byname.3 +++ b/docs/libcurl/curl_pushheader_byname.md @@ -1,38 +1,30 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_pushheader_byname 3 "9 Jun 2023" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_pushheader_byname +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PUSHFUNCTION (3) + - curl_pushheader_bynum (3) +--- + +# NAME + curl_pushheader_byname - get a push header by name -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include char *curl_pushheader_byname(struct curl_pushheaders *h, const char *name); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This is a function that is only functional within a -\fICURLMOPT_PUSHFUNCTION(3)\fP callback. It makes no sense to try to use it +CURLMOPT_PUSHFUNCTION(3) callback. It makes no sense to try to use it elsewhere and it has no function then. It returns the value for the given header field name (or NULL) for the @@ -41,8 +33,9 @@ not have to loop through all headers to find the one it is interested in. The data this function points to is freed when this callback returns. If more than one header field use the same name, this returns only the first one. -.SH EXAMPLE -.nf +# EXAMPLE + +~~~c #include /* for strncmp */ static int push_cb(CURL *parent, @@ -56,7 +49,7 @@ static int push_cb(CURL *parent, FILE *out; headp = curl_pushheader_byname(headers, ":path"); if(headp && !strncmp(headp, "/push-", 6)) { - fprintf(stderr, "The PATH is %s\\n", headp); + fprintf(stderr, "The PATH is %s\n", headp); /* save the push here */ out = fopen("pushed-stream", "wb"); @@ -78,11 +71,12 @@ int main(void) curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb); curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.44.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns a pointer to the header field content or NULL. -.SH "SEE ALSO" -.BR CURLMOPT_PUSHFUNCTION (3), -.BR curl_pushheader_bynum (3) diff --git a/docs/libcurl/curl_pushheader_bynum.3 b/docs/libcurl/curl_pushheader_bynum.3 deleted file mode 100644 index da951bafb..000000000 --- a/docs/libcurl/curl_pushheader_bynum.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_pushheader_bynum 3 "9 Jun 2023" "libcurl" "libcurl" -.SH NAME -curl_pushheader_bynum - get a push header by index -.SH SYNOPSIS -.nf -#include - -char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num); -.fi -.SH DESCRIPTION -This is a function that is only functional within a -\fICURLMOPT_PUSHFUNCTION(3)\fP callback. It makes no sense to try to use it -elsewhere and it has no function then. - -It returns the value for the header field at the given index \fBnum\fP, for -the incoming server push request or NULL. The data pointed to is freed by -libcurl when this callback returns. The returned pointer points to a -"name:value" string that gets freed when this callback returns. - -.SH EXAMPLE -.nf -/* output all the incoming push request headers */ -static int push_cb(CURL *parent, - CURL *easy, - size_t num_headers, - struct curl_pushheaders *headers, - void *clientp) -{ - int i = 0; - char *field; - do { - field = curl_pushheader_bynum(headers, i); - if(field) - fprintf(stderr, "Push header: %s\\n", field); - i++; - } while(field); - return CURL_PUSH_OK; /* permission granted */ -} - -int main(void) -{ - CURLM *multi = curl_multi_init(); - curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb); -} -.fi -.SH AVAILABILITY -Added in 7.44.0 -.SH RETURN VALUE -Returns a pointer to the header field content or NULL. -.SH "SEE ALSO" -.BR CURLMOPT_PUSHFUNCTION (3), -.BR curl_pushheader_byname (3) diff --git a/docs/libcurl/curl_pushheader_bynum.md b/docs/libcurl/curl_pushheader_bynum.md new file mode 100644 index 000000000..537f06b1c --- /dev/null +++ b/docs/libcurl/curl_pushheader_bynum.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_pushheader_bynum +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PUSHFUNCTION (3) + - curl_pushheader_byname (3) +--- + +# NAME + +curl_pushheader_bynum - get a push header by index + +# SYNOPSIS + +~~~c +#include + +char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num); +~~~ + +# DESCRIPTION + +This is a function that is only functional within a +CURLMOPT_PUSHFUNCTION(3) callback. It makes no sense to try to use it +elsewhere and it has no function then. + +It returns the value for the header field at the given index **num**, for +the incoming server push request or NULL. The data pointed to is freed by +libcurl when this callback returns. The returned pointer points to a +"name:value" string that gets freed when this callback returns. + +# EXAMPLE + +~~~c +/* output all the incoming push request headers */ +static int push_cb(CURL *parent, + CURL *easy, + size_t num_headers, + struct curl_pushheaders *headers, + void *clientp) +{ + int i = 0; + char *field; + do { + field = curl_pushheader_bynum(headers, i); + if(field) + fprintf(stderr, "Push header: %s\n", field); + i++; + } while(field); + return CURL_PUSH_OK; /* permission granted */ +} + +int main(void) +{ + CURLM *multi = curl_multi_init(); + curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb); +} +~~~ + +# AVAILABILITY + +Added in 7.44.0 + +# RETURN VALUE + +Returns a pointer to the header field content or NULL. diff --git a/docs/libcurl/curl_share_cleanup.3 b/docs/libcurl/curl_share_cleanup.3 deleted file mode 100644 index ad49857f2..000000000 --- a/docs/libcurl/curl_share_cleanup.3 +++ /dev/null @@ -1,59 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_share_cleanup 3 "8 Aug 2003" "libcurl" "libcurl" -.SH NAME -curl_share_cleanup - Clean up a shared object -.SH SYNOPSIS -.nf -#include - -CURLSHcode curl_share_cleanup(CURLSH *share_handle); -.fi -.SH DESCRIPTION -This function deletes a shared object. The share handle cannot be used anymore -when this function has been called. - -Passing in a NULL pointer in \fIshare_handle\fP makes this function return -immediately with no action. -.SH EXAMPLE -.nf -int main(void) -{ - CURLSHcode sh; - CURLSH *share = curl_share_init(); - sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); - /* use the share, then ... */ - curl_share_cleanup(share); -} -.fi -.SH AVAILABILITY -Added in 7.10 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred as \fI\fP defines. See the \fIlibcurl-errors(3)\fP -man page for the full list with descriptions. If an error occurs, then the -share object is not deleted. -.SH "SEE ALSO" -.BR curl_share_init (3), -.BR curl_share_setopt (3) diff --git a/docs/libcurl/curl_share_cleanup.md b/docs/libcurl/curl_share_cleanup.md new file mode 100644 index 000000000..59126a145 --- /dev/null +++ b/docs/libcurl/curl_share_cleanup.md @@ -0,0 +1,54 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_share_cleanup +Section: 3 +Source: libcurl +See-also: + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + +curl_share_cleanup - Clean up a shared object + +# SYNOPSIS + +~~~c +#include + +CURLSHcode curl_share_cleanup(CURLSH *share_handle); +~~~ + +# DESCRIPTION + +This function deletes a shared object. The share handle cannot be used anymore +when this function has been called. + +Passing in a NULL pointer in *share_handle* makes this function return +immediately with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); + /* use the share, then ... */ + curl_share_cleanup(share); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred as ** defines. See the libcurl-errors(3) +man page for the full list with descriptions. If an error occurs, then the +share object is not deleted. diff --git a/docs/libcurl/curl_share_init.3 b/docs/libcurl/curl_share_init.3 deleted file mode 100644 index b68c4bd8d..000000000 --- a/docs/libcurl/curl_share_init.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_share_init 3 "Aug 3, 2003" "libcurl" "libcurl" -.SH NAME -curl_share_init - Create a shared object -.SH SYNOPSIS -.nf -#include - -CURLSH *curl_share_init(); -.fi -.SH DESCRIPTION -This function returns a pointer to a \fICURLSH\fP handle to be used as input -to all the other share-functions, sometimes referred to as a share handle in -some places in the documentation. This init call MUST have a corresponding -call to \fIcurl_share_cleanup(3)\fP when all operations using the share are -complete. - -This \fIshare handle\fP is what you pass to curl using the -\fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, to make that -specific curl handle use the data in this share. -.SH EXAMPLE -.nf -int main(void) -{ - CURLSHcode sh; - CURLSH *share = curl_share_init(); - sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); - if(sh) - printf("Error: %s\\n", curl_share_strerror(sh)); -} -.fi -.SH AVAILABILITY -Added in 7.10 -.SH RETURN VALUE -If this function returns NULL, something went wrong (out of memory, etc.) -and therefore the share object was not created. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_setopt (3) diff --git a/docs/libcurl/curl_share_init.md b/docs/libcurl/curl_share_init.md new file mode 100644 index 000000000..553710727 --- /dev/null +++ b/docs/libcurl/curl_share_init.md @@ -0,0 +1,56 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_share_init +Section: 3 +Source: libcurl +See-also: + - curl_share_cleanup (3) + - curl_share_setopt (3) +--- + +# NAME + +curl_share_init - Create a shared object + +# SYNOPSIS + +~~~c +#include + +CURLSH *curl_share_init(); +~~~ + +# DESCRIPTION + +This function returns a pointer to a *CURLSH* handle to be used as input +to all the other share-functions, sometimes referred to as a share handle in +some places in the documentation. This init call MUST have a corresponding +call to curl_share_cleanup(3) when all operations using the share are +complete. + +This *share handle* is what you pass to curl using the +CURLOPT_SHARE(3) option with curl_easy_setopt(3), to make that +specific curl handle use the data in this share. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +If this function returns NULL, something went wrong (out of memory, etc.) +and therefore the share object was not created. diff --git a/docs/libcurl/curl_share_setopt.3 b/docs/libcurl/curl_share_setopt.3 deleted file mode 100644 index 960354991..000000000 --- a/docs/libcurl/curl_share_setopt.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_share_setopt 3 "8 Aug 2003" "libcurl" "libcurl" -.SH NAME -curl_share_setopt - Set options for a shared object -.SH SYNOPSIS -.nf -#include - -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter); -.fi -.SH DESCRIPTION -Set the \fIoption\fP to \fIparameter\fP for the given \fIshare\fP. -.SH OPTIONS -.IP CURLSHOPT_LOCKFUNC -See \fICURLSHOPT_LOCKFUNC(3)\fP. -.IP CURLSHOPT_UNLOCKFUNC -See \fICURLSHOPT_UNLOCKFUNC(3)\fP. -.IP CURLSHOPT_SHARE -See \fICURLSHOPT_SHARE(3)\fP. -.IP CURLSHOPT_UNSHARE -See \fICURLSHOPT_UNSHARE(3)\fP. -.IP CURLSHOPT_USERDATA -See \fICURLSHOPT_USERDATA(3)\fP. -.SH EXAMPLE -.nf -int main(void) -{ - CURLSHcode sh; - CURLSH *share = curl_share_init(); - sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); - if(sh) - printf("Error: %s\\n", curl_share_strerror(sh)); -} -.fi -.SH AVAILABILITY -Added in 7.10 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred as \fI\fP defines. See the \fIlibcurl-errors(3)\fP -man page for the full list with descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3) diff --git a/docs/libcurl/curl_share_setopt.md b/docs/libcurl/curl_share_setopt.md new file mode 100644 index 000000000..5ab95503b --- /dev/null +++ b/docs/libcurl/curl_share_setopt.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_share_setopt +Section: 3 +Source: libcurl +See-also: + - curl_share_cleanup (3) + - curl_share_init (3) +--- + +# NAME + +curl_share_setopt - Set options for a shared object + +# SYNOPSIS + +~~~c +#include + +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter); +~~~ + +# DESCRIPTION + +Set the *option* to *parameter* for the given *share*. + +# OPTIONS + +## CURLSHOPT_LOCKFUNC + +See CURLSHOPT_LOCKFUNC(3). + +## CURLSHOPT_UNLOCKFUNC + +See CURLSHOPT_UNLOCKFUNC(3). + +## CURLSHOPT_SHARE + +See CURLSHOPT_SHARE(3). + +## CURLSHOPT_UNSHARE + +See CURLSHOPT_UNSHARE(3). + +## CURLSHOPT_USERDATA + +See CURLSHOPT_USERDATA(3). + +# EXAMPLE + +~~~c +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred as ** defines. See the libcurl-errors(3) +man page for the full list with descriptions. diff --git a/docs/libcurl/curl_share_strerror.3 b/docs/libcurl/curl_share_strerror.3 deleted file mode 100644 index b1f5e2f39..000000000 --- a/docs/libcurl/curl_share_strerror.3 +++ /dev/null @@ -1,55 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_share_strerror 3 "Apr 26, 2004" "libcurl" "libcurl" -.SH NAME -curl_share_strerror - return string describing error code -.SH SYNOPSIS -.nf -#include - -const char *curl_share_strerror(CURLSHcode errornum); -.fi -.SH DESCRIPTION -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; - 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 -.SH RETURN VALUE -A pointer to a null-terminated string. -.SH "SEE ALSO" -.BR curl_easy_strerror (3), -.BR curl_multi_strerror (3), -.BR curl_url_strerror (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_share_strerror.md b/docs/libcurl/curl_share_strerror.md new file mode 100644 index 000000000..130d43b3b --- /dev/null +++ b/docs/libcurl/curl_share_strerror.md @@ -0,0 +1,50 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_share_strerror +Section: 3 +Source: libcurl +See-also: + - curl_easy_strerror (3) + - curl_multi_strerror (3) + - curl_url_strerror (3) + - libcurl-errors (3) +--- + +# NAME + +curl_share_strerror - return string describing error code + +# SYNOPSIS + +~~~c +#include + +const char *curl_share_strerror(CURLSHcode errornum); +~~~ + +# DESCRIPTION + +The curl_share_strerror(3) function returns a string describing the +*CURLSHcode* error code passed in the argument *errornum*. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +This function was added in libcurl 7.12.0 + +# RETURN VALUE + +A pointer to a null-terminated string. diff --git a/docs/libcurl/curl_slist_append.3 b/docs/libcurl/curl_slist_append.3 deleted file mode 100644 index 09dbc99a4..000000000 --- a/docs/libcurl/curl_slist_append.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_slist_append 3 "19 Jun 2003" "libcurl" "libcurl" -.SH NAME -curl_slist_append - add a string to an slist -.SH SYNOPSIS -.nf -#include - -struct curl_slist *curl_slist_append(struct curl_slist *list, - const char *string); -.fi -.SH DESCRIPTION -\fIcurl_slist_append(3)\fP appends a string to a linked list of strings. The -existing \fBlist\fP should be passed as the first argument and the new list is -returned from this function. Pass in NULL in the \fBlist\fP argument to create -a new list. The specified \fBstring\fP has been appended when this function -returns. \fIcurl_slist_append(3)\fP copies the string. - -The list should be freed again (after usage) with -\fIcurl_slist_free_all(3)\fP. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *handle; - struct curl_slist *slist = NULL; - struct curl_slist *temp = NULL; - - slist = curl_slist_append(slist, "pragma:"); - - if(!slist) - return -1; - - temp = curl_slist_append(slist, "Accept:"); - - if(!temp) { - curl_slist_free_all(slist); - return -1; - } - - slist = temp; - - curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); - - curl_easy_perform(handle); - - curl_slist_free_all(slist); /* free the list again */ -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -A null pointer is returned if anything went wrong, otherwise the new list -pointer is returned. To avoid overwriting an existing non-empty list on -failure, the new list should be returned to a temporary variable which can -be tested for NULL before updating the original list pointer. -.SH "SEE ALSO" -.BR curl_slist_free_all (3) diff --git a/docs/libcurl/curl_slist_append.md b/docs/libcurl/curl_slist_append.md new file mode 100644 index 000000000..9773fd494 --- /dev/null +++ b/docs/libcurl/curl_slist_append.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_slist_append +Section: 3 +Source: libcurl +See-also: + - curl_slist_free_all (3) +--- + +# NAME + +curl_slist_append - add a string to an slist + +# SYNOPSIS + +~~~c +#include + +struct curl_slist *curl_slist_append(struct curl_slist *list, + const char *string); +~~~ + +# DESCRIPTION + +curl_slist_append(3) appends a string to a linked list of strings. The +existing **list** should be passed as the first argument and the new list is +returned from this function. Pass in NULL in the **list** argument to create +a new list. The specified **string** has been appended when this function +returns. curl_slist_append(3) copies the string. + +The list should be freed again (after usage) with +curl_slist_free_all(3). + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *handle; + struct curl_slist *slist = NULL; + struct curl_slist *temp = NULL; + + slist = curl_slist_append(slist, "pragma:"); + + if(!slist) + return -1; + + temp = curl_slist_append(slist, "Accept:"); + + if(!temp) { + curl_slist_free_all(slist); + return -1; + } + + slist = temp; + + curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); + + curl_easy_perform(handle); + + curl_slist_free_all(slist); /* free the list again */ +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +A null pointer is returned if anything went wrong, otherwise the new list +pointer is returned. To avoid overwriting an existing non-empty list on +failure, the new list should be returned to a temporary variable which can +be tested for NULL before updating the original list pointer. diff --git a/docs/libcurl/curl_slist_free_all.3 b/docs/libcurl/curl_slist_free_all.3 deleted file mode 100644 index 4eeb54132..000000000 --- a/docs/libcurl/curl_slist_free_all.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_slist_free_all 3 "5 March 2001" "libcurl" "libcurl" -.SH NAME -curl_slist_free_all - free an entire curl_slist list -.SH SYNOPSIS -.nf -#include - -void curl_slist_free_all(struct curl_slist *list); -.fi -.SH DESCRIPTION -curl_slist_free_all() removes all traces of a previously built curl_slist -linked list. - -Passing in a NULL pointer in \fIlist\fP makes this function return immediately -with no action. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *handle; - struct curl_slist *slist = NULL; - - slist = curl_slist_append(slist, "X-libcurl: coolness"); - - if(!slist) - return -1; - - curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); - - curl_easy_perform(handle); - - curl_slist_free_all(slist); /* free the list again */ -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Nothing. -.SH "SEE ALSO" -.BR curl_slist_append (3) diff --git a/docs/libcurl/curl_slist_free_all.md b/docs/libcurl/curl_slist_free_all.md new file mode 100644 index 000000000..928f30601 --- /dev/null +++ b/docs/libcurl/curl_slist_free_all.md @@ -0,0 +1,58 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_slist_free_all +Section: 3 +Source: libcurl +See-also: + - curl_slist_append (3) +--- + +# NAME + +curl_slist_free_all - free an entire curl_slist list + +# SYNOPSIS + +~~~c +#include + +void curl_slist_free_all(struct curl_slist *list); +~~~ + +# DESCRIPTION + +curl_slist_free_all() removes all traces of a previously built curl_slist +linked list. + +Passing in a NULL pointer in *list* makes this function return immediately +with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *handle; + struct curl_slist *slist = NULL; + + slist = curl_slist_append(slist, "X-libcurl: coolness"); + + if(!slist) + return -1; + + curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); + + curl_easy_perform(handle); + + curl_slist_free_all(slist); /* free the list again */ +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Nothing. diff --git a/docs/libcurl/curl_strequal.3 b/docs/libcurl/curl_strequal.3 deleted file mode 100644 index dc21c2e3b..000000000 --- a/docs/libcurl/curl_strequal.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_strequal 3 "30 April 2004" "libcurl" "libcurl" -.SH NAME -curl_strequal, curl_strnequal - case insensitive string comparisons -.SH SYNOPSIS -.nf -#include - -int curl_strequal(const char *str1, const char *str2); -int curl_strnequal(const char *str1, const char *str2, size_t length); -.fi -.SH DESCRIPTION -The \fIcurl_strequal(3)\fP function compares the two strings \fIstr1\fP and -\fIstr2\fP, ignoring the case of the characters. It returns a non-zero (TRUE) -integer if the strings are identical. - -The \fBcurl_strnequal()\fP function is similar, except it only compares the -first \fIlength\fP characters of \fIstr1\fP. - -These functions are provided by libcurl to enable applications to compare -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 -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 -.SH RETURN VALUE -Non-zero if the strings are identical. Zero if they are not. -.SH "SEE ALSO" -.BR strcmp "(3), " strcasecmp "(3)" diff --git a/docs/libcurl/curl_strequal.md b/docs/libcurl/curl_strequal.md new file mode 100644 index 000000000..518faee6a --- /dev/null +++ b/docs/libcurl/curl_strequal.md @@ -0,0 +1,57 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_strequal +Section: 3 +Source: libcurl +See-also: + - strcasecmp (3) + - strcmp (3) +--- + +# NAME + +curl_strequal, curl_strnequal - case insensitive string comparisons + +# SYNOPSIS + +~~~c +#include + +int curl_strequal(const char *str1, const char *str2); +int curl_strnequal(const char *str1, const char *str2, size_t length); +~~~ + +# DESCRIPTION + +The curl_strequal(3) function compares the two strings *str1* and +*str2*, ignoring the case of the characters. It returns a non-zero (TRUE) +integer if the strings are identical. + +The **curl_strnequal()** function is similar, except it only compares the +first *length* characters of *str1*. + +These functions are provided by libcurl to enable applications to compare +strings in a truly portable manner. There are no standard portable case +insensitive string comparison functions. These two work on all platforms. + +# EXAMPLE + +~~~c +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"); +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Non-zero if the strings are identical. Zero if they are not. diff --git a/docs/libcurl/curl_strnequal.3 b/docs/libcurl/curl_strnequal.3 deleted file mode 100644 index ce41d3e41..000000000 --- a/docs/libcurl/curl_strnequal.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/curl_strequal.3 diff --git a/docs/libcurl/curl_strnequal.md b/docs/libcurl/curl_strnequal.md new file mode 100644 index 000000000..518faee6a --- /dev/null +++ b/docs/libcurl/curl_strnequal.md @@ -0,0 +1,57 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_strequal +Section: 3 +Source: libcurl +See-also: + - strcasecmp (3) + - strcmp (3) +--- + +# NAME + +curl_strequal, curl_strnequal - case insensitive string comparisons + +# SYNOPSIS + +~~~c +#include + +int curl_strequal(const char *str1, const char *str2); +int curl_strnequal(const char *str1, const char *str2, size_t length); +~~~ + +# DESCRIPTION + +The curl_strequal(3) function compares the two strings *str1* and +*str2*, ignoring the case of the characters. It returns a non-zero (TRUE) +integer if the strings are identical. + +The **curl_strnequal()** function is similar, except it only compares the +first *length* characters of *str1*. + +These functions are provided by libcurl to enable applications to compare +strings in a truly portable manner. There are no standard portable case +insensitive string comparison functions. These two work on all platforms. + +# EXAMPLE + +~~~c +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"); +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Non-zero if the strings are identical. Zero if they are not. diff --git a/docs/libcurl/curl_unescape.3 b/docs/libcurl/curl_unescape.3 deleted file mode 100644 index 5df8a8f82..000000000 --- a/docs/libcurl/curl_unescape.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_unescape 3 "22 March 2001" "libcurl" "libcurl" -.SH NAME -curl_unescape - URL decodes the given string -.SH SYNOPSIS -.nf -#include - -char *curl_unescape(const char *input, int length); -.fi -.SH DESCRIPTION -Obsolete function. Use \fIcurl_easy_unescape(3)\fP instead! - -This function converts the URL encoded string \fBinput\fP to a "plain string" -and return that as a new allocated string. All input characters that are URL -encoded (%XX where XX is a two-digit hexadecimal number) are converted to -their plain text versions. - -If the \fBlength\fP argument is set to 0, \fIcurl_unescape(3)\fP calls -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 -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 -.SH AVAILABILITY -Since 7.15.4, \fIcurl_easy_unescape(3)\fP should be used. This function might -be removed in a future release. -.SH RETURN VALUE -A pointer to a null-terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_easy_escape (3), -.BR curl_easy_unescape (3), -.BR curl_free (3), -.BR RFC 2396 diff --git a/docs/libcurl/curl_unescape.md b/docs/libcurl/curl_unescape.md new file mode 100644 index 000000000..8ae9f5089 --- /dev/null +++ b/docs/libcurl/curl_unescape.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_unescape +Section: 3 +Source: libcurl +See-also: + - RFC 2396 + - curl_easy_escape (3) + - curl_easy_unescape (3) + - curl_free (3) +--- + +# NAME + +curl_unescape - URL decodes the given string + +# SYNOPSIS + +~~~c +#include + +char *curl_unescape(const char *input, int length); +~~~ + +# DESCRIPTION + +Obsolete function. Use curl_easy_unescape(3) instead. + +This function converts the URL encoded string **input** to a "plain string" +and return that as a new allocated string. All input characters that are URL +encoded (%XX where XX is a two-digit hexadecimal number) are converted to +their plain text versions. + +If the **length** argument is set to 0, curl_unescape(3) calls +strlen() on **input** to find out the size. + +You must curl_free(3) the returned string when you are done with it. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + char *decoded = curl_unescape("%63%75%72%6c", 12); + if(decoded) { + /* do not assume printf() works on the decoded data */ + printf("Decoded: "); + /* ... */ + curl_free(decoded); + } + } +} +~~~ + +# AVAILABILITY + +Since 7.15.4, curl_easy_unescape(3) should be used. This function might +be removed in a future release. + +# RETURN VALUE + +A pointer to a null-terminated string or NULL if it failed. diff --git a/docs/libcurl/curl_url.3 b/docs/libcurl/curl_url.3 deleted file mode 100644 index 3f6eb0c01..000000000 --- a/docs/libcurl/curl_url.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url 3 "6 Aug 2018" "libcurl" "libcurl" -.SH NAME -curl_url - returns a new URL handle -.SH SYNOPSIS -.nf -#include - -CURLU *curl_url(); -.fi -.SH DESCRIPTION -This function allocates a URL object and returns a \fICURLU\fP handle for it, -to be used as input to all other URL API functions. - -This is a handle to a URL object that holds or can hold URL components for a -single URL. When the object is first created, there is of course no components -stored. They are then set in the object with the \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); - if(!rc) { - char *scheme; - rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0); - if(!rc) { - printf("the scheme is %s\\n", scheme); - curl_free(scheme); - } - curl_url_cleanup(url); - } -} -.fi -.SH AVAILABILITY -Added in 7.62.0 -.SH RETURN VALUE -Returns a \fBCURLU *\fP if successful, or NULL if out of memory. -.SH "SEE ALSO" -.BR curl_url_cleanup (3), -.BR curl_url_dup (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR curl_url_strerror (3), -.BR CURLOPT_CURLU (3) diff --git a/docs/libcurl/curl_url.md b/docs/libcurl/curl_url.md new file mode 100644 index 000000000..f71fb3580 --- /dev/null +++ b/docs/libcurl/curl_url.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CURLU (3) + - curl_url_cleanup (3) + - curl_url_dup (3) + - curl_url_get (3) + - curl_url_set (3) + - curl_url_strerror (3) +--- + +# NAME + +curl_url - returns a new URL handle + +# SYNOPSIS + +~~~c +#include + +CURLU *curl_url(); +~~~ + +# DESCRIPTION + +This function allocates a URL object and returns a *CURLU* handle for it, +to be used as input to all other URL API functions. + +This is a handle to a URL object that holds or can hold URL components for a +single URL. When the object is first created, there is of course no components +stored. They are then set in the object with the curl_url_set(3) +function. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLUcode rc; + CURLU *url = curl_url(); + rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0); + if(!rc) { + char *scheme; + rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0); + if(!rc) { + printf("the scheme is %s\n", scheme); + curl_free(scheme); + } + curl_url_cleanup(url); + } +} +~~~ + +# AVAILABILITY + +Added in 7.62.0 + +# RETURN VALUE + +Returns a **CURLU *** if successful, or NULL if out of memory. diff --git a/docs/libcurl/curl_url_cleanup.3 b/docs/libcurl/curl_url_cleanup.3 deleted file mode 100644 index 94507efc3..000000000 --- a/docs/libcurl/curl_url_cleanup.3 +++ /dev/null @@ -1,56 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url_cleanup 3 "6 Aug 2018" "libcurl" "libcurl" -.SH NAME -curl_url_cleanup - free the URL handle -.SH SYNOPSIS -.nf -#include - -void curl_url_cleanup(CURLU *handle); -.fi -.SH DESCRIPTION -Frees all the resources associated with the given \fICURLU\fP handle! - -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 -.SH RETURN VALUE -none -.SH "SEE ALSO" -.BR curl_url_dup (3), -.BR curl_url (3), -.BR curl_url_set (3), -.BR curl_url_get (3), -.BR CURLOPT_CURLU (3) diff --git a/docs/libcurl/curl_url_cleanup.md b/docs/libcurl/curl_url_cleanup.md new file mode 100644 index 000000000..d0f85b69c --- /dev/null +++ b/docs/libcurl/curl_url_cleanup.md @@ -0,0 +1,51 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url_cleanup +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CURLU (3) + - curl_url (3) + - curl_url_dup (3) + - curl_url_get (3) + - curl_url_set (3) +--- + +# NAME + +curl_url_cleanup - free the URL handle + +# SYNOPSIS + +~~~c +#include + +void curl_url_cleanup(CURLU *handle); +~~~ + +# DESCRIPTION + +Frees all the resources associated with the given *CURLU* handle! + +Passing in a NULL pointer in *handle* makes this function return +immediately with no action. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLU *url = curl_url(); + curl_url_set(url, CURLUPART_URL, "https://example.com", 0); + curl_url_cleanup(url); +} +~~~ + +# AVAILABILITY + +Added in 7.62.0 + +# RETURN VALUE + +none diff --git a/docs/libcurl/curl_url_dup.3 b/docs/libcurl/curl_url_dup.3 deleted file mode 100644 index 228834771..000000000 --- a/docs/libcurl/curl_url_dup.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url_dup 3 "6 Aug 2018" "libcurl" "libcurl" -.SH NAME -curl_url_dup - duplicate a URL handle -.SH SYNOPSIS -.nf -#include - -CURLU *curl_url_dup(const CURLU *inhandle); -.fi -.SH DESCRIPTION -Duplicates the URL object the input \fICURLU\fP \fIinhandle\fP identifies and -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; - rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0); - if(!rc) { - url2 = curl_url_dup(url); /* clone it! */ - curl_url_cleanup(url2); - } - curl_url_cleanup(url); -} -.fi -.SH AVAILABILITY -Added in 7.62.0 -.SH RETURN VALUE -Returns a new handle or NULL if out of memory. -.SH "SEE ALSO" -.BR curl_url (3), -.BR curl_url_cleanup (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR CURLOPT_CURLU (3) diff --git a/docs/libcurl/curl_url_dup.md b/docs/libcurl/curl_url_dup.md new file mode 100644 index 000000000..ea590ce83 --- /dev/null +++ b/docs/libcurl/curl_url_dup.md @@ -0,0 +1,56 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url_dup +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CURLU (3) + - curl_url (3) + - curl_url_cleanup (3) + - curl_url_get (3) + - curl_url_set (3) +--- + +# NAME + +curl_url_dup - duplicate a URL handle + +# SYNOPSIS + +~~~c +#include + +CURLU *curl_url_dup(const CURLU *inhandle); +~~~ + +# DESCRIPTION + +Duplicates the URL object the input *CURLU* *inhandle* identifies and +returns a pointer to the copy as a new *CURLU* handle. The new handle also +needs to be freed with curl_url_cleanup(3). + +# EXAMPLE + +~~~c +int main(void) +{ + CURLUcode rc; + CURLU *url = curl_url(); + CURLU *url2; + rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0); + if(!rc) { + url2 = curl_url_dup(url); /* clone it! */ + curl_url_cleanup(url2); + } + curl_url_cleanup(url); +} +~~~ + +# AVAILABILITY + +Added in 7.62.0 + +# RETURN VALUE + +Returns a new handle or NULL if out of memory. diff --git a/docs/libcurl/curl_url_get.3 b/docs/libcurl/curl_url_get.md similarity index 50% rename from docs/libcurl/curl_url_get.3 rename to docs/libcurl/curl_url_get.md index 1940f4b6a..d373a3f4b 100644 --- a/docs/libcurl/curl_url_get.3 +++ b/docs/libcurl/curl_url_get.md @@ -1,62 +1,68 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url_get 3 "6 Aug 2018" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url_get +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CURLU (3) + - curl_url (3) + - curl_url_cleanup (3) + - curl_url_dup (3) + - curl_url_set (3) + - curl_url_strerror (3) +--- + +# NAME + curl_url_get - extract a part from a URL -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLUcode curl_url_get(const CURLU *url, CURLUPart part, char **content, unsigned int flags); -.fi -.SH DESCRIPTION -Given a \fIurl\fP handle of a URL object, this function extracts an individual +~~~ + +# DESCRIPTION + +Given a *url* handle of a URL object, this function extracts an individual piece or the full URL from it. -The \fIpart\fP argument specifies which part to extract (see list below) and -\fIcontent\fP points to a 'char *' to get updated to point to a newly +The *part* argument specifies which part to extract (see list below) and +*content* points to a 'char *' to get updated to point to a newly allocated string with the contents. -The \fIflags\fP argument is a bitmask with individual features. +The *flags* argument is a bitmask with individual features. + +The returned content pointer must be freed with curl_free(3) after use. + +# FLAGS -The returned content pointer must be freed with \fIcurl_free(3)\fP after use. -.SH FLAGS The flags argument is zero, one or more bits set in a bitmask. -.IP CURLU_DEFAULT_PORT -If the handle has no port stored, this option makes \fIcurl_url_get(3)\fP + +## CURLU_DEFAULT_PORT + +If the handle has no port stored, this option makes curl_url_get(3) return the default port for the used scheme. -.IP CURLU_DEFAULT_SCHEME -If the handle has no scheme stored, this option makes \fIcurl_url_get(3)\fP + +## CURLU_DEFAULT_SCHEME + +If the handle has no scheme stored, this option makes curl_url_get(3) return the default scheme instead of error. -.IP CURLU_NO_DEFAULT_PORT -Instructs \fIcurl_url_get(3)\fP to not return a port number if it matches the + +## CURLU_NO_DEFAULT_PORT + +Instructs curl_url_get(3) to not return a port number if it matches the default port for the scheme. -.IP CURLU_URLDECODE -Asks \fIcurl_url_get(3)\fP to URL decode the contents before returning it. It + +## CURLU_URLDECODE + +Asks curl_url_get(3) to URL decode the contents before returning it. It does not decode the scheme, the port number or the full URL. The query component also gets plus-to-space conversion as a bonus when this @@ -67,84 +73,113 @@ string back with data that could be intended for a particular encoding. If there are byte values lower than 32 in the decoded string, the get operation returns an error instead. -.IP CURLU_URLENCODE -If set, \fIcurl_url_get(3)\fP URL encodes the host name part when a full URL + +## CURLU_URLENCODE + +If set, curl_url_get(3) URL encodes the host name part when a full URL is retrieved. If not set (default), libcurl returns the URL with the host name "raw" to support IDN names to appear as-is. IDN host names are typically using non-ASCII bytes that otherwise gets percent-encoded. Note that even when not asking for URL encoding, the '%' (byte 37) is URL encoded to make sure the host name remains valid. -.IP CURLU_PUNYCODE -If set and \fICURLU_URLENCODE\fP is not set, and asked to retrieve the -\fBCURLUPART_HOST\fP or \fBCURLUPART_URL\fP parts, libcurl returns the host + +## CURLU_PUNYCODE + +If set and *CURLU_URLENCODE* is not set, and asked to retrieve the +**CURLUPART_HOST** or **CURLUPART_URL** parts, libcurl returns the host name in its punycode version if it contains any non-ASCII octets (and is an IDN name). If libcurl is built without IDN capabilities, using this bit makes -\fIcurl_url_get(3)\fP return \fICURLUE_LACKS_IDN\fP if the host name contains +curl_url_get(3) return *CURLUE_LACKS_IDN* if the host name contains anything outside the ASCII range. (Added in curl 7.88.0) -.IP CURLU_PUNY2IDN -If set and asked to retrieve the \fBCURLUPART_HOST\fP or \fBCURLUPART_URL\fP + +## CURLU_PUNY2IDN + +If set and asked to retrieve the **CURLUPART_HOST** or **CURLUPART_URL** parts, libcurl returns the host name in its IDN (International Domain Name) UTF-8 version if it otherwise is a punycode version. If the punycode name cannot be converted to IDN correctly, libcurl returns -\fICURLUE_BAD_HOSTNAME\fP. +*CURLUE_BAD_HOSTNAME*. If libcurl is built without IDN capabilities, using this bit makes -\fIcurl_url_get(3)\fP return \fICURLUE_LACKS_IDN\fP if the host name is using +curl_url_get(3) return *CURLUE_LACKS_IDN* if the host name is using punycode. (Added in curl 8.3.0) -.SH PARTS -.IP CURLUPART_URL -When asked to return the full URL, \fIcurl_url_get(3)\fP returns a normalized + +# PARTS + +## CURLUPART_URL + +When asked to return the full URL, curl_url_get(3) returns a normalized and possibly cleaned up version using all available URL parts. -We advise using the \fICURLU_PUNYCODE\fP option to get the URL as "normalized" +We advise using the *CURLU_PUNYCODE* option to get the URL as "normalized" as possible since IDN allows host names to be written in many different ways that still end up the same punycode version. -.IP CURLUPART_SCHEME + +## CURLUPART_SCHEME + Scheme cannot be URL decoded on get. -.IP CURLUPART_USER -.IP CURLUPART_PASSWORD -.IP CURLUPART_OPTIONS + +## CURLUPART_USER + +## CURLUPART_PASSWORD + +## CURLUPART_OPTIONS + The options field is an optional field that might follow the password in the userinfo part. It is only recognized/used when parsing URLs for the following schemes: pop3, smtp and imap. The URL API still allows users to set and get this field independently of scheme when not parsing full URLs. -.IP CURLUPART_HOST + +## CURLUPART_HOST + The host name. If it is an IPv6 numeric address, the zone id is not part of it -but is provided separately in \fICURLUPART_ZONEID\fP. IPv6 numerical addresses +but is provided separately in *CURLUPART_ZONEID*. IPv6 numerical addresses are returned within brackets ([]). IPv6 names are normalized when set, which should make them as short as possible while maintaining correct syntax. -.IP CURLUPART_ZONEID + +## CURLUPART_ZONEID + If the host name is a numeric IPv6 address, this field might also be set. -.IP CURLUPART_PORT + +## CURLUPART_PORT + A port cannot be URL decoded on get. This number is returned in a string just like all other parts. That string is guaranteed to hold a valid port number in ASCII using base 10. -.IP CURLUPART_PATH -The \fIpart\fP is always at least a slash ('/') even if no path was supplied -in the URL. A URL path always starts with a slash. -.IP CURLUPART_QUERY -The initial question mark that denotes the beginning of the query part is a -delimiter only. It is not part of the query contents. -A not-present query returns \fIpart\fP set to NULL. -A zero-length query returns \fIpart\fP as a zero-length string. +## CURLUPART_PATH + +The *part* is always at least a slash ('/') even if no path was supplied +in the URL. A URL path always starts with a slash. + +## CURLUPART_QUERY + +The initial question mark that denotes the beginning of the query part is a +delimiter only. It is not part of the query contents. + +A not-present query returns *part* set to NULL. +A zero-length query returns *part* as a zero-length string. The query part gets pluses converted to space when asked to URL decode on get with the CURLU_URLDECODE bit. -.IP CURLUPART_FRAGMENT + +## CURLUPART_FRAGMENT + The initial hash sign that denotes the beginning of the fragment is a delimiter only. It is not part of the fragment contents. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURLUcode rc; @@ -154,25 +189,22 @@ int main(void) char *scheme; rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0); if(!rc) { - printf("the scheme is %s\\n", scheme); + printf("the scheme is %s\n", scheme); curl_free(scheme); } curl_url_cleanup(url); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.62.0. CURLUPART_ZONEID was added in 7.65.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns a CURLUcode error value, which is CURLUE_OK (0) if everything went -fine. See the \fIlibcurl-errors(3)\fP man page for the full list with +fine. See the libcurl-errors(3) man page for the full list with descriptions. If this function returns an error, no URL part is returned. -.SH "SEE ALSO" -.BR curl_url (3), -.BR curl_url_cleanup (3), -.BR curl_url_dup (3), -.BR curl_url_set (3), -.BR curl_url_strerror (3), -.BR CURLOPT_CURLU (3) diff --git a/docs/libcurl/curl_url_set.3 b/docs/libcurl/curl_url_set.md similarity index 56% rename from docs/libcurl/curl_url_set.3 rename to docs/libcurl/curl_url_set.md index e5b1790b8..6a7526f90 100644 --- a/docs/libcurl/curl_url_set.3 +++ b/docs/libcurl/curl_url_set.md @@ -1,64 +1,60 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url_set 3 "6 Aug 2018" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url_set +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CURLU (3) + - curl_url (3) + - curl_url_cleanup (3) + - curl_url_dup (3) + - curl_url_get (3) + - curl_url_strerror (3) +--- + +# NAME + curl_url_set - set a URL part -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLUcode curl_url_set(CURLU *url, CURLUPart part, const char *content, unsigned int flags); -.fi -.SH DESCRIPTION -The \fIurl\fP handle to work on, passed in as the first argument, must be a -handle previously created by \fIcurl_url(3)\fP or \fIcurl_url_dup(3)\fP. +~~~ + +# DESCRIPTION + +The *url* handle to work on, passed in as the first argument, must be a +handle previously created by curl_url(3) or curl_url_dup(3). This function sets or updates individual URL components, or parts, held by the URL object the handle identifies. -The \fIpart\fP argument should identify the particular URL part (see list -below) to set or change, with \fIcontent\fP pointing to a null-terminated +The *part* argument should identify the particular URL part (see list +below) to set or change, with *content* pointing to a null-terminated string with the new contents for that URL part. The contents should be in the form and encoding they would use in a URL: URL encoded. When setting part in the URL object that was previously already set, it replaces the data that was previously stored for that part with the new -\fIcontent\fP. +*content*. -The caller does not have to keep \fIcontent\fP around after a successful call +The caller does not have to keep *content* around after a successful call as this function copies the content. Setting a part to a NULL pointer removes that part's contents from the -\fICURLU\fP handle. +*CURLU* handle. By default, this API only accepts URLs using schemes for protocols that are supported built-in. To make libcurl parse URLs generically even for schemes it -does not know about, the \fBCURLU_NON_SUPPORT_SCHEME\fP flags bit must be -set. Otherwise, this function returns \fICURLUE_UNSUPPORTED_SCHEME\fP for URL +does not know about, the **CURLU_NON_SUPPORT_SCHEME** flags bit must be +set. Otherwise, this function returns *CURLUE_UNSUPPORTED_SCHEME* for URL schemes it does not recognize. This function has an 8 MB maximum length limit for all provided input strings. @@ -70,71 +66,100 @@ accept data that would not be otherwise possible to set in the string when it gets populated as a result of a full URL parse. Beware. If done so, extracting a full URL later on from such components might render an invalid URL. -The \fIflags\fP argument is a bitmask with independent features. -.SH PARTS -.IP CURLUPART_URL +The *flags* argument is a bitmask with independent features. + +# PARTS + +## CURLUPART_URL + Allows the full URL of the handle to be replaced. If the handle already is populated with a URL, the new URL can be relative to the previous. When successfully setting a new URL, relative or absolute, the handle contents is replaced with the components of the newly set URL. -Pass a pointer to a null-terminated string to the \fIurl\fP parameter. The +Pass a pointer to a null-terminated string to the *url* parameter. The string must point to a correctly formatted "RFC 3986+" URL or be a NULL pointer. -Unless \fICURLU_NO_AUTHORITY\fP is set, a blank host name is not allowed in +Unless *CURLU_NO_AUTHORITY* is set, a blank host name is not allowed in the URL. -.IP CURLUPART_SCHEME + +## CURLUPART_SCHEME + Scheme cannot be URL decoded on set. libcurl only accepts setting schemes up to 40 bytes long. -.IP CURLUPART_USER -.IP CURLUPART_PASSWORD -.IP CURLUPART_OPTIONS + +## CURLUPART_USER + +## CURLUPART_PASSWORD + +## CURLUPART_OPTIONS + The options field is an optional field that might follow the password in the userinfo part. It is only recognized/used when parsing URLs for the following schemes: pop3, smtp and imap. This function however allows users to independently set this field. -.IP CURLUPART_HOST + +## CURLUPART_HOST + The host name. If it is International Domain Name (IDN) the string must then be encoded as your locale says or UTF-8 (when WinIDN is used). If it is a bracketed IPv6 numeric address it may contain a zone id (or you can use -\fICURLUPART_ZONEID\fP). +*CURLUPART_ZONEID*). + +Unless *CURLU_NO_AUTHORITY* is set, a blank host name is not allowed to set. + +## CURLUPART_ZONEID -Unless \fICURLU_NO_AUTHORITY\fP is set, a blank host name is not allowed to set. -.IP CURLUPART_ZONEID If the host name is a numeric IPv6 address, this field can also be set. -.IP CURLUPART_PORT + +## CURLUPART_PORT + The port number cannot be URL encoded on set. The given port number is provided as a string and the decimal number in it must be between 0 and 65535. Anything else returns an error. -.IP CURLUPART_PATH + +## CURLUPART_PATH + If a path is set in the URL without a leading slash, a slash is prepended automatically. -.IP CURLUPART_QUERY -The query part gets spaces converted to pluses when asked to URL encode on set -with the \fICURLU_URLENCODE\fP bit. -If used together with the \fICURLU_APPENDQUERY\fP bit, the provided part is +## CURLUPART_QUERY + +The query part gets spaces converted to pluses when asked to URL encode on set +with the *CURLU_URLENCODE* bit. + +If used together with the *CURLU_APPENDQUERY* bit, the provided part is appended on the end of the existing query. The question mark in the URL is not part of the actual query contents. -.IP CURLUPART_FRAGMENT + +## CURLUPART_FRAGMENT + The hash sign in the URL is not part of the actual fragment contents. -.SH FLAGS + +# FLAGS + The flags argument is zero, one or more bits set in a bitmask. -.IP CURLU_APPENDQUERY -Can be used when setting the \fICURLUPART_QUERY\fP component. The provided new + +## CURLU_APPENDQUERY + +Can be used when setting the *CURLUPART_QUERY* component. The provided new part is then appended at the end of the existing query - and if the previous part did not end with an ampersand (&), an ampersand gets inserted before the new appended part. -When \fICURLU_APPENDQUERY\fP is used together with \fICURLU_URLENCODE\fP, the +When *CURLU_APPENDQUERY* is used together with *CURLU_URLENCODE*, the first '=' symbol is not URL encoded. -.IP CURLU_NON_SUPPORT_SCHEME -If set, allows \fIcurl_url_set(3)\fP to set a non-supported scheme. -.IP CURLU_URLENCODE -When set, \fIcurl_url_set(3)\fP URL encodes the part on entry, except for + +## CURLU_NON_SUPPORT_SCHEME + +If set, allows curl_url_set(3) to set a non-supported scheme. + +## CURLU_URLENCODE + +When set, curl_url_set(3) URL encodes the part on entry, except for scheme, port and URL. When setting the path component with URL encoding enabled, the slash character @@ -144,41 +169,55 @@ The query part gets space-to-plus conversion before the URL conversion. This URL encoding is charset unaware and converts the input in a byte-by-byte manner. -.IP CURLU_DEFAULT_SCHEME + +## CURLU_DEFAULT_SCHEME + If set, allows the URL to be set without a scheme and then sets that to the -default scheme: HTTPS. Overrides the \fICURLU_GUESS_SCHEME\fP option if both +default scheme: HTTPS. Overrides the *CURLU_GUESS_SCHEME* option if both are set. -.IP CURLU_GUESS_SCHEME + +## CURLU_GUESS_SCHEME + If set, allows the URL to be set without a scheme and it instead "guesses" which scheme that was intended based on the host name. If the outermost subdomain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that scheme is used, otherwise it picks HTTP. Conflicts with the -\fICURLU_DEFAULT_SCHEME\fP option which takes precedence if both are set. -.IP CURLU_NO_AUTHORITY +*CURLU_DEFAULT_SCHEME* option which takes precedence if both are set. + +## CURLU_NO_AUTHORITY + If set, skips authority checks. The RFC allows individual schemes to omit the host part (normally the only mandatory part of the authority), but libcurl cannot know whether this is permitted for custom schemes. Specifying the flag permits empty authority sections, similar to how file scheme is handled. -.IP CURLU_PATH_AS_IS -When set for \fBCURLUPART_URL\fP, this skips the normalization of the + +## CURLU_PATH_AS_IS + +When set for **CURLUPART_URL**, this skips the normalization of the path. That is the procedure where libcurl otherwise removes sequences of dot-slash and dot-dot etc. The same option used for transfers is called -\fICURLOPT_PATH_AS_IS(3)\fP. -.IP CURLU_ALLOW_SPACE +CURLOPT_PATH_AS_IS(3). + +## CURLU_ALLOW_SPACE + If set, the URL parser allows space (ASCII 32) where possible. The URL syntax does normally not allow spaces anywhere, but they should be encoded as %20 or '+'. When spaces are allowed, they are still not allowed in the scheme. When space is used and allowed in a URL, it is stored as-is unless -\fICURLU_URLENCODE\fP is also set, which then makes libcurl URL encode the +*CURLU_URLENCODE* is also set, which then makes libcurl URL encode the space before stored. This affects how the URL is constructed when -\fIcurl_url_get(3)\fP is subsequently used to extract the full URL or +curl_url_get(3) is subsequently used to extract the full URL or individual parts. (Added in 7.78.0) -.IP CURLU_DISALLOW_USER + +## CURLU_DISALLOW_USER + If set, the URL parser does not accept embedded credentials for the -\fBCURLUPART_URL\fP, and instead returns \fBCURLUE_USER_NOT_ALLOWED\fP for +**CURLUPART_URL**, and instead returns **CURLUE_USER_NOT_ALLOWED** for such URLs. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURLUcode rc; @@ -190,22 +229,19 @@ int main(void) } curl_url_cleanup(url); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.62.0. CURLUPART_ZONEID was added in 7.65.0. -.SH RETURN VALUE -Returns a \fICURLUcode\fP error value, which is CURLUE_OK (0) if everything -went fine. See the \fIlibcurl-errors(3)\fP man page for the full list with + +# RETURN VALUE + +Returns a *CURLUcode* error value, which is CURLUE_OK (0) if everything +went fine. See the libcurl-errors(3) man page for the full list with descriptions. -The input string passed to \fIcurl_url_set(3)\fP must be shorter than eight -million bytes. Otherwise this function returns \fBCURLUE_MALFORMED_INPUT\fP. +The input string passed to curl_url_set(3) must be shorter than eight +million bytes. Otherwise this function returns **CURLUE_MALFORMED_INPUT**. If this function returns an error, no URL part is set. -.SH "SEE ALSO" -.BR curl_url (3), -.BR curl_url_cleanup (3), -.BR curl_url_dup (3), -.BR curl_url_get (3), -.BR curl_url_strerror (3), -.BR CURLOPT_CURLU (3) diff --git a/docs/libcurl/curl_url_strerror.3 b/docs/libcurl/curl_url_strerror.3 deleted file mode 100644 index 38af12e9c..000000000 --- a/docs/libcurl/curl_url_strerror.3 +++ /dev/null @@ -1,58 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_url_strerror 3 "21 Aug 2021" "libcurl" "libcurl" -.SH NAME -curl_url_strerror - return string describing error code -.SH SYNOPSIS -.nf -#include - -const char *curl_url_strerror(CURLUcode errornum); -.fi -.SH DESCRIPTION -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 -A pointer to a null-terminated string. -.SH "SEE ALSO" -.BR curl_easy_strerror (3), -.BR curl_multi_strerror (3), -.BR curl_share_strerror (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/curl_url_strerror.md b/docs/libcurl/curl_url_strerror.md new file mode 100644 index 000000000..26562aa21 --- /dev/null +++ b/docs/libcurl/curl_url_strerror.md @@ -0,0 +1,53 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_url_strerror +Section: 3 +Source: libcurl +See-also: + - curl_easy_strerror (3) + - curl_multi_strerror (3) + - curl_share_strerror (3) + - curl_url_get (3) + - curl_url_set (3) + - libcurl-errors (3) +--- + +# NAME + +curl_url_strerror - return string describing error code + +# SYNOPSIS + +~~~c +#include + +const char *curl_url_strerror(CURLUcode errornum); +~~~ + +# DESCRIPTION + +This function returns a string describing the CURLUcode error code passed in +the argument *errornum*. + +# EXAMPLE + +~~~c +int main(void) +{ + CURLUcode rc; + CURLU *url = curl_url(); + rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0); + if(rc) + printf("URL error: %s\n", curl_url_strerror(rc)); + curl_url_cleanup(url); +} +~~~ + +# AVAILABILITY + +Added in 7.80.0 + +# RETURN VALUE + +A pointer to a null-terminated string. diff --git a/docs/libcurl/curl_version.3 b/docs/libcurl/curl_version.3 deleted file mode 100644 index fdf09d1ba..000000000 --- a/docs/libcurl/curl_version.3 +++ /dev/null @@ -1,52 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH curl_version 3 "5 March 2001" "libcurl" "libcurl" -.SH NAME -curl_version - returns the libcurl version string -.SH SYNOPSIS -.nf -#include - -char *curl_version(); -.fi -.SH DESCRIPTION -Returns a human readable string with the version number of libcurl and some of -its important components (like OpenSSL version). - -We recommend using \fIcurl_version_info(3)\fP instead! -.SH EXAMPLE -.nf -int main(void) -{ - printf("libcurl version %s\\n", curl_version()); -} -.fi - -.SH AVAILABILITY -Always -.SH RETURN VALUE -A pointer to a null-terminated string. The string resides in a statically -allocated buffer and must not be freed by the caller. -.SH "SEE ALSO" -.BR curl_version_info (3) diff --git a/docs/libcurl/curl_version.md b/docs/libcurl/curl_version.md new file mode 100644 index 000000000..3a3cb359b --- /dev/null +++ b/docs/libcurl/curl_version.md @@ -0,0 +1,46 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_version +Section: 3 +Source: libcurl +See-also: + - curl_version_info (3) +--- + +# NAME + +curl_version - returns the libcurl version string + +# SYNOPSIS + +~~~c +#include + +char *curl_version(); +~~~ + +# DESCRIPTION + +Returns a human readable string with the version number of libcurl and some of +its important components (like OpenSSL version). + +We recommend using curl_version_info(3) instead! + +# EXAMPLE + +~~~c +int main(void) +{ + printf("libcurl version %s\n", curl_version()); +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +A pointer to a null-terminated string. The string resides in a statically +allocated buffer and must not be freed by the caller. diff --git a/docs/libcurl/curl_version_info.3 b/docs/libcurl/curl_version_info.md similarity index 63% rename from docs/libcurl/curl_version_info.3 rename to docs/libcurl/curl_version_info.md index 32bea8272..be626b6ec 100644 --- a/docs/libcurl/curl_version_info.3 +++ b/docs/libcurl/curl_version_info.md @@ -1,57 +1,47 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_version_info 3 "2 Nov 2014" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_version_info +Section: 3 +Source: libcurl +See-also: + - curl_version (3) +--- + +# NAME + curl_version_info - returns runtime libcurl version info -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include curl_version_info_data *curl_version_info(CURLversion age); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Returns a pointer to a filled in static struct with information about various -features in the running version of libcurl. \fIage\fP should be set to the +features in the running version of libcurl. *age* should be set to the version of this functionality by the time you write your program. This way, libcurl always returns a proper struct that your program understands, while -programs in the future might get a different struct. \fBCURLVERSION_NOW\fP is +programs in the future might get a different struct. **CURLVERSION_NOW** is the most recent one for the library you have installed: -.nf +~~~c data = curl_version_info(CURLVERSION_NOW); -.fi +~~~ Applications should use this information to judge if things are possible to do or not, instead of using compile-time checks, as dynamic/DLL libraries can be changed independent of applications. This function can alter the returned static data as long as -\fIcurl_global_init(3)\fP has not been called. It is therefore not thread-safe +curl_global_init(3) has not been called. It is therefore not thread-safe before libcurl initialization occurs. The curl_version_info_data struct looks like this -.nf +~~~c typedef struct { CURLversion age; /* see description below */ @@ -113,211 +103,279 @@ typedef struct { below exist */ const char *const *feature_names; /* Feature names. */ } curl_version_info_data; -.fi +~~~ -\fIage\fP describes what the age of this struct is. The number depends on how +*age* describes what the age of this struct is. The number depends on how new the libcurl you are using is. You are however guaranteed to get a struct that you have a matching struct for in the header, as you tell libcurl your "age" with the input argument. -\fIversion\fP is just an ascii string for the libcurl version. +*version* is just an ascii string for the libcurl version. -\fIversion_num\fP is a 24 bit number created like this: <8 bits major number> +*version_num* is a 24 bit number created like this: <8 bits major number> | <8 bits minor number> | <8 bits patch number>. Version 7.9.8 is therefore returned as 0x070908. -\fIhost\fP is an ascii string showing what host information that this libcurl +*host* is an ascii string showing what host information that this libcurl was built for. As discovered by a configure script or set by the build environment. -\fIfeatures\fP is a bit mask representing available features. It can -have none, one or more bits set. -The use of this field is deprecated: use \fIfeature_names\fP instead. -The feature names description below lists the associated bits. +*features* is a bit mask representing available features. It can have none, +one or more bits set. The use of this field is deprecated: use +*feature_names* instead. The feature names description below lists the +associated bits. -\fIfeature_names\fP is a pointer to an array of string pointers, containing the +*feature_names* is a pointer to an array of string pointers, containing the names of the features that libcurl supports. The array is terminated by a NULL -entry. Currently defined names are: -.RS -.IP """alt-svc""" -\fIfeatures\fP mask bit: CURL_VERSION_ALTSVC +entry. See the list of features names below. + +*ssl_version* is an ASCII string for the TLS library name + version +used. If libcurl has no SSL support, this is NULL. For example "Schannel", +&"Secure Transport" or "OpenSSL/1.1.0g". + +*ssl_version_num* is always 0. + +*libz_version* is an ASCII string (there is no numerical version). If +libcurl has no libz support, this is NULL. + +*protocols* is a pointer to an array of char * pointers, containing the +names protocols that libcurl supports (using lowercase letters). The protocol +names are the same as would be used in URLs. The array is terminated by a NULL +entry. + +# FEATURES + +## alt-svc + +*features* mask bit: CURL_VERSION_ALTSVC HTTP Alt-Svc parsing and the associated options (Added in 7.64.1) -.IP """AsynchDNS""" -\fIfeatures\fP mask bit: CURL_VERSION_ASYNCHDNS + +## AsynchDNS + +*features* mask bit: CURL_VERSION_ASYNCHDNS libcurl was built with support for asynchronous name lookups, which allows more exact timeouts (even on Windows) and less blocking when using the multi interface. (added in 7.10.7) -.IP """brotli""" -\fIfeatures\fP mask bit: CURL_VERSION_BROTLI + +## brotli + +*features* mask bit: CURL_VERSION_BROTLI supports HTTP Brotli content encoding using libbrotlidec (Added in 7.57.0) -.IP """Debug""" -\fIfeatures\fP mask bit: CURL_VERSION_DEBUG + +## Debug + +*features* mask bit: CURL_VERSION_DEBUG libcurl was built with debug capabilities (added in 7.10.6) -.IP """gsasl""" -\fIfeatures\fP mask bit: CURL_VERSION_GSASL + +## gsasl + +*features* mask bit: CURL_VERSION_GSASL libcurl was built with libgsasl and thus with some extra SCRAM-SHA authentication methods. (added in 7.76.0) -.IP """GSS-API""" -\fIfeatures\fP mask bit: CURL_VERSION_GSSAPI + +## GSS-API + +*features* mask bit: CURL_VERSION_GSSAPI libcurl was built with support for GSS-API. This makes libcurl use provided functions for Kerberos and SPNEGO authentication. It also allows libcurl to use the current user credentials without the app having to pass them on. (Added in 7.38.0) -.IP """HSTS""" -\fIfeatures\fP mask bit: CURL_VERSION_HSTS + +## HSTS + +*features* mask bit: CURL_VERSION_HSTS libcurl was built with support for HSTS (HTTP Strict Transport Security) (Added in 7.74.0) -.IP """HTTP2""" -\fIfeatures\fP mask bit: CURL_VERSION_HTTP2 + +## HTTP2 + +*features* mask bit: CURL_VERSION_HTTP2 libcurl was built with support for HTTP2. (Added in 7.33.0) -.IP """HTTP3""" -\fIfeatures\fP mask bit: CURL_VERSION_HTTP3 + +## HTTP3 + +*features* mask bit: CURL_VERSION_HTTP3 HTTP/3 and QUIC support are built-in (Added in 7.66.0) -.IP """HTTPS-proxy""" -\fIfeatures\fP mask bit: CURL_VERSION_HTTPS_PROXY + +## HTTPS-proxy + +*features* mask bit: CURL_VERSION_HTTPS_PROXY libcurl was built with support for HTTPS-proxy. (Added in 7.52.0) -.IP """IDN""" -\fIfeatures\fP mask bit: CURL_VERSION_IDN + +## IDN + +*features* mask bit: CURL_VERSION_IDN libcurl was built with support for IDNA, domain names with international letters. (Added in 7.12.0) -.IP """IPv6""" -\fIfeatures\fP mask bit: CURL_VERSION_IPV6 + +## IPv6 + +*features* mask bit: CURL_VERSION_IPV6 supports IPv6 -.IP """Kerberos""" -\fIfeatures\fP mask bit: CURL_VERSION_KERBEROS5 + +## Kerberos + +*features* mask bit: CURL_VERSION_KERBEROS5 supports Kerberos V5 authentication for FTP, IMAP, LDAP, POP3, SMTP and SOCKSv5 proxy. (Added in 7.40.0) -.IP """Largefile""" -\fIfeatures\fP mask bit: CURL_VERSION_LARGEFILE + +## Largefile + +*features* mask bit: CURL_VERSION_LARGEFILE libcurl was built with support for large files. (Added in 7.11.1) -.IP """libz""" -\fIfeatures\fP mask bit: CURL_VERSION_LIBZ + +## libz + +*features* mask bit: CURL_VERSION_LIBZ supports HTTP deflate using libz (Added in 7.10) -.IP """MultiSSL""" -\fIfeatures\fP mask bit: CURL_VERSION_MULTI_SSL + +## MultiSSL + +*features* mask bit: CURL_VERSION_MULTI_SSL libcurl was built with multiple SSL backends. For details, see -\fIcurl_global_sslset(3)\fP. +curl_global_sslset(3). (Added in 7.56.0) -.IP """NTLM""" -\fIfeatures\fP mask bit: CURL_VERSION_NTLM + +## NTLM + +*features* mask bit: CURL_VERSION_NTLM supports HTTP NTLM (added in 7.10.6) -.IP """NTLM_WB""" -\fIfeatures\fP mask bit: CURL_VERSION_NTLM_WB + +## NTLM_WB + +*features* mask bit: CURL_VERSION_NTLM_WB libcurl was built with support for NTLM delegation to a winbind helper. (Added in 7.22.0) -.IP """PSL""" -\fIfeatures\fP mask bit: CURL_VERSION_PSL + +## PSL + +*features* mask bit: CURL_VERSION_PSL libcurl was built with support for Mozilla's Public Suffix List. This makes libcurl ignore cookies with a domain that is on the list. (Added in 7.47.0) -.IP """SPNEGO""" -\fIfeatures\fP mask bit: CURL_VERSION_SPNEGO + +## SPNEGO + +*features* mask bit: CURL_VERSION_SPNEGO libcurl was built with support for SPNEGO authentication (Simple and Protected GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8) -.IP """SSL""" -\fIfeatures\fP mask bit: CURL_VERSION_SSL + +## SSL + +*features* mask bit: CURL_VERSION_SSL supports SSL (HTTPS/FTPS) (Added in 7.10) -.IP """SSPI""" -\fIfeatures\fP mask bit: CURL_VERSION_SSPI + +## SSPI + +*features* mask bit: CURL_VERSION_SSPI libcurl was built with support for SSPI. This is only available on Windows and makes libcurl use Windows-provided functions for Kerberos, NTLM, SPNEGO and Digest authentication. It also allows libcurl to use the current user credentials without the app having to pass them on. (Added in 7.13.2) -.IP """threadsafe""" -\fIfeatures\fP mask bit: CURL_VERSION_THREADSAFE + +## threadsafe + +*features* mask bit: CURL_VERSION_THREADSAFE libcurl was built with thread-safety support (Atomic or SRWLOCK) to protect -curl initialization. (Added in 7.84.0) See \fIlibcurl-thread(3)\fP -.IP """TLS-SRP""" -\fIfeatures\fP mask bit: CURL_VERSION_TLSAUTH_SRP +curl initialization. (Added in 7.84.0) See libcurl-thread(3) + +## TLS-SRP + +*features* mask bit: CURL_VERSION_TLSAUTH_SRP libcurl was built with support for TLS-SRP (in one or more of the built-in TLS backends). (Added in 7.21.4) -.IP """TrackMemory""" -\fIfeatures\fP mask bit: CURL_VERSION_CURLDEBUG + +## TrackMemory + +*features* mask bit: CURL_VERSION_CURLDEBUG libcurl was built with memory tracking debug capabilities. This is mainly of interest for libcurl hackers. (added in 7.19.6) -.IP """Unicode""" -\fIfeatures\fP mask bit: CURL_VERSION_UNICODE + +## Unicode + +*features* mask bit: CURL_VERSION_UNICODE libcurl was built with Unicode support on Windows. This makes non-ASCII characters work in filenames and options passed to libcurl. (Added in 7.72.0) -.IP """UnixSockets""" -\fIfeatures\fP mask bit: CURL_VERSION_UNIX_SOCKETS + +## UnixSockets + +*features* mask bit: CURL_VERSION_UNIX_SOCKETS libcurl was built with support for Unix domain sockets. (Added in 7.40.0) -.IP """zstd""" -\fIfeatures\fP mask bit: CURL_VERSION_ZSTD + +## zstd + +*features* mask bit: CURL_VERSION_ZSTD supports HTTP zstd content encoding using zstd library (Added in 7.72.0) -.IP none -\fIfeatures\fP mask bit: CURL_VERSION_CONV + +## no name + +*features* mask bit: CURL_VERSION_CONV libcurl was built with support for character conversions, as provided by the -CURLOPT_CONV_* callbacks. Always 0 since 7.82.0. (Added in 7.15.4) -.IP none -\fIfeatures\fP mask bit: CURL_VERSION_GSSNEGOTIATE +CURLOPT_CONV_* callbacks. Always 0 since 7.82.0. (Added in 7.15.4, +deprecated.) + +## no name + +*features* mask bit: CURL_VERSION_GSSNEGOTIATE supports HTTP GSS-Negotiate (added in 7.10.6, deprecated in 7.38.0) -.IP none -\fIfeatures\fP mask bit: CURL_VERSION_KERBEROS4 + +## no name + +*features* mask bit: CURL_VERSION_KERBEROS4 supports Kerberos V4 (when using FTP). Legacy bit. Deprecated since 7.33.0. -.RE -\fIssl_version\fP is an ASCII string for the TLS library name + version -used. If libcurl has no SSL support, this is NULL. For example "Schannel", -\&"Secure Transport" or "OpenSSL/1.1.0g". +# EXAMPLE -\fIssl_version_num\fP is always 0. - -\fIlibz_version\fP is an ASCII string (there is no numerical version). If -libcurl has no libz support, this is NULL. - -\fIprotocols\fP is a pointer to an array of char * pointers, containing the -names protocols that libcurl supports (using lowercase letters). The protocol -names are the same as would be used in URLs. The array is terminated by a NULL -entry. -.SH EXAMPLE -.nf +~~~c int main(void) { curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW); - printf("libcurl version %u.%u.%u\\n", + printf("libcurl version %u.%u.%u\n", (ver->version_num >> 16) & 0xff, (ver->version_num >> 8) & 0xff, ver->version_num & 0xff); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.10 -.SH RETURN VALUE + +# RETURN VALUE + A pointer to a curl_version_info_data struct. -.SH "SEE ALSO" -\fIcurl_version(3)\fP +curl_version(3) diff --git a/docs/libcurl/curl_ws_meta.3 b/docs/libcurl/curl_ws_meta.md similarity index 53% rename from docs/libcurl/curl_ws_meta.3 rename to docs/libcurl/curl_ws_meta.md index 8623ad089..531791a51 100644 --- a/docs/libcurl/curl_ws_meta.3 +++ b/docs/libcurl/curl_ws_meta.md @@ -1,41 +1,35 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_ws_meta 3 "12 Jun 2022" "libcurl" "libcurl" -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_ws_meta +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_setopt (3) + - curl_ws_recv (3) + - curl_ws_send (3) + - libcurl-ws (3) +--- + +# NAME + curl_ws_meta - meta data WebSocket information -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include const struct curl_ws_frame *curl_ws_meta(CURL *curl); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This function call is EXPERIMENTAL. -When the write callback (\fICURLOPT_WRITEFUNCTION(3)\fP) is invoked on -received WebSocket traffic, \fIcurl_ws_meta(3)\fP can be called from within +When the write callback (CURLOPT_WRITEFUNCTION(3)) is invoked on +received WebSocket traffic, curl_ws_meta(3) can be called from within the callback to provide additional information about the current frame. This function only works from within the callback, and only when receiving @@ -44,45 +38,67 @@ WebSocket data. This function requires an easy handle as input argument for libcurl to know what transfer the question is about, but as there is no such pointer provided to the callback by libcurl itself, applications that want to use -\fIcurl_ws_meta(3)\fP need to pass it on to the callback on its own. +curl_ws_meta(3) need to pass it on to the callback on its own. -.SH "struct curl_ws_frame" -.nf +# struct curl_ws_frame + +~~~c struct curl_ws_frame { int age; int flags; curl_off_t offset; curl_off_t bytesleft; }; -.fi -.IP age +~~~ + +## age + This field specify the age of this struct. It is always zero for now. -.IP flags + +## flags + This is a bitmask with individual bits set that describes the WebSocket data. See the list below. -.IP offset + +## offset + When this frame is a continuation of fragment data already delivered, this is the offset into the final fragment where this piece belongs. -.IP bytesleft -If this is not a complete fragment, the \fIbytesleft\fP field informs about + +## bytesleft + +If this is not a complete fragment, the *bytesleft* field informs about how many additional bytes are expected to arrive before this fragment is complete. -.SH FLAGS -.IP CURLWS_TEXT + +# FLAGS + +## CURLWS_TEXT + The buffer contains text data. Note that this makes a difference to WebSocket but libcurl itself does not make any verification of the content or precautions that you actually receive valid UTF-8 content. -.IP CURLWS_BINARY + +## CURLWS_BINARY + This is binary data. -.IP CURLWS_CONT + +## CURLWS_CONT + This is not the final fragment of the message, it implies that there is another fragment coming as part of the same message. -.IP CURLWS_CLOSE + +## CURLWS_CLOSE + This transfer is now closed. -.IP CURLWS_PING + +## CURLWS_PING + This as an incoming ping message, that expects a pong response. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* we pass a pointer to this struct to the callback */ struct customdata { @@ -96,7 +112,7 @@ static size_t writecb(unsigned char *buffer, struct customdata *c = (struct customdata *)p; const struct curl_ws_frame *m = curl_ws_meta(c->easy); - printf("flags: %x\\n", m->flags); + printf("flags: %x\n", m->flags); } int main(void) @@ -113,17 +129,15 @@ int main(void) } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.86.0. -.SH RETURN VALUE -This function returns a pointer to a \fIcurl_ws_frame\fP struct with read-only + +# RETURN VALUE + +This function returns a pointer to a *curl_ws_frame* struct with read-only information that is valid for this specific callback invocation. If it cannot return this information, or if the function is called in the wrong context, it returns NULL. -.SH "SEE ALSO" -.BR curl_easy_setopt (3), -.BR curl_easy_getinfo (3), -.BR curl_ws_send (3), -.BR curl_ws_recv (3), -.BR libcurl-ws (3) diff --git a/docs/libcurl/curl_ws_recv.3 b/docs/libcurl/curl_ws_recv.3 deleted file mode 100644 index e35d93688..000000000 --- a/docs/libcurl/curl_ws_recv.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_ws_recv 3 "12 Jun 2022" "libcurl" "libcurl" -.SH NAME -curl_ws_recv - receive WebSocket data -.SH SYNOPSIS -.nf -#include - -CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen, - size_t *recv, const struct curl_ws_frame **meta); -.fi -.SH DESCRIPTION -This function call is EXPERIMENTAL. - -Retrieves as much as possible of a received WebSocket data fragment into the -\fBbuffer\fP, but not more than \fBbuflen\fP bytes. \fIrecv\fP is set to the -number of bytes actually stored. - -If there is more fragment data to deliver than what fits in the provided -\fIbuffer\fP, libcurl returns a full buffer and the application needs to call -this function again to continue draining the buffer. - -The \fImeta\fP pointer gets set to point to a \fIconst struct curl_ws_frame\fP -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]; - 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. -.SH RETURN VALUE -Returns \fBCURLE_OK\fP if everything is okay, and a non-zero number for -errors. Returns \fBCURLE_GOT_NOTHING\fP if the associated connection is -closed. - -Instead of blocking, the function returns \fBCURLE_AGAIN\fP. The correct -behavior is then to wait for the socket to signal readability before calling -this function again. -.SH "SEE ALSO" -.BR curl_easy_setopt (3), -.BR curl_easy_perform (3), -.BR curl_easy_getinfo (3), -.BR curl_ws_send (3), -.BR libcurl-ws (3) diff --git a/docs/libcurl/curl_ws_recv.md b/docs/libcurl/curl_ws_recv.md new file mode 100644 index 000000000..d801eddee --- /dev/null +++ b/docs/libcurl/curl_ws_recv.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_ws_recv +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_perform (3) + - curl_easy_setopt (3) + - curl_ws_send (3) + - libcurl-ws (3) +--- + +# NAME + +curl_ws_recv - receive WebSocket data + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen, + size_t *recv, const struct curl_ws_frame **meta); +~~~ + +# DESCRIPTION + +This function call is EXPERIMENTAL. + +Retrieves as much as possible of a received WebSocket data fragment into the +**buffer**, but not more than **buflen** bytes. *recv* is set to the +number of bytes actually stored. + +If there is more fragment data to deliver than what fits in the provided +*buffer*, libcurl returns a full buffer and the application needs to call +this function again to continue draining the buffer. + +The *meta* pointer gets set to point to a *const struct curl_ws_frame* +that contains information about the received data. See the +curl_ws_meta(3) for details on that struct. + +# EXAMPLE + +~~~c +int main(void) +{ + size_t rlen; + const struct curl_ws_frame *meta; + char buffer[256]; + 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)); + } +} +~~~ + +# AVAILABILITY + +Added in 7.86.0. + +# RETURN VALUE + +Returns **CURLE_OK** if everything is okay, and a non-zero number for +errors. Returns **CURLE_GOT_NOTHING** if the associated connection is +closed. + +Instead of blocking, the function returns **CURLE_AGAIN**. The correct +behavior is then to wait for the socket to signal readability before calling +this function again. diff --git a/docs/libcurl/curl_ws_send.3 b/docs/libcurl/curl_ws_send.3 deleted file mode 100644 index 95873b787..000000000 --- a/docs/libcurl/curl_ws_send.3 +++ /dev/null @@ -1,111 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH curl_ws_send 3 "12 Jun 2022" "libcurl" "libcurl" -.SH NAME -curl_ws_send - send WebSocket data -.SH SYNOPSIS -.nf -#include - -CURLcode curl_ws_send(CURL *curl, const void *buffer, size_t buflen, - size_t *sent, curl_off_t fragsize, - unsigned int flags); -.fi -.SH DESCRIPTION -This function call is EXPERIMENTAL. - -Send the specific message fragment over an established WebSocket -connection. The \fIbuffer\fP holds the data to send and it is \fIbuflen\fP -number of payload bytes in that memory area. - -\fIsent\fP is returned as the number of payload bytes actually sent. - -To send a (huge) fragment using multiple calls with partial content per -invoke, set the \fICURLWS_OFFSET\fP bit and the \fIfragsize\fP argument as the -total expected size for the first part, then set the \fICURLWS_OFFSET\fP with -a zero \fIfragsize\fP for the following parts. - -If not sending a partial fragment or if this is raw mode, \fIfragsize\fP -should be set to zero. - -If \fBCURLWS_RAW_MODE\fP is enabled in \fICURLOPT_WS_OPTIONS(3)\fP, the -\fBflags\fP argument should be set to 0. - -To send a message consisting of multiple frames, set the \fICURLWS_CONT\fP bit -in all frames except the final one. -.SH FLAGS -.IP CURLWS_TEXT -The buffer contains text data. Note that this makes a difference to WebSocket -but libcurl itself does not make any verification of the content or -precautions that you actually send valid UTF-8 content. -.IP CURLWS_BINARY -This is binary data. -.IP CURLWS_CONT -This is not the final fragment of the message, which implies that there is -another fragment coming as part of the same message where this bit is not set. -.IP CURLWS_CLOSE -Close this transfer. -.IP CURLWS_PING -This is a ping. -.IP CURLWS_PONG -This is a pong. -.IP CURLWS_OFFSET -The provided data is only a partial fragment and there is more coming in a -following call to \fIcurl_ws_send()\fP. When sending only a piece of the -fragment like this, the \fIfragsize\fP must be provided with the total -expected fragment size in the first call and it needs to be zero in subsequent -calls. -.SH EXAMPLE -.nf -#include /* for strlen */ - -const char *send_payload = "magic"; - -int main(void) -{ - size_t sent; - 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 -Added in 7.86.0. -.SH RETURN VALUE -\fICURLE_OK\fP (zero) means that the data was sent properly, non-zero means an -error occurred as \fI\fP defines. See the \fIlibcurl-errors(3)\fP -man page for the full list with descriptions. -.SH "SEE ALSO" -.BR curl_easy_setopt (3), -.BR curl_easy_perform (3), -.BR curl_easy_getinfo (3), -.BR curl_ws_recv (3), -.BR libcurl-ws (3) diff --git a/docs/libcurl/curl_ws_send.md b/docs/libcurl/curl_ws_send.md new file mode 100644 index 000000000..a5a056c9d --- /dev/null +++ b/docs/libcurl/curl_ws_send.md @@ -0,0 +1,120 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: curl_ws_send +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_perform (3) + - curl_easy_setopt (3) + - curl_ws_recv (3) + - libcurl-ws (3) +--- + +# NAME + +curl_ws_send - send WebSocket data + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_ws_send(CURL *curl, const void *buffer, size_t buflen, + size_t *sent, curl_off_t fragsize, + unsigned int flags); +~~~ + +# DESCRIPTION + +This function call is EXPERIMENTAL. + +Send the specific message fragment over an established WebSocket +connection. The *buffer* holds the data to send and it is *buflen* +number of payload bytes in that memory area. + +*sent* is returned as the number of payload bytes actually sent. + +To send a (huge) fragment using multiple calls with partial content per +invoke, set the *CURLWS_OFFSET* bit and the *fragsize* argument as the +total expected size for the first part, then set the *CURLWS_OFFSET* with +a zero *fragsize* for the following parts. + +If not sending a partial fragment or if this is raw mode, *fragsize* +should be set to zero. + +If **CURLWS_RAW_MODE** is enabled in CURLOPT_WS_OPTIONS(3), the +**flags** argument should be set to 0. + +To send a message consisting of multiple frames, set the *CURLWS_CONT* bit +in all frames except the final one. + +# FLAGS + +## CURLWS_TEXT + +The buffer contains text data. Note that this makes a difference to WebSocket +but libcurl itself does not make any verification of the content or +precautions that you actually send valid UTF-8 content. + +## CURLWS_BINARY + +This is binary data. + +## CURLWS_CONT + +This is not the final fragment of the message, which implies that there is +another fragment coming as part of the same message where this bit is not set. + +## CURLWS_CLOSE + +Close this transfer. + +## CURLWS_PING + +This is a ping. + +## CURLWS_PONG + +This is a pong. + +## CURLWS_OFFSET + +The provided data is only a partial fragment and there is more coming in a +following call to *curl_ws_send()*. When sending only a piece of the +fragment like this, the *fragsize* must be provided with the total +expected fragment size in the first call and it needs to be zero in subsequent +calls. + +# EXAMPLE + +~~~c +#include /* for strlen */ + +const char *send_payload = "magic"; + +int main(void) +{ + size_t sent; + 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; +} +~~~ + +# AVAILABILITY + +Added in 7.86.0. + +# RETURN VALUE + +*CURLE_OK* (zero) means that the data was sent properly, non-zero means an +error occurred as ** defines. See the libcurl-errors(3) +man page for the full list with descriptions. diff --git a/docs/libcurl/libcurl-easy.3 b/docs/libcurl/libcurl-easy.3 deleted file mode 100644 index 1842c2116..000000000 --- a/docs/libcurl/libcurl-easy.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl 3 "19 Sep 2014" "libcurl" "libcurl" -.SH NAME -libcurl-easy \- easy interface overview -.SH DESCRIPTION -When using libcurl's "easy" interface you init your session and get a handle -(often referred to as an "easy handle"), which you use as input to the easy -interface functions you use. Use \fIcurl_easy_init(3)\fP to get the handle. - -You continue by setting all the options you want in the upcoming transfer, the -most important among them is the URL itself (you cannot transfer anything -without a specified URL as you may have figured out yourself). You might want -to set some callbacks as well that are called from the library when data is -available etc. \fIcurl_easy_setopt(3)\fP is used for all this. - -\fICURLOPT_URL(3)\fP is the only option you really must set, as otherwise -there can be no transfer. Another commonly used option is -\fICURLOPT_VERBOSE(3)\fP that helps you see what libcurl is doing under the -hood, which is useful when debugging for example. The -\fIcurl_easy_setopt(3)\fP man page has a full index of the almost 300 -available options. - -If you at any point would like to blank all previously set options for a -single easy handle, you can call \fIcurl_easy_reset(3)\fP and you can also -make a clone of an easy handle (with all its set options) using -\fIcurl_easy_duphandle(3)\fP. - -When all is setup, you tell libcurl to perform the transfer using -\fIcurl_easy_perform(3)\fP. It performs the entire transfer operation and does -not return until it is done (successfully or not). - -After the transfer has been made, you can set new options and make another -transfer, or if you are done, cleanup the session by calling -\fIcurl_easy_cleanup(3)\fP. If you want persistent connections, you do not -cleanup immediately, but instead run ahead and perform other transfers using -the same easy handle. -.SH "SEE ALSO" -.BR curl_easy_init (3), -.BR curl_easy_cleanup (3), -.BR curl_easy_setopt (3), -.BR libcurl-errors (3), -.BR libcurl-multi (3), -.BR libcurl (3) diff --git a/docs/libcurl/libcurl-easy.md b/docs/libcurl/libcurl-easy.md new file mode 100644 index 000000000..f456c97be --- /dev/null +++ b/docs/libcurl/libcurl-easy.md @@ -0,0 +1,52 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl +Section: 3 +Source: libcurl +See-also: + - curl_easy_cleanup (3) + - curl_easy_init (3) + - curl_easy_setopt (3) + - libcurl (3) + - libcurl-errors (3) + - libcurl-multi (3) +--- + +# NAME + +libcurl-easy - easy interface overview + +# DESCRIPTION + +When using libcurl's "easy" interface you init your session and get a handle +(often referred to as an "easy handle"), which you use as input to the easy +interface functions you use. Use curl_easy_init(3) to get the handle. + +You continue by setting all the options you want in the upcoming transfer, the +most important among them is the URL itself (you cannot transfer anything +without a specified URL as you may have figured out yourself). You might want +to set some callbacks as well that are called from the library when data is +available etc. curl_easy_setopt(3) is used for all this. + +CURLOPT_URL(3) is the only option you really must set, as otherwise +there can be no transfer. Another commonly used option is +CURLOPT_VERBOSE(3) that helps you see what libcurl is doing under the +hood, which is useful when debugging for example. The +curl_easy_setopt(3) man page has a full index of the almost 300 +available options. + +If you at any point would like to blank all previously set options for a +single easy handle, you can call curl_easy_reset(3) and you can also +make a clone of an easy handle (with all its set options) using +curl_easy_duphandle(3). + +When all is setup, you tell libcurl to perform the transfer using +curl_easy_perform(3). It performs the entire transfer operation and does +not return until it is done (successfully or not). + +After the transfer has been made, you can set new options and make another +transfer, or if you are done, cleanup the session by calling +curl_easy_cleanup(3). If you want persistent connections, you do not +cleanup immediately, but instead run ahead and perform other transfers using +the same easy handle. diff --git a/docs/libcurl/libcurl-env-dbg.3 b/docs/libcurl/libcurl-env-dbg.3 deleted file mode 100644 index 6995a8ede..000000000 --- a/docs/libcurl/libcurl-env-dbg.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl-env-dbg 3 "18 September 2023" "libcurl" "libcurl" -.SH NAME -libcurl-env-dbg \- environment variables libcurl DEBUGBUILD understands -.SH DESCRIPTION -This is a set of variables only recognized and used if libcurl was built -"debug enabled", which should never be true for a library used in production. -These variables are intended for internal use only, subject to change and have -many effects on the behavior of libcurl. Refer to the source code to determine -how exactly they are being used. -.RS -.IP "CURL_ALTSVC_HTTP" -Bypass the AltSvc HTTPS protocol restriction if this variable exists. -.IP "CURL_DBG_SOCK_RBLOCK" -The percentage of recv() calls that should be answered with a EAGAIN at random. -For TCP/UNIX sockets. -.IP "CURL_DBG_SOCK_RMAX" -The maximum data that shall be received from the network in one recv() call. -For TCP/UNIX sockets. This is applied to every recv. - -Example: \fBCURL_DBG_SOCK_RMAX=400\fP means recv buffer size is limited to a -maximum of 400 bytes. -.IP "CURL_DBG_SOCK_WBLOCK" -The percentage of send() calls that should be answered with a EAGAIN at random. -For TCP/UNIX sockets. -.IP "CURL_DBG_SOCK_WPARTIAL" -The percentage of data that shall be written to the network. For TCP/UNIX -sockets. This is applied to every send. - -Example: \fBCURL_DBG_SOCK_WPARTIAL=80\fP means a send with 1000 bytes would -only send 800. -.IP "CURL_DBG_QUIC_WBLOCK" -The percentage of send() calls that should be answered with EAGAIN at random. -QUIC only. -.IP "CURL_DEBUG" -Trace logging behavior as an alternative to calling \fIcurl_global_trace(3)\fP. - -Example: \fBCURL_DEBUG=http/2\fP means trace details about HTTP/2 handling. -.IP "CURL_DEBUG_SIZE" -Fake the size returned by CURLINFO_HEADER_SIZE and CURLINFO_REQUEST_SIZE. -.IP "CURL_GETHOSTNAME" -Fake the local machine's unqualified hostname for NTLM and SMTP. -.IP "CURL_HSTS_HTTP" -Bypass the HSTS HTTPS protocol restriction if this variable exists. -.IP "CURL_FORCETIME" -A time of 0 is used for AWS signatures and NTLM if this variable exists. -.IP "CURL_ENTROPY" -A fixed faked value to use instead of a proper random number so that functions -in libcurl that are otherwise getting random outputs can be tested for what -they generate. -.IP "CURL_SMALLREQSEND" -An alternative size of HTTP data to be sent at a time only if smaller than the -current. -.IP "CURL_SMALLSENDS" -An alternative size of socket data to be sent at a time only if smaller than -the current. -.IP "CURL_TIME" -Fake unix timestamp to use for AltSvc, HSTS and CURLINFO variables that are -time related. - -This variable can also be used to fake the data returned by some CURLINFO -variables that are not time-related (such as CURLINFO_LOCAL_PORT), and in that -case the value is not a timestamp. -.IP "CURL_TRACE" -LDAP tracing is enabled if this variable exists and its value is 1 or greater. - -OpenLDAP tracing is separate. Refer to CURL_OPENLDAP_TRACE. -.IP "CURL_NTLM_WB_FILE" -Debug-version of the \fIntlm-wb\fP executable. -.IP "CURL_OPENLDAP_TRACE" -OpenLDAP tracing is enabled if this variable exists and its value is 1 or -greater. There's a number of debug levels, refer to \fIopenldap.c\fP comments. -.RE -.SH "SEE ALSO" -.BR libcurl-env (3) diff --git a/docs/libcurl/libcurl-env-dbg.md b/docs/libcurl/libcurl-env-dbg.md new file mode 100644 index 000000000..d697a72fb --- /dev/null +++ b/docs/libcurl/libcurl-env-dbg.md @@ -0,0 +1,118 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-env-dbg +Section: 3 +Source: libcurl +See-also: + - libcurl-env (3) +--- + +# NAME + +libcurl-env-dbg - environment variables libcurl DEBUGBUILD understands + +# DESCRIPTION + +This is a set of variables only recognized and used if libcurl was built +"debug enabled", which should never be true for a library used in production. +These variables are intended for internal use only, subject to change and have +many effects on the behavior of libcurl. Refer to the source code to determine +how exactly they are being used. + +## CURL_ALTSVC_HTTP + +Bypass the AltSvc HTTPS protocol restriction if this variable exists. + +## CURL_DBG_SOCK_RBLOCK + +The percentage of recv() calls that should be answered with a EAGAIN at random. +For TCP/UNIX sockets. + +## CURL_DBG_SOCK_RMAX + +The maximum data that shall be received from the network in one recv() call. +For TCP/UNIX sockets. This is applied to every recv. + +Example: **CURL_DBG_SOCK_RMAX=400** means recv buffer size is limited to a +maximum of 400 bytes. + +## CURL_DBG_SOCK_WBLOCK + +The percentage of send() calls that should be answered with a EAGAIN at random. +For TCP/UNIX sockets. + +## CURL_DBG_SOCK_WPARTIAL + +The percentage of data that shall be written to the network. For TCP/UNIX +sockets. This is applied to every send. + +Example: **CURL_DBG_SOCK_WPARTIAL=80** means a send with 1000 bytes would +only send 800. + +## CURL_DBG_QUIC_WBLOCK + +The percentage of send() calls that should be answered with EAGAIN at random. +QUIC only. + +## CURL_DEBUG + +Trace logging behavior as an alternative to calling curl_global_trace(3). + +Example: **CURL_DEBUG=http/2** means trace details about HTTP/2 handling. + +## CURL_DEBUG_SIZE + +Fake the size returned by CURLINFO_HEADER_SIZE and CURLINFO_REQUEST_SIZE. + +## CURL_GETHOSTNAME + +Fake the local machine's unqualified hostname for NTLM and SMTP. + +## CURL_HSTS_HTTP + +Bypass the HSTS HTTPS protocol restriction if this variable exists. + +## CURL_FORCETIME + +A time of 0 is used for AWS signatures and NTLM if this variable exists. + +## CURL_ENTROPY + +A fixed faked value to use instead of a proper random number so that functions +in libcurl that are otherwise getting random outputs can be tested for what +they generate. + +## CURL_SMALLREQSEND + +An alternative size of HTTP data to be sent at a time only if smaller than the +current. + +## CURL_SMALLSENDS + +An alternative size of socket data to be sent at a time only if smaller than +the current. + +## CURL_TIME + +Fake unix timestamp to use for AltSvc, HSTS and CURLINFO variables that are +time related. + +This variable can also be used to fake the data returned by some CURLINFO +variables that are not time-related (such as CURLINFO_LOCAL_PORT), and in that +case the value is not a timestamp. + +## CURL_TRACE + +LDAP tracing is enabled if this variable exists and its value is 1 or greater. + +OpenLDAP tracing is separate. Refer to CURL_OPENLDAP_TRACE. + +## CURL_NTLM_WB_FILE + +Debug-version of the *ntlm-wb* executable. + +## CURL_OPENLDAP_TRACE + +OpenLDAP tracing is enabled if this variable exists and its value is 1 or +greater. There's a number of debug levels, refer to *openldap.c* comments. diff --git a/docs/libcurl/libcurl-env.3 b/docs/libcurl/libcurl-env.3 deleted file mode 100644 index c2ba43215..000000000 --- a/docs/libcurl/libcurl-env.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl-env 3 "20 January 2018" "libcurl" "libcurl" -.SH NAME -libcurl-env \- environment variables libcurl understands -.SH DESCRIPTION -libcurl reads and understands a set of environment variables that if set -controls and changes behaviors. This is the full list of variables to set and -description of what they do. Also note that curl, the command line tool, -supports a set of additional environment variables independently of this. -.RS -.IP "[scheme]_proxy" -When libcurl is given a URL to use in a transfer, it first extracts the scheme -part from the URL and checks if there is a given proxy set for that in its -corresponding environment variable. A URL like https://example.com makes -libcurl use the \fBhttp_proxy\fP variable, while a URL like ftp://example.com -uses the \fBftp_proxy\fP variable. - -These proxy variables are also checked for in their uppercase versions, except -the \fBhttp_proxy\fP one which is only used lowercase. Note also that some -systems actually have a case insensitive handling of environment variables and -then of course \fBHTTP_PROXY\fP still works. - -An exception exists for the WebSocket \fBws\fP and \fBwss\fP URL schemes, -where libcurl first checks \fBws_proxy\fP or \fBwss_proxy\fP but if they are -not set, it will fall back and try the http and https versions instead if set. -.IP ALL_PROXY -This is a setting to set proxy for all URLs, independently of what scheme is -being used. Note that the scheme specific variables overrides this one if set. -.IP CURL_SSL_BACKEND -When libcurl is built to support multiple SSL backends, it selects a specific -backend at first use. If no selection is done by the program using libcurl, -this variable's selection is used. Setting a name that is not a built-in -alternative makes libcurl stay with the default. - -SSL backend names (case-insensitive): BearSSL, GnuTLS, mbedTLS, -nss, OpenSSL, rustls, Schannel, Secure-Transport, wolfSSL -.IP HOME -When the netrc feature is used (\fICURLOPT_NETRC(3)\fP), this variable is -checked as the primary way to find the "current" home directory in which -the .netrc file is likely to exist. -.IP USERPROFILE -When the netrc feature is used (\fICURLOPT_NETRC(3)\fP), this variable is -checked as the secondary way to find the "current" home directory (on Windows -only) in which the .netrc file is likely to exist. -.IP LOGNAME -User name to use when invoking the \fIntlm-wb\fP tool, if \fINTLMUSER\fP was -not set. -.IP NO_PROXY -This has the same functionality as the \fICURLOPT_NOPROXY(3)\fP option: it -gives libcurl a comma-separated list of host name patterns for which libcurl -should not use a proxy. -.IP NTLMUSER -User name to use when invoking the \fIntlm-wb\fP tool. -.IP SSLKEYLOGFILE -When set and libcurl runs with a SSL backend that supports this feature, -libcurl saves SSL secrets into the given file name. Using those SSL secrets, -other tools (such as Wireshark) can decrypt the SSL communication and -analyze/view the traffic. - -These secrets and this file might be sensitive. Users are advised to take -precautions so that they are not stolen or otherwise inadvertently revealed. -.IP USER -User name to use when invoking the \fIntlm-wb\fP tool, if \fINTLMUSER\fP and -\fILOGNAME\fP were not set. -.RE -.SH "Debug Variables" -Debug variables are intended for internal use and are documented in -\fIlibcurl-env-dbg(3)\fP. -.SH "SEE ALSO" -.BR libcurl-env-dbg (3) diff --git a/docs/libcurl/libcurl-env.md b/docs/libcurl/libcurl-env.md new file mode 100644 index 000000000..410ed03f7 --- /dev/null +++ b/docs/libcurl/libcurl-env.md @@ -0,0 +1,99 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-env +Section: 3 +Source: libcurl +See-also: + - libcurl-env-dbg (3) +--- + +# NAME + +libcurl-env - environment variables libcurl understands + +# DESCRIPTION + +libcurl reads and understands a set of environment variables that if set +controls and changes behaviors. This is the full list of variables to set and +description of what they do. Also note that curl, the command line tool, +supports a set of additional environment variables independently of this. + +## [scheme]_proxy + +When libcurl is given a URL to use in a transfer, it first extracts the scheme +part from the URL and checks if there is a given proxy set for that in its +corresponding environment variable. A URL like https://example.com makes +libcurl use the **http_proxy** variable, while a URL like ftp://example.com +uses the **ftp_proxy** variable. + +These proxy variables are also checked for in their uppercase versions, except +the **http_proxy** one which is only used lowercase. Note also that some +systems actually have a case insensitive handling of environment variables and +then of course **HTTP_PROXY** still works. + +An exception exists for the WebSocket **ws** and **wss** URL schemes, +where libcurl first checks **ws_proxy** or **wss_proxy** but if they are +not set, it will fall back and try the http and https versions instead if set. + +## ALL_PROXY + +This is a setting to set proxy for all URLs, independently of what scheme is +being used. Note that the scheme specific variables overrides this one if set. + +## CURL_SSL_BACKEND + +When libcurl is built to support multiple SSL backends, it selects a specific +backend at first use. If no selection is done by the program using libcurl, +this variable's selection is used. Setting a name that is not a built-in +alternative makes libcurl stay with the default. + +SSL backend names (case-insensitive): BearSSL, GnuTLS, mbedTLS, +nss, OpenSSL, rustls, Schannel, Secure-Transport, wolfSSL + +## HOME + +When the netrc feature is used (CURLOPT_NETRC(3)), this variable is +checked as the primary way to find the "current" home directory in which +the .netrc file is likely to exist. + +## USERPROFILE + +When the netrc feature is used (CURLOPT_NETRC(3)), this variable is +checked as the secondary way to find the "current" home directory (on Windows +only) in which the .netrc file is likely to exist. + +## LOGNAME + +User name to use when invoking the *ntlm-wb* tool, if *NTLMUSER* was +not set. + +## NO_PROXY + +This has the same functionality as the CURLOPT_NOPROXY(3) option: it +gives libcurl a comma-separated list of host name patterns for which libcurl +should not use a proxy. + +## NTLMUSER + +User name to use when invoking the *ntlm-wb* tool. + +## SSLKEYLOGFILE + +When set and libcurl runs with a SSL backend that supports this feature, +libcurl saves SSL secrets into the given file name. Using those SSL secrets, +other tools (such as Wireshark) can decrypt the SSL communication and +analyze/view the traffic. + +These secrets and this file might be sensitive. Users are advised to take +precautions so that they are not stolen or otherwise inadvertently revealed. + +## USER + +User name to use when invoking the *ntlm-wb* tool, if *NTLMUSER* and +*LOGNAME* were not set. + +# Debug Variables + +Debug variables are intended for internal use and are documented in +libcurl-env-dbg(3). diff --git a/docs/libcurl/libcurl-errors.3 b/docs/libcurl/libcurl-errors.md similarity index 58% rename from docs/libcurl/libcurl-errors.3 rename to docs/libcurl/libcurl-errors.md index cd7bd9a3d..a04660526 100644 --- a/docs/libcurl/libcurl-errors.3 +++ b/docs/libcurl/libcurl-errors.md @@ -1,443 +1,757 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-errors 3 "23 Nov 2021" "libcurl" "libcurl" -.SH NAME -libcurl-errors \- error codes in libcurl -.SH DESCRIPTION +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-errors +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_ERRORBUFFER (3) + - CURLOPT_VERBOSE (3) + - curl_easy_strerror (3) + - curl_multi_strerror (3) + - curl_share_strerror (3) + - curl_url_strerror (3) +--- + +# NAME + +libcurl-errors - error codes in libcurl + +# DESCRIPTION + This man page includes most, if not all, available error codes in libcurl. Why they occur and possibly what you can do to fix the problem are also included. -.SH "CURLcode" + +# CURLcode + Almost all "easy" interface functions return a CURLcode error code. No matter -what, using the \fIcurl_easy_setopt(3)\fP option \fICURLOPT_ERRORBUFFER(3)\fP +what, using the curl_easy_setopt(3) option CURLOPT_ERRORBUFFER(3) is a good idea as it gives you a human readable error string that may offer more details about the cause of the error than just the error code. -\fIcurl_easy_strerror(3)\fP can be called to get an error string from a given +curl_easy_strerror(3) can be called to get an error string from a given CURLcode number. CURLcode is one of the following: -.IP "CURLE_OK (0)" + +## CURLE_OK (0) + All fine. Proceed as usual. -.IP "CURLE_UNSUPPORTED_PROTOCOL (1)" + +## CURLE_UNSUPPORTED_PROTOCOL (1) + The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you did not use, it can be a misspelled protocol string or just a protocol libcurl has no code for. -.IP "CURLE_FAILED_INIT (2)" + +## CURLE_FAILED_INIT (2) + Early initialization code failed. This is likely to be an internal error or problem, or a resource problem where something fundamental could not get done at init time. -.IP "CURLE_URL_MALFORMAT (3)" + +## CURLE_URL_MALFORMAT (3) + The URL was not properly formatted. -.IP "CURLE_NOT_BUILT_IN (4)" + +## CURLE_NOT_BUILT_IN (4) + A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. This means that a feature or option was not enabled or explicitly disabled when libcurl was built and in order to get it to function you have to get a rebuilt libcurl. -.IP "CURLE_COULDNT_RESOLVE_PROXY (5)" + +## CURLE_COULDNT_RESOLVE_PROXY (5) + Could not resolve proxy. The given proxy host could not be resolved. -.IP "CURLE_COULDNT_RESOLVE_HOST (6)" + +## CURLE_COULDNT_RESOLVE_HOST (6) + Could not resolve host. The given remote host was not resolved. -.IP "CURLE_COULDNT_CONNECT (7)" + +## CURLE_COULDNT_CONNECT (7) + Failed to connect() to host or proxy. -.IP "CURLE_WEIRD_SERVER_REPLY (8)" + +## CURLE_WEIRD_SERVER_REPLY (8) + The server sent data libcurl could not parse. This error code was known as -\fICURLE_FTP_WEIRD_SERVER_REPLY\fP before 7.51.0. -.IP "CURLE_REMOTE_ACCESS_DENIED (9)" +*CURLE_FTP_WEIRD_SERVER_REPLY* before 7.51.0. + +## CURLE_REMOTE_ACCESS_DENIED (9) + We were denied access to the resource given in the URL. For FTP, this occurs while trying to change to the remote directory. -.IP "CURLE_FTP_ACCEPT_FAILED (10)" + +## CURLE_FTP_ACCEPT_FAILED (10) + While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar. -.IP "CURLE_FTP_WEIRD_PASS_REPLY (11)" + +## CURLE_FTP_WEIRD_PASS_REPLY (11) + After having sent the FTP password to the server, libcurl expects a proper reply. This error code indicates that an unexpected code was returned. -.IP "CURLE_FTP_ACCEPT_TIMEOUT (12)" + +## CURLE_FTP_ACCEPT_TIMEOUT (12) + During an active FTP session while waiting for the server to connect, the -\fICURLOPT_ACCEPTTIMEOUT_MS(3)\fP (or the internal default) timeout expired. -.IP "CURLE_FTP_WEIRD_PASV_REPLY (13)" +CURLOPT_ACCEPTTIMEOUT_MS(3) (or the internal default) timeout expired. + +## CURLE_FTP_WEIRD_PASV_REPLY (13) + libcurl failed to get a sensible result back from the server as a response to either a PASV or a EPSV command. The server is flawed. -.IP "CURLE_FTP_WEIRD_227_FORMAT (14)" + +## CURLE_FTP_WEIRD_227_FORMAT (14) + FTP servers return a 227-line as a response to a PASV command. If libcurl fails to parse that line, this return code is passed back. -.IP "CURLE_FTP_CANT_GET_HOST (15)" + +## CURLE_FTP_CANT_GET_HOST (15) + An internal failure to lookup the host used for the new connection. -.IP "CURLE_HTTP2 (16)" + +## CURLE_HTTP2 (16) + A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error buffer for details. -.IP "CURLE_FTP_COULDNT_SET_TYPE (17)" + +## CURLE_FTP_COULDNT_SET_TYPE (17) + Received an error when trying to set the transfer mode to binary or ASCII. -.IP "CURLE_PARTIAL_FILE (18)" + +## CURLE_PARTIAL_FILE (18) + A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that does not match the previously given size. -.IP "CURLE_FTP_COULDNT_RETR_FILE (19)" + +## CURLE_FTP_COULDNT_RETR_FILE (19) + This was either a weird reply to a 'RETR' command or a zero byte transfer complete. -.IP "Obsolete error (20)" + +## Obsolete error (20) + Not used in modern versions. -.IP "CURLE_QUOTE_ERROR (21)" + +## CURLE_QUOTE_ERROR (21) + When sending custom "QUOTE" commands to the remote server, one of the commands returned an error code that was 400 or higher (for FTP) or otherwise indicated unsuccessful completion of the command. -.IP "CURLE_HTTP_RETURNED_ERROR (22)" -This is returned if \fICURLOPT_FAILONERROR(3)\fP is set TRUE and the HTTP + +## CURLE_HTTP_RETURNED_ERROR (22) + +This is returned if CURLOPT_FAILONERROR(3) is set TRUE and the HTTP server returns an error code that is >= 400. -.IP "CURLE_WRITE_ERROR (23)" + +## CURLE_WRITE_ERROR (23) + An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback. -.IP "Obsolete error (24)" + +## Obsolete error (24) + Not used in modern versions. -.IP "CURLE_UPLOAD_FAILED (25)" + +## CURLE_UPLOAD_FAILED (25) + Failed starting the upload. For FTP, the server typically denied the STOR command. The error buffer usually contains the server's explanation for this. -.IP "CURLE_READ_ERROR (26)" + +## CURLE_READ_ERROR (26) + There was a problem reading a local file or an error returned by the read callback. -.IP "CURLE_OUT_OF_MEMORY (27)" + +## CURLE_OUT_OF_MEMORY (27) + A memory allocation request failed. This is serious badness and things are severely screwed up if this ever occurs. -.IP "CURLE_OPERATION_TIMEDOUT (28)" + +## CURLE_OPERATION_TIMEDOUT (28) + Operation timeout. The specified time-out period was reached according to the conditions. -.IP "Obsolete error (29)" + +## Obsolete error (29) + Not used in modern versions. -.IP "CURLE_FTP_PORT_FAILED (30)" + +## CURLE_FTP_PORT_FAILED (30) + The FTP PORT command returned error. This mostly happens when you have not specified a good enough address for libcurl to use. See -\fICURLOPT_FTPPORT(3)\fP. -.IP "CURLE_FTP_COULDNT_USE_REST (31)" +CURLOPT_FTPPORT(3). + +## CURLE_FTP_COULDNT_USE_REST (31) + The FTP REST command returned error. This should never happen if the server is sane. -.IP "Obsolete error (32)" + +## Obsolete error (32) + Not used in modern versions. -.IP "CURLE_RANGE_ERROR (33)" + +## CURLE_RANGE_ERROR (33) + The server does not support or accept range requests. -.IP "CURLE_HTTP_POST_ERROR (34)" + +## CURLE_HTTP_POST_ERROR (34) + This is an odd error that mainly occurs due to internal confusion. -.IP "CURLE_SSL_CONNECT_ERROR (35)" + +## CURLE_SSL_CONNECT_ERROR (35) + A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others. -.IP "CURLE_BAD_DOWNLOAD_RESUME (36)" + +## CURLE_BAD_DOWNLOAD_RESUME (36) + The download could not be resumed because the specified offset was out of the file boundary. -.IP "CURLE_FILE_COULDNT_READ_FILE (37)" + +## CURLE_FILE_COULDNT_READ_FILE (37) + A file given with FILE:// could not be opened. Most likely because the file path does not identify an existing file. Did you check file permissions? -.IP "CURLE_LDAP_CANNOT_BIND (38)" + +## CURLE_LDAP_CANNOT_BIND (38) + LDAP cannot bind. LDAP bind operation failed. -.IP "CURLE_LDAP_SEARCH_FAILED (39)" + +## CURLE_LDAP_SEARCH_FAILED (39) + LDAP search failed. -.IP "Obsolete error (40)" + +## Obsolete error (40) + Not used in modern versions. -.IP "CURLE_FUNCTION_NOT_FOUND (41)" + +## CURLE_FUNCTION_NOT_FOUND (41) + Function not found. A required zlib function was not found. -.IP "CURLE_ABORTED_BY_CALLBACK (42)" + +## CURLE_ABORTED_BY_CALLBACK (42) + Aborted by callback. A callback returned "abort" to libcurl. -.IP "CURLE_BAD_FUNCTION_ARGUMENT (43)" + +## CURLE_BAD_FUNCTION_ARGUMENT (43) + A function was called with a bad parameter. -.IP "Obsolete error (44)" + +## Obsolete error (44) + Not used in modern versions. -.IP "CURLE_INTERFACE_FAILED (45)" + +## CURLE_INTERFACE_FAILED (45) + Interface error. A specified outgoing interface could not be used. Set which interface to use for outgoing connections' source IP address with -\fICURLOPT_INTERFACE(3)\fP. -.IP "Obsolete error (46)" +CURLOPT_INTERFACE(3). + +## Obsolete error (46) + Not used in modern versions. -.IP "CURLE_TOO_MANY_REDIRECTS (47)" + +## CURLE_TOO_MANY_REDIRECTS (47) + Too many redirects. When following redirects, libcurl hit the maximum amount. -Set your limit with \fICURLOPT_MAXREDIRS(3)\fP. -.IP "CURLE_UNKNOWN_OPTION (48)" +Set your limit with CURLOPT_MAXREDIRS(3). + +## CURLE_UNKNOWN_OPTION (48) + An option passed to libcurl is not recognized/known. Refer to the appropriate documentation. This is most likely a problem in the program that uses libcurl. The error buffer might contain more specific information about which exact option it concerns. -.IP "CURLE_SETOPT_OPTION_SYNTAX (49)" + +## CURLE_SETOPT_OPTION_SYNTAX (49) + An option passed in to a setopt was wrongly formatted. See error message for details about what option. -.IP "Obsolete errors (50-51)" + +## Obsolete errors (50-51) + Not used in modern versions. -.IP "CURLE_GOT_NOTHING (52)" + +## CURLE_GOT_NOTHING (52) + Nothing was returned from the server, and under the circumstances, getting nothing is considered an error. -.IP "CURLE_SSL_ENGINE_NOTFOUND (53)" + +## CURLE_SSL_ENGINE_NOTFOUND (53) + The specified crypto engine was not found. -.IP "CURLE_SSL_ENGINE_SETFAILED (54)" + +## CURLE_SSL_ENGINE_SETFAILED (54) + Failed setting the selected SSL crypto engine as default. -.IP "CURLE_SEND_ERROR (55)" + +## CURLE_SEND_ERROR (55) + Failed sending network data. -.IP "CURLE_RECV_ERROR (56)" + +## CURLE_RECV_ERROR (56) + Failure with receiving network data. -.IP "Obsolete error (57)" + +## Obsolete error (57) + Not used in modern versions. -.IP "CURLE_SSL_CERTPROBLEM (58)" + +## CURLE_SSL_CERTPROBLEM (58) + problem with the local client certificate. -.IP "CURLE_SSL_CIPHER (59)" + +## CURLE_SSL_CIPHER (59) + Could not use specified cipher. -.IP "CURLE_PEER_FAILED_VERIFICATION (60)" + +## CURLE_PEER_FAILED_VERIFICATION (60) + The remote server's SSL certificate or SSH fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51. -.IP "CURLE_BAD_CONTENT_ENCODING (61)" + +## CURLE_BAD_CONTENT_ENCODING (61) + Unrecognized transfer encoding. -.IP "Obsolete error (62)" + +## Obsolete error (62) + Not used in modern versions. -.IP "CURLE_FILESIZE_EXCEEDED (63)" + +## CURLE_FILESIZE_EXCEEDED (63) + Maximum file size exceeded. -.IP "CURLE_USE_SSL_FAILED (64)" + +## CURLE_USE_SSL_FAILED (64) + Requested FTP SSL level failed. -.IP "CURLE_SEND_FAIL_REWIND (65)" + +## CURLE_SEND_FAIL_REWIND (65) + When doing a send operation curl had to rewind the data to retransmit, but the rewinding operation failed. -.IP "CURLE_SSL_ENGINE_INITFAILED (66)" + +## CURLE_SSL_ENGINE_INITFAILED (66) + Initiating the SSL Engine failed. -.IP "CURLE_LOGIN_DENIED (67)" + +## CURLE_LOGIN_DENIED (67) + The remote server denied curl to login (Added in 7.13.1) -.IP "CURLE_TFTP_NOTFOUND (68)" + +## CURLE_TFTP_NOTFOUND (68) + File not found on TFTP server. -.IP "CURLE_TFTP_PERM (69)" + +## CURLE_TFTP_PERM (69) + Permission problem on TFTP server. -.IP "CURLE_REMOTE_DISK_FULL (70)" + +## CURLE_REMOTE_DISK_FULL (70) + Out of disk space on the server. -.IP "CURLE_TFTP_ILLEGAL (71)" + +## CURLE_TFTP_ILLEGAL (71) + Illegal TFTP operation. -.IP "CURLE_TFTP_UNKNOWNID (72)" + +## CURLE_TFTP_UNKNOWNID (72) + Unknown TFTP transfer ID. -.IP "CURLE_REMOTE_FILE_EXISTS (73)" + +## CURLE_REMOTE_FILE_EXISTS (73) + File already exists and is not overwritten. -.IP "CURLE_TFTP_NOSUCHUSER (74)" + +## CURLE_TFTP_NOSUCHUSER (74) + This error should never be returned by a properly functioning TFTP server. -.IP "Obsolete error (75-76)" + +## Obsolete error (75-76) + Not used in modern versions. -.IP "CURLE_SSL_CACERT_BADFILE (77)" + +## CURLE_SSL_CACERT_BADFILE (77) + Problem with reading the SSL CA cert (path? access rights?) -.IP "CURLE_REMOTE_FILE_NOT_FOUND (78)" + +## CURLE_REMOTE_FILE_NOT_FOUND (78) + The resource referenced in the URL does not exist. -.IP "CURLE_SSH (79)" + +## CURLE_SSH (79) + An unspecified error occurred during the SSH session. -.IP "CURLE_SSL_SHUTDOWN_FAILED (80)" + +## CURLE_SSL_SHUTDOWN_FAILED (80) + Failed to shut down the SSL connection. -.IP "CURLE_AGAIN (81)" + +## CURLE_AGAIN (81) + Socket is not ready for send/recv wait till it's ready and try again. This -return code is only returned from \fIcurl_easy_recv(3)\fP and -\fIcurl_easy_send(3)\fP (Added in 7.18.2) -.IP "CURLE_SSL_CRL_BADFILE (82)" +return code is only returned from curl_easy_recv(3) and +curl_easy_send(3) (Added in 7.18.2) + +## CURLE_SSL_CRL_BADFILE (82) + Failed to load CRL file (Added in 7.19.0) -.IP "CURLE_SSL_ISSUER_ERROR (83)" + +## CURLE_SSL_ISSUER_ERROR (83) + Issuer check failed (Added in 7.19.0) -.IP "CURLE_FTP_PRET_FAILED (84)" + +## CURLE_FTP_PRET_FAILED (84) + The FTP server does not understand the PRET command at all or does not support -the given argument. Be careful when using \fICURLOPT_CUSTOMREQUEST(3)\fP, a +the given argument. Be careful when using CURLOPT_CUSTOMREQUEST(3), a custom LIST command is sent with the PRET command before PASV as well. (Added in 7.20.0) -.IP "CURLE_RTSP_CSEQ_ERROR (85)" + +## CURLE_RTSP_CSEQ_ERROR (85) + Mismatch of RTSP CSeq numbers. -.IP "CURLE_RTSP_SESSION_ERROR (86)" + +## CURLE_RTSP_SESSION_ERROR (86) + Mismatch of RTSP Session Identifiers. -.IP "CURLE_FTP_BAD_FILE_LIST (87)" + +## CURLE_FTP_BAD_FILE_LIST (87) + Unable to parse FTP file list (during FTP wildcard downloading). -.IP "CURLE_CHUNK_FAILED (88)" + +## CURLE_CHUNK_FAILED (88) + Chunk callback reported error. -.IP "CURLE_NO_CONNECTION_AVAILABLE (89)" + +## CURLE_NO_CONNECTION_AVAILABLE (89) + (For internal use only, is never returned by libcurl) No connection available, the session is queued. (added in 7.30.0) -.IP "CURLE_SSL_PINNEDPUBKEYNOTMATCH (90)" -Failed to match the pinned key specified with \fICURLOPT_PINNEDPUBLICKEY(3)\fP. -.IP "CURLE_SSL_INVALIDCERTSTATUS (91)" -Status returned failure when asked with \fICURLOPT_SSL_VERIFYSTATUS(3)\fP. -.IP "CURLE_HTTP2_STREAM (92)" + +## CURLE_SSL_PINNEDPUBKEYNOTMATCH (90) + +Failed to match the pinned key specified with CURLOPT_PINNEDPUBLICKEY(3). + +## CURLE_SSL_INVALIDCERTSTATUS (91) + +Status returned failure when asked with CURLOPT_SSL_VERIFYSTATUS(3). + +## CURLE_HTTP2_STREAM (92) + Stream error in the HTTP/2 framing layer. -.IP "CURLE_RECURSIVE_API_CALL (93)" + +## CURLE_RECURSIVE_API_CALL (93) + An API function was called from inside a callback. -.IP "CURLE_AUTH_ERROR (94)" + +## CURLE_AUTH_ERROR (94) + An authentication function returned an error. -.IP "CURLE_HTTP3 (95)" + +## CURLE_HTTP3 (95) + A problem was detected in the HTTP/3 layer. This is somewhat generic and can be one out of several problems, see the error buffer for details. -.IP "CURLE_QUIC_CONNECT_ERROR (96)" + +## CURLE_QUIC_CONNECT_ERROR (96) + QUIC connection error. This error may be caused by an SSL library error. QUIC is the protocol used for HTTP/3 transfers. -.IP "CURLE_PROXY (97)" -Proxy handshake error. \fICURLINFO_PROXY_ERROR(3)\fP provides extra details on + +## CURLE_PROXY (97) + +Proxy handshake error. CURLINFO_PROXY_ERROR(3) provides extra details on the specific problem. -.IP "CURLE_SSL_CLIENTCERT (98)" + +## CURLE_SSL_CLIENTCERT (98) + SSL Client Certificate required. -.IP "CURLE_UNRECOVERABLE_POLL (99)" + +## CURLE_UNRECOVERABLE_POLL (99) + An internal call to poll() or select() returned error that is not recoverable. -.IP "CURLE_TOO_LARGE (100)" + +## CURLE_TOO_LARGE (100) + A value or data field grew larger than allowed. -.SH "CURLMcode" + +# CURLMcode + This is the generic return code used by functions in the libcurl multi -interface. Also consider \fIcurl_multi_strerror(3)\fP. -.IP "CURLM_CALL_MULTI_PERFORM (-1)" +interface. Also consider curl_multi_strerror(3). + +## CURLM_CALL_MULTI_PERFORM (-1) + This is not really an error. It means you should call -\fIcurl_multi_perform(3)\fP again without doing select() or similar in +curl_multi_perform(3) again without doing select() or similar in between. Before version 7.20.0 (released on February 9 2010) this could be returned by -\fIcurl_multi_perform(3)\fP, but in later versions this return code is never +curl_multi_perform(3), but in later versions this return code is never used. -.IP "CURLM_OK (0)" + +## CURLM_OK (0) + Things are fine. -.IP "CURLM_BAD_HANDLE (1)" -The passed-in handle is not a valid \fICURLM\fP handle. -.IP "CURLM_BAD_EASY_HANDLE (2)" + +## CURLM_BAD_HANDLE (1) + +The passed-in handle is not a valid *CURLM* handle. + +## CURLM_BAD_EASY_HANDLE (2) + An easy handle was not good/valid. It could mean that it is not an easy handle at all, or possibly that the handle already is in use by this or another multi handle. -.IP "CURLM_OUT_OF_MEMORY (3)" + +## CURLM_OUT_OF_MEMORY (3) + You are doomed. -.IP "CURLM_INTERNAL_ERROR (4)" + +## CURLM_INTERNAL_ERROR (4) + This can only be returned if libcurl bugs. Please report it to us! -.IP "CURLM_BAD_SOCKET (5)" + +## CURLM_BAD_SOCKET (5) + The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4) -.IP "CURLM_UNKNOWN_OPTION (6)" + +## CURLM_UNKNOWN_OPTION (6) + curl_multi_setopt() with unsupported option (Added in 7.15.4) -.IP "CURLM_ADDED_ALREADY (7)" + +## CURLM_ADDED_ALREADY (7) + An easy handle already added to a multi handle was attempted to get added a second time. (Added in 7.32.1) -.IP "CURLM_RECURSIVE_API_CALL (8)" + +## CURLM_RECURSIVE_API_CALL (8) + An API function was called from inside a callback. -.IP "CURLM_WAKEUP_FAILURE (9)" + +## CURLM_WAKEUP_FAILURE (9) + Wake up is unavailable or failed. -.IP "CURLM_BAD_FUNCTION_ARGUMENT (10)" + +## CURLM_BAD_FUNCTION_ARGUMENT (10) + A function was called with a bad parameter. -.IP "CURLM_ABORTED_BY_CALLBACK (11)" + +## CURLM_ABORTED_BY_CALLBACK (11) + A multi handle callback returned error. -.IP "CURLM_UNRECOVERABLE_POLL (12)" + +## CURLM_UNRECOVERABLE_POLL (12) + An internal call to poll() or select() returned error that is not recoverable. -.SH "CURLSHcode" -The "share" interface returns a \fBCURLSHcode\fP to indicate when an error has -occurred. Also consider \fIcurl_share_strerror(3)\fP. -.IP "CURLSHE_OK (0)" + +# CURLSHcode + +The "share" interface returns a **CURLSHcode** to indicate when an error has +occurred. Also consider curl_share_strerror(3). + +## CURLSHE_OK (0) + All fine. Proceed as usual. -.IP "CURLSHE_BAD_OPTION (1)" + +## CURLSHE_BAD_OPTION (1) + An invalid option was passed to the function. -.IP "CURLSHE_IN_USE (2)" + +## CURLSHE_IN_USE (2) + The share object is currently in use. -.IP "CURLSHE_INVALID (3)" + +## CURLSHE_INVALID (3) + An invalid share object was passed to the function. -.IP "CURLSHE_NOMEM (4)" + +## CURLSHE_NOMEM (4) + Not enough memory was available. (Added in 7.12.0) -.IP "CURLSHE_NOT_BUILT_IN (5)" + +## CURLSHE_NOT_BUILT_IN (5) + The requested sharing could not be done because the library you use do not have that particular feature enabled. (Added in 7.23.0) -.SH "CURLUcode" -The URL interface returns a \fICURLUcode\fP to indicate when an error has -occurred. Also consider \fIcurl_url_strerror(3)\fP. -.IP "CURLUE_OK (0)" + +# CURLUcode + +The URL interface returns a *CURLUcode* to indicate when an error has +occurred. Also consider curl_url_strerror(3). + +## CURLUE_OK (0) + All fine. Proceed as usual. -.IP "CURLUE_BAD_HANDLE (1)" + +## CURLUE_BAD_HANDLE (1) + An invalid URL handle was passed as argument. -.IP "CURLUE_BAD_PARTPOINTER (2)" + +## CURLUE_BAD_PARTPOINTER (2) + An invalid 'part' argument was passed as argument. -.IP "CURLUE_MALFORMED_INPUT (3)" + +## CURLUE_MALFORMED_INPUT (3) + A malformed input was passed to a URL API function. -.IP "CURLUE_BAD_PORT_NUMBER (4)" + +## CURLUE_BAD_PORT_NUMBER (4) + The port number was not a decimal number between 0 and 65535. -.IP "CURLUE_UNSUPPORTED_SCHEME (5)" + +## CURLUE_UNSUPPORTED_SCHEME (5) + This libcurl build does not support the given URL scheme. -.IP "CURLUE_URLDECODE (6)" + +## CURLUE_URLDECODE (6) + URL decode error, most likely because of rubbish in the input. -.IP "CURLUE_OUT_OF_MEMORY (7)" + +## CURLUE_OUT_OF_MEMORY (7) + A memory function failed. -.IP "CURLUE_USER_NOT_ALLOWED (8)" + +## CURLUE_USER_NOT_ALLOWED (8) + Credentials was passed in the URL when prohibited. -.IP "CURLUE_UNKNOWN_PART (9)" + +## CURLUE_UNKNOWN_PART (9) + An unknown part ID was passed to a URL API function. -.IP "CURLUE_NO_SCHEME (10)" + +## CURLUE_NO_SCHEME (10) + There is no scheme part in the URL. -.IP "CURLUE_NO_USER (11)" + +## CURLUE_NO_USER (11) + There is no user part in the URL. -.IP "CURLUE_NO_PASSWORD (12)" + +## CURLUE_NO_PASSWORD (12) + There is no password part in the URL. -.IP "CURLUE_NO_OPTIONS (13)" + +## CURLUE_NO_OPTIONS (13) + There is no options part in the URL. -.IP "CURLUE_NO_HOST (14)" + +## CURLUE_NO_HOST (14) + There is no host part in the URL. -.IP "CURLUE_NO_PORT (15)" + +## CURLUE_NO_PORT (15) + There is no port part in the URL. -.IP "CURLUE_NO_QUERY (16)" + +## CURLUE_NO_QUERY (16) + There is no query part in the URL. -.IP "CURLUE_NO_FRAGMENT (17)" + +## CURLUE_NO_FRAGMENT (17) + There is no fragment part in the URL. -.IP "CURLUE_NO_ZONEID (18)" + +## CURLUE_NO_ZONEID (18) + There is no zone id set in the URL. -.IP "CURLUE_BAD_FILE_URL (19)" + +## CURLUE_BAD_FILE_URL (19) + The file:// URL is invalid. -.IP "CURLUE_BAD_FRAGMENT (20)" + +## CURLUE_BAD_FRAGMENT (20) + The fragment part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_HOSTNAME (21)" + +## CURLUE_BAD_HOSTNAME (21) + The hostname contained bad or invalid characters. -.IP "CURLUE_BAD_IPV6 (22)" + +## CURLUE_BAD_IPV6 (22) + The IPv6 address hostname contained bad or invalid characters. -.IP "CURLUE_BAD_LOGIN (23)" + +## CURLUE_BAD_LOGIN (23) + The login part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_PASSWORD (24)" + +## CURLUE_BAD_PASSWORD (24) + The password part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_PATH (25)" + +## CURLUE_BAD_PATH (25) + The path part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_QUERY (26)" + +## CURLUE_BAD_QUERY (26) + The query part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_SCHEME (27)" + +## CURLUE_BAD_SCHEME (27) + The scheme part of the URL contained bad or invalid characters. -.IP "CURLUE_BAD_SLASHES (28)" + +## CURLUE_BAD_SLASHES (28) + The URL contained an invalid number of slashes. -.IP "CURLUE_BAD_USER (29)" + +## CURLUE_BAD_USER (29) + The user part of the URL contained bad or invalid characters. -.IP "CURLUE_LACKS_IDN (30)" + +## CURLUE_LACKS_IDN (30) + libcurl lacks IDN support. -.IP "CURLUE_TOO_LARGE (31)" + +## CURLUE_TOO_LARGE (31) + A value or data field is larger than allowed. -.SH "CURLHcode" -The header interface returns a \fICURLHcode\fP to indicate when an error has + +# CURLHcode + +The header interface returns a *CURLHcode* to indicate when an error has occurred. -.IP "CURLHE_OK (0)" + +## CURLHE_OK (0) + All fine. Proceed as usual. -.IP "CURLHE_BADINDEX (1)" + +## CURLHE_BADINDEX (1) + There is no header with the requested index. -.IP "CURLHE_MISSING (2)" + +## CURLHE_MISSING (2) + No such header exists. -.IP "CURLHE_NOHEADERS (3)" + +## CURLHE_NOHEADERS (3) + No headers at all have been recorded. -.IP "CURLHE_NOREQUEST (4)" + +## CURLHE_NOREQUEST (4) + There was no such request number. -.IP "CURLHE_OUT_OF_MEMORY (5)" + +## CURLHE_OUT_OF_MEMORY (5) + Out of resources -.IP "CURLHE_BAD_ARGUMENT (6)" + +## CURLHE_BAD_ARGUMENT (6) + One or more of the given arguments are bad. -.IP "CURLHE_NOT_BUILT_IN (7)" + +## CURLHE_NOT_BUILT_IN (7) + HTTP support or the header API has been disabled in the build. -.SH "SEE ALSO" -.BR curl_easy_strerror (3), -.BR curl_multi_strerror (3), -.BR curl_share_strerror (3), -.BR curl_url_strerror (3), -.BR CURLOPT_ERRORBUFFER (3), -.BR CURLOPT_VERBOSE (3), -.BR CURLOPT_DEBUGFUNCTION (3) diff --git a/docs/libcurl/libcurl-multi.3 b/docs/libcurl/libcurl-multi.md similarity index 60% rename from docs/libcurl/libcurl-multi.3 rename to docs/libcurl/libcurl-multi.md index 8bd893185..3acd13ea6 100644 --- a/docs/libcurl/libcurl-multi.3 +++ b/docs/libcurl/libcurl-multi.md @@ -1,39 +1,31 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-multi 3 "19 Sep 2014" "libcurl" "libcurl" -.SH NAME -libcurl-multi \- how to use the multi interface -.SH DESCRIPTION +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-multi +Section: 3 +Source: libcurl +See-also: + - libcurl (3) + - libcurl-easy (3) + - libcurl-errors (3) +--- + +# NAME + +libcurl-multi - how to use the multi interface + +# DESCRIPTION + This is an overview on how to use the libcurl multi interface in your C programs. There are specific man pages for each function mentioned in -here. There is also the \fIlibcurl-tutorial(3)\fP man page for a complete -tutorial to programming with libcurl and the \fIlibcurl-easy(3)\fP man page +here. There is also the libcurl-tutorial(3) man page for a complete +tutorial to programming with libcurl and the libcurl-easy(3) man page for an overview of the libcurl easy interface. All functions in the multi interface are prefixed with curl_multi. -.SH "OBJECTIVES" + +# OBJECTIVES + The multi interface offers several abilities that the easy interface does not. They are mainly: @@ -48,15 +40,17 @@ curl's file descriptors simultaneously. 4. Enable event-based handling and scaling transfers up to and beyond thousands of parallel connections. -.SH "ONE MULTI HANDLE MANY EASY HANDLES" + +# ONE MULTI HANDLE MANY EASY HANDLES + To use the multi interface, you must first create a 'multi handle' with -\fIcurl_multi_init(3)\fP. This handle is then used as input to all further +curl_multi_init(3). This handle is then used as input to all further curl_multi_* functions. With a multi handle and the multi interface you can do several simultaneous transfers in parallel. Each single transfer is built up around an easy handle. You create all the easy handles you need, and setup the appropriate -options for each easy handle using \fIcurl_easy_setopt(3)\fP. +options for each easy handle using curl_easy_setopt(3). There are two flavors of the multi interface, the select() oriented one and the event based one we call multi_socket. You benefit from reading through the @@ -64,21 +58,21 @@ description of both versions to fully understand how they work and differentiate. We start out with the select() oriented version. When an easy handle is setup and ready for transfer, then instead of using -\fIcurl_easy_perform(3)\fP like when using the easy interface for transfers, +curl_easy_perform(3) like when using the easy interface for transfers, you should add the easy handle to the multi handle with -\fIcurl_multi_add_handle(3)\fP. You can add more easy handles to a multi +curl_multi_add_handle(3). You can add more easy handles to a multi handle at any point, even if other transfers are already running. Should you change your mind, the easy handle is again removed from the multi -stack using \fIcurl_multi_remove_handle(3)\fP. Once removed from the multi +stack using curl_multi_remove_handle(3). Once removed from the multi handle, you can again use other easy interface functions like -\fIcurl_easy_perform(3)\fP on the handle or whatever you think is +curl_easy_perform(3) on the handle or whatever you think is necessary. You can remove handles at any point during transfers. Adding the easy handle to the multi handle does not start the transfer. Remember that one of the main ideas with this interface is to let your application drive. You drive the transfers by invoking -\fIcurl_multi_perform(3)\fP. libcurl then transfers data if there is anything +curl_multi_perform(3). libcurl then transfers data if there is anything available to transfer. It uses the callbacks and everything else you have setup in the individual easy handles. It transfers data on all current transfers in the multi stack that are ready to transfer anything. It may be @@ -87,22 +81,22 @@ to the calling application. Your application extracts info from libcurl about when it would like to get invoked to transfer data or do other work. The most convenient way is to use -\fIcurl_multi_poll(3)\fP that helps you wait until the application should call +curl_multi_poll(3) that helps you wait until the application should call libcurl again. The older API to accomplish the same thing is -\fIcurl_multi_fdset(3)\fP that extracts \fIfd_sets\fP from libcurl to use in +curl_multi_fdset(3) that extracts *fd_sets* from libcurl to use in select() or poll() calls in order to get to know when the transfers in the multi stack might need attention. Both these APIs allow for your program to wait for input on your own private file descriptors at the same time. -\fIcurl_multi_timeout(3)\fP also helps you with providing a suitable timeout +curl_multi_timeout(3) also helps you with providing a suitable timeout period for your select() calls. -\fIcurl_multi_perform(3)\fP stores the number of still running transfers in +curl_multi_perform(3) stores the number of still running transfers in one of its input arguments, and by reading that you can figure out when all the transfers in the multi handles are done. 'done' does not mean successful. One or more of the transfers may have failed. To get information about completed transfers, to figure out success or not and -similar, \fIcurl_multi_info_read(3)\fP should be called. It can return a +similar, curl_multi_info_read(3) should be called. It can return a message about a current or previous transfer. Repeated invokes of the function get more messages until the message queue is empty. The information you receive there includes an easy handle pointer which you may use to identify @@ -110,31 +104,33 @@ which easy handle the information regards. When a single transfer is completed, the easy handle is still left added to the multi stack. You need to first remove the easy handle with -\fIcurl_multi_remove_handle(3)\fP and then close it with -\fIcurl_easy_cleanup(3)\fP, or possibly set new options to it and add it again -with \fIcurl_multi_add_handle(3)\fP to start another transfer. +curl_multi_remove_handle(3) and then close it with +curl_easy_cleanup(3), or possibly set new options to it and add it again +with curl_multi_add_handle(3) to start another transfer. When all transfers in the multi stack are done, close the multi handle with -\fIcurl_multi_cleanup(3)\fP. Be careful and please note that you \fBMUST\fP -invoke separate \fIcurl_easy_cleanup(3)\fP calls for every single easy handle +curl_multi_cleanup(3). Be careful and please note that you **MUST** +invoke separate curl_easy_cleanup(3) calls for every single easy handle to clean them up properly. If you want to reuse an easy handle that was added to the multi handle for transfer, you must first remove it from the multi stack and then re-add it again (possibly after having altered some options at your own choice). -.SH "MULTI_SOCKET" -\fIcurl_multi_socket_action(3)\fP function offers a way for applications to + +# MULTI_SOCKET + +curl_multi_socket_action(3) function offers a way for applications to not only avoid being forced to use select(), but it also offers a much more high-performance API that makes a significant difference for applications using large numbers of simultaneous connections. -\fIcurl_multi_socket_action(3)\fP is then used instead of -\fIcurl_multi_perform(3)\fP. +curl_multi_socket_action(3) is then used instead of +curl_multi_perform(3). When using this API, you add easy handles to the multi handle just as with the normal multi interface. Then you also set two callbacks with the -\fICURLMOPT_SOCKETFUNCTION(3)\fP and \fICURLMOPT_TIMERFUNCTION(3)\fP options -to \fIcurl_multi_setopt(3)\fP. They are two callback functions that libcurl +CURLMOPT_SOCKETFUNCTION(3) and CURLMOPT_TIMERFUNCTION(3) options +to curl_multi_setopt(3). They are two callback functions that libcurl calls with information about what sockets to wait for, and for what activity, and what the current timeout time is - if that expires libcurl should be notified. @@ -144,14 +140,14 @@ sockets libcurl is currently using and for what activities (read and/or write) on those sockets your application is expected to wait for. Your application must make sure to receive all sockets informed about in the -\fICURLMOPT_SOCKETFUNCTION(3)\fP callback and make sure it reacts on the given +CURLMOPT_SOCKETFUNCTION(3) callback and make sure it reacts on the given activity on them. When a socket has the given activity, you call -\fIcurl_multi_socket_action(3)\fP specifying which socket and action there +curl_multi_socket_action(3) specifying which socket and action there are. -The \fICURLMOPT_TIMERFUNCTION(3)\fP callback is called to set a timeout. When +The CURLMOPT_TIMERFUNCTION(3) callback is called to set a timeout. When that timeout expires, your application should call the -\fIcurl_multi_socket_action(3)\fP function saying it was due to a timeout. +curl_multi_socket_action(3) function saying it was due to a timeout. This API is typically used with an event-driven underlying functionality (like libevent, libev, kqueue, epoll or similar) with which the application @@ -160,25 +156,23 @@ better scale upward and beyond thousands of simultaneous transfers without losing performance. When you have added your initial set of handles, you call -\fIcurl_multi_socket_action(3)\fP with CURL_SOCKET_TIMEOUT set in the -\fIsockfd\fP argument, and you get callbacks invoked that set you up and you -then continue to call \fIcurl_multi_socket_action(3)\fP accordingly when you +curl_multi_socket_action(3) with CURL_SOCKET_TIMEOUT set in the +*sockfd* argument, and you get callbacks invoked that set you up and you +then continue to call curl_multi_socket_action(3) accordingly when you get activity on the sockets you have been asked to wait on, or if the timeout timer expires. -You can poll \fIcurl_multi_info_read(3)\fP to see if any transfer has +You can poll curl_multi_info_read(3) to see if any transfer has completed, as it then has a message saying so. -.SH "BLOCKING" + +# BLOCKING + A few areas in the code are still using blocking code, even when used from the multi interface. While we certainly want and intend for these to get fixed in the future, you should be aware of the following current restrictions: -.nf +~~~c - Name resolves unless the c-ares or threaded-resolver backends are used - file:// transfers - TELNET transfers -.fi -.SH "SEE ALSO" -.BR libcurl-errors (3), -.BR libcurl-easy (3), -.BR libcurl (3) +~~~ diff --git a/docs/libcurl/libcurl-security.3 b/docs/libcurl/libcurl-security.md similarity index 75% rename from docs/libcurl/libcurl-security.3 rename to docs/libcurl/libcurl-security.md index 4a0d76d66..88c230f49 100644 --- a/docs/libcurl/libcurl-security.3 +++ b/docs/libcurl/libcurl-security.md @@ -1,31 +1,19 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-security 3 "13 Feb 2018" "libcurl" "libcurl" -.SH NAME -libcurl-security \- security considerations when using libcurl -.SH "Security" +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-security +Section: 3 +Source: libcurl +See-also: + - libcurl-thread (3) +--- + +# NAME + +libcurl-security - security considerations when using libcurl + +# Security + The libcurl project takes security seriously. The library is written with caution and precautions are taken to mitigate many kinds of risks encountered while operating with potentially malicious servers on the Internet. It is a @@ -42,17 +30,21 @@ classes of attacks that robust applications should consider. The Common Weakness Enumeration project at https://cwe.mitre.org/ is a good reference for many of these and similar types of weaknesses of which application writers should be aware. -.SH "Command Lines" + +# Command Lines + If you use a command line tool (such as curl) that uses libcurl, and you give options to the tool on the command line those options can get read by other -users of your system when they use \fIps\fP or other tools to list currently +users of your system when they use *ps* or other tools to list currently running processes. To avoid these problems, never feed sensitive things to programs using command -line options. Write them to a protected file and use the \-K option to avoid +line options. Write them to a protected file and use the -K option to avoid this. -.SH ".netrc" -\&.netrc is a pretty handy file/feature that allows you to login quickly and + +# .netrc + +&.netrc is a pretty handy file/feature that allows you to login quickly and automatically to frequently visited sites. The file contains passwords in clear text and is a real security risk. In some cases, your .netrc is also stored in a home directory that is NFS mounted or used on another network @@ -64,7 +56,9 @@ URL might then be possible to pass on passwords. To avoid these problems, do not use .netrc files and never store passwords in plain text anywhere. -.SH "Clear Text Passwords" + +# Clear Text Passwords + Many of the protocols libcurl supports send name and password unencrypted as clear text (HTTP Basic authentication, FTP, TELNET etc). It is easy for anyone on your network or a network nearby yours to just fire up a network analyzer @@ -76,7 +70,9 @@ To avoid this problem, use an authentication mechanism or other protocol that does not let snoopers see your password: Digest, CRAM-MD5, Kerberos, SPNEGO or NTLM authentication. Or even better: use authenticated protocols that protect the entire connection and everything sent over it. -.SH "Unauthenticated Connections" + +# Unauthenticated Connections + Protocols that do not have any form of cryptographic authentication cannot with any certainty know that they communicate with the right remote server. @@ -90,12 +86,18 @@ before it reaches the intended server. If it even reaches the intended server at all. Remedies: -.IP "Restrict operations to authenticated transfers" + +## Restrict operations to authenticated transfers + Use authenticated protocols protected with HTTPS or SSH. -.IP "Make sure the server's certificate etc is verified" + +## Make sure the server's certificate etc is verified + Never ever switch off certificate verification. -.SH "Redirects" -The \fICURLOPT_FOLLOWLOCATION(3)\fP option automatically follows HTTP + +# Redirects + +The CURLOPT_FOLLOWLOCATION(3) option automatically follows HTTP redirects sent by a remote server. These redirects can refer to any kind of URL, not just HTTP. libcurl restricts the protocols allowed to be used in redirects for security reasons: only HTTP, HTTPS, FTP and FTPS are @@ -105,64 +107,68 @@ A redirect to a file: URL would cause the libcurl to read (or write) arbitrary files from the local filesystem. If the application returns the data back to the user (as would happen in some kinds of CGI scripts), an attacker could leverage this to read otherwise forbidden data (e.g. -\fBfile://localhost/etc/passwd\fP). +**file://localhost/etc/passwd**). If authentication credentials are stored in the ~/.netrc file, or Kerberos is in use, any other URL type (not just file:) that requires authentication is -also at risk. A redirect such as ftp://some-internal-server/private-file would +also at risk. A redirect such as **ftp://some-internal-server/private-file** would then return data even when the server is password protected. In the same way, if an unencrypted SSH private key has been configured for the user running the libcurl application, SCP: or SFTP: URLs could access password or private-key protected resources, -e.g. \fBsftp://user@some-internal-server/etc/passwd\fP +e.g. **sftp://user@some-internal-server/etc/passwd** -The \fICURLOPT_REDIR_PROTOCOLS(3)\fP and \fICURLOPT_NETRC(3)\fP options can be +The CURLOPT_REDIR_PROTOCOLS(3) and CURLOPT_NETRC(3) options can be used to mitigate against this kind of attack. A redirect can also specify a location available only on the machine running libcurl, including servers hidden behind a firewall from the attacker. -e.g. http://127.0.0.1/ or http://intranet/delete-stuff.cgi?delete=all or -tftp://bootp-server/pc-config-data +E.g. **http://127.0.0.1/** or **http://intranet/delete-stuff.cgi?delete=all** or +**tftp://bootp-server/pc-config-data** Applications can mitigate against this by disabling -\fICURLOPT_FOLLOWLOCATION(3)\fP and handling redirects itself, sanitizing URLs -as necessary. Alternately, an app could leave \fICURLOPT_FOLLOWLOCATION(3)\fP -enabled but set \fICURLOPT_REDIR_PROTOCOLS(3)\fP and install a -\fICURLOPT_OPENSOCKETFUNCTION(3)\fP or \fICURLOPT_PREREQFUNCTION(3)\fP callback +CURLOPT_FOLLOWLOCATION(3) and handling redirects itself, sanitizing URLs +as necessary. Alternately, an app could leave CURLOPT_FOLLOWLOCATION(3) +enabled but set CURLOPT_REDIR_PROTOCOLS(3) and install a +CURLOPT_OPENSOCKETFUNCTION(3) or CURLOPT_PREREQFUNCTION(3) callback function in which addresses are sanitized before use. -.SH "CRLF in Headers" + +# CRLF in Headers + For all options in libcurl which specify headers, including but not limited to -\fICURLOPT_HTTPHEADER(3)\fP, \fICURLOPT_PROXYHEADER(3)\fP, -\fICURLOPT_COOKIE(3)\fP, \fICURLOPT_USERAGENT(3)\fP, \fICURLOPT_REFERER(3)\fP -and \fICURLOPT_RANGE(3)\fP, libcurl sends the headers as-is and does not apply +CURLOPT_HTTPHEADER(3), CURLOPT_PROXYHEADER(3), +CURLOPT_COOKIE(3), CURLOPT_USERAGENT(3), CURLOPT_REFERER(3) +and CURLOPT_RANGE(3), libcurl sends the headers as-is and does not apply any special sanitation or normalization to them. If you allow untrusted user input into these options without sanitizing CRLF sequences in them, someone malicious may be able to modify the request in a way you did not intend such as injecting new headers. -.SH "Local Resources" + +# Local Resources + A user who can control the DNS server of a domain being passed in within a URL can change the address of the host to a local, private address which a -server-side libcurl-using application could then use. e.g. the innocuous URL -\fBhttp://fuzzybunnies.example.com/\fP could actually resolve to the IP +server-side libcurl-using application could then use. E.g. the innocuous URL +**http://fuzzybunnies.example.com/** could actually resolve to the IP address of a server behind a firewall, such as 127.0.0.1 or 10.1.2.3. Applications can mitigate against this by setting a -\fICURLOPT_OPENSOCKETFUNCTION(3)\fP or \fICURLOPT_PREREQFUNCTION(3)\fP and +CURLOPT_OPENSOCKETFUNCTION(3) or CURLOPT_PREREQFUNCTION(3) and checking the address before a connection. All the malicious scenarios regarding redirected URLs apply just as well to non-redirected URLs, if the user is allowed to specify an arbitrary URL that could point to a private resource. For example, a web app providing a -translation service might happily translate \fBfile://localhost/etc/passwd\fP +translation service might happily translate **file://localhost/etc/passwd** and display the result. Applications can mitigate against this with the -\fICURLOPT_PROTOCOLS(3)\fP option as well as by similar mitigation techniques +CURLOPT_PROTOCOLS(3) option as well as by similar mitigation techniques for redirections. A malicious FTP server could in response to the PASV command return an IP address and port number for a server local to the app running libcurl but behind a firewall. Applications can mitigate against this by using the -\fICURLOPT_FTP_SKIP_PASV_IP(3)\fP option or \fICURLOPT_FTPPORT(3)\fP. +CURLOPT_FTP_SKIP_PASV_IP(3) option or CURLOPT_FTPPORT(3). Local servers sometimes assume local access comes from friends and trusted users. An application that expects https://example.com/file_to_read that and @@ -173,61 +179,75 @@ Allowing your application to connect to local hosts, be it the same machine that runs the application or a machine on the same local network, might be possible to exploit by an attacker who then perhaps can "port-scan" the particular hosts - depending on how the application and servers acts. -.SH "IPv4 Addresses" + +# IPv4 Addresses + Some users might be tempted to filter access to local resources or similar based on numerical IPv4 addresses used in URLs. This is a bad and error-prone idea because of the many different ways a numerical IPv4 address can be specified and libcurl accepts: one to four dot-separated fields using one of or a mix of decimal, octal or hexadecimal encoding. -.SH "IPv6 Addresses" + +# IPv6 Addresses + libcurl handles IPv6 addresses transparently and just as easily as IPv4 addresses. That means that a sanitizing function that filters out addresses -like 127.0.0.1 is not sufficient - the equivalent IPv6 addresses \fB::1\fP, -\fB::\fP, \fB0:00::0:1\fP, \fB::127.0.0.1\fP and \fB::ffff:7f00:1\fP supplied +like 127.0.0.1 is not sufficient - the equivalent IPv6 addresses **::1**, +**::**, **0:00::0:1**, **::127.0.0.1** and **::ffff:7f00:1** supplied somehow by an attacker would all bypass a naive filter and could allow access to undesired local resources. IPv6 also has special address blocks like link-local and site-local that generally should not be accessed by a server-side libcurl-using application. A poorly configured firewall installed in a data center, organization or server may also be configured to limit IPv4 connections but leave IPv6 connections wide open. In some cases, setting -\fICURLOPT_IPRESOLVE(3)\fP to CURL_IPRESOLVE_V4 can be used to limit resolved +CURLOPT_IPRESOLVE(3) to CURL_IPRESOLVE_V4 can be used to limit resolved addresses to IPv4 only and bypass these issues. -.SH Uploads + +# Uploads + When uploading, a redirect can cause a local (or remote) file to be overwritten. Applications must not allow any unsanitized URL to be passed in -for uploads. Also, \fICURLOPT_FOLLOWLOCATION(3)\fP should not be used on +for uploads. Also, CURLOPT_FOLLOWLOCATION(3) should not be used on uploads. Instead, the applications should consider handling redirects itself, sanitizing each URL first. -.SH Authentication -Use of \fICURLOPT_UNRESTRICTED_AUTH(3)\fP could cause authentication + +# Authentication + +Use of CURLOPT_UNRESTRICTED_AUTH(3) could cause authentication information to be sent to an unknown second server. Applications can mitigate -against this by disabling \fICURLOPT_FOLLOWLOCATION(3)\fP and handling +against this by disabling CURLOPT_FOLLOWLOCATION(3) and handling redirects itself, sanitizing where necessary. -Use of the CURLAUTH_ANY option to \fICURLOPT_HTTPAUTH(3)\fP could result in +Use of the CURLAUTH_ANY option to CURLOPT_HTTPAUTH(3) could result in user name and password being sent in clear text to an HTTP server. Instead, use CURLAUTH_ANYSAFE which ensures that the password is encrypted over the network, or else fail the request. -Use of the CURLUSESSL_TRY option to \fICURLOPT_USE_SSL(3)\fP could result in +Use of the CURLUSESSL_TRY option to CURLOPT_USE_SSL(3) could result in user name and password being sent in clear text to an FTP server. Instead, use CURLUSESSL_CONTROL to ensure that an encrypted connection is used or else fail the request. -.SH Cookies + +# Cookies + If cookies are enabled and cached, then a user could craft a URL which performs some malicious action to a site whose authentication is already -stored in a cookie. e.g. http://mail.example.com/delete-stuff.cgi?delete=all -Applications can mitigate against this by disabling cookies or clearing them -between requests. -.SH "Dangerous SCP URLs" +stored in a cookie. E.g. +**http://mail.example.com/delete-stuff.cgi?delete=all** Applications can +mitigate against this by disabling cookies or clearing them between requests. + +# Dangerous SCP URLs + SCP URLs can contain raw commands within the scp: URL, which is a side effect -of how the SCP protocol is designed. e.g. -.nf +of how the SCP protocol is designed. E.g. +~~~ scp://user:pass@host/a;date >/tmp/test; -.fi +~~~ Applications must not allow unsanitized SCP: URLs to be passed in for downloads. -.SH "file://" + +# file:// + By default curl and libcurl support file:// URLs. Such a URL is always an access, or attempted access, to a local resource. If your application wants to avoid that, keep control of what URLs to use and/or prevent curl/libcurl from @@ -235,7 +255,8 @@ using the protocol. By default, libcurl prohibits redirects to file:// URLs. -.SH "Warning: file:// on Windows" +# Warning: file:// on Windows + The Windows operating system tries automatically, and without any way for applications to disable it, to establish a connection to another host over the network and access it (over SMB or other protocols), if only the correct file @@ -260,7 +281,9 @@ If you use curl or libcurl on Windows (any version), disable the use of the FILE protocol in curl or be prepared that accesses to a range of "magic paths" potentially make your system access other hosts on your network. curl cannot protect you against this. -.SH "What if the user can set the URL" + +# What if the user can set the URL + Applications may find it tempting to let users set the URL that it can work on. That is probably fine, but opens up for mischief and trickery that you as an application author may want to address or take precautions against. @@ -278,14 +301,22 @@ particular scheme in the URL but point to a server doing a different protocol on a non-standard port. Remedies: -.IP "Use --proto" -curl command lines can use \fI--proto\fP to limit what URL schemes it accepts -.IP "Use CURLOPT_PROTOCOLS" -libcurl programs can use \fICURLOPT_PROTOCOLS(3)\fP to limit what URL schemes it accepts -.IP "consider not allowing the user to set the full URL" + +## Use --proto + +curl command lines can use *--proto* to limit what URL schemes it accepts + +## Use CURLOPT_PROTOCOLS + +libcurl programs can use CURLOPT_PROTOCOLS(3) to limit what URL schemes it accepts + +## consider not allowing the user to set the full URL + Maybe just let the user provide data for parts of it? Or maybe filter input to only allow specific choices? -.SH "RFC 3986 vs WHATWG URL" + +# RFC 3986 vs WHATWG URL + curl supports URLs mostly according to how they are defined in RFC 3986, and has done so since the beginning. @@ -298,9 +329,11 @@ assumptions about a link. This can mislead users into getting the wrong thing, connecting to the wrong host or otherwise not working identically. Within an application, this can be mitigated by always using the -\fIcurl_url(3)\fP API to parse URLs, ensuring that they are parsed the same way +curl_url(3) API to parse URLs, ensuring that they are parsed the same way as within libcurl itself. -.SH "FTP uses two connections" + +# FTP uses two connections + When performing an FTP transfer, two TCP connections are used: one for setting up the transfer and one for the actual data. @@ -329,46 +362,56 @@ instead of back to curl. The fact that FTP uses two connections makes it vulnerable in a way that is hard to avoid. -.SH "Denial of Service" + +# Denial of Service + A malicious server could cause libcurl to effectively hang by sending data slowly, or even no data at all but just keeping the TCP connection open. This could effectively result in a denial-of-service attack. The -\fICURLOPT_TIMEOUT(3)\fP and/or \fICURLOPT_LOW_SPEED_LIMIT(3)\fP options can +CURLOPT_TIMEOUT(3) and/or CURLOPT_LOW_SPEED_LIMIT(3) options can be used to mitigate against this. A malicious server could cause libcurl to download an infinite amount of data, potentially causing all of memory or disk to be filled. Setting the -\fICURLOPT_MAXFILESIZE_LARGE(3)\fP option is not sufficient to guard against +CURLOPT_MAXFILESIZE_LARGE(3) option is not sufficient to guard against this. Instead, applications should monitor the amount of data received within the write or progress callback and abort once the limit is reached. A malicious HTTP server could cause an infinite redirection loop, causing a denial-of-service. This can be mitigated by using the -\fICURLOPT_MAXREDIRS(3)\fP option. -.SH "Arbitrary Headers" +CURLOPT_MAXREDIRS(3) option. + +# Arbitrary Headers + User-supplied data must be sanitized when used in options like -\fICURLOPT_USERAGENT(3)\fP, \fICURLOPT_HTTPHEADER(3)\fP, -\fICURLOPT_POSTFIELDS(3)\fP and others that are used to generate structured +CURLOPT_USERAGENT(3), CURLOPT_HTTPHEADER(3), +CURLOPT_POSTFIELDS(3) and others that are used to generate structured data. Characters like embedded carriage returns or ampersands could allow the user to create additional headers or fields that could cause malicious transactions. -.SH "Server-supplied Names" + +# Server-supplied Names + A server can supply data which the application may, in some cases, use as a file name. The curl command-line tool does this with -\fI--remote-header-name\fP, using the Content-disposition: header to generate -a file name. An application could also use \fICURLINFO_EFFECTIVE_URL(3)\fP to +*--remote-header-name*, using the Content-disposition: header to generate +a file name. An application could also use CURLINFO_EFFECTIVE_URL(3) to generate a file name from a server-supplied redirect URL. Special care must be taken to sanitize such names to avoid the possibility of a malicious server -supplying one like \fB"/etc/passwd"\fP, \fB"\\autoexec.bat"\fP, \fB"prn:"\fP -or even \fB".bashrc"\fP. -.SH "Server Certificates" -A secure application should never use the \fICURLOPT_SSL_VERIFYPEER(3)\fP +supplying one like **"/etc/passwd"**, **"autoexec.bat"**, **"prn:"** +or even **".bashrc"**. + +# Server Certificates + +A secure application should never use the CURLOPT_SSL_VERIFYPEER(3) option to disable certificate validation. There are numerous attacks that are enabled by applications that fail to properly validate server TLS/SSL certificates, thus enabling a malicious server to spoof a legitimate one. HTTPS without validated certificates is potentially as insecure as a plain HTTP connection. -.SH "Showing What You Do" + +# Showing What You Do + Relatedly, be aware that in situations when you have problems with libcurl and ask someone for help, everything you reveal in order to get best possible help might also impose certain security related risks. Host names, user names, @@ -384,7 +427,9 @@ sensitive data. To avoid this problem, you must of course use your common sense. Often, you can just edit out the sensitive data or just search/replace your true information with faked data. -.SH "setuid applications using libcurl" + +# setuid applications using libcurl + libcurl-using applications that set the 'setuid' bit to run with elevated or modified rights also implicitly give that extra power to libcurl and this should only be done after careful considerations. @@ -396,16 +441,20 @@ that the user is otherwise not able to view (like credentials for a login etc), it should be noted that libcurl still might understand proxy environment variables that allow the user to redirect libcurl operations to use a proxy controlled by the user. -.SH "File descriptors, fork and NTLM" -An application that uses libcurl and invokes \fIfork()\fP gets all file + +# File descriptors, fork and NTLM + +An application that uses libcurl and invokes *fork()* gets all file descriptors duplicated in the child process, including the ones libcurl created. -libcurl itself uses \fIfork()\fP and \fIexecl()\fP if told to use the -\fBCURLAUTH_NTLM_WB\fP authentication method which then invokes the helper +libcurl itself uses *fork()* and *execl()* if told to use the +**CURLAUTH_NTLM_WB** authentication method which then invokes the helper command in a child process with file descriptors duplicated. Make sure that only the trusted and reliable helper program is invoked! -.SH "Secrets in memory" + +# Secrets in memory + When applications pass user names, passwords or other sensitive data to libcurl to be used for upcoming transfers, those secrets are kept around as-is in memory. In many cases they are stored in the heap for as long as the handle @@ -417,17 +466,23 @@ core dump file, such data might be accessible. Further, when eventually closing a handle and the secrets are no longer needed, libcurl does not explicitly clear memory before freeing it, so credentials may be left in freed data. -.SH "Saving files" + +# Saving files + libcurl cannot protect against attacks where an attacker has write access to the same directory where libcurl is directed to save files. -.SH "Cookies" + +# Cookies + If libcurl is built with PSL (**Public Suffix List**) support, it detects and discards cookies that are specified for such suffix domains that should not be allowed to have cookies. if libcurl is *not* built with PSL support, it has no ability to stop super cookies. -.SH "Report Security Problems" + +# Report Security Problems + Should you detect or just suspect a security problem in libcurl or curl, contact the project curl security team immediately. See https://curl.se/dev/secprocess.html for details. diff --git a/docs/libcurl/libcurl-share.3 b/docs/libcurl/libcurl-share.3 deleted file mode 100644 index 7e7ee2ae6..000000000 --- a/docs/libcurl/libcurl-share.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl-share 3 "8 Aug 2003" "libcurl" "libcurl" -.SH NAME -libcurl-share \- how to use the share interface -.SH DESCRIPTION -This is an overview on how to use the libcurl share interface in your C -programs. There are specific man pages for each function mentioned in -here. - -All functions in the share interface are prefixed with curl_share. - -.SH "OBJECTIVES" -The share interface was added to enable sharing of data between curl -\&"handles". -.SH "ONE SET OF DATA - MANY TRANSFERS" -You can have multiple easy handles share data between them. Have them update -and use the \fBsame\fP cookie database, DNS cache, TLS session cache and/or -connection cache! This way, each single transfer takes advantage from data -updates made by the other transfer(s). -.SH "SHARE OBJECT" -You create a shared object with \fIcurl_share_init(3)\fP. It returns a handle -for a newly created one. - -You tell the shared object what data you want it to share by using -\fIcurl_share_setopt(3)\fP. - -Since you can use this share from multiple threads, and libcurl has no -internal thread synchronization, you must provide mutex callbacks if you are -using this multi-threaded. You set lock and unlock functions with -\fIcurl_share_setopt(3)\fP too. - -Then, you make an easy handle to use this share, you set the -\fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, and pass in -share handle. You can make any number of easy handles share the same share -handle. - -To make an easy handle stop using that particular share, you set -\fICURLOPT_SHARE(3)\fP to NULL for that easy handle. To make a handle stop -sharing a particular data, you can \fICURLSHOPT_UNSHARE(3)\fP it. - -When you are done using the share, make sure that no easy handle is still using -it, and call \fIcurl_share_cleanup(3)\fP on the handle. -.SH "SEE ALSO" -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR curl_share_cleanup (3), -.BR libcurl-errors (3), -.BR libcurl-easy (3), -.BR libcurl-multi (3) diff --git a/docs/libcurl/libcurl-share.md b/docs/libcurl/libcurl-share.md new file mode 100644 index 000000000..0106eb592 --- /dev/null +++ b/docs/libcurl/libcurl-share.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-share +Section: 3 +Source: libcurl +See-also: + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) + - libcurl-easy (3) + - libcurl-errors (3) + - libcurl-multi (3) +--- + +# NAME + +libcurl-share - how to use the share interface + +# DESCRIPTION + +This is an overview on how to use the libcurl share interface in your C +programs. There are specific man pages for each function mentioned in +here. + +All functions in the share interface are prefixed with curl_share. + +# OBJECTIVES + +The share interface was added to enable sharing of data between curl +&"handles". + +# ONE SET OF DATA - MANY TRANSFERS + +You can have multiple easy handles share data between them. Have them update +and use the **same** cookie database, DNS cache, TLS session cache and/or +connection cache! This way, each single transfer takes advantage from data +updates made by the other transfer(s). + +# SHARE OBJECT + +You create a shared object with curl_share_init(3). It returns a handle +for a newly created one. + +You tell the shared object what data you want it to share by using +curl_share_setopt(3). + +Since you can use this share from multiple threads, and libcurl has no +internal thread synchronization, you must provide mutex callbacks if you are +using this multi-threaded. You set lock and unlock functions with +curl_share_setopt(3) too. + +Then, you make an easy handle to use this share, you set the +CURLOPT_SHARE(3) option with curl_easy_setopt(3), and pass in +share handle. You can make any number of easy handles share the same share +handle. + +To make an easy handle stop using that particular share, you set +CURLOPT_SHARE(3) to NULL for that easy handle. To make a handle stop +sharing a particular data, you can CURLSHOPT_UNSHARE(3) it. + +When you are done using the share, make sure that no easy handle is still using +it, and call curl_share_cleanup(3) on the handle. diff --git a/docs/libcurl/libcurl-thread.3 b/docs/libcurl/libcurl-thread.3 deleted file mode 100644 index 397eeae66..000000000 --- a/docs/libcurl/libcurl-thread.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-thread 3 "13 Jul 2015" "libcurl" "libcurl" -.SH NAME -libcurl-thread \- libcurl thread safety -.SH "Multi-threading with libcurl" -libcurl is thread safe but has no internal thread synchronization. You may have -to provide your own locking should you meet any of the thread safety exceptions -below. - -.SH "Handles" -You must \fBnever\fP share the same handle in multiple threads. You can pass -the handles around among threads, but you must never use a single handle from -more than one thread at any given time. -.SH "Shared objects" -You can share certain data between multiple handles by using the share -interface but you must provide your own locking and set -\fIcurl_share_setopt(3)\fP CURLSHOPT_LOCKFUNC and CURLSHOPT_UNLOCKFUNC. - -Note that some items are specifically documented as not thread-safe in the -share API (the connection pool and HSTS cache for example). -.SH TLS -All current TLS libraries libcurl supports are thread-safe. OpenSSL 1.1.0+ can -be safely used in multi-threaded applications provided that support for the -underlying OS threading API is built-in. For older versions of OpenSSL, the -user must set mutex callbacks. -.SH "Signals" -Signals are used for timing out name resolves (during DNS lookup) - when built -without using either the c-ares or threaded resolver backends. On systems that -have a signal concept. - -When using multiple threads you should set the \fICURLOPT_NOSIGNAL(3)\fP -option to 1L for all handles. Everything works fine except that timeouts -cannot be honored during DNS lookups - which you can work around by building -libcurl with c-ares or threaded-resolver support. c-ares is a library that -provides asynchronous name resolves. On some platforms, libcurl simply cannot -function properly multi-threaded unless the \fICURLOPT_NOSIGNAL(3)\fP option -is set. - -When \fICURLOPT_NOSIGNAL(3)\fP is set to 1L, your application needs to deal -with the risk of a SIGPIPE (that at least the OpenSSL backend can -trigger). Note that setting \fICURLOPT_NOSIGNAL(3)\fP to 0L does not work in a -threaded situation as there is a race condition where libcurl risks restoring -the former signal handler while another thread should still ignore it. -.SH "Name resolving" -The \fBgethostbyname\fP or \fBgetaddrinfo\fP and other name resolving system -calls used by libcurl are provided by your operating system and must be thread -safe. It is important that libcurl can find and use thread safe versions of -these and other system calls, as otherwise it cannot function fully thread -safe. Some operating systems are known to have faulty thread -implementations. We have previously received problem reports on *BSD (at least -in the past, they may be working fine these days). Some operating systems that -are known to have solid and working thread support are Linux, Solaris and -Windows. -.SH "curl_global_* functions" -These functions are thread-safe since libcurl 7.84.0 if -\fIcurl_version_info(3)\fP has the \fBCURL_VERSION_THREADSAFE\fP feature bit -set (most platforms). - -If these functions are not thread-safe and you are using libcurl with multiple -threads it is especially important that before use you call -\fIcurl_global_init(3)\fP or \fIcurl_global_init_mem(3)\fP to explicitly -initialize the library and its dependents, rather than rely on the "lazy" -fail-safe initialization that takes place the first time -\fIcurl_easy_init(3)\fP is called. For an in-depth explanation refer to -\fIlibcurl(3)\fP section \fBGLOBAL CONSTANTS\fP. -.SH "Memory functions" -These functions, provided either by your operating system or your own -replacements, must be thread safe. You can use \fIcurl_global_init_mem(3)\fP -to set your own replacement memory functions. -.SH "Non-safe functions" -\fICURLOPT_DNS_USE_GLOBAL_CACHE(3)\fP is not thread-safe. - -\fIcurl_version_info(3)\fP is not thread-safe before libcurl initialization. diff --git a/docs/libcurl/libcurl-thread.md b/docs/libcurl/libcurl-thread.md new file mode 100644 index 000000000..b3e9ecf82 --- /dev/null +++ b/docs/libcurl/libcurl-thread.md @@ -0,0 +1,99 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-thread +Section: 3 +Source: libcurl +See-also: + - libcurl-security (3) +--- + +# NAME + +libcurl-thread - libcurl thread safety + +# Multi-threading with libcurl + +libcurl is thread safe but has no internal thread synchronization. You may have +to provide your own locking should you meet any of the thread safety exceptions +below. + +# Handles + +You must **never** share the same handle in multiple threads. You can pass the +handles around among threads, but you must never use a single handle from more +than one thread at any given time. + +# Shared objects + +You can share certain data between multiple handles by using the share +interface but you must provide your own locking and set +curl_share_setopt(3) CURLSHOPT_LOCKFUNC and CURLSHOPT_UNLOCKFUNC. + +Note that some items are specifically documented as not thread-safe in the +share API (the connection pool and HSTS cache for example). + +# TLS + +All current TLS libraries libcurl supports are thread-safe. OpenSSL 1.1.0+ can +be safely used in multi-threaded applications provided that support for the +underlying OS threading API is built-in. For older versions of OpenSSL, the +user must set mutex callbacks. + +# Signals + +Signals are used for timing out name resolves (during DNS lookup) - when built +without using either the c-ares or threaded resolver backends. On systems that +have a signal concept. + +When using multiple threads you should set the CURLOPT_NOSIGNAL(3) +option to 1L for all handles. Everything works fine except that timeouts +cannot be honored during DNS lookups - which you can work around by building +libcurl with c-ares or threaded-resolver support. c-ares is a library that +provides asynchronous name resolves. On some platforms, libcurl simply cannot +function properly multi-threaded unless the CURLOPT_NOSIGNAL(3) option +is set. + +When CURLOPT_NOSIGNAL(3) is set to 1L, your application needs to deal +with the risk of a SIGPIPE (that at least the OpenSSL backend can +trigger). Note that setting CURLOPT_NOSIGNAL(3) to 0L does not work in a +threaded situation as there is a race condition where libcurl risks restoring +the former signal handler while another thread should still ignore it. + +# Name resolving + +The **gethostbyname** or **getaddrinfo** and other name resolving system +calls used by libcurl are provided by your operating system and must be thread +safe. It is important that libcurl can find and use thread safe versions of +these and other system calls, as otherwise it cannot function fully thread +safe. Some operating systems are known to have faulty thread +implementations. We have previously received problem reports on *BSD (at least +in the past, they may be working fine these days). Some operating systems that +are known to have solid and working thread support are Linux, Solaris and +Windows. + +# curl_global_* functions + +These functions are thread-safe since libcurl 7.84.0 if +curl_version_info(3) has the **CURL_VERSION_THREADSAFE** feature bit +set (most platforms). + +If these functions are not thread-safe and you are using libcurl with multiple +threads it is especially important that before use you call +curl_global_init(3) or curl_global_init_mem(3) to explicitly +initialize the library and its dependents, rather than rely on the "lazy" +fail-safe initialization that takes place the first time +curl_easy_init(3) is called. For an in-depth explanation refer to +libcurl(3) section **GLOBAL CONSTANTS**. + +# Memory functions + +These functions, provided either by your operating system or your own +replacements, must be thread safe. You can use curl_global_init_mem(3) +to set your own replacement memory functions. + +# Non-safe functions + +CURLOPT_DNS_USE_GLOBAL_CACHE(3) is not thread-safe. + +curl_version_info(3) is not thread-safe before libcurl initialization. diff --git a/docs/libcurl/libcurl-tutorial.3 b/docs/libcurl/libcurl-tutorial.md similarity index 79% rename from docs/libcurl/libcurl-tutorial.3 rename to docs/libcurl/libcurl-tutorial.md index f8c9edf22..188a5e042 100644 --- a/docs/libcurl/libcurl-tutorial.3 +++ b/docs/libcurl/libcurl-tutorial.md @@ -1,38 +1,29 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-tutorial 3 "19 Sep 2014" "libcurl" "libcurl" -.SH NAME -libcurl-tutorial \- libcurl programming tutorial -.SH "Objective" +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-tutorial +Section: 3 +Source: libcurl +See-also: + - libcurl-easy (3) + - libcurl-errors (3) + - libcurl-multi (3) + - libcurl-url (3) +--- + +# NAME + +libcurl-tutorial - libcurl programming tutorial + +# Objective + This document attempts to describe the general principles and some basic approaches to consider when programming with libcurl. The text focuses on the C interface but should apply fairly well on other language bindings as well as they usually follow the C API pretty closely. This document refers to 'the user' as the person writing the source code that -uses libcurl. That would probably be you or someone in your position. What is +uses libcurl. That would probably be you or someone in your position. What is generally referred to as 'the program' is the collected source code that you write that is using libcurl for transfers. The program is outside libcurl and libcurl is outside of the program. @@ -40,48 +31,58 @@ libcurl is outside of the program. To get more details on all options and functions described herein, please refer to their respective man pages. -.SH "Building" +# Building + There are many different ways to build C programs. This chapter assumes a Unix style build process. If you use a different build system, you can still read this to get general information that may apply to your environment as well. -.IP "Compiling the Program" + +## Compiling the Program + Your compiler needs to know where the libcurl headers are located. Therefore you must set your compiler's include path to point to the directory where you installed them. The 'curl-config'[3] tool can be used to get this information: -.nf +~~~c $ curl-config --cflags -.fi -.IP "Linking the Program with libcurl" +~~~ + +## Linking the Program with libcurl + When having compiled the program, you need to link your object files to create a single executable. For that to succeed, you need to link with libcurl and possibly also with other libraries that libcurl itself depends on. Like the OpenSSL libraries, but even some standard OS libraries may be needed on the command line. To figure out which flags to use, once again the 'curl-config' tool comes to the rescue: -.nf +~~~c $ curl-config --libs -.fi -.IP "SSL or Not" +~~~ + +## SSL or Not + libcurl can be built and customized in many ways. One of the things that varies from different libraries and builds is the support for SSL-based transfers, like HTTPS and FTPS. If a supported SSL library was detected properly at build-time, libcurl is built with SSL support. To figure out if an -installed libcurl has been built with SSL support enabled, use \&'curl-config' +installed libcurl has been built with SSL support enabled, use &'curl-config' like this: -.nf +~~~c $ curl-config --feature -.fi -And if SSL is supported, the keyword \fISSL\fP is written to stdout, possibly +~~~ +And if SSL is supported, the keyword *SSL* is written to stdout, possibly together with a other features that could be either on or off on for different libcurls. See also the "Features libcurl Provides" further down. -.IP "autoconf macro" + +## autoconf macro + When you write your configure script to detect libcurl and setup variables accordingly, we offer a macro that probably does everything you need in this area. See docs/libcurl/libcurl.m4 file - it includes docs on how to use it. -.SH "Portable Code in a Portable World" +# Portable Code in a Portable World + The people behind libcurl have put a considerable effort to make libcurl work on a large amount of different operating systems and environments. @@ -90,54 +91,59 @@ are only a few minor details that differ. If you just make sure to write your code portable enough, you can create a portable program. libcurl should not stop you from that. -.SH "Global Preparation" +# Global Preparation + The program must initialize some of the libcurl functionality globally. That means it should be done exactly once, no matter how many times you intend to use the library. Once for your program's entire life time. This is done using -.nf +~~~c curl_global_init() -.fi +~~~ and it takes one parameter which is a bit pattern that tells libcurl what to -initialize. Using \fICURL_GLOBAL_ALL\fP makes it initialize all known internal +initialize. Using *CURL_GLOBAL_ALL* makes it initialize all known internal sub modules, and might be a good default option. The current two bits that are specified are: -.RS -.IP "CURL_GLOBAL_WIN32" + +## CURL_GLOBAL_WIN32 + which only does anything on Windows machines. When used on a Windows machine, it makes libcurl initialize the win32 socket stuff. Without having that initialized properly, your program cannot use sockets properly. You should only do this once for each application, so if your program already does this or of another library in use does it, you should not tell libcurl to do this as well. -.IP CURL_GLOBAL_SSL + +## CURL_GLOBAL_SSL + which only does anything on libcurls compiled and built SSL-enabled. On these systems, this makes libcurl initialize the SSL library properly for this application. This only needs to be done once for each application so if your program or another library already does this, this bit should not be needed. -.RE libcurl has a default protection mechanism that detects if -\fIcurl_global_init(3)\fP has not been called by the time -\fIcurl_easy_perform(3)\fP is called and if that is the case, libcurl runs the +curl_global_init(3) has not been called by the time +curl_easy_perform(3) is called and if that is the case, libcurl runs the function itself with a guessed bit pattern. Please note that depending solely on this is not considered nice nor good. When the program no longer uses libcurl, it should call -\fIcurl_global_cleanup(3)\fP, which is the opposite of the init call. It +curl_global_cleanup(3), which is the opposite of the init call. It performs the reversed operations to cleanup the resources the -\fIcurl_global_init(3)\fP call initialized. +curl_global_init(3) call initialized. -Repeated calls to \fIcurl_global_init(3)\fP and \fIcurl_global_cleanup(3)\fP +Repeated calls to curl_global_init(3) and curl_global_cleanup(3) should be avoided. They should only be called once each. -.SH "Features libcurl Provides" +# Features libcurl Provides + It is considered best-practice to determine libcurl features at runtime rather than at build-time (if possible of course). By calling -\fIcurl_version_info(3)\fP and checking out the details of the returned +curl_version_info(3) and checking out the details of the returned struct, your program can figure out exactly what the currently running libcurl supports. -.SH "Two Interfaces" +# Two Interfaces + libcurl first introduced the so called easy interface. All operations in the easy interface are prefixed with 'curl_easy'. The easy interface lets you do single transfers with a synchronous and blocking function call. @@ -147,101 +153,103 @@ transfers in a single thread, the so called multi interface. More about that interface is detailed in a separate chapter further down. You still need to understand the easy interface first, so please continue reading for better understanding. -.SH "Handle the Easy libcurl" + +# Handle the Easy libcurl + To use the easy interface, you must first create yourself an easy handle. You need one handle for each easy session you want to perform. Basically, you should use one handle for every thread you plan to use for transferring. You must never share the same handle in multiple threads. Get an easy handle with -.nf +~~~c handle = curl_easy_init(); -.fi +~~~ It returns an easy handle. Using that you proceed to the next step: setting up your preferred actions. A handle is just a logic entity for the upcoming transfer or series of transfers. You set properties and options for this handle using -\fIcurl_easy_setopt(3)\fP. They control how the subsequent transfer or +curl_easy_setopt(3). They control how the subsequent transfer or transfers using this handle are made. Options remain set in the handle until set again to something different. They are sticky. Multiple requests using the same handle use the same options. If you at any point would like to blank all previously set options for a -single easy handle, you can call \fIcurl_easy_reset(3)\fP and you can also +single easy handle, you can call curl_easy_reset(3) and you can also make a clone of an easy handle (with all its set options) using -\fIcurl_easy_duphandle(3)\fP. +curl_easy_duphandle(3). Many of the options you set in libcurl are "strings", pointers to data terminated with a zero byte. When you set strings with -\fIcurl_easy_setopt(3)\fP, libcurl makes its own copy so that they do not need +curl_easy_setopt(3), libcurl makes its own copy so that they do not need to be kept around in your application after being set[4]. One of the most basic properties to set in the handle is the URL. You set your -preferred URL to transfer with \fICURLOPT_URL(3)\fP in a manner similar to: +preferred URL to transfer with CURLOPT_URL(3) in a manner similar to: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_URL, "http://domain.com/"); -.fi +~~~ Let's assume for a while that you want to receive data as the URL identifies a remote resource you want to get here. Since you write a sort of application that needs this transfer, I assume that you would like to get the data passed to you directly instead of simply getting it passed to stdout. So, you write your own function that matches this prototype: -.nf +~~~c size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp); -.fi +~~~ You tell libcurl to pass all data to this function by issuing a function similar to this: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_data); -.fi +~~~ You can control what data your callback function gets in the fourth argument by setting another property: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_WRITEDATA, &internal_struct); -.fi +~~~ Using that property, you can easily pass local data between your application and the function that gets invoked by libcurl. libcurl itself does not touch -the data you pass with \fICURLOPT_WRITEDATA(3)\fP. +the data you pass with CURLOPT_WRITEDATA(3). libcurl offers its own default internal callback that takes care of the data -if you do not set the callback with \fICURLOPT_WRITEFUNCTION(3)\fP. It simply +if you do not set the callback with CURLOPT_WRITEFUNCTION(3). It simply outputs the received data to stdout. You can have the default callback write the data to a different file handle by passing a 'FILE *' to a file opened for -writing with the \fICURLOPT_WRITEDATA(3)\fP option. +writing with the CURLOPT_WRITEDATA(3) option. Now, we need to take a step back and take a deep breath. Here is one of those rare platform-dependent nitpicks. Did you spot it? On some platforms[2], libcurl is not able to operate on file handles opened by the program. Therefore, if you use the default callback and pass in an open file -handle with \fICURLOPT_WRITEDATA(3)\fP, libcurl crashes. You should avoid this +handle with CURLOPT_WRITEDATA(3), libcurl crashes. You should avoid this to make your program run fine virtually everywhere. -(\fICURLOPT_WRITEDATA(3)\fP was formerly known as \fICURLOPT_FILE\fP. Both +(CURLOPT_WRITEDATA(3) was formerly known as *CURLOPT_FILE*. Both names still work and do the same thing). If you are using libcurl as a win32 DLL, you MUST use the -\fICURLOPT_WRITEFUNCTION(3)\fP if you set \fICURLOPT_WRITEDATA(3)\fP - or +CURLOPT_WRITEFUNCTION(3) if you set CURLOPT_WRITEDATA(3) - or experience crashes. There are of course many more options you can set, and we get back to a few of them later. Let's instead continue to the actual transfer: -.nf +~~~c success = curl_easy_perform(handle); -.fi -\fIcurl_easy_perform(3)\fP connects to the remote site, does the necessary +~~~ +curl_easy_perform(3) connects to the remote site, does the necessary commands and performs the transfer. Whenever it receives data, it calls the callback function we previously set. The function may get one byte at a time, or it may get many kilobytes at once. libcurl delivers as much as possible as often as possible. Your callback function should return the number of bytes it -\&"took care of". If that is not the same amount of bytes that was passed to +&"took care of". If that is not the same amount of bytes that was passed to it, libcurl aborts the operation and returns with an error code. When the transfer is complete, the function returns a return code that informs you if it succeeded in its mission or not. If a return code is not enough for -you, you can use the \fICURLOPT_ERRORBUFFER(3)\fP to point libcurl to a buffer +you, you can use the CURLOPT_ERRORBUFFER(3) to point libcurl to a buffer of yours where it stores a human readable error message as well. If you then want to transfer another file, the handle is ready to be used @@ -255,39 +263,42 @@ finally transferring the file data. libcurl takes care of all that complication for you. Given simply the URL to a file, libcurl takes care of all the details needed to get the file moved from one machine to another. -.SH "Multi-threading Issues" -libcurl is thread safe but there are a few exceptions. Refer to -\fIlibcurl-thread(3)\fP for more information. +# Multi-threading Issues + +libcurl is thread safe but there are a few exceptions. Refer to +libcurl-thread(3) for more information. + +# When It does not Work -.SH "When It does not Work" There are times when the transfer fails for some reason. You might have set the wrong libcurl option or misunderstood what the libcurl option actually does, or the remote server might return non-standard replies that confuse the library which then confuses your program. There is one golden rule when these things occur: set the -\fICURLOPT_VERBOSE(3)\fP option to 1. it causes the library to spew out the +CURLOPT_VERBOSE(3) option to 1. it causes the library to spew out the entire protocol details it sends, some internal info and some received protocol data as well (especially when using FTP). If you are using HTTP, adding the headers in the received output to study is also a clever way to get a better understanding why the server behaves the way it does. Include headers -in the normal body output with \fICURLOPT_HEADER(3)\fP set 1. +in the normal body output with CURLOPT_HEADER(3) set 1. Of course, there are bugs left. We need to know about them to be able to fix them, so we are quite dependent on your bug reports. When you do report suspected bugs in libcurl, please include as many details as you possibly can: -a protocol dump that \fICURLOPT_VERBOSE(3)\fP produces, library version, as +a protocol dump that CURLOPT_VERBOSE(3) produces, library version, as much as possible of your code that uses libcurl, operating system name and version, compiler name and version etc. -If \fICURLOPT_VERBOSE(3)\fP is not enough, you increase the level of debug -data your application receive by using the \fICURLOPT_DEBUGFUNCTION(3)\fP. +If CURLOPT_VERBOSE(3) is not enough, you increase the level of debug +data your application receive by using the CURLOPT_DEBUGFUNCTION(3). Getting some in-depth knowledge about the protocols involved is never wrong, and if you are trying to do funny things, you might understand libcurl and how to use it better if you study the appropriate RFC documents at least briefly. -.SH "Upload Data to a Remote Site" +# Upload Data to a Remote Site + libcurl tries to keep a protocol independent approach to most transfers, thus uploading to a remote FTP site is similar to uploading data to an HTTP server with a PUT request. @@ -300,40 +311,41 @@ Since we write an application, we most likely want libcurl to get the upload data by asking us for it. To make it do that, we set the read callback and the custom pointer libcurl passes to our read callback. The read callback should have a prototype similar to: -.nf +~~~c size_t function(char *bufptr, size_t size, size_t nitems, void *userp); -.fi -Where \fIbufptr\fP is the pointer to a buffer we fill in with data to upload -and \fIsize*nitems\fP is the size of the buffer and therefore also the maximum -amount of data we can return to libcurl in this call. The \fIuserp\fP pointer +~~~ +Where *bufptr* is the pointer to a buffer we fill in with data to upload +and *size*nitems* is the size of the buffer and therefore also the maximum +amount of data we can return to libcurl in this call. The *userp* pointer is the custom pointer we set to point to a struct of ours to pass private data between the application and the callback. -.nf +~~~c curl_easy_setopt(handle, CURLOPT_READFUNCTION, read_function); curl_easy_setopt(handle, CURLOPT_READDATA, &filedata); -.fi +~~~ Tell libcurl that we want to upload: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L); -.fi +~~~ A few protocols do not behave properly when uploads are done without any prior knowledge of the expected file size. So, set the upload file size using the -\fICURLOPT_INFILESIZE_LARGE(3)\fP for all known file sizes like this[1]: +CURLOPT_INFILESIZE_LARGE(3) for all known file sizes like this[1]: -.nf +~~~c /* in this example, file_size must be an curl_off_t variable */ curl_easy_setopt(handle, CURLOPT_INFILESIZE_LARGE, file_size); -.fi +~~~ -When you call \fIcurl_easy_perform(3)\fP this time, it performs all the +When you call curl_easy_perform(3) this time, it performs all the necessary operations and when it has invoked the upload it calls your supplied callback to get the data to upload. The program should return as much data as possible in every invoke, as that is likely to make the upload perform as fast as possible. The callback should return the number of bytes it wrote in the buffer. Returning 0 signals the end of the upload. -.SH "Passwords" +# Passwords + Many protocols use or even require that user name and password are provided to be able to download or upload the data of your choice. libcurl offers several ways to specify them. @@ -341,46 +353,46 @@ several ways to specify them. Most protocols support that you specify the name and password in the URL itself. libcurl detects this and use them accordingly. This is written like this: -.nf +~~~c protocol://user:password@example.com/path/ -.fi +~~~ If you need any odd letters in your user name or password, you should enter them URL encoded, as %XX where XX is a two-digit hexadecimal number. libcurl also provides options to set various passwords. The user name and password as shown embedded in the URL can instead get set with the -\fICURLOPT_USERPWD(3)\fP option. The argument passed to libcurl should be a +CURLOPT_USERPWD(3) option. The argument passed to libcurl should be a char * to a string in the format "user:password". In a manner like this: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_USERPWD, "myname:thesecret"); -.fi +~~~ Another case where name and password might be needed at times, is for those users who need to authenticate themselves to a proxy they use. libcurl offers -another option for this, the \fICURLOPT_PROXYUSERPWD(3)\fP. It is used quite -similar to the \fICURLOPT_USERPWD(3)\fP option like this: -.nf +another option for this, the CURLOPT_PROXYUSERPWD(3). It is used quite +similar to the CURLOPT_USERPWD(3) option like this: +~~~c curl_easy_setopt(handle, CURLOPT_PROXYUSERPWD, "myname:thesecret"); -.fi +~~~ There is a long time Unix "standard" way of storing FTP user names and passwords, namely in the $HOME/.netrc file (on Windows, libcurl also checks -the \fI%USERPROFILE% environment\fP variable if \fI%HOME%\fP is unset, and +the *%USERPROFILE% environment* variable if *%HOME%* is unset, and tries "_netrc" as name). The file should be made private so that only the user may read it (see also the "Security Considerations" chapter), as it might contain the password in plain text. libcurl has the ability to use this file to figure out what set of user name and password to use for a particular host. As an extension to the normal functionality, libcurl also supports this file for non-FTP protocols such as HTTP. To make curl use this file, use the -\fICURLOPT_NETRC(3)\fP option: -.nf +CURLOPT_NETRC(3) option: +~~~c curl_easy_setopt(handle, CURLOPT_NETRC, 1L); -.fi +~~~ And a basic example of how such a .netrc file may look like: -.nf +~~~c machine myhost.mydomain.com login userlogin password secretword -.fi +~~~ All these examples have been cases where the password has been optional, or at least you could leave it out and have libcurl attempt to do its job @@ -388,10 +400,12 @@ without it. There are times when the password is not optional, like when you are using an SSL private key for secure transfers. To pass the known private key password to libcurl: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_KEYPASSWD, "keypassword"); -.fi -.SH "HTTP Authentication" +~~~ + +# HTTP Authentication + The previous chapter showed how to set user name and password for getting URLs that require authentication. When using the HTTP protocol, there are many different ways a client can provide those credentials to the server and you @@ -401,29 +415,30 @@ in the HTTP request, base64-encoded. This is insecure. At the time of this writing, libcurl can be built to use: Basic, Digest, NTLM, Negotiate (SPNEGO). You can tell libcurl which one to use -with \fICURLOPT_HTTPAUTH(3)\fP as in: -.nf +with CURLOPT_HTTPAUTH(3) as in: +~~~c curl_easy_setopt(handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); -.fi +~~~ And when you send authentication to a proxy, you can also set authentication -type the same way but instead with \fICURLOPT_PROXYAUTH(3)\fP: -.nf +type the same way but instead with CURLOPT_PROXYAUTH(3): +~~~c curl_easy_setopt(handle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); -.fi +~~~ Both these options allow you to set multiple types (by ORing them together), to make libcurl pick the most secure one out of the types the server/proxy claims to support. This method does however add a round-trip since libcurl must first ask the server what it supports: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST|CURLAUTH_BASIC); -.fi -For convenience, you can use the \fICURLAUTH_ANY\fP define (instead of a list +~~~ +For convenience, you can use the *CURLAUTH_ANY* define (instead of a list with specific types) which allows libcurl to use whatever method it wants. When asking for multiple types, libcurl picks the available one it considers "best" in its own internal order of preference. -.SH "HTTP POSTing" +# HTTP POSTing + We get many questions regarding how to issue HTTP POSTs with libcurl the proper way. This chapter thus includes examples using both different versions of HTTP POST that libcurl supports. @@ -432,16 +447,16 @@ The first version is the simple POST, the most common version, that most HTML pages using the
tag uses. We provide a pointer to the data and tell libcurl to post it all to the remote site: -.nf +~~~c char *data="name=daniel&project=curl"; curl_easy_setopt(handle, CURLOPT_POSTFIELDS, data); curl_easy_setopt(handle, CURLOPT_URL, "http://posthere.com/"); curl_easy_perform(handle); /* post away! */ -.fi +~~~ Simple enough, huh? Since you set the POST options with the -\fICURLOPT_POSTFIELDS(3)\fP, this automatically switches the handle to use +CURLOPT_POSTFIELDS(3), this automatically switches the handle to use POST in the upcoming request. What if you want to post binary data that also requires you to set the @@ -451,7 +466,7 @@ tell libcurl the size of the post data. Setting headers in libcurl requests are done in a generic way, by building a list of our own headers and then passing that list to libcurl. -.nf +~~~c struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); @@ -467,34 +482,35 @@ that list to libcurl. curl_easy_perform(handle); /* post away! */ curl_slist_free_all(headers); /* free the header list */ -.fi +~~~ While the simple examples above cover the majority of all cases where HTTP POST operations are required, they do not do multi-part formposts. Multi-part formposts were introduced as a better way to post (possibly large) binary data -and were first documented in the RFC 1867 (updated in RFC 2388). they are +and were first documented in the RFC 1867 (updated in RFC 2388). They are called multi-part because they are built by a chain of parts, each part being a single unit of data. Each part has its own name and contents. You can in fact create and post a multi-part formpost with the regular libcurl POST support described above, but that would require that you build a formpost -yourself and provide to libcurl. To make that easier, libcurl provides a MIME -API consisting in several functions: using those, you can create and fill a -multi-part form. Function \fIcurl_mime_init(3)\fP creates a multi-part body; -you can then append new parts to a multi-part body using -\fIcurl_mime_addpart(3)\fP. There are three possible data sources for a part: -memory using \fIcurl_mime_data(3)\fP, file using \fIcurl_mime_filedata(3)\fP -and user-defined data read callback using \fIcurl_mime_data_cb(3)\fP. -\fIcurl_mime_name(3)\fP sets a part's (i.e.: form field) name, while -\fIcurl_mime_filename(3)\fP fills in the remote file name. With -\fIcurl_mime_type(3)\fP, you can tell the MIME type of a part, -\fIcurl_mime_headers(3)\fP allows defining the part's headers. When a -multi-part body is no longer needed, you can destroy it using -\fIcurl_mime_free(3)\fP. +yourself and provide to libcurl. + +To make that easier, libcurl provides a MIME API consisting in several +functions: using those, you can create and fill a multi-part form. Function +curl_mime_init(3) creates a multi-part body; you can then append new parts +to a multi-part body using curl_mime_addpart(3). + +There are three possible data sources for a part: memory using +curl_mime_data(3), file using curl_mime_filedata(3) and user-defined data +read callback using curl_mime_data_cb(3). curl_mime_name(3) sets a part's +(i.e.: form field) name, while curl_mime_filename(3) fills in the remote +file name. With curl_mime_type(3), you can tell the MIME type of a part, +curl_mime_headers(3) allows defining the part's headers. When a multi-part +body is no longer needed, you can destroy it using curl_mime_free(3). The following example sets two simple text parts with plain textual contents, and then a file with binary contents and uploads the whole thing. -.nf +~~~c curl_mime *multipart = curl_mime_init(handle); curl_mimepart *part = curl_mime_addpart(multipart); curl_mime_name(part, "name"); @@ -513,31 +529,31 @@ and then a file with binary contents and uploads the whole thing. /* free the post data again */ curl_mime_free(multipart); -.fi +~~~ To post multiple files for a single form field, you must supply each file in a separate part, all with the same field name. Although function -\fIcurl_mime_subparts(3)\fP implements nested multi-parts, this way of +curl_mime_subparts(3) implements nested multi-parts, this way of multiple files posting is deprecated by RFC 7578, chapter 4.3. To set the data source from an already opened FILE pointer, use: -.nf +~~~c curl_mime_data_cb(part, filesize, (curl_read_callback) fread, (curl_seek_callback) fseek, NULL, filepointer); -.fi +~~~ -A deprecated \fIcurl_formadd(3)\fP function is still supported in libcurl. +A deprecated curl_formadd(3) function is still supported in libcurl. It should however not be used anymore for new designs and programs using it ought to be converted to the MIME API. It is however described here as an aid to conversion. -Using \fIcurl_formadd\fP, you add parts to the form. When you are done adding +Using *curl_formadd*, you add parts to the form. When you are done adding parts, you post the whole form. The MIME API example above is expressed as follows using this function: -.nf +~~~c struct curl_httppost *post=NULL; struct curl_httppost *last=NULL; curl_formadd(&post, &last, @@ -557,7 +573,7 @@ The MIME API example above is expressed as follows using this function: /* free the post data again */ curl_formfree(post); -.fi +~~~ Multipart formposts are chains of parts using MIME-style separators and headers. It means that each one of these separate parts get a few headers set @@ -568,7 +584,7 @@ of course supply headers to as many parts as you like, but this little example shows how you set headers to one specific part when you add that to the post handle: -.nf +~~~c struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); @@ -582,20 +598,21 @@ handle: curl_formfree(post); /* free post */ curl_slist_free_all(headers); /* free custom header list */ -.fi +~~~ Since all options on an easy handle are "sticky", they remain the same until -changed even if you do call \fIcurl_easy_perform(3)\fP, you may need to tell +changed even if you do call curl_easy_perform(3), you may need to tell curl to go back to a plain GET request if you intend to do one as your next request. You force an easy handle to go back to GET by using the -\fICURLOPT_HTTPGET(3)\fP option: -.nf +CURLOPT_HTTPGET(3) option: +~~~c curl_easy_setopt(handle, CURLOPT_HTTPGET, 1L); -.fi -Just setting \fICURLOPT_POSTFIELDS(3)\fP to "" or NULL does *not* stop libcurl +~~~ +Just setting CURLOPT_POSTFIELDS(3) to "" or NULL does *not* stop libcurl from doing a POST. It just makes it POST without any data to send! -.SH "Converting from deprecated form API to MIME API" +# Converting from deprecated form API to MIME API + Four rules have to be respected in building the multi-part: - The easy handle must be created before building the multi-part. @@ -605,68 +622,68 @@ Four rules have to be respected in building the multi-part: - Each part is created by a call to curl_mime_addpart(multipart). - When complete, the multi-part must be bound to the easy handle using -\fICURLOPT_MIMEPOST(3)\fP instead of \fICURLOPT_HTTPPOST(3)\fP. +CURLOPT_MIMEPOST(3) instead of CURLOPT_HTTPPOST(3). -Here are some example of \fIcurl_formadd\fP calls to MIME API sequences: +Here are some example of *curl_formadd* calls to MIME API sequences: -.nf +~~~c curl_formadd(&post, &last, CURLFORM_COPYNAME, "id", CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END); CURLFORM_CONTENTHEADER, headers, CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "id"); curl_mime_data(part, "daniel", CURL_ZERO_TERMINATED); curl_mime_headers(part, headers, FALSE); -.fi +~~~ -Setting the last \fIcurl_mime_headers(3)\fP argument to TRUE would have caused +Setting the last curl_mime_headers(3) argument to TRUE would have caused the headers to be automatically released upon destroyed the multi-part, thus -saving a clean-up call to \fIcurl_slist_free_all(3)\fP. +saving a clean-up call to curl_slist_free_all(3). -.nf +~~~c curl_formadd(&post, &last, CURLFORM_PTRNAME, "logotype-image", CURLFORM_FILECONTENT, "-", CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "logotype-image"); curl_mime_data_cb(part, (curl_off_t) -1, fread, fseek, NULL, stdin); -.fi +~~~ -\fIcurl_mime_name(3)\fP always copies the field name. The special file name -"-" is not supported by \fIcurl_mime_filename(3)\fP: to read an open file, use +curl_mime_name(3) always copies the field name. The special file name +"-" is not supported by curl_mime_filename(3): to read an open file, use a callback source using fread(). The transfer is be chunk-encoded since the data size is unknown. -.nf +~~~c curl_formadd(&post, &last, CURLFORM_COPYNAME, "datafile[]", CURLFORM_FILE, "file1", CURLFORM_FILE, "file2", CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "datafile[]"); curl_mime_filedata(part, "file1"); part = curl_mime_addpart(multipart); curl_mime_name(part, "datafile[]"); curl_mime_filedata(part, "file2"); -.fi +~~~ The deprecated multipart/mixed implementation of multiple files field is translated to two distinct parts with the same name. -.nf +~~~c curl_easy_setopt(handle, CURLOPT_READFUNCTION, myreadfunc); curl_formadd(&post, &last, CURLFORM_COPYNAME, "stream", @@ -675,87 +692,87 @@ translated to two distinct parts with the same name. CURLFORM_FILENAME, "archive.zip", CURLFORM_CONTENTTYPE, "application/zip", CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "stream"); curl_mime_data_cb(part, (curl_off_t) datasize, myreadfunc, NULL, NULL, arg); curl_mime_filename(part, "archive.zip"); curl_mime_type(part, "application/zip"); -.fi +~~~ -\fICURLOPT_READFUNCTION(3)\fP callback is not used: it is replace by directly +CURLOPT_READFUNCTION(3) callback is not used: it is replace by directly setting the part source data from the callback read function. -.nf +~~~c curl_formadd(&post, &last, CURLFORM_COPYNAME, "memfile", CURLFORM_BUFFER, "memfile.bin", CURLFORM_BUFFERPTR, databuffer, CURLFORM_BUFFERLENGTH, (long) sizeof databuffer, CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "memfile"); curl_mime_data(part, databuffer, (curl_off_t) sizeof databuffer); curl_mime_filename(part, "memfile.bin"); -.fi +~~~ -\fIcurl_mime_data(3)\fP always copies the initial data: data buffer is thus +curl_mime_data(3) always copies the initial data: data buffer is thus free for immediate reuse. -.nf +~~~c curl_formadd(&post, &last, CURLFORM_COPYNAME, "message", CURLFORM_FILECONTENT, "msg.txt", CURLFORM_END); -.fi +~~~ becomes: -.nf +~~~c part = curl_mime_addpart(multipart); curl_mime_name(part, "message"); curl_mime_filedata(part, "msg.txt"); curl_mime_filename(part, NULL); -.fi +~~~ -Use of \fIcurl_mime_filedata(3)\fP sets the remote file name as a side effect: -it is therefore necessary to clear it for \fICURLFORM_FILECONTENT\fP +Use of curl_mime_filedata(3) sets the remote file name as a side effect: +it is therefore necessary to clear it for *CURLFORM_FILECONTENT* emulation. -.SH "Showing Progress" +# Showing Progress For historical and traditional reasons, libcurl has a built-in progress meter that can be switched on and then makes it present a progress meter in your terminal. Switch on the progress meter by, oddly enough, setting -\fICURLOPT_NOPROGRESS(3)\fP to zero. This option is set to 1 by default. +CURLOPT_NOPROGRESS(3) to zero. This option is set to 1 by default. For most applications however, the built-in progress meter is useless and what instead is interesting is the ability to specify a progress callback. The function pointer you pass to libcurl is then called on irregular intervals with information about the current transfer. -Set the progress callback by using \fICURLOPT_PROGRESSFUNCTION(3)\fP. And pass +Set the progress callback by using CURLOPT_PROGRESSFUNCTION(3). And pass a pointer to a function that matches this prototype: -.nf +~~~c int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); -.fi +~~~ If any of the input arguments is unknown, a 0 is provided. The first argument, the 'clientp' is the pointer you pass to libcurl with -\fICURLOPT_PROGRESSDATA(3)\fP. libcurl does not touch it. +CURLOPT_PROGRESSDATA(3). libcurl does not touch it. -.SH "libcurl with C++" +# libcurl with C++ There is basically only one thing to keep in mind when using C++ instead of C when interfacing libcurl: @@ -764,7 +781,7 @@ The callbacks CANNOT be non-static class member functions Example C++ code: -.nf +~~~c class AClass { static size_t write_data(void *ptr, size_t size, size_t nmemb, void *ourpointer) @@ -772,9 +789,9 @@ class AClass { /* do what you want with the data */ } } -.fi +~~~ -.SH "Proxies" +# Proxies What "proxy" means according to Merriam-Webster: "a person authorized to act for another" but also "the agency, function, or office of a deputy who acts as @@ -800,53 +817,55 @@ at times it is important to understand that all operations over an HTTP proxy use the HTTP protocol. For example, you cannot invoke your own custom FTP commands or even proper FTP directory listings. -.IP "Proxy Options" +## Proxy Options To tell libcurl to use a proxy at a given port number: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_PROXY, "proxy-host.com:8080"); -.fi +~~~ Some proxies require user authentication before allowing a request, and you pass that information similar to this: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_PROXYUSERPWD, "user:password"); -.fi +~~~ If you want to, you can specify the host name only in the -\fICURLOPT_PROXY(3)\fP option, and set the port number separately with -\fICURLOPT_PROXYPORT(3)\fP. +CURLOPT_PROXY(3) option, and set the port number separately with +CURLOPT_PROXYPORT(3). -Tell libcurl what kind of proxy it is with \fICURLOPT_PROXYTYPE(3)\fP (if not, +Tell libcurl what kind of proxy it is with CURLOPT_PROXYTYPE(3) (if not, it defaults to assuming an HTTP proxy): -.nf +~~~c curl_easy_setopt(handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); -.fi -.IP "Environment Variables" +~~~ + +## Environment Variables libcurl automatically checks and uses a set of environment variables to know what proxies to use for certain protocols. The names of the variables are following an old tradition and are built up as "[protocol]_proxy" (note the -lower casing). Which makes the variable \&'http_proxy' checked for a name of a +lower casing). Which makes the variable &'http_proxy' checked for a name of a proxy to use when the input URL is HTTP. Following the same rule, the variable named 'ftp_proxy' is checked for FTP URLs. Again, the proxies are always HTTP proxies, the different names of the variables simply allows different HTTP proxies to be used. The proxy environment variable contents should be in the format -\&"[protocol://][user:password@]machine[:port]". Where the protocol:// part +"[protocol://][user:password@]machine[:port]". Where the protocol:// part specifies which type of proxy it is, and the optional port number specifies on which port the proxy operates. If not specified, the internal default port number is used and that is most likely not the one you would like it to be. There are two special environment variables. 'all_proxy' is what sets proxy for any URL in case the protocol specific variable was not set, and -\&'no_proxy' defines a list of hosts that should not use a proxy even though a +&'no_proxy' defines a list of hosts that should not use a proxy even though a variable may say so. If 'no_proxy' is a plain asterisk ("*") it matches all hosts. To explicitly disable libcurl's checking for and using the proxy environment variables, set the proxy name to "" - an empty string - with -\fICURLOPT_PROXY(3)\fP. -.IP "SSL and Proxies" +CURLOPT_PROXY(3). + +## SSL and Proxies SSL is for secure point-to-point connections. This involves strong encryption and similar things, which effectively makes it impossible for a proxy to @@ -866,7 +885,8 @@ few advantages that come from using a proxy, such as caching. Many organizations prevent this kind of tunneling to other destination port numbers than 443 (which is the default HTTPS port number). -.IP "Tunneling Through Proxy" +## Tunneling Through Proxy + As explained above, tunneling is required for SSL to work and often even restricted to the operation intended for SSL; HTTPS. @@ -882,18 +902,18 @@ Again, this is often prevented by the administrators of proxies and is rarely allowed. Tell libcurl to use proxy tunneling like this: -.nf +~~~c curl_easy_setopt(handle, CURLOPT_HTTPPROXYTUNNEL, 1L); -.fi +~~~ In fact, there might even be times when you want to do plain HTTP operations using a tunnel like this, as it then enables you to operate on the remote server instead of asking the proxy to do so. libcurl does not stand in the way for such innovative actions either! -.IP "Proxy Auto-Config" +## Proxy Auto-Config Netscape first came up with this. It is basically a web page (usually using a -\&.pac extension) with a JavaScript that when executed by the browser with the +&.pac extension) with a JavaScript that when executed by the browser with the requested URL as input, returns information to the browser on how to connect to the URL. The returned information might be "DIRECT" (which means no proxy should be used), "PROXY host:port" (to tell the browser where the proxy for @@ -914,12 +934,12 @@ Mozilla JavaScript engine in the past. - Ask your admins to stop this, for a static proxy setup or similar. -.SH "Persistence Is The Way to Happiness" +# Persistence Is The Way to Happiness Re-cycling the same easy handle several times when doing multiple requests is the way to go. -After each single \fIcurl_easy_perform(3)\fP operation, libcurl keeps the +After each single curl_easy_perform(3) operation, libcurl keeps the connection alive and open. A subsequent request using the same easy handle to the same host might just be able to use the already open connection! This reduces network impact a lot. @@ -941,36 +961,41 @@ may also be added in the future. Each easy handle attempts to keep the last few connections alive for a while in case they are to be used again. You can set the size of this "cache" with -the \fICURLOPT_MAXCONNECTS(3)\fP option. Default is 5. There is rarely any +the CURLOPT_MAXCONNECTS(3) option. Default is 5. There is rarely any point in changing this value, and if you think of changing this it is often just a matter of thinking again. To force your upcoming request to not use an already existing connection, you -can do that by setting \fICURLOPT_FRESH_CONNECT(3)\fP to 1. In a similar +can do that by setting CURLOPT_FRESH_CONNECT(3) to 1. In a similar spirit, you can also forbid the upcoming request to be "lying" around and possibly get reused after the request by setting -\fICURLOPT_FORBID_REUSE(3)\fP to 1. +CURLOPT_FORBID_REUSE(3) to 1. + +# HTTP Headers Used by libcurl -.SH "HTTP Headers Used by libcurl" When you use libcurl to do HTTP requests, it passes along a series of headers automatically. It might be good for you to know and understand these. You can -replace or remove them by using the \fICURLOPT_HTTPHEADER(3)\fP option. +replace or remove them by using the CURLOPT_HTTPHEADER(3) option. + +## Host -.IP "Host" This header is required by HTTP 1.1 and even many 1.0 servers and should be the name of the server we want to talk to. This includes the port number if anything but default. -.IP "Accept" -\&"*/*". +## Accept -.IP "Expect" -When doing POST requests, libcurl sets this header to \&"100-continue" to ask +&"*/*". + +## Expect + +When doing POST requests, libcurl sets this header to &"100-continue" to ask the server for an "OK" message before it proceeds with sending the data part of the post. If the posted data amount is deemed "small", libcurl does not use this header. -.SH "Customizing Operations" +# Customizing Operations + There is an ongoing development today where more and more protocols are built upon HTTP for transport. This has obvious benefits as HTTP is a tested and reliable protocol that is widely deployed and has excellent proxy-support. @@ -981,50 +1006,53 @@ manners. You may need to change words, headers or various data. libcurl is your friend here too. -.IP CUSTOMREQUEST -If just changing the actual HTTP request keyword is what you want, like when -GET, HEAD or POST is not good enough for you, \fICURLOPT_CUSTOMREQUEST(3)\fP -is there for you. It is simple to use: -.nf - curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MYOWNREQUEST"); -.fi -When using the custom request, you change the request keyword of the actual -request you are performing. Thus, by default you make a GET request but you can -also make a POST operation (as described before) and then replace the POST -keyword if you want to. you are the boss. +## CUSTOMREQUEST + +If just changing the actual HTTP request keyword is what you want, like when +GET, HEAD or POST is not good enough for you, CURLOPT_CUSTOMREQUEST(3) +is there for you. It is simple to use: +~~~c +curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "MYOWNREQUEST"); +~~~ +When using the custom request, you change the request keyword of the actual +request you are performing. Thus, by default you make a GET request but you +can also make a POST operation (as described before) and then replace the POST +keyword if you want to. You are the boss. + +## Modify Headers -.IP "Modify Headers" HTTP-like protocols pass a series of headers to the server when doing the request, and you are free to pass any amount of extra headers that you think fit. Adding headers is this easy: -.nf - struct curl_slist *headers=NULL; /* init to NULL is important */ +~~~c +struct curl_slist *headers=NULL; /* init to NULL is important */ - headers = curl_slist_append(headers, "Hey-server-hey: how are you?"); - headers = curl_slist_append(headers, "X-silly-content: yes"); +headers = curl_slist_append(headers, "Hey-server-hey: how are you?"); +headers = curl_slist_append(headers, "X-silly-content: yes"); - /* pass our list of custom made headers */ - curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); +/* pass our list of custom made headers */ +curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); - curl_easy_perform(handle); /* transfer http */ +curl_easy_perform(handle); /* transfer http */ - curl_slist_free_all(headers); /* free the header list */ -.fi +curl_slist_free_all(headers); /* free the header list */ +~~~ -\&... and if you think some of the internally generated headers, such as +&... and if you think some of the internally generated headers, such as Accept: or Host: do not contain the data you want them to contain, you can replace them by simply setting them too: -.nf - headers = curl_slist_append(headers, "Accept: Agent-007"); - headers = curl_slist_append(headers, "Host: munged.host.line"); -.fi +~~~c +headers = curl_slist_append(headers, "Accept: Agent-007"); +headers = curl_slist_append(headers, "Host: munged.host.line"); +~~~ + +## Delete Headers -.IP "Delete Headers" If you replace an existing header with one with no contents, you prevent the header from being sent. For instance, if you want to completely prevent the -\&"Accept:" header from being sent, you can disable it with code similar to +&"Accept:" header from being sent, you can disable it with code similar to this: headers = curl_slist_append(headers, "Accept:"); @@ -1033,7 +1061,7 @@ Both replacing and canceling internal headers should be done with careful consideration and you should be aware that you may violate the HTTP protocol when doing so. -.IP "Enforcing chunked transfer-encoding" +## Enforcing chunked transfer-encoding By making sure a request uses the custom header "Transfer-Encoding: chunked" when doing a non-GET HTTP operation, libcurl switches over to "chunked" @@ -1041,7 +1069,7 @@ upload, even though the size of the data to upload might be known. By default, libcurl usually switches over to chunked upload automatically if the upload data size is unknown. -.IP "HTTP Version" +## HTTP Version All HTTP requests includes the version number to tell the server which version we support. libcurl speaks HTTP 1.1 by default. Some old servers do not like @@ -1050,7 +1078,7 @@ can tell libcurl to use 1.0 instead by doing something like this: curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); -.IP "FTP Custom Commands" +## FTP Custom Commands Not all protocols are HTTP-like, and thus the above may not help you when you want to make, for example, your FTP transfers to behave differently. @@ -1067,7 +1095,7 @@ correct remote directory. A little example that deletes a given file before an operation: -.nf +~~~c headers = curl_slist_append(headers, "DELE file-to-remove"); /* pass the list of custom commands to the handle */ @@ -1076,35 +1104,37 @@ A little example that deletes a given file before an operation: curl_easy_perform(handle); /* transfer ftp data! */ curl_slist_free_all(headers); /* free the header list */ -.fi +~~~ If you would instead want this operation (or chain of operations) to happen -_after_ the data transfer took place the option to \fIcurl_easy_setopt(3)\fP -would instead be called \fICURLOPT_POSTQUOTE(3)\fP and used the exact same +_after_ the data transfer took place the option to curl_easy_setopt(3) +would instead be called CURLOPT_POSTQUOTE(3) and used the exact same way. The custom FTP commands are issued to the server in the same order they are added to the list, and if a command gets an error code returned back from the server, no more commands are issued and libcurl bails out with an error code -(CURLE_QUOTE_ERROR). Note that if you use \fICURLOPT_QUOTE(3)\fP to send +(CURLE_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE(3) to send commands before a transfer, no transfer actually takes place when a quote command has failed. -If you set the \fICURLOPT_HEADER(3)\fP to 1, you tell libcurl to get +If you set the CURLOPT_HEADER(3) to 1, you tell libcurl to get information about the target file and output "headers" about it. The headers are in "HTTP-style", looking like they do in HTTP. The option to enable headers or to run custom FTP commands may be useful to -combine with \fICURLOPT_NOBODY(3)\fP. If this option is set, no actual file +combine with CURLOPT_NOBODY(3). If this option is set, no actual file content transfer is performed. -.IP "FTP Custom CUSTOMREQUEST" +## FTP Custom CUSTOMREQUEST + If you do want to list the contents of an FTP directory using your own defined -FTP command, \fICURLOPT_CUSTOMREQUEST(3)\fP does just that. "NLST" is the +FTP command, CURLOPT_CUSTOMREQUEST(3) does just that. "NLST" is the default one for listing directories but you are free to pass in your idea of a good alternative. -.SH "Cookies Without Chocolate Chips" +# Cookies Without Chocolate Chips + In the HTTP sense, a cookie is a name with an associated value. A server sends the name and value to the client, and expects it to get sent back on every subsequent request to the server that matches the particular conditions @@ -1118,10 +1148,10 @@ Cookies are sent from server to clients with the header Set-Cookie: and they are sent from clients to servers with the Cookie: header. To just send whatever cookie you want to a server, you can use -\fICURLOPT_COOKIE(3)\fP to set a cookie string like this: -.nf +CURLOPT_COOKIE(3) to set a cookie string like this: +~~~c curl_easy_setopt(handle, CURLOPT_COOKIE, "name1=var1; name2=var2;"); -.fi +~~~ In many cases, that is not enough. You might want to dynamically save whatever cookies the remote server passes to you, and make sure those cookies are then used accordingly on later requests. @@ -1129,33 +1159,33 @@ are then used accordingly on later requests. One way to do this, is to save all headers you receive in a plain file and when you make a request, you tell libcurl to read the previous headers to figure out which cookies to use. Set the header file to read cookies from with -\fICURLOPT_COOKIEFILE(3)\fP. +CURLOPT_COOKIEFILE(3). -The \fICURLOPT_COOKIEFILE(3)\fP option also automatically enables the cookie +The CURLOPT_COOKIEFILE(3) option also automatically enables the cookie parser in libcurl. Until the cookie parser is enabled, libcurl does not parse or understand incoming cookies and they are just be ignored. However, when the parser is enabled the cookies are understood and the cookies are kept in memory and used properly in subsequent requests when the same handle is used. Many times this is enough, and you may not have to save the cookies to -disk at all. Note that the file you specify to \fICURLOPT_COOKIEFILE(3)\fP +disk at all. Note that the file you specify to CURLOPT_COOKIEFILE(3) does not have to exist to enable the parser, so a common way to just enable the parser and not read any cookies is to use the name of a file you know does not exist. If you would rather use existing cookies that you have previously received with your Netscape or Mozilla browsers, you can make libcurl use that cookie -file as input. The \fICURLOPT_COOKIEFILE(3)\fP is used for that too, as +file as input. The CURLOPT_COOKIEFILE(3) is used for that too, as libcurl automatically finds out what kind of file it is and acts accordingly. Perhaps the most advanced cookie operation libcurl offers, is saving the entire internal cookie state back into a Netscape/Mozilla formatted cookie file. We call that the cookie-jar. When you set a file name with -\fICURLOPT_COOKIEJAR(3)\fP, that file name is created and all received cookies -get stored in it when \fIcurl_easy_cleanup(3)\fP is called. This enables +CURLOPT_COOKIEJAR(3), that file name is created and all received cookies +get stored in it when curl_easy_cleanup(3) is called. This enables cookies to get passed on properly between multiple handles without any information getting lost. -.SH "FTP Peculiarities We Need" +# FTP Peculiarities We Need FTP transfers use a second TCP/IP connection for the data transfer. This is usually a fact you can forget and ignore but at times this detail comes back @@ -1171,22 +1201,23 @@ work it tries PASV instead. (EPSV is an extension to the original FTP spec and does not exist nor work on all FTP servers.) You can prevent libcurl from first trying the EPSV command by setting -\fICURLOPT_FTP_USE_EPSV(3)\fP to zero. +CURLOPT_FTP_USE_EPSV(3) to zero. In some cases, you want to have the server connect back to you for the second connection. This might be when the server is perhaps behind a firewall or something and only allows connections on a single port. libcurl then informs -the remote server which IP address and port number to connect to. This is -made with the \fICURLOPT_FTPPORT(3)\fP option. If you set it to "-", libcurl -uses your system's "default IP address". If you want to use a particular IP, -you can set the full IP address, a host name to resolve to an IP address or -even a local network interface name that libcurl gets the IP address from. +the remote server which IP address and port number to connect to. This is made +with the CURLOPT_FTPPORT(3) option. If you set it to "-", libcurl uses your +system's "default IP address". If you want to use a particular IP, you can set +the full IP address, a host name to resolve to an IP address or even a local +network interface name that libcurl gets the IP address from. When doing the "PORT" approach, libcurl attempts to use the EPRT and the LPRT before trying PORT, as they work with more protocols. You can disable this -behavior by setting \fICURLOPT_FTP_USE_EPRT(3)\fP to zero. +behavior by setting CURLOPT_FTP_USE_EPRT(3) to zero. + +# MIME API revisited for SMTP and IMAP -.SH "MIME API revisited for SMTP and IMAP" In addition to support HTTP multi-part form fields, the MIME API can be used to build structured email messages and send them via SMTP or append such messages to IMAP directories. @@ -1198,26 +1229,26 @@ text formats alternatives. This can be nested to any level. To build such a message, you prepare the nth-level multi-part and then include it as a source to the parent multi-part using function -\fIcurl_mime_subparts(3)\fP. Once it has been +curl_mime_subparts(3). Once it has been bound to its parent multi-part, a nth-level multi-part belongs to it and should not be freed explicitly. Email messages data is not supposed to be non-ascii and line length is limited: fortunately, some transfer encodings are defined by the standards to support the transmission of such incompatible data. Function -\fIcurl_mime_encoder(3)\fP tells a part that its source data must be encoded +curl_mime_encoder(3) tells a part that its source data must be encoded before being sent. It also generates the corresponding header for that part. If the part data you want to send is already encoded in such a scheme, do not use this function (this would over-encode it), but explicitly set the corresponding part header. Upon sending such a message, libcurl prepends it with the header list -set with \fICURLOPT_HTTPHEADER(3)\fP, as zero level mime part headers. +set with CURLOPT_HTTPHEADER(3), as zero level mime part headers. Here is an example building an email message with an inline plain/html text alternative and a file attachment encoded in base64: -.nf +~~~c curl_mime *message = curl_mime_init(handle); /* The inline part is an alternative proposing the html and the text @@ -1255,37 +1286,40 @@ alternative and a file attachment encoded in base64: /* Set these into the easy handle. */ curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(handle, CURLOPT_MIMEPOST, mime); -.fi +~~~ It should be noted that appending a message to an IMAP directory requires the message size to be known prior upload. It is therefore not possible to include parts with unknown data size in this context. -.SH "Headers Equal Fun" +# Headers Equal Fun Some protocols provide "headers", meta-data separated from the normal data. These headers are by default not included in the normal data stream, but -you can make them appear in the data stream by setting \fICURLOPT_HEADER(3)\fP +you can make them appear in the data stream by setting CURLOPT_HEADER(3) to 1. What might be even more useful, is libcurl's ability to separate the headers from the data and thus make the callbacks differ. You can for example set a different pointer to pass to the ordinary write callback by setting -\fICURLOPT_HEADERDATA(3)\fP. +CURLOPT_HEADERDATA(3). Or, you can set an entirely separate function to receive the headers, by using -\fICURLOPT_HEADERFUNCTION(3)\fP. +CURLOPT_HEADERFUNCTION(3). The headers are passed to the callback function one by one, and you can depend on that fact. It makes it easier for you to add custom header parsers etc. -\&"Headers" for FTP transfers equal all the FTP server responses. They are not +&"Headers" for FTP transfers equal all the FTP server responses. They are not actually true headers, but in this case we pretend they are! ;-) -.SH "Post Transfer Information" -See \fIcurl_easy_getinfo(3)\fP. -.SH "The multi Interface" +# Post Transfer Information + +See curl_easy_getinfo(3). + +# The multi Interface + The easy interface as described in detail in this document is a synchronous interface that transfers one file at a time and does not return until it is done. @@ -1312,14 +1346,14 @@ a "multi stack". You create the easy handles you want, one for each concurrent transfer, and you set all the options just like you learned above, and then you create a -multi handle with \fIcurl_multi_init(3)\fP and add all those easy handles to -that multi handle with \fIcurl_multi_add_handle(3)\fP. +multi handle with curl_multi_init(3) and add all those easy handles to +that multi handle with curl_multi_add_handle(3). When you have added the handles you have for the moment (you can still add new ones at any time), you start the transfers by calling -\fIcurl_multi_perform(3)\fP. +curl_multi_perform(3). -\fIcurl_multi_perform(3)\fP is asynchronous. It only performs what can be done +curl_multi_perform(3) is asynchronous. It only performs what can be done now and then return control to your program. It is designed to never block. You need to keep calling the function until all transfers are completed. @@ -1328,37 +1362,38 @@ The best usage of this interface is when you do a select() on all possible file descriptors or sockets to know when to call libcurl again. This also makes it easy for you to wait and respond to actions on your own application's sockets/handles. You figure out what to select() for by using -\fIcurl_multi_fdset(3)\fP, that fills in a set of \fIfd_set\fP variables for +curl_multi_fdset(3), that fills in a set of *fd_set* variables for you with the particular file descriptors libcurl uses for the moment. When you then call select(), it returns when one of the file handles signal -action and you then call \fIcurl_multi_perform(3)\fP to allow libcurl to do +action and you then call curl_multi_perform(3) to allow libcurl to do what it wants to do. Take note that libcurl does also feature some time-out code so we advise you to never use long timeouts on select() before you call -\fIcurl_multi_perform(3)\fP again. \fIcurl_multi_timeout(3)\fP is provided to +curl_multi_perform(3) again. curl_multi_timeout(3) is provided to help you get a suitable timeout period. -Another precaution you should use: always call \fIcurl_multi_fdset(3)\fP +Another precaution you should use: always call curl_multi_fdset(3) immediately before the select() call since the current set of file descriptors may change in any curl function invoke. If you want to stop the transfer of one of the easy handles in the stack, you -can use \fIcurl_multi_remove_handle(3)\fP to remove individual easy -handles. Remember that easy handles should be \fIcurl_easy_cleanup(3)\fPed. +can use curl_multi_remove_handle(3) to remove individual easy +handles. Remember that easy handles should be curl_easy_cleanup(3)ed. When a transfer within the multi stack has finished, the counter of running -transfers (as filled in by \fIcurl_multi_perform(3)\fP) decreases. When the +transfers (as filled in by curl_multi_perform(3)) decreases. When the number reaches zero, all transfers are done. -\fIcurl_multi_info_read(3)\fP can be used to get information about completed +curl_multi_info_read(3) can be used to get information about completed transfers. It then returns the CURLcode for each easy transfer, to allow you to figure out success on each individual transfer. -.SH "SSL, Certificates and Other Tricks" +# SSL, Certificates and Other Tricks [ seeding, passwords, keys, certificates, ENGINE, ca certs ] -.SH "Sharing Data Between Easy Handles" +# Sharing Data Between Easy Handles + You can share some data between easy handles when the easy interface is used, and some data is share automatically when you use the multi interface. @@ -1370,29 +1405,32 @@ The DNS cache is shared between handles within a multi handle, making subsequent name resolving faster, and the connection pool that is kept to better allow persistent connections and connection reuse is also shared. If you are using the easy interface, you can still share these between specific -easy handles by using the share interface, see \fIlibcurl-share(3)\fP. +easy handles by using the share interface, see libcurl-share(3). Some things are never shared automatically, not within multi handles, like for example cookies so the only way to share that is with the share interface. -.SH "Footnotes" -.IP "[1]" +# Footnotes + +## [1] + libcurl 7.10.3 and later have the ability to switch over to chunked Transfer-Encoding in cases where HTTP uploads are done with data of an unknown size. -.IP "[2]" + +## [2] + This happens on Windows machines when libcurl is built and used as a DLL. However, you can still do this on Windows if you link with a static library. -.IP "[3]" + +## [3] + The curl-config tool is generated at build-time (on Unix-like systems) and should be installed with the 'make install' or similar instruction that installs the library, header files, man pages etc. -.IP "[4]" + +## [4] + This behavior was different in versions before 7.17.0, where strings had to -remain valid past the end of the \fIcurl_easy_setopt(3)\fP call. -.SH "SEE ALSO" -.BR libcurl-easy (3), -.BR libcurl-errors (3), -.BR libcurl-multi (3), -.BR libcurl-url (3) +remain valid past the end of the curl_easy_setopt(3) call. diff --git a/docs/libcurl/libcurl-url.3 b/docs/libcurl/libcurl-url.md similarity index 59% rename from docs/libcurl/libcurl-url.3 rename to docs/libcurl/libcurl-url.md index fb96a1f03..e1469d08f 100644 --- a/docs/libcurl/libcurl-url.3 +++ b/docs/libcurl/libcurl-url.md @@ -1,80 +1,91 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl 3 "10 Sep 2018" "libcurl" "libcurl" -.SH NAME -libcurl-url \- URL interface overview -.SH DESCRIPTION +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl +Section: 3 +Source: libcurl +See-also: + - CURLOPT_URL (3) + - curl_url (3) + - curl_url_cleanup (3) + - curl_url_dup (3) + - curl_url_get (3) + - curl_url_set (3) + - curl_url_strerror (3) +--- + +# NAME + +libcurl-url - URL interface overview + +# DESCRIPTION + The URL interface provides functions for parsing and generating URLs. -.SH INCLUDE + +# INCLUDE + You still only include in your code. -.SH CREATE -Create a handle that holds URL info and resources with \fIcurl_url(3)\fP: -.nf + +# CREATE + +Create a handle that holds URL info and resources with curl_url(3): +~~~c CURLU *h = curl_url(); -.fi -.SH CLEANUP -When done with it, clean it up with \fIcurl_url_cleanup(3)\fP -.nf +~~~ + +# CLEANUP + +When done with it, clean it up with curl_url_cleanup(3) +~~~c curl_url_cleanup(h); -.fi -.SH DUPLICATE -When you need a copy of a handle, just duplicate it with \fIcurl_url_dup(3)\fP: -.nf +~~~ + +# DUPLICATE + +When you need a copy of a handle, just duplicate it with curl_url_dup(3): +~~~c CURLU *nh = curl_url_dup(h); -.fi -.SH PARSING -By setting a URL to the handle with \fIcurl_url_set(3)\fP, the URL is parsed +~~~ + +# PARSING + +By setting a URL to the handle with curl_url_set(3), the URL is parsed and stored in the handle. If the URL is not syntactically correct it returns an error instead. -.nf +~~~c rc = curl_url_set(h, CURLUPART_URL, "https://example.com:449/foo/bar?name=moo", 0); -.fi +~~~ The zero in the fourth argument is a bitmask for changing specific features. If successful, this stores the URL in its individual parts within the handle. -.SH REDIRECT + +# REDIRECT + When a handle already contains info about a URL, setting a relative URL makes it "redirect" to that. -.nf +~~~c rc = curl_url_set(h, CURLUPART_URL, "../test?another", 0); -.fi -.SH "GET URL" -The \fBCURLU\fP handle represents a URL and you can easily extract that with -\fIcurl_url_get(3)\fP: -.nf +~~~ + +# GET URL + +The **CURLU** handle represents a URL and you can easily extract that with +curl_url_get(3): +~~~c char *url; rc = curl_url_get(h, CURLUPART_URL, &url, 0); curl_free(url); -.fi +~~~ The zero in the fourth argument is a bitmask for changing specific features. -.SH "GET PARTS" + +# GET PARTS + When a URL has been parsed or parts have been set, you can extract those pieces from the handle at any time. -.nf +~~~c rc = curl_url_get(h, CURLUPART_FRAGMENT, &fragment, 0); rc = curl_url_get(h, CURLUPART_HOST, &host, 0); rc = curl_url_get(h, CURLUPART_PASSWORD, &password, 0); @@ -84,18 +95,20 @@ pieces from the handle at any time. rc = curl_url_get(h, CURLUPART_SCHEME, &scheme, 0); rc = curl_url_get(h, CURLUPART_USER, &user, 0); rc = curl_url_get(h, CURLUPART_ZONEID, &zoneid, 0); -.fi +~~~ Extracted parts are not URL decoded unless the user also asks for it with the -\fICURLU_URLDECODE\fP flag set in the fourth bitmask argument. +*CURLU_URLDECODE* flag set in the fourth bitmask argument. -Remember to free the returned string with \fIcurl_free(3)\fP when you are done +Remember to free the returned string with curl_free(3) when you are done with it! -.SH "SET PARTS" + +# SET PARTS + A user set individual URL parts, either after having parsed a full URL or instead of parsing such. -.nf +~~~c rc = curl_url_set(urlp, CURLUPART_FRAGMENT, "anchor", 0); rc = curl_url_set(urlp, CURLUPART_HOST, "www.example.com", 0); rc = curl_url_set(urlp, CURLUPART_PASSWORD, "doe", 0); @@ -105,20 +118,22 @@ instead of parsing such. rc = curl_url_set(urlp, CURLUPART_SCHEME, "https", 0); rc = curl_url_set(urlp, CURLUPART_USER, "john", 0); rc = curl_url_set(urlp, CURLUPART_ZONEID, "eth0", 0); -.fi +~~~ Set parts are not URL encoded unless the user asks for it with the -\fICURLU_URLENCODE\fP flag. -.SH "CURLU_APPENDQUERY" +*CURLU_URLENCODE* flag. + +# CURLU_APPENDQUERY + An application can append a string to the right end of the query part with the -\fICURLU_APPENDQUERY\fP flag to \fIcurl_url_set(3)\fP. +*CURLU_APPENDQUERY* flag to curl_url_set(3). Imagine a handle that holds the URL "https://example.com/?shoes=2". An application can then add the string "hat=1" to the query part like this: -.nf +~~~c rc = curl_url_set(urlp, CURLUPART_QUERY, "hat=1", CURLU_APPENDQUERY); -.fi +~~~ It notices the lack of an ampersand (&) separator and injects one, and the handle's full URL then equals "https://example.com/?shoes=2&hat=1". @@ -127,25 +142,19 @@ The appended string can of course also get URL encoded on add, and if asked to URL encode, the encoding process skips the '=' character. For example, append "candy=N&N" to what we already have, and URL encode it to deal with the ampersand in the data: -.nf +~~~c rc = curl_url_set(urlp, CURLUPART_QUERY, "candy=N&N", CURLU_APPENDQUERY | CURLU_URLENCODE); -.fi +~~~ Now the URL looks like -.nf +~~~c https://example.com/?shoes=2&hat=1&candy=N%26N -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + The URL API was introduced in libcurl 7.62.0. A URL with a literal IPv6 address can be parsed even when IPv6 support is not enabled. -.SH "SEE ALSO" -.BR curl_url (3), -.BR curl_url_cleanup (3), -.BR curl_url_dup (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR curl_url_strerror (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/libcurl-ws.3 b/docs/libcurl/libcurl-ws.md similarity index 60% rename from docs/libcurl/libcurl-ws.3 rename to docs/libcurl/libcurl-ws.md index 2a96b8bc4..40f7c039c 100644 --- a/docs/libcurl/libcurl-ws.3 +++ b/docs/libcurl/libcurl-ws.md @@ -1,36 +1,35 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl 3 "10 Sep 2018" "libcurl" "libcurl" -.SH NAME -libcurl-ws \- WebSocket interface overview -.SH DESCRIPTION +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECT_ONLY (3) + - CURLOPT_WRITEFUNCTION (3) + - CURLOPT_WS_OPTIONS (3) + - curl_easy_init (3) + - curl_ws_meta (3) + - curl_ws_recv (3) + - curl_ws_send (3) +--- + +# NAME + +libcurl-ws - WebSocket interface overview + +# DESCRIPTION + The WebSocket interface provides functions for receiving and sending WebSocket data. -.SH INCLUDE + +# INCLUDE + You still only include in your code. -.SH SETUP -WebSocket is also often known as \fIWebSockets\fP, in plural. It is done by + +# SETUP + +WebSocket is also often known as *WebSockets*, in plural. It is done by upgrading a regular HTTP(S) GET request to a WebSocket connection. WebSocket is a TCP-like message-based communication protocol done over HTTP, @@ -44,7 +43,9 @@ A WebSocket request is done as an HTTP/1 GET request with an "Upgrade WebSocket" request header field. When the upgrade is accepted by the server, it responds with a 101 Switching and then the client can speak WebSocket with the server. The communication can happen in both directions at the same time. -.SH MESSAGES + +# MESSAGES + WebSocket communication is message based. That means that both ends send and receive entire messages, not streams like TCP. A WebSocket message is sent over the wire in one or more frames. Each frame in a message can have a size @@ -58,9 +59,11 @@ arrive for the same frame. A message has an unknown size until the last frame header for the message has been received since only frames have set sizes. -.SH "Raw mode" + +# Raw mode + libcurl can be told to speak WebSocket in "raw mode" by setting the -\fBCURLWS_RAW_MODE\fP bit to the \fICURLOPT_WS_OPTIONS(3)\fP option. +**CURLWS_RAW_MODE** bit to the CURLOPT_WS_OPTIONS(3) option. Raw WebSocket means that libcurl passes on the data from the network without parsing it leaving that entirely to the application. This mode assumes that @@ -69,50 +72,52 @@ itself. This mode is intended for applications that already have a WebSocket parser/engine that want to switch over to use libcurl for enabling WebSocket, -but keep parts of the existing software architecture. -.SH PING +and keep parts of the existing software architecture. + +# PING + WebSocket is designed to allow long-lived sessions and in order to keep the connections alive, both ends can send PING messages for the other end to respond with a PONG. libcurl automatically responds to server PING messages with a PONG. It does not send any PING messages automatically. -.SH MODELS + +# MODELS + Because of the many different ways WebSocket can be used, which is much more flexible than limited to plain downloads or uploads, libcurl offers two different API models to use it: -1. Using a write callback with \fICURLOPT_WRITEFUNCTION(3)\fP much like other +1. Using a write callback with CURLOPT_WRITEFUNCTION(3) much like other downloads for when the traffic is download oriented. -2. Using \fICURLOPT_CONNECT_ONLY(3)\fP and use the WebSocket recv/send +2. Using CURLOPT_CONNECT_ONLY(3) and use the WebSocket recv/send functions. -.SH "Callback model" + +# Callback model + When a write callback is set and a WebSocket transfer is performed, the callback is called to deliver all WebSocket data that arrives. -The callback can then call \fIcurl_ws_meta(3)\fP to learn about the details of +The callback can then call curl_ws_meta(3) to learn about the details of the incoming data fragment. -.SH "CONNECT_ONLY model" -By setting \fICURLOPT_CONNECT_ONLY(3)\fP to \fB2L\fP, the transfer only + +# CONNECT_ONLY model + +By setting CURLOPT_CONNECT_ONLY(3) to **2L**, the transfer only establishes and setups the WebSocket communication and then returns control back to the application. Once such a setup has been successfully performed, the application can proceed -and use \fIcurl_ws_recv(3)\fP and \fIcurl_ws_send(3)\fP freely to exchange +and use curl_ws_recv(3) and curl_ws_send(3) freely to exchange WebSocket messages with the server. -.SH AVAILABILITY + +# AVAILABILITY + The WebSocket API was introduced as experimental in 7.86.0 and is still experimental today. It is only built-in if explicitly opted in at build time. We discourage use of the WebSocket API in production because of its experimental state. We might change API, ABI and behavior before this "goes live". -.SH "SEE ALSO" -.BR curl_easy_init (3), -.BR curl_ws_meta (3), -.BR curl_ws_recv (3), -.BR curl_ws_send (3), -.BR CURLOPT_CONNECT_ONLY (3), -.BR CURLOPT_WRITEFUNCTION (3), -.BR CURLOPT_WS_OPTIONS (3) diff --git a/docs/libcurl/libcurl.3 b/docs/libcurl/libcurl.md similarity index 63% rename from docs/libcurl/libcurl.3 rename to docs/libcurl/libcurl.md index dd4163a7e..fd574a666 100644 --- a/docs/libcurl/libcurl.3 +++ b/docs/libcurl/libcurl.md @@ -1,87 +1,97 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH libcurl 3 "March 19, 2002" "libcurl" "libcurl" -.SH NAME -libcurl \- client-side URL transfers -.SH DESCRIPTION +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl +Section: 3 +Source: libcurl +See-also: + - libcurl-easy (3) + - libcurl-multi (3) + - libcurl-security (3) + - libcurl-thread (3) +--- + +# NAME + +libcurl - client-side URL transfers + +# DESCRIPTION + This is a short overview on how to use libcurl in your C programs. There are specific man pages for each function mentioned in here. See -\fIlibcurl-easy(3)\fP, \fIlibcurl-multi(3)\fP, \fIlibcurl-share(3)\fP, -\fIlibcurl-url(3)\fP, \fIlibcurl-ws(3)\fP and \fIlibcurl-tutorial(3)\fP for +libcurl-easy(3), libcurl-multi(3), libcurl-share(3), +libcurl-url(3), libcurl-ws(3) and libcurl-tutorial(3) for in-depth understanding on how to program with libcurl. There are many bindings available that bring libcurl access to your favorite language. Look elsewhere for documentation on those. -.SH TRANSFERS -To transfer files, you create an "easy handle" using \fIcurl_easy_init(3)\fP + +# TRANSFERS + +To transfer files, you create an "easy handle" using curl_easy_init(3) for a single individual transfer (in either direction). You then set your -desired set of options in that handle with \fIcurl_easy_setopt(3)\fP. Options -you set with \fIcurl_easy_setopt(3)\fP stick. They are then used for every +desired set of options in that handle with curl_easy_setopt(3). Options +you set with curl_easy_setopt(3) stick. They are then used for every repeated use of this handle until you either change the option, or you reset -them all with \fIcurl_easy_reset(3)\fP. +them all with curl_easy_reset(3). To actually transfer data you have the option of using the "easy" interface, or the "multi" interface. The easy interface is a synchronous interface with which you call -\fIcurl_easy_perform(3)\fP and let it perform the transfer. When it is +curl_easy_perform(3) and let it perform the transfer. When it is completed, the function returns and you can continue. More details are found in -the \fIlibcurl-easy(3)\fP man page. +the libcurl-easy(3) man page. The multi interface on the other hand is an asynchronous interface, that you call and that performs only a little piece of the transfer on each invoke. It is perfect if you want to do things while the transfer is in progress, or similar. The multi interface allows you to select() on libcurl action, and even to easily download multiple files simultaneously using a single -thread. See further details in the \fIlibcurl-multi(3)\fP man page. +thread. See further details in the libcurl-multi(3) man page. + +# SUPPORT INTERFACES -.SH "SUPPORT INTERFACES" There is also a series of other helpful functions and interface families to use, including these: -.RS -.IP curl_version_info() + +## curl_version_info() + gets detailed libcurl (and other used libraries) version info. See -\fIcurl_version_info(3)\fP -.IP curl_getdate() -converts a date string to time_t. See \fIcurl_getdate(3)\fP -.IP curl_easy_getinfo() -get information about a performed transfer. See \fIcurl_easy_getinfo(3)\fP -.IP curl_mime_addpart() -helps building an HTTP form POST. See \fIcurl_mime_addpart(3)\fP -.IP curl_slist_append() -builds a linked list. See \fIcurl_slist_append(3)\fP -.IP "Sharing data between transfers" +curl_version_info(3) + +## curl_getdate() + +converts a date string to time_t. See curl_getdate(3) + +## curl_easy_getinfo() + +get information about a performed transfer. See curl_easy_getinfo(3) + +## curl_mime_addpart() + +helps building an HTTP form POST. See curl_mime_addpart(3) + +## curl_slist_append() + +builds a linked list. See curl_slist_append(3) + +## Sharing data between transfers + You can have multiple easy handles share certain data, even if they are used in different threads. This magic is setup using the share interface, as -described in the \fIlibcurl-share(3)\fP man page. -.IP "URL Parsing" -URL parsing and manipulations. See \fIlibcurl-url(3)\fP -.IP "WebSocket communication" -See \fIlibcurl-ws(3)\fP -.RE +described in the libcurl-share(3) man page. + +## URL Parsing + +URL parsing and manipulations. See libcurl-url(3) + +## WebSocket communication + +See libcurl-ws(3) + +# LINKING WITH LIBCURL -.SH "LINKING WITH LIBCURL" On unix-like machines, there is a tool named curl-config that gets installed with the rest of the curl stuff when 'make install' is performed. @@ -90,7 +100,7 @@ and developers to learn about libcurl and how to use it. Run 'curl-config --libs' to get the (additional) linker options you need to link with the particular version of libcurl you have installed. See the -\fIcurl-config(1)\fP man page for further details. +*curl-config(1)* man page for further details. Unix-like operating system that ship libcurl as part of their distributions often do not provide the curl-config tool, but simply install the library and @@ -98,42 +108,51 @@ headers in the common path for this purpose. Many Linux and similar systems use pkg-config to provide build and link options about libraries and libcurl supports that as well. -.SH "LIBCURL SYMBOL NAMES" + +# LIBCURL SYMBOL NAMES + All public functions in the libcurl interface are prefixed with 'curl_' (with a lowercase c). You can find other functions in the library source code, but other prefixes indicate that the functions are private and may change without further notice in the next release. Only use documented functions and functionality! -.SH "PORTABILITY" -libcurl works -.B exactly -the same, on any of the platforms it compiles and builds on. -.SH "THREADS" -libcurl is thread safe but there are a few exceptions. Refer to -\fIlibcurl-thread(3)\fP for more information. -.SH "PERSISTENT CONNECTIONS" +# PORTABILITY + +libcurl works +**exactly** +the same, on any of the platforms it compiles and builds on. + +# THREADS + +libcurl is thread safe but there are a few exceptions. Refer to +libcurl-thread(3) for more information. + +# PERSISTENT CONNECTIONS + Persistent connections means that libcurl can reuse the same connection for several transfers, if the conditions are right. libcurl always attempts to use persistent connections. Whenever you use -\fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP etc, libcurl +curl_easy_perform(3) or curl_multi_perform(3) etc, libcurl attempts to use an existing connection to do the transfer, and if none exists it opens a new one that is subject for reuse on a possible following call to -\fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP. +curl_easy_perform(3) or curl_multi_perform(3). To allow libcurl to take full advantage of persistent connections, you should do as many of your file transfers as possible using the same handle. -If you use the easy interface, and you call \fIcurl_easy_cleanup(3)\fP, all +If you use the easy interface, and you call curl_easy_cleanup(3), all the possibly open connections held by libcurl are closed and forgotten. When you have created a multi handle and are using the multi interface, the connection pool is instead kept in the multi handle so closing and creating new easy handles to do transfers do not affect them. Instead all added easy handles can take advantage of the single shared pool. -.SH "GLOBAL CONSTANTS" + +# GLOBAL CONSTANTS + There are a variety of constants that libcurl uses, mainly through its internal use of other libraries, which are too complicated for the library loader to set up. Therefore, a program must call a library @@ -142,19 +161,19 @@ the library code. For example, when libcurl is built for SSL capability via the GNU TLS library, there is an elaborate tree inside that library that describes the SSL protocol. -\fIcurl_global_init(3)\fP is the function that you must call. This may +curl_global_init(3) is the function that you must call. This may allocate resources (e.g. the memory for the GNU TLS tree mentioned above), so -the companion function \fIcurl_global_cleanup(3)\fP releases them. +the companion function curl_global_cleanup(3) releases them. If libcurl was compiled with support for multiple SSL backends, the function -\fIcurl_global_sslset(3)\fP can be called before \fIcurl_global_init(3)\fP +curl_global_sslset(3) can be called before curl_global_init(3) to select the active SSL backend. The global constant functions are thread-safe since libcurl 7.84.0 if -\fIcurl_version_info(3)\fP has the CURL_VERSION_THREADSAFE feature bit set -(most platforms). Read \fIlibcurl-thread(3)\fP for thread safety guidelines. +curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set +(most platforms). Read libcurl-thread(3) for thread safety guidelines. -If the global constant functions are \fInot thread safe\fP, then you must +If the global constant functions are *not thread safe*, then you must not call them when any other thread in the program is running. It is not good enough that no other thread is using libcurl at the time, because these functions internally call similar functions of other @@ -162,11 +181,11 @@ libraries, and those functions are similarly thread-unsafe. You cannot generally know what these libraries are, or whether other threads are using them. -If the global constant functions are \fInot thread safe\fP, then the basic rule +If the global constant functions are *not thread safe*, then the basic rule for constructing a program that uses libcurl is this: Call -\fIcurl_global_init(3)\fP, with a \fICURL_GLOBAL_ALL\fP argument, immediately +curl_global_init(3), with a *CURL_GLOBAL_ALL* argument, immediately after the program starts, while it is still only one thread and before it uses -libcurl at all. Call \fIcurl_global_cleanup(3)\fP immediately before the +libcurl at all. Call curl_global_cleanup(3) immediately before the program exits, when the program is again only one thread and after its last use of libcurl. @@ -184,11 +203,11 @@ know whether they use libcurl or not. And its code does not necessarily run at the start and end of the whole program. A module like this must have global constant functions of its own, just like -\fIcurl_global_init(3)\fP and \fIcurl_global_cleanup(3)\fP. The module thus +curl_global_init(3) and curl_global_cleanup(3). The module thus has control at the beginning and end of the program and has a place to call the libcurl functions. If multiple modules in the program use libcurl, they all separately call the libcurl functions, and that is OK because only the -first \fIcurl_global_init(3)\fP and the last \fIcurl_global_cleanup(3)\fP in a +first curl_global_init(3) and the last curl_global_cleanup(3) in a program change anything. (libcurl uses a reference count in static memory). In a C++ module, it is common to deal with the global constant situation by @@ -197,28 +216,28 @@ the module. A program always has exactly one object of the class, in static storage. That way, the program automatically calls the constructor of the object as the program starts up and the destructor as it terminates. As the author of this libcurl-using module, you can make the constructor call -\fIcurl_global_init(3)\fP and the destructor call \fIcurl_global_cleanup(3)\fP +curl_global_init(3) and the destructor call curl_global_cleanup(3) and satisfy libcurl's requirements without your user having to think about it. (Caveat: If you are initializing libcurl from a Windows DLL you should not -initialize it from \fIDllMain\fP or a static initializer because Windows holds +initialize it from *DllMain* or a static initializer because Windows holds the loader lock during that time and it could cause a deadlock.) -\fIcurl_global_init(3)\fP has an argument that tells what particular parts of +curl_global_init(3) has an argument that tells what particular parts of the global constant environment to set up. In order to successfully use any -value except \fICURL_GLOBAL_ALL\fP (which says to set up the whole thing), you +value except *CURL_GLOBAL_ALL* (which says to set up the whole thing), you must have specific knowledge of internal workings of libcurl and all other parts of the program of which it is part. A special part of the global constant environment is the identity of the -memory allocator. \fIcurl_global_init(3)\fP selects the system default memory -allocator, but you can use \fIcurl_global_init_mem(3)\fP to supply one of your -own. However, there is no way to use \fIcurl_global_init_mem(3)\fP in a +memory allocator. curl_global_init(3) selects the system default memory +allocator, but you can use curl_global_init_mem(3) to supply one of your +own. However, there is no way to use curl_global_init_mem(3) in a modular program -- all modules in the program that might use libcurl would have to agree on one allocator. There is a failsafe in libcurl that makes it usable in simple situations without you having to worry about the global constant environment at all: -\fIcurl_easy_init(3)\fP sets up the environment itself if it has not been done +curl_easy_init(3) sets up the environment itself if it has not been done yet. The resources it acquires to do so get released by the operating system automatically when the program exits. diff --git a/docs/libcurl/mksymbolsmanpage.pl b/docs/libcurl/mksymbolsmanpage.pl index 3bc686949..fb59eea7a 100755 --- a/docs/libcurl/mksymbolsmanpage.pl +++ b/docs/libcurl/mksymbolsmanpage.pl @@ -23,8 +23,6 @@ # * # *************************************************************************** -my $version="7.41.0"; - use POSIX qw(strftime); my @ts; if (defined($ENV{SOURCE_DATE_EPOCH})) { @@ -36,33 +34,21 @@ my $date = strftime "%b %e, %Y", @ts; my $year = strftime "%Y", @ts; print <
, et al. -.\\" * -.\\" * This software is licensed as described in the file COPYING, which -.\\" * you should have received as part of this distribution. The terms -.\\" * are also available at https://curl.se/docs/copyright.html. -.\\" * -.\\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\\" * copies of the Software, and permit persons to whom the Software is -.\\" * furnished to do so, under the terms of the COPYING file. -.\\" * -.\\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\\" * KIND, either express or implied. -.\\" * -.\\" * SPDX-License-Identifier: curl -.\\" * -.\\" ************************************************************************** -.TH libcurl-symbols 3 "$date" "libcurl" "libcurl" -.SH NAME -libcurl-symbols \\- libcurl symbol version information -.SH "libcurl symbols" +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: libcurl-symbols +Section: 3 +Source: libcurl +See-also: + - libcurl (3) + - libcurl-easy (3) + - libcurl-multi (3) + - libcurl-security (3) + - libcurl-thread (3) +--- +# libcurl symbols + This man page details version information for public symbols provided in the libcurl header files. This lists the first version in which the symbol was introduced and for some symbols two additional information pieces: @@ -91,13 +77,13 @@ while() { if($rest =~ s/^([0-9.]*) *//) { $rem = $1; } - print ".IP $symbol\nIntroduced in $intro\n"; + print "\n## $symbol\nIntroduced in $intro."; if($dep) { - print "Deprecated since $dep\n"; + print " Deprecated since $dep."; } if($rem) { - print "Last used in $rem\n"; + print " Last used in $rem."; } + print "\n"; } - } diff --git a/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 b/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 deleted file mode 100644 index b1f5b9883..000000000 --- a/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_ACTIVESOCKET 3 "12 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_ACTIVESOCKET \- get the active socket -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_ACTIVESOCKET, - curl_socket_t *socket); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_socket_t to receive the most recently active socket -used for the transfer connection by this curl session. If the socket is no -longer valid, \fICURL_SOCKET_BAD\fP is returned. When you are finished working -with the socket, you must call \fIcurl_easy_cleanup(3)\fP as usual on the easy -handle and let libcurl close the socket and cleanup other resources associated -with the handle. This option returns the active socket only after the transfer -is complete, and is typically used in combination with -\fICURLOPT_CONNECT_ONLY(3)\fP, which skips the transfer phase. - -\fICURLINFO_ACTIVESOCKET(3)\fP was added as a replacement for -\fICURLINFO_LASTSOCKET(3)\fP since that one is not working on all platforms. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_socket_t sockfd; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Do not do the transfer - only connect to host */ - curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); - res = curl_easy_perform(curl); - - /* 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; - } - } -} -.fi -.SH AVAILABILITY -Added in 7.45.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_LASTSOCKET (3), -.BR CURLOPT_CONNECT_ONLY (3) diff --git a/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.md b/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.md new file mode 100644 index 000000000..7e106ed0b --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_ACTIVESOCKET +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LASTSOCKET (3) + - CURLOPT_CONNECT_ONLY (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_ACTIVESOCKET - get the active socket + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_ACTIVESOCKET, + curl_socket_t *socket); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_socket_t to receive the most recently active socket +used for the transfer connection by this curl session. If the socket is no +longer valid, *CURL_SOCKET_BAD* is returned. When you are finished working +with the socket, you must call curl_easy_cleanup(3) as usual on the easy +handle and let libcurl close the socket and cleanup other resources associated +with the handle. This option returns the active socket only after the transfer +is complete, and is typically used in combination with +CURLOPT_CONNECT_ONLY(3), which skips the transfer phase. + +CURLINFO_ACTIVESOCKET(3) was added as a replacement for +CURLINFO_LASTSOCKET(3) since that one is not working on all platforms. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_socket_t sockfd; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Do not do the transfer - only connect to host */ + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + res = curl_easy_perform(curl); + + /* 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; + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.45.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3 b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3 deleted file mode 100644 index 977ef5736..000000000 --- a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_APPCONNECT_TIME 3 "28 Aug 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_APPCONNECT_TIME \- get the time until the SSL/SSH handshake is completed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME, - double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the SSL/SSH connect/handshake to the remote host was completed. -This time is most often close to the \fICURLINFO_PRETRANSFER_TIME(3)\fP time, -except for cases such as HTTP pipelining where the pretransfer time can be -delayed due to waits in line for the pipeline and more. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - double connect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect); - if(CURLE_OK == res) { - printf("Time: %.1f", connect); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_APPCONNECT_TIME_T (3) diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.md b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.md new file mode 100644 index 000000000..17fb46580 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_APPCONNECT_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_APPCONNECT_TIME_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_APPCONNECT_TIME - get the time until the SSL/SSH handshake is completed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME, + double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the time, in seconds, it took from the +start until the SSL/SSH connect/handshake to the remote host was completed. +This time is most often close to the CURLINFO_PRETRANSFER_TIME(3) time, +except for cases such as HTTP pipelining where the pretransfer time can be +delayed due to waits in line for the pipeline and more. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + double connect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect); + if(CURLE_OK == res) { + printf("Time: %.1f", connect); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 deleted file mode 100644 index 7a2ecff23..000000000 --- a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_APPCONNECT_TIME_T 3 "28 Apr 2018" "libcurl" "libcurl" -.SH NAME -CURLINFO_APPCONNECT_TIME_T \- time until the SSL/SSH handshake completed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the time, in microseconds, it took -from the start until the SSL/SSH connect/handshake to the remote host was -completed. This time is most often close to the -\fICURLINFO_PRETRANSFER_TIME_T(3)\fP time, except for cases such as HTTP -pipelining where the pretransfer time can be delayed due to waits in line for -the pipeline and more. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t connect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect); - if(CURLE_OK == res) { - printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000, - (long)(connect % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_APPCONNECT_TIME (3) diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.md b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.md new file mode 100644 index 000000000..cc4f2b858 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_APPCONNECT_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_APPCONNECT_TIME (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_APPCONNECT_TIME_T - time until the SSL/SSH handshake completed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the time, in microseconds, it took +from the start until the SSL/SSH connect/handshake to the remote host was +completed. This time is most often close to the +CURLINFO_PRETRANSFER_TIME_T(3) time, except for cases such as HTTP +pipelining where the pretransfer time can be delayed due to waits in line for +the pipeline and more. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t connect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect); + if(CURLE_OK == res) { + printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000, + (long)(connect % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CAINFO.3 b/docs/libcurl/opts/CURLINFO_CAINFO.3 deleted file mode 100644 index 61c3e14fe..000000000 --- a/docs/libcurl/opts/CURLINFO_CAINFO.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CAINFO 3 "20 May 2022" "libcurl" "libcurl" -.SH NAME -CURLINFO_CAINFO \- get the default built-in CA certificate path -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to a null-terminated -string holding the default built-in path used for the \fICURLOPT_CAINFO(3)\fP -option unless set by the user. - -Note that in a situation where libcurl has been built to support multiple TLS -libraries, this option might return a string even if the specific TLS library -currently set to be used does not support \fICURLOPT_CAINFO(3)\fP. - -This is a path identifying a single file containing CA certificates. - -The \fBpath\fP pointer is set to NULL if there is no default path. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - char *cainfo = NULL; - curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo); - if(cainfo) { - printf("default ca info path: %s\\n", cainfo); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.84.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CAPATH (3) diff --git a/docs/libcurl/opts/CURLINFO_CAINFO.md b/docs/libcurl/opts/CURLINFO_CAINFO.md new file mode 100644 index 000000000..44b253967 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CAINFO.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CAINFO +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAPATH (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CAINFO - get the default built-in CA certificate path + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to a null-terminated +string holding the default built-in path used for the CURLOPT_CAINFO(3) +option unless set by the user. + +Note that in a situation where libcurl has been built to support multiple TLS +libraries, this option might return a string even if the specific TLS library +currently set to be used does not support CURLOPT_CAINFO(3). + +This is a path identifying a single file containing CA certificates. + +The **path** pointer is set to NULL if there is no default path. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + char *cainfo = NULL; + curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo); + if(cainfo) { + printf("default ca info path: %s\n", cainfo); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.84.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CAPATH.3 b/docs/libcurl/opts/CURLINFO_CAPATH.3 deleted file mode 100644 index 56f05d182..000000000 --- a/docs/libcurl/opts/CURLINFO_CAPATH.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CAPATH 3 "20 May 2022" "libcurl" "libcurl" -.SH NAME -CURLINFO_CAPATH \- get the default built-in CA path string -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAPATH, char **path); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to a null-terminated -string holding the default built-in path used for the \fICURLOPT_CAPATH(3)\fP -option unless set by the user. - -Note that in a situation where libcurl has been built to support multiple TLS -libraries, this option might return a string even if the specific TLS library -currently set to be used does not support \fICURLOPT_CAPATH(3)\fP. - -This is a path identifying a directory. - -The \fBpath\fP pointer is set to NULL if there is no default path. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - char *capath = NULL; - curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath); - if(capath) { - printf("default ca path: %s\\n", capath); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.84.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CAINFO (3) diff --git a/docs/libcurl/opts/CURLINFO_CAPATH.md b/docs/libcurl/opts/CURLINFO_CAPATH.md new file mode 100644 index 000000000..46499e7f6 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CAPATH.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CAPATH +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAINFO (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CAPATH - get the default built-in CA path string + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAPATH, char **path); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to a null-terminated +string holding the default built-in path used for the CURLOPT_CAPATH(3) +option unless set by the user. + +Note that in a situation where libcurl has been built to support multiple TLS +libraries, this option might return a string even if the specific TLS library +currently set to be used does not support CURLOPT_CAPATH(3). + +This is a path identifying a directory. + +The **path** pointer is set to NULL if there is no default path. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + char *capath = NULL; + curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath); + if(capath) { + printf("default ca path: %s\n", capath); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.84.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CERTINFO.3 b/docs/libcurl/opts/CURLINFO_CERTINFO.3 deleted file mode 100644 index 46e93ccd3..000000000 --- a/docs/libcurl/opts/CURLINFO_CERTINFO.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CERTINFO 3 "12 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CERTINFO \- get the TLS certificate chain -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CERTINFO, - struct curl_certinfo **chainp); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIstruct curl_certinfo *\fP and it is set to point to a -struct that holds info about the server's certificate chain, assuming you had -\fICURLOPT_CERTINFO(3)\fP enabled when the request was made. - -.nf -struct curl_certinfo { - int num_of_certs; - struct curl_slist **certinfo; -}; -.fi - -The \fIcertinfo\fP struct member is an array of linked lists of certificate -information. The \fInum_of_certs\fP struct member is the number of -certificates which is the number of elements in the array. Each certificate's -list has items with textual information in the format "name:content" such as -\&"Subject:Foo", "Issuer:Bar", etc. The items in each list varies depending on -the SSL backend and the certificate. -.SH PROTOCOLS -All TLS-based -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); - - /* connect to any HTTPS site, trusted or not */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - - curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); - - res = curl_easy_perform(curl); - - if(!res) { - int i; - struct curl_certinfo *ci; - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); - - if(!res) { - printf("%d certs!\\n", ci->num_of_certs); - - for(i = 0; i < ci->num_of_certs; i++) { - struct curl_slist *slist; - - for(slist = ci->certinfo[i]; slist; slist = slist->next) - printf("%s\\n", slist->data); - } - } - } - curl_easy_cleanup(curl); - } -} -.fi - -See also the \fIcertinfo.c\fP example. -.SH AVAILABILITY -This option is only working in libcurl built with OpenSSL, GnuTLS, Schannel or -Secure Transport. GnuTLS support added in 7.42.0. Schannel support added in -7.50.0. Secure Transport support added in 7.79.0. - -Added in 7.19.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CAPATH (3) diff --git a/docs/libcurl/opts/CURLINFO_CERTINFO.md b/docs/libcurl/opts/CURLINFO_CERTINFO.md new file mode 100644 index 000000000..46f28375b --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CERTINFO.md @@ -0,0 +1,101 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CERTINFO +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAPATH (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CERTINFO - get the TLS certificate chain + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CERTINFO, + struct curl_certinfo **chainp); +~~~ + +# DESCRIPTION + +Pass a pointer to a *struct curl_certinfo ** and it is set to point to a +struct that holds info about the server's certificate chain, assuming you had +CURLOPT_CERTINFO(3) enabled when the request was made. + +~~~c +struct curl_certinfo { + int num_of_certs; + struct curl_slist **certinfo; +}; +~~~ + +The *certinfo* struct member is an array of linked lists of certificate +information. The *num_of_certs* struct member is the number of +certificates which is the number of elements in the array. Each certificate's +list has items with textual information in the format "name:content" such as +&"Subject:Foo", "Issuer:Bar", etc. The items in each list varies depending on +the SSL backend and the certificate. + +# PROTOCOLS + +All TLS-based + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); + + /* connect to any HTTPS site, trusted or not */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + + curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + int i; + struct curl_certinfo *ci; + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); + + if(!res) { + printf("%d certs!\n", ci->num_of_certs); + + for(i = 0; i < ci->num_of_certs; i++) { + struct curl_slist *slist; + + for(slist = ci->certinfo[i]; slist; slist = slist->next) + printf("%s\n", slist->data); + } + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +See also the *certinfo.c* example. + +# AVAILABILITY + +This option is only working in libcurl built with OpenSSL, GnuTLS, Schannel or +Secure Transport. GnuTLS support added in 7.42.0. Schannel support added in +7.50.0. Secure Transport support added in 7.79.0. + +Added in 7.19.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3 b/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3 deleted file mode 100644 index d59d16adb..000000000 --- a/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONDITION_UNMET 3 "1 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONDITION_UNMET \- get info on unmet time conditional or 304 HTTP response. -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET, - long *unmet); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the number 1 if the condition provided in -the previous request did not match (see \fICURLOPT_TIMECONDITION(3)\fP). Alas, -if this returns a 1 you know that the reason you did not get data in return is -because it did not fulfill the condition. The long this argument points to -gets a zero stored if the condition instead was met. This can also return 1 if -the server responded with a 304 HTTP status code, for example after sending a -custom "If-Match-*" header. -.SH PROTOCOLS -HTTP and some -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* January 1, 2020 is 1577833200 */ - curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L); - - /* If-Modified-Since the above time stamp */ - curl_easy_setopt(curl, CURLOPT_TIMECONDITION, - (long)CURL_TIMECOND_IFMODSINCE); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the time condition */ - long unmet; - res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet); - if(!res) { - printf("The time condition was %sfulfilled\\n", unmet?"NOT":""); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.19.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_TIMECONDITION (3), -.BR CURLOPT_TIMEVALUE (3) diff --git a/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.md b/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.md new file mode 100644 index 000000000..aca04f1c9 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONDITION_UNMET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TIMECONDITION (3) + - CURLOPT_TIMEVALUE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONDITION_UNMET - get info on unmet time conditional or 304 HTTP response. + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONDITION_UNMET, + long *unmet); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the number 1 if the condition provided in +the previous request did not match (see CURLOPT_TIMECONDITION(3)). Alas, +if this returns a 1 you know that the reason you did not get data in return is +because it did not fulfill the condition. The long this argument points to +gets a zero stored if the condition instead was met. This can also return 1 if +the server responded with a 304 HTTP status code, for example after sending a +custom "If-Match-*" header. + +# PROTOCOLS + +HTTP and some + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* January 1, 2020 is 1577833200 */ + curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L); + + /* If-Modified-Since the above time stamp */ + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, + (long)CURL_TIMECOND_IFMODSINCE); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the time condition */ + long unmet; + res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet); + if(!res) { + printf("The time condition was %sfulfilled\n", unmet?"NOT":""); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 b/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 deleted file mode 100644 index 299e2d520..000000000 --- a/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONNECT_TIME 3 "28 Aug 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONNECT_TIME \- get the time until connect -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total time in seconds from the start -until the connection to the remote host (or proxy) was completed. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - double connect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect); - if(CURLE_OK == res) { - printf("Time: %.1f", connect); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONNECT_TIME_T (3) diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME.md b/docs/libcurl/opts/CURLINFO_CONNECT_TIME.md new file mode 100644 index 000000000..1fde76699 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONNECT_TIME.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONNECT_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONNECT_TIME_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONNECT_TIME - get the time until connect + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total time in seconds from the start +until the connection to the remote host (or proxy) was completed. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + double connect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect); + if(CURLE_OK == res) { + printf("Time: %.1f", connect); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 deleted file mode 100644 index d215839c2..000000000 --- a/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONNECT_TIME_T 3 "28 Apr 2018" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONNECT_TIME_T \- get the time until connect -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the total time in microseconds from -the start until the connection to the remote host (or proxy) was completed. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t connect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect); - if(CURLE_OK == res) { - printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000, - (long)(connect % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONNECT_TIME (3), -.BR CURLOPT_CONNECTTIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.md b/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.md new file mode 100644 index 000000000..cd72cdd07 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONNECT_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONNECT_TIME (3) + - CURLOPT_CONNECTTIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONNECT_TIME_T - get the time until connect + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the total time in microseconds from +the start until the connection to the remote host (or proxy) was completed. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t connect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect); + if(CURLE_OK == res) { + printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000, + (long)(connect % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONN_ID.3 b/docs/libcurl/opts/CURLINFO_CONN_ID.3 deleted file mode 100644 index 1b9da9338..000000000 --- a/docs/libcurl/opts/CURLINFO_CONN_ID.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONN_ID 3 "07 June 2023" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONN_ID \- get the ID of the last connection used by the handle -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONN_ID, - curl_off_t *conn_id); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the connection identifier last -used by the handle. Stores -1 if there was no connection used. - -The connection id is unique among all connections using the same -connection cache. This is implicitly the case for all connections in the -same multi handle. - -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - curl_off_t conn_id; - res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id); - if(!res) { - printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\\n", conn_id); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 8.2.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_XFER_ID (3) diff --git a/docs/libcurl/opts/CURLINFO_CONN_ID.md b/docs/libcurl/opts/CURLINFO_CONN_ID.md new file mode 100644 index 000000000..d4791b42c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONN_ID.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONN_ID +Section: 3 +Source: libcurl +See-also: + - CURLINFO_XFER_ID (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONN_ID - get the ID of the last connection used by the handle + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONN_ID, + curl_off_t *conn_id); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the connection identifier last +used by the handle. Stores -1 if there was no connection used. + +The connection id is unique among all connections using the same +connection cache. This is implicitly the case for all connections in the +same multi handle. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + curl_off_t conn_id; + res = curl_easy_getinfo(curl, CURLINFO_CONN_ID, &conn_id); + if(!res) { + printf("Connection used: %" CURL_FORMAT_CURL_OFF_T "\n", conn_id); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 8.2.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 deleted file mode 100644 index fbb89b223..000000000 --- a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONTENT_LENGTH_DOWNLOAD 3 "1 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONTENT_LENGTH_DOWNLOAD \- get content-length of download -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, - double *content_length); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the content-length of the download. This -is the value read from the Content-Length: field. Since 7.19.4, this returns --1 if the size is not known. - -\fICURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)\fP is a newer replacement that returns a more -sensible variable type. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - double cl; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl); - if(!res) { - printf("Size: %.0f\\n", cl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.6.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONTENT_LENGTH_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.md b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.md new file mode 100644 index 000000000..1e01419bd --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONTENT_LENGTH_DOWNLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_UPLOAD (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONTENT_LENGTH_DOWNLOAD - get content-length of download + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, + double *content_length); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the content-length of the download. This +is the value read from the Content-Length: field. Since 7.19.4, this returns +-1 if the size is not known. + +CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3) is a newer replacement that returns a more +sensible variable type. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + double cl; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl); + if(!res) { + printf("Size: %.0f\n", cl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.6.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3 b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3 deleted file mode 100644 index f924df26d..000000000 --- a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONTENT_LENGTH_DOWNLOAD_T 3 "25 May 2017" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONTENT_LENGTH_DOWNLOAD_T \- get content-length of download -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, - curl_off_t *content_length); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the content-length of the -download. This is the value read from the Content-Length: field. Stores -1 if -the size is not known. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - curl_off_t cl; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl); - if(!res) { - printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONTENT_LENGTH_UPLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md new file mode 100644 index 000000000..15016c84c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONTENT_LENGTH_DOWNLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_UPLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONTENT_LENGTH_DOWNLOAD_T - get content-length of download + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, + curl_off_t *content_length); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the content-length of the +download. This is the value read from the Content-Length: field. Stores -1 if +the size is not known. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + curl_off_t cl; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl); + if(!res) { + printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\n", cl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3 b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3 deleted file mode 100644 index 418e3c720..000000000 --- a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONTENT_LENGTH_UPLOAD 3 "1 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONTENT_LENGTH_UPLOAD \- get the specified size of the upload -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD, - double *content_length); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the specified size of the upload. Since -7.19.4, this returns -1 if the size is not known. - -\fICURLINFO_CONTENT_LENGTH_UPLOAD_T(3)\fP is a newer replacement that returns a -more sensible variable type. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the upload */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - double cl; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl); - if(!res) { - printf("Size: %.0f\\n", cl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.6.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.md b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.md new file mode 100644 index 000000000..c90e19e72 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONTENT_LENGTH_UPLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONTENT_LENGTH_UPLOAD - get the specified size of the upload + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD, + double *content_length); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the specified size of the upload. Since +7.19.4, this returns -1 if the size is not known. + +CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) is a newer replacement that returns a +more sensible variable type. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the upload */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + double cl; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl); + if(!res) { + printf("Size: %.0f\n", cl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.6.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3 b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3 deleted file mode 100644 index 170c1080a..000000000 --- a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONTENT_LENGTH_UPLOAD_T 3 "25 May 2017" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONTENT_LENGTH_UPLOAD_T \- get the specified size of the upload -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD_T, - curl_off_t *content_length); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the specified size of the -upload. Stores -1 if the size is not known. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the upload */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - curl_off_t cl; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl); - if(!res) { - printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\\n", cl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.md b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.md new file mode 100644 index 000000000..319a3345e --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONTENT_LENGTH_UPLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONTENT_LENGTH_UPLOAD_T - get the specified size of the upload + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD_T, + curl_off_t *content_length); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the specified size of the +upload. Stores -1 if the size is not known. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the upload */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + curl_off_t cl; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl); + if(!res) { + printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\n", cl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3 b/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3 deleted file mode 100644 index 1045821b5..000000000 --- a/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_CONTENT_TYPE 3 "1 Sep 2015" "libcurl" "libcurl" -.SH NAME -CURLINFO_CONTENT_TYPE \- get Content-Type -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_TYPE, char **ct); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the content-type of the downloaded -object. This is the value read from the Content-Type: field. If you get NULL, -it means that the server did not send a valid Content-Type header or that the -protocol used does not support this. - -The \fBct\fP pointer is set to NULL or pointing to private memory. You MUST -NOT free it - it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the -corresponding CURL handle. - -The modern way to get this header from a response is to instead use the -\fIcurl_easy_header(3)\fP function. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - res = curl_easy_perform(curl); - - if(!res) { - /* extract the content-type */ - char *ct = NULL; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - if(!res && ct) { - printf("Content-Type: %s\\n", ct); - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.9.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_header (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_HEADERFUNCTION (3) diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.md b/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.md new file mode 100644 index 000000000..b87457251 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_CONTENT_TYPE.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_CONTENT_TYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERFUNCTION (3) + - curl_easy_getinfo (3) + - curl_easy_header (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_CONTENT_TYPE - get Content-Type + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_TYPE, char **ct); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the content-type of the downloaded +object. This is the value read from the Content-Type: field. If you get NULL, +it means that the server did not send a valid Content-Type header or that the +protocol used does not support this. + +The **ct** pointer is set to NULL or pointing to private memory. You MUST +NOT free it - it gets freed when you call curl_easy_cleanup(3) on the +corresponding CURL handle. + +The modern way to get this header from a response is to instead use the +curl_easy_header(3) function. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + res = curl_easy_perform(curl); + + if(!res) { + /* extract the content-type */ + char *ct = NULL; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); + if(!res && ct) { + printf("Content-Type: %s\n", ct); + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_COOKIELIST.3 b/docs/libcurl/opts/CURLINFO_COOKIELIST.3 deleted file mode 100644 index 02e2490eb..000000000 --- a/docs/libcurl/opts/CURLINFO_COOKIELIST.3 +++ /dev/null @@ -1,86 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_COOKIELIST 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_COOKIELIST \- get all known cookies -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_COOKIELIST, - struct curl_slist **cookies); -.fi -.SH DESCRIPTION -Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all -cookies curl knows (expired ones, too). do not forget to call -\fIcurl_slist_free_all(3)\fP on the list after it has been used. If there are -no cookies (cookies for the handle have not been enabled or simply none have -been received) the 'struct curl_slist *' is made a NULL pointer. - -Since 7.43.0 cookies that were imported in the Set-Cookie format without a -domain name are not exported by this option. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* enable the cookie engine */ - curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); - - res = curl_easy_perform(curl); - - if(!res) { - /* extract all known cookies */ - struct curl_slist *cookies = NULL; - res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); - if(!res && cookies) { - /* a linked list of cookies in cookie file format */ - struct curl_slist *each = cookies; - while(each) { - printf("%s\\n", each->data); - each = each->next; - } - /* we must free these cookies when we are done */ - curl_slist_free_all(cookies); - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.14.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_COOKIELIST (3) diff --git a/docs/libcurl/opts/CURLINFO_COOKIELIST.md b/docs/libcurl/opts/CURLINFO_COOKIELIST.md new file mode 100644 index 000000000..60ac0f036 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_COOKIELIST.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_COOKIELIST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COOKIELIST (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_COOKIELIST - get all known cookies + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_COOKIELIST, + struct curl_slist **cookies); +~~~ + +# DESCRIPTION + +Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all +cookies curl knows (expired ones, too). Do not forget to call +curl_slist_free_all(3) on the list after it has been used. If there are no +cookies (cookies for the handle have not been enabled or simply none have been +received) the 'struct curl_slist *' is made a NULL pointer. + +Since 7.43.0 cookies that were imported in the Set-Cookie format without a +domain name are not exported by this option. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* enable the cookie engine */ + curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); + + res = curl_easy_perform(curl); + + if(!res) { + /* extract all known cookies */ + struct curl_slist *cookies = NULL; + res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); + if(!res && cookies) { + /* a linked list of cookies in cookie file format */ + struct curl_slist *each = cookies; + while(each) { + printf("%s\n", each->data); + each = each->next; + } + /* we must free these cookies when we are done */ + curl_slist_free_all(cookies); + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.14.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 b/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 deleted file mode 100644 index 50f028b57..000000000 --- a/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_EFFECTIVE_METHOD 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_EFFECTIVE_METHOD \- get the last used HTTP method -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_METHOD, - char **methodp); -.fi -.SH DESCRIPTION -Pass in a pointer to a char pointer and get the last used effective HTTP -method. - -In cases when you have asked libcurl to follow redirects, the method may not be -the same method the first request would use. - -The \fBmethodp\fP pointer is NULL or points to private memory. You MUST NOT -free - it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the -corresponding CURL handle. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data"); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - char *method = NULL; - curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method); - if(method) - printf("Redirected to method: %s\\n", method); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.72.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_FOLLOWLOCATION (3) diff --git a/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.md b/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.md new file mode 100644 index 000000000..da2e2a016 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_EFFECTIVE_METHOD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_FOLLOWLOCATION (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_EFFECTIVE_METHOD - get the last used HTTP method + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_METHOD, + char **methodp); +~~~ + +# DESCRIPTION + +Pass in a pointer to a char pointer and get the last used effective HTTP +method. + +In cases when you have asked libcurl to follow redirects, the method may not be +the same method the first request would use. + +The **methodp** pointer is NULL or points to private memory. You MUST NOT +free - it gets freed when you call curl_easy_cleanup(3) on the +corresponding CURL handle. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + char *method = NULL; + curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method); + if(method) + printf("Redirected to method: %s\n", method); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.72.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.3 b/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.3 deleted file mode 100644 index 810e7873e..000000000 --- a/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_EFFECTIVE_URL 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_EFFECTIVE_URL \- get the last used URL -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_URL, char **urlp); -.fi -.SH DESCRIPTION -Pass in a pointer to a char pointer and get the last used effective URL. - -In cases when you have asked libcurl to follow redirects, it may not be the same -value you set with \fICURLOPT_URL(3)\fP. - -The \fBurlp\fP pointer is NULL or points to private memory. You MUST NOT free -- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - char *url = NULL; - curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); - if(url) - printf("Redirect to: %s\\n", url); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_FOLLOWLOCATION (3) diff --git a/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.md b/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.md new file mode 100644 index 000000000..268ff2c67 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_EFFECTIVE_URL.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_EFFECTIVE_URL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FOLLOWLOCATION (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_EFFECTIVE_URL - get the last used URL + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_EFFECTIVE_URL, char **urlp); +~~~ + +# DESCRIPTION + +Pass in a pointer to a char pointer and get the last used effective URL. + +In cases when you have asked libcurl to follow redirects, it may not be the same +value you set with CURLOPT_URL(3). + +The **urlp** pointer is NULL or points to private memory. You MUST NOT free +- it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + char *url = NULL; + curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); + if(url) + printf("Redirect to: %s\n", url); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_FILETIME.3 b/docs/libcurl/opts/CURLINFO_FILETIME.3 deleted file mode 100644 index ae08db367..000000000 --- a/docs/libcurl/opts/CURLINFO_FILETIME.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_FILETIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_FILETIME \- get the remote time of the retrieved document -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the remote time of the retrieved document -in number of seconds since January 1 1970 in the GMT/UTC time zone. If you get --1, it can be because of many reasons (it might be unknown, the server might -hide it or the server does not support the command that tells document time -etc) and the time of the document is unknown. - -You must tell libcurl to collect this information before the transfer is made, -by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or -you this unconditionally gets a -1 back. - -Consider using \fICURLINFO_FILETIME_T(3)\fP to be able to extract dates beyond -the year 2038 on systems using 32 bit longs (Windows). -.SH PROTOCOLS -HTTP(S), FTP(S), SFTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - /* Ask for filetime */ - curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - long filetime = 0; - res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); - if((CURLE_OK == res) && (filetime >= 0)) { - time_t file_time = (time_t)filetime; - printf("filetime: %s", ctime(&file_time)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.5 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_FILETIME (3) diff --git a/docs/libcurl/opts/CURLINFO_FILETIME.md b/docs/libcurl/opts/CURLINFO_FILETIME.md new file mode 100644 index 000000000..77ef534b4 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_FILETIME.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_FILETIME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FILETIME (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_FILETIME - get the remote time of the retrieved document + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the remote time of the retrieved document +in number of seconds since January 1 1970 in the GMT/UTC time zone. If you get +-1, it can be because of many reasons (it might be unknown, the server might +hide it or the server does not support the command that tells document time +etc) and the time of the document is unknown. + +You must tell libcurl to collect this information before the transfer is made, +by using the CURLOPT_FILETIME(3) option to curl_easy_setopt(3) or +you this unconditionally gets a -1 back. + +Consider using CURLINFO_FILETIME_T(3) to be able to extract dates beyond +the year 2038 on systems using 32 bit longs (Windows). + +# PROTOCOLS + +HTTP(S), FTP(S), SFTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + /* Ask for filetime */ + curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + long filetime = 0; + res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); + if((CURLE_OK == res) && (filetime >= 0)) { + time_t file_time = (time_t)filetime; + printf("filetime: %s", ctime(&file_time)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.5 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_FILETIME_T.3 b/docs/libcurl/opts/CURLINFO_FILETIME_T.3 deleted file mode 100644 index 48ddc4163..000000000 --- a/docs/libcurl/opts/CURLINFO_FILETIME_T.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_FILETIME 3 "25 Jan 2018" libcurl libcurl -.SH NAME -CURLINFO_FILETIME_T \- get the remote time of the retrieved document -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the remote time of the retrieved -document in number of seconds since January 1 1970 in the GMT/UTC time -zone. If you get -1, it can be because of many reasons (it might be unknown, -the server might hide it or the server does not support the command that tells -document time etc) and the time of the document is unknown. - -You must ask libcurl to collect this information before the transfer is made, -by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or -you unconditionally get a -1 back. - -This option is an alternative to \fICURLINFO_FILETIME(3)\fP to allow systems -with 32 bit long variables to extract dates outside of the 32bit timestamp -range. -.SH PROTOCOLS -HTTP(S), FTP(S), SFTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - /* Ask for filetime */ - curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - curl_off_t filetime; - res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime); - if((CURLE_OK == res) && (filetime >= 0)) { - time_t file_time = (time_t)filetime; - printf("filetime: %s", ctime(&file_time)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.59.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_FILETIME (3) diff --git a/docs/libcurl/opts/CURLINFO_FILETIME_T.md b/docs/libcurl/opts/CURLINFO_FILETIME_T.md new file mode 100644 index 000000000..62c5f3cb0 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_FILETIME_T.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_FILETIME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FILETIME (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_FILETIME_T - get the remote time of the retrieved document + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the remote time of the retrieved +document in number of seconds since January 1 1970 in the GMT/UTC time +zone. If you get -1, it can be because of many reasons (it might be unknown, +the server might hide it or the server does not support the command that tells +document time etc) and the time of the document is unknown. + +You must ask libcurl to collect this information before the transfer is made, +by using the CURLOPT_FILETIME(3) option to curl_easy_setopt(3) or +you unconditionally get a -1 back. + +This option is an alternative to CURLINFO_FILETIME(3) to allow systems +with 32 bit long variables to extract dates outside of the 32bit timestamp +range. + +# PROTOCOLS + +HTTP(S), FTP(S), SFTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + /* Ask for filetime */ + curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + curl_off_t filetime; + res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime); + if((CURLE_OK == res) && (filetime >= 0)) { + time_t file_time = (time_t)filetime; + printf("filetime: %s", ctime(&file_time)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.59.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3 b/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3 deleted file mode 100644 index 8e0f1a23b..000000000 --- a/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_FTP_ENTRY_PATH 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_FTP_ENTRY_PATH \- get entry path in FTP server -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive a pointer to a string holding the -path of the entry path. That is the initial path libcurl ended up in when -logging on to the remote FTP server. This stores a NULL as pointer if -something is wrong. - -The \fBpath\fP pointer is NULL or points to private memory. You MUST NOT free -- it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -FTP(S) and SFTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com"); - - res = curl_easy_perform(curl); - - if(!res) { - /* extract the entry path */ - char *ep = NULL; - res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep); - if(!res && ep) { - printf("Entry path was: %s\\n", ep); - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.15.4. Works for SFTP since 7.21.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.md b/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.md new file mode 100644 index 000000000..344e1f174 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_FTP_ENTRY_PATH.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_FTP_ENTRY_PATH +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_FTP_ENTRY_PATH - get entry path in FTP server + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive a pointer to a string holding the +path of the entry path. That is the initial path libcurl ended up in when +logging on to the remote FTP server. This stores a NULL as pointer if +something is wrong. + +The **path** pointer is NULL or points to private memory. You MUST NOT free +- it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +FTP(S) and SFTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com"); + + res = curl_easy_perform(curl); + + if(!res) { + /* extract the entry path */ + char *ep = NULL; + res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep); + if(!res && ep) { + printf("Entry path was: %s\n", ep); + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.4. Works for SFTP since 7.21.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_HEADER_SIZE.3 b/docs/libcurl/opts/CURLINFO_HEADER_SIZE.3 deleted file mode 100644 index 2c9d8faed..000000000 --- a/docs/libcurl/opts/CURLINFO_HEADER_SIZE.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_HEADER_SIZE 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_HEADER_SIZE \- get size of retrieved headers -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the total size of all the headers -received. Measured in number of bytes. - -The total includes the size of any received headers suppressed by -\fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long size; - res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size); - if(!res) - printf("Header size: %ld bytes\\n", size); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_REQUEST_SIZE (3), -.BR CURLINFO_SIZE_DOWNLOAD (3) diff --git a/docs/libcurl/opts/CURLINFO_HEADER_SIZE.md b/docs/libcurl/opts/CURLINFO_HEADER_SIZE.md new file mode 100644 index 000000000..67ccfc232 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_HEADER_SIZE.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_HEADER_SIZE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REQUEST_SIZE (3) + - CURLINFO_SIZE_DOWNLOAD (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_HEADER_SIZE - get size of retrieved headers + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the total size of all the headers +received. Measured in number of bytes. + +The total includes the size of any received headers suppressed by +CURLOPT_SUPPRESS_CONNECT_HEADERS(3). + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long size; + res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size); + if(!res) + printf("Header size: %ld bytes\n", size); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3 b/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3 deleted file mode 100644 index 7ceb790b4..000000000 --- a/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_HTTPAUTH_AVAIL 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_HTTPAUTH_AVAIL \- get available HTTP authentication methods -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long *authp); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive a bitmask indicating the authentication -method(s) available according to the previous response. The meaning of the -bits is explained in the \fICURLOPT_HTTPAUTH(3)\fP option for -\fIcurl_easy_setopt(3)\fP. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - res = curl_easy_perform(curl); - - if(!res) { - /* extract the available authentication types */ - long auth; - res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth); - if(!res) { - if(!auth) - printf("No auth available, perhaps no 401?\\n"); - else { - printf("%s%s%s%s\\n", - auth & CURLAUTH_BASIC ? "Basic ":"", - auth & CURLAUTH_DIGEST ? "Digest ":"", - auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"", - auth % CURLAUTH_NTLM ? "NTLM ":""); - } - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added RFC 2617 in 7.10.8 -Added RFC 7616 in 7.57.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_PROXYAUTH_AVAIL (3), -.BR CURLOPT_HTTPAUTH (3) diff --git a/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.md b/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.md new file mode 100644 index 000000000..574e0a52b --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_HTTPAUTH_AVAIL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PROXYAUTH_AVAIL (3) + - CURLOPT_HTTPAUTH (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_HTTPAUTH_AVAIL - get available HTTP authentication methods + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long *authp); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive a bitmask indicating the authentication +method(s) available according to the previous response. The meaning of the +bits is explained in the CURLOPT_HTTPAUTH(3) option for +curl_easy_setopt(3). + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + res = curl_easy_perform(curl); + + if(!res) { + /* extract the available authentication types */ + long auth; + res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth); + if(!res) { + if(!auth) + printf("No auth available, perhaps no 401?\n"); + else { + printf("%s%s%s%s\n", + auth & CURLAUTH_BASIC ? "Basic ":"", + auth & CURLAUTH_DIGEST ? "Digest ":"", + auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"", + auth % CURLAUTH_NTLM ? "NTLM ":""); + } + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added RFC 2617 in 7.10.8 +Added RFC 7616 in 7.57.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3 b/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3 deleted file mode 100644 index b4b3ac3fe..000000000 --- a/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_HTTP_CONNECTCODE 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_HTTP_CONNECTCODE \- get the CONNECT response code -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the last received HTTP proxy response code -to a CONNECT request. The returned value is zero if no such response code was -available. -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* typically CONNECT is used to do HTTPS over HTTP proxies */ - curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long code; - res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code); - if(!res && code) - printf("The CONNECT response code: %03ld\\n", code); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.7 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RESPONSE_CODE (3) diff --git a/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.md b/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.md new file mode 100644 index 000000000..ee3f0f65c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_HTTP_CONNECTCODE.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_HTTP_CONNECTCODE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_HTTP_CONNECTCODE - get the CONNECT response code + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_CONNECTCODE, long *p); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the last received HTTP proxy response code +to a CONNECT request. The returned value is zero if no such response code was +available. + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* typically CONNECT is used to do HTTPS over HTTP proxies */ + curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long code; + res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &code); + if(!res && code) + printf("The CONNECT response code: %03ld\n", code); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_HTTP_VERSION.3 b/docs/libcurl/opts/CURLINFO_HTTP_VERSION.3 deleted file mode 100644 index d4d4e8940..000000000 --- a/docs/libcurl/opts/CURLINFO_HTTP_VERSION.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_HTTP_VERSION 3 "11 May 2016" libcurl libcurl -.SH NAME -CURLINFO_HTTP_VERSION \- get the http version used in the connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the version used in the last http -connection done using this handle. The returned value is -CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0, -CURL_HTTP_VERSION_3 or 0 if the version cannot be determined. -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long http_version; - curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.50.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RESPONSE_CODE (3) diff --git a/docs/libcurl/opts/CURLINFO_HTTP_VERSION.md b/docs/libcurl/opts/CURLINFO_HTTP_VERSION.md new file mode 100644 index 000000000..994d7712c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_HTTP_VERSION.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_HTTP_VERSION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_HTTP_VERSION - get the http version used in the connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTP_VERSION, long *p); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the version used in the last http +connection done using this handle. The returned value is +CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_2_0, +CURL_HTTP_VERSION_3 or 0 if the version cannot be determined. + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long http_version; + curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, &http_version); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.50.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_LASTSOCKET.3 b/docs/libcurl/opts/CURLINFO_LASTSOCKET.3 deleted file mode 100644 index 88a7345a9..000000000 --- a/docs/libcurl/opts/CURLINFO_LASTSOCKET.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_LASTSOCKET 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_LASTSOCKET \- get the last socket used -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LASTSOCKET, long *socket); -.fi -.SH DESCRIPTION -Deprecated since 7.45.0. Use \fICURLINFO_ACTIVESOCKET(3)\fP instead. - -Pass a pointer to a long to receive the last socket used by this curl -session. If the socket is no longer valid, -1 is returned. When you finish -working with the socket, you must call \fIcurl_easy_cleanup(3)\fP as usual and -let libcurl close the socket and cleanup other resources associated with the -handle. This is typically used in combination with -\fICURLOPT_CONNECT_ONLY(3)\fP. - -NOTE: this API is deprecated since it is not working on win64 where the SOCKET -type is 64 bits large while its 'long' is 32 bits. Use the -\fICURLINFO_ACTIVESOCKET(3)\fP instead, if possible. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - long sockfd; /* does not work on win64! */ - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Do not do the transfer - only connect to host */ - curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); - res = curl_easy_perform(curl); - - /* 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; - } - } -} -.fi -.SH AVAILABILITY -Added in 7.15.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_ACTIVESOCKET (3), -.BR CURLOPT_CONNECT_ONLY (3) diff --git a/docs/libcurl/opts/CURLINFO_LASTSOCKET.md b/docs/libcurl/opts/CURLINFO_LASTSOCKET.md new file mode 100644 index 000000000..b1619ebdb --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_LASTSOCKET.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_LASTSOCKET +Section: 3 +Source: libcurl +See-also: + - CURLINFO_ACTIVESOCKET (3) + - CURLOPT_CONNECT_ONLY (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_LASTSOCKET - get the last socket used + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LASTSOCKET, long *socket); +~~~ + +# DESCRIPTION + +Deprecated since 7.45.0. Use CURLINFO_ACTIVESOCKET(3) instead. + +Pass a pointer to a long to receive the last socket used by this curl +session. If the socket is no longer valid, -1 is returned. When you finish +working with the socket, you must call curl_easy_cleanup(3) as usual and +let libcurl close the socket and cleanup other resources associated with the +handle. This is typically used in combination with +CURLOPT_CONNECT_ONLY(3). + +NOTE: this API is deprecated since it is not working on win64 where the SOCKET +type is 64 bits large while its 'long' is 32 bits. Use the +CURLINFO_ACTIVESOCKET(3) instead, if possible. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + long sockfd; /* does not work on win64! */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Do not do the transfer - only connect to host */ + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + res = curl_easy_perform(curl); + + /* 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; + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_LOCAL_IP.3 b/docs/libcurl/opts/CURLINFO_LOCAL_IP.3 deleted file mode 100644 index 5501ba7f9..000000000 --- a/docs/libcurl/opts/CURLINFO_LOCAL_IP.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_LOCAL_IP 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_LOCAL_IP \- get local IP address of last connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_IP, char **ip); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to a null-terminated -string holding the IP address of the local end of most recent connection done -with this \fBcurl\fP handle. This string may be IPv6 when that is -enabled. Note that you get a pointer to a memory area that is reused at next -request so you need to copy the string if you want to keep the information. - -The \fBip\fP pointer is NULL or points to private memory. You MUST NOT free - -it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -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"); - - /* Perform the transfer */ - res = curl_easy_perform(curl); - /* Check for errors */ - if((res == CURLE_OK) && - !curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) { - printf("Local IP: %s\\n", ip); - } - - /* always cleanup */ - curl_easy_cleanup(curl); -} -.fi -.SH AVAILABILITY -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_PRIMARY_IP (3), -.BR CURLINFO_LOCAL_PORT (3) diff --git a/docs/libcurl/opts/CURLINFO_LOCAL_IP.md b/docs/libcurl/opts/CURLINFO_LOCAL_IP.md new file mode 100644 index 000000000..e70d0cf04 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_LOCAL_IP.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_LOCAL_IP +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LOCAL_PORT (3) + - CURLINFO_PRIMARY_IP (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_LOCAL_IP - get local IP address of last connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_IP, char **ip); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to a null-terminated +string holding the IP address of the local end of most recent connection done +with this **curl** handle. This string may be IPv6 when that is +enabled. Note that you get a pointer to a memory area that is reused at next +request so you need to copy the string if you want to keep the information. + +The **ip** pointer is NULL or points to private memory. You MUST NOT free - +it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + char *ip; + CURLcode res; + CURL *curl = curl_easy_init(); + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the transfer */ + res = curl_easy_perform(curl); + /* Check for errors */ + if((res == CURLE_OK) && + !curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) { + printf("Local IP: %s\n", ip); + } + + /* always cleanup */ + curl_easy_cleanup(curl); +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_LOCAL_PORT.3 b/docs/libcurl/opts/CURLINFO_LOCAL_PORT.3 deleted file mode 100644 index 31617ac31..000000000 --- a/docs/libcurl/opts/CURLINFO_LOCAL_PORT.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_LOCAL_PORT 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_LOCAL_PORT \- get the latest local port number -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_PORT, long *portp); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the local port number of the most recent -connection done with this \fBcurl\fP handle. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - - if(CURLE_OK == res) { - long port; - res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port); - - if(CURLE_OK == res) { - printf("We used local port: %ld\\n", port); - } - } - curl_easy_cleanup(curl); - } - return 0; -} -.fi -.SH AVAILABILITY -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_LOCAL_IP (3), -.BR CURLINFO_PRIMARY_PORT (3) diff --git a/docs/libcurl/opts/CURLINFO_LOCAL_PORT.md b/docs/libcurl/opts/CURLINFO_LOCAL_PORT.md new file mode 100644 index 000000000..055fc2ee0 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_LOCAL_PORT.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_LOCAL_PORT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LOCAL_IP (3) + - CURLINFO_PRIMARY_PORT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_LOCAL_PORT - get the latest local port number + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_PORT, long *portp); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the local port number of the most recent +connection done with this **curl** handle. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + + if(CURLE_OK == res) { + long port; + res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port); + + if(CURLE_OK == res) { + printf("We used local port: %ld\n", port); + } + } + curl_easy_cleanup(curl); + } + return 0; +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 deleted file mode 100644 index 4ad0e9522..000000000 --- a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_NAMELOOKUP_TIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_NAMELOOKUP_TIME \- get the name lookup time -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME, - double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total time in seconds from the start -until the name resolving was completed. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - double namelookup; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup); - if(CURLE_OK == res) { - printf("Time: %.1f", namelookup); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_NAMELOOKUP_TIME_T (3) diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.md b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.md new file mode 100644 index 000000000..8cf425e0f --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_NAMELOOKUP_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_NAMELOOKUP_TIME_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_NAMELOOKUP_TIME - get the name lookup time + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME, + double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total time in seconds from the start +until the name resolving was completed. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + double namelookup; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup); + if(CURLE_OK == res) { + printf("Time: %.1f", namelookup); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 deleted file mode 100644 index 91be68a29..000000000 --- a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_NAMELOOKUP_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_NAMELOOKUP_TIME_T \- get the name lookup time in microseconds -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the total time in microseconds -from the start until the name resolving was completed. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t namelookup; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup); - if(CURLE_OK == res) { - printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000, - (long)(namelookup % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_NAMELOOKUP_TIME (3) diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.md b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.md new file mode 100644 index 000000000..a3fd4dd84 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_NAMELOOKUP_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_NAMELOOKUP_TIME (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_NAMELOOKUP_TIME_T - get the name lookup time in microseconds + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the total time in microseconds +from the start until the name resolving was completed. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t namelookup; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup); + if(CURLE_OK == res) { + printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000, + (long)(namelookup % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3 b/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3 deleted file mode 100644 index b151f1e26..000000000 --- a/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_NUM_CONNECTS 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_NUM_CONNECTS \- get number of created connections -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NUM_CONNECTS, long *nump); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive how many new connections libcurl had to -create to achieve the previous transfer (only the successful connects are -counted). Combined with \fICURLINFO_REDIRECT_COUNT(3)\fP you are able to know -how many times libcurl successfully reused existing connection(s) or not. See -the connection options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries -to make persistent connections to save time. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long connects; - res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects); - if(res) - printf("It needed %ld connects\\n", connects); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.12.3 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.md b/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.md new file mode 100644 index 000000000..5127a0a32 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_NUM_CONNECTS.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_NUM_CONNECTS +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_NUM_CONNECTS - get number of created connections + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NUM_CONNECTS, long *nump); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive how many new connections libcurl had to +create to achieve the previous transfer (only the successful connects are +counted). Combined with CURLINFO_REDIRECT_COUNT(3) you are able to know how +many times libcurl successfully reused existing connection(s) or not. See the +connection options of curl_easy_setopt(3) to see how libcurl tries to make +persistent connections to save time. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long connects; + res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects); + if(res) + printf("It needed %ld connects\n", connects); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.12.3 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_OS_ERRNO.3 b/docs/libcurl/opts/CURLINFO_OS_ERRNO.3 deleted file mode 100644 index cafeb68a1..000000000 --- a/docs/libcurl/opts/CURLINFO_OS_ERRNO.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_OS_ERRNO 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_OS_ERRNO \- get errno number from last connect failure -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *errnop); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the errno variable from a connect failure. -Note that the value is only set on failure, it is not reset upon a successful -operation. The number is OS and system specific. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res != CURLE_OK) { - long error; - res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error); - if(res && error) { - printf("Errno: %ld\\n", error); - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.12.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3) diff --git a/docs/libcurl/opts/CURLINFO_OS_ERRNO.md b/docs/libcurl/opts/CURLINFO_OS_ERRNO.md new file mode 100644 index 000000000..3fb69b43c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_OS_ERRNO.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_OS_ERRNO +Section: 3 +Source: libcurl +See-also: + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_OS_ERRNO - get errno number from last connect failure + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *errnop); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the errno variable from a connect failure. +Note that the value is only set on failure, it is not reset upon a successful +operation. The number is OS and system specific. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res != CURLE_OK) { + long error; + res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error); + if(res && error) { + printf("Errno: %ld\n", error); + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.12.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 deleted file mode 100644 index 01f90f214..000000000 --- a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PRETRANSFER_TIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_PRETRANSFER_TIME \- get the time until the file transfer start -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME, - double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the file transfer is just about to begin. - -This time-stamp includes all pre-transfer commands and negotiations that are -specific to the particular protocol(s) involved. It includes the sending of -the protocol-specific instructions that trigger a transfer. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - double pretransfer; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer); - if(CURLE_OK == res) { - printf("Time: %.1f", pretransfer); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONNECT_TIME_T (3), -.BR CURLINFO_PRETRANSFER_TIME_T (3) diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.md b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.md new file mode 100644 index 000000000..8eda23a3c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PRETRANSFER_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONNECT_TIME_T (3) + - CURLINFO_PRETRANSFER_TIME_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PRETRANSFER_TIME - get the time until the file transfer start + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME, + double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the time, in seconds, it took from the +start until the file transfer is just about to begin. + +This time-stamp includes all pre-transfer commands and negotiations that are +specific to the particular protocol(s) involved. It includes the sending of +the protocol-specific instructions that trigger a transfer. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + double pretransfer; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer); + if(CURLE_OK == res) { + printf("Time: %.1f", pretransfer); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 deleted file mode 100644 index f05543446..000000000 --- a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PRETRANSFER_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_PRETRANSFER_TIME_T \- get the time until the file transfer start -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the time, in microseconds, it took -from the start until the file transfer is just about to begin. - -This time-stamp includes all pre-transfer commands and negotiations that are -specific to the particular protocol(s) involved. It includes the sending of -the protocol-specific instructions that trigger a transfer. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t pretransfer; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer); - if(CURLE_OK == res) { - printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\\n", - pretransfer / 1000000, - (long)(pretransfer % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONNECT_TIME (3), -.BR CURLINFO_PRETRANSFER_TIME_T (3) diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.md b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.md new file mode 100644 index 000000000..50c515f3a --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PRETRANSFER_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONNECT_TIME (3) + - CURLINFO_PRETRANSFER_TIME_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PRETRANSFER_TIME_T - get the time until the file transfer start + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the time, in microseconds, it took +from the start until the file transfer is just about to begin. + +This time-stamp includes all pre-transfer commands and negotiations that are +specific to the particular protocol(s) involved. It includes the sending of +the protocol-specific instructions that trigger a transfer. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t pretransfer; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer); + if(CURLE_OK == res) { + printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\n", + pretransfer / 1000000, + (long)(pretransfer % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PRIMARY_IP.3 b/docs/libcurl/opts/CURLINFO_PRIMARY_IP.3 deleted file mode 100644 index 597a797ec..000000000 --- a/docs/libcurl/opts/CURLINFO_PRIMARY_IP.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PRIMARY_IP 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_PRIMARY_IP \- get IP address of last connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_IP, char **ip); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to a null-terminated -string holding the IP address of the most recent connection done with this -\fBcurl\fP handle. This string may be IPv6 when that is enabled. Note that you -get a pointer to a memory area that is reused at next request so you need to -copy the string if you want to keep the information. - -The \fBip\fP pointer is NULL or points to private memory. You MUST NOT free - -it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -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"); - - /* Perform the transfer */ - res = curl_easy_perform(curl); - /* Check for errors */ - if((res == CURLE_OK) && - !curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip) && ip) { - printf("IP: %s\\n", ip); - } - - /* always cleanup */ - curl_easy_cleanup(curl); -} -.fi -.SH AVAILABILITY -Added in 7.19.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_LOCAL_IP (3), -.BR CURLINFO_LOCAL_PORT (3), -.BR CURLINFO_PRIMARY_PORT (3) diff --git a/docs/libcurl/opts/CURLINFO_PRIMARY_IP.md b/docs/libcurl/opts/CURLINFO_PRIMARY_IP.md new file mode 100644 index 000000000..115113f3f --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PRIMARY_IP.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PRIMARY_IP +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LOCAL_IP (3) + - CURLINFO_LOCAL_PORT (3) + - CURLINFO_PRIMARY_PORT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PRIMARY_IP - get IP address of last connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_IP, char **ip); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to a null-terminated +string holding the IP address of the most recent connection done with this +**curl** handle. This string may be IPv6 when that is enabled. Note that you +get a pointer to a memory area that is reused at next request so you need to +copy the string if you want to keep the information. + +The **ip** pointer is NULL or points to private memory. You MUST NOT free - +it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +All network based ones + +# EXAMPLE + +~~~c +int main(void) +{ + char *ip; + CURLcode res; + CURL *curl = curl_easy_init(); + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the transfer */ + res = curl_easy_perform(curl); + /* Check for errors */ + if((res == CURLE_OK) && + !curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip) && ip) { + printf("IP: %s\n", ip); + } + + /* always cleanup */ + curl_easy_cleanup(curl); +} +~~~ + +# AVAILABILITY + +Added in 7.19.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3 b/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3 deleted file mode 100644 index 51d2b746f..000000000 --- a/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PRIMARY_PORT 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_PRIMARY_PORT \- get the latest destination port number -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_PORT, long *portp); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the destination port of the most recent -connection done with this \fBcurl\fP handle. - -This is the destination port of the actual TCP or UDP connection libcurl used. -If a proxy was used for the most recent transfer, this is the port number of -the proxy, if no proxy was used it is the port number of the most recently -accessed URL. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long port; - res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port); - if(!res) - printf("Connected to remote port: %ld\\n", port); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_LOCAL_PORT (3), -.BR CURLINFO_PRIMARY_IP (3) diff --git a/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.md b/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.md new file mode 100644 index 000000000..3d90b64ed --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PRIMARY_PORT.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PRIMARY_PORT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LOCAL_PORT (3) + - CURLINFO_PRIMARY_IP (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PRIMARY_PORT - get the latest destination port number + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_PORT, long *portp); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the destination port of the most recent +connection done with this **curl** handle. + +This is the destination port of the actual TCP or UDP connection libcurl used. +If a proxy was used for the most recent transfer, this is the port number of +the proxy, if no proxy was used it is the port number of the most recently +accessed URL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long port; + res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port); + if(!res) + printf("Connected to remote port: %ld\n", port); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PRIVATE.3 b/docs/libcurl/opts/CURLINFO_PRIVATE.3 deleted file mode 100644 index 2c63e3e48..000000000 --- a/docs/libcurl/opts/CURLINFO_PRIVATE.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PRIVATE 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_PRIVATE \- get the private pointer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to the private data -associated with the curl handle (set with the \fICURLOPT_PRIVATE(3)\fP). -Please note that for internal reasons, the value is returned as a char -pointer, although effectively being a 'void *'. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - void *pointer = (void *)0x2345454; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); - - /* set the private pointer */ - curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer); - res = curl_easy_perform(curl); - - /* extract the private pointer again */ - res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer); - - if(res) - printf("error: %s\\n", curl_easy_strerror(res)); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.3 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_PRIVATE (3) diff --git a/docs/libcurl/opts/CURLINFO_PRIVATE.md b/docs/libcurl/opts/CURLINFO_PRIVATE.md new file mode 100644 index 000000000..127049f7e --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PRIVATE.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PRIVATE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PRIVATE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PRIVATE - get the private pointer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to the private data +associated with the curl handle (set with the CURLOPT_PRIVATE(3)). +Please note that for internal reasons, the value is returned as a char +pointer, although effectively being a 'void *'. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + void *pointer = (void *)0x2345454; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); + + /* set the private pointer */ + curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer); + res = curl_easy_perform(curl); + + /* extract the private pointer again */ + res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer); + + if(res) + printf("error: %s\n", curl_easy_strerror(res)); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.3 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PROTOCOL.3 b/docs/libcurl/opts/CURLINFO_PROTOCOL.3 deleted file mode 100644 index aac7e9f3f..000000000 --- a/docs/libcurl/opts/CURLINFO_PROTOCOL.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PROTOCOL 3 "23 November 2016" libcurl libcurl -.SH NAME -CURLINFO_PROTOCOL \- get the protocol used in the connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p); -.fi -.SH DESCRIPTION -This option is deprecated. We strongly recommend using -\fICURLINFO_SCHEME(3)\fP instead, because this option cannot return all -possible protocols! - -Pass a pointer to a long to receive the version used in the last http -connection. The returned value is set to one of the CURLPROTO_* values: - -.nf -CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS, -CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP, -CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3, -CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS, -CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP, -CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP, -CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long protocol; - curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0. Deprecated since 7.85.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RESPONSE_CODE (3) diff --git a/docs/libcurl/opts/CURLINFO_PROTOCOL.md b/docs/libcurl/opts/CURLINFO_PROTOCOL.md new file mode 100644 index 000000000..9dfb2970f --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PROTOCOL.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PROTOCOL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PROTOCOL - get the protocol used in the connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROTOCOL, long *p); +~~~ + +# DESCRIPTION + +This option is deprecated. We strongly recommend using +CURLINFO_SCHEME(3) instead, because this option cannot return all +possible protocols! + +Pass a pointer to a long to receive the version used in the last http +connection. The returned value is set to one of the CURLPROTO_* values: + +~~~c +CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS, +CURLPROTO_GOPHER, CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_IMAP, +CURLPROTO_IMAPS, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_POP3, +CURLPROTO_POP3S, CURLPROTO_RTMP, CURLPROTO_RTMPE, CURLPROTO_RTMPS, +CURLPROTO_RTMPT, CURLPROTO_RTMPTE, CURLPROTO_RTMPTS, CURLPROTO_RTSP, +CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_SMB, CURLPROTO_SMBS, CURLPROTO_SMTP, +CURLPROTO_SMTPS, CURLPROTO_TELNET, CURLPROTO_TFTP, CURLPROTO_MQTT +~~~ + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long protocol; + curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0. Deprecated since 7.85.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3 b/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3 deleted file mode 100644 index 3d6e54948..000000000 --- a/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PROXYAUTH_AVAIL 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_PROXYAUTH_AVAIL \- get available HTTP proxy authentication methods -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_AVAIL, - long *authp); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive a bitmask indicating the authentication -method(s) available according to the previous response. The meaning of the -bits is explained in the \fICURLOPT_PROXYAUTH(3)\fP option for -\fIcurl_easy_setopt(3)\fP. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80"); - - res = curl_easy_perform(curl); - - if(!res) { - /* extract the available proxy authentication types */ - long auth; - res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth); - if(!res) { - if(!auth) - printf("No proxy auth available, perhaps no 407?\\n"); - else { - printf("%s%s%s%s\\n", - auth & CURLAUTH_BASIC ? "Basic ":"", - auth & CURLAUTH_DIGEST ? "Digest ":"", - auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"", - auth % CURLAUTH_NTLM ? "NTLM ":""); - } - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added RFC 2617 in 7.10.8 -Added RFC 7616 in 7.57.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_HTTPAUTH_AVAIL (3) diff --git a/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.md b/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.md new file mode 100644 index 000000000..0e9dbdcb5 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PROXYAUTH_AVAIL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_HTTPAUTH_AVAIL (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PROXYAUTH_AVAIL - get available HTTP proxy authentication methods + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_AVAIL, + long *authp); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive a bitmask indicating the authentication +method(s) available according to the previous response. The meaning of the +bits is explained in the CURLOPT_PROXYAUTH(3) option for +curl_easy_setopt(3). + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80"); + + res = curl_easy_perform(curl); + + if(!res) { + /* extract the available proxy authentication types */ + long auth; + res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth); + if(!res) { + if(!auth) + printf("No proxy auth available, perhaps no 407?\n"); + else { + printf("%s%s%s%s\n", + auth & CURLAUTH_BASIC ? "Basic ":"", + auth & CURLAUTH_DIGEST ? "Digest ":"", + auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"", + auth % CURLAUTH_NTLM ? "NTLM ":""); + } + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added RFC 2617 in 7.10.8 +Added RFC 7616 in 7.57.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 b/docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 deleted file mode 100644 index f4ce84918..000000000 --- a/docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 +++ /dev/null @@ -1,109 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PROXY_ERROR 3 "3 Aug 2020" libcurl libcurl -.SH NAME -CURLINFO_PROXY_ERROR \- get the detailed (SOCKS) proxy error -.SH SYNOPSIS -.nf -#include - -typedef enum { - CURLPX_OK, - CURLPX_BAD_ADDRESS_TYPE, - CURLPX_BAD_VERSION, - CURLPX_CLOSED, - CURLPX_GSSAPI, - CURLPX_GSSAPI_PERMSG, - CURLPX_GSSAPI_PROTECTION, - CURLPX_IDENTD, - CURLPX_IDENTD_DIFFER, - CURLPX_LONG_HOSTNAME, - CURLPX_LONG_PASSWD, - CURLPX_LONG_USER, - CURLPX_NO_AUTH, - CURLPX_RECV_ADDRESS, - CURLPX_RECV_AUTH, - CURLPX_RECV_CONNECT, - CURLPX_RECV_REQACK, - CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED, - CURLPX_REPLY_COMMAND_NOT_SUPPORTED, - CURLPX_REPLY_CONNECTION_REFUSED, - CURLPX_REPLY_GENERAL_SERVER_FAILURE, - CURLPX_REPLY_HOST_UNREACHABLE, - CURLPX_REPLY_NETWORK_UNREACHABLE, - CURLPX_REPLY_NOT_ALLOWED, - CURLPX_REPLY_TTL_EXPIRED, - CURLPX_REPLY_UNASSIGNED, - CURLPX_REQUEST_FAILED, - CURLPX_RESOLVE_HOST, - CURLPX_SEND_AUTH, - CURLPX_SEND_CONNECT, - CURLPX_SEND_REQUEST, - CURLPX_UNKNOWN_FAIL, - CURLPX_UNKNOWN_MODE, - CURLPX_USER_REJECTED, - CURLPX_LAST /* never use */ -} CURLproxycode; - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_ERROR, long *detail); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive a detailed error code when the most recent -transfer returned a \fBCURLE_PROXY\fP error. That error code matches the -\fBCURLproxycode\fP set. - -The error code is zero (\fBCURLPX_OK\fP) if no response code was available. -.SH PROTOCOLS -All that can be done over SOCKS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1"); - res = curl_easy_perform(curl); - if(res == CURLE_PROXY) { - long proxycode; - res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode); - if(!res && proxycode) - printf("The detailed proxy error: %ld\\n", proxycode); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.73.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RESPONSE_CODE (3), -.BR libcurl-errors (3) diff --git a/docs/libcurl/opts/CURLINFO_PROXY_ERROR.md b/docs/libcurl/opts/CURLINFO_PROXY_ERROR.md new file mode 100644 index 000000000..01113c740 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PROXY_ERROR.md @@ -0,0 +1,105 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PROXY_ERROR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) + - libcurl-errors (3) +--- + +# NAME + +CURLINFO_PROXY_ERROR - get the detailed (SOCKS) proxy error + +# SYNOPSIS + +~~~c +#include + +typedef enum { + CURLPX_OK, + CURLPX_BAD_ADDRESS_TYPE, + CURLPX_BAD_VERSION, + CURLPX_CLOSED, + CURLPX_GSSAPI, + CURLPX_GSSAPI_PERMSG, + CURLPX_GSSAPI_PROTECTION, + CURLPX_IDENTD, + CURLPX_IDENTD_DIFFER, + CURLPX_LONG_HOSTNAME, + CURLPX_LONG_PASSWD, + CURLPX_LONG_USER, + CURLPX_NO_AUTH, + CURLPX_RECV_ADDRESS, + CURLPX_RECV_AUTH, + CURLPX_RECV_CONNECT, + CURLPX_RECV_REQACK, + CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED, + CURLPX_REPLY_COMMAND_NOT_SUPPORTED, + CURLPX_REPLY_CONNECTION_REFUSED, + CURLPX_REPLY_GENERAL_SERVER_FAILURE, + CURLPX_REPLY_HOST_UNREACHABLE, + CURLPX_REPLY_NETWORK_UNREACHABLE, + CURLPX_REPLY_NOT_ALLOWED, + CURLPX_REPLY_TTL_EXPIRED, + CURLPX_REPLY_UNASSIGNED, + CURLPX_REQUEST_FAILED, + CURLPX_RESOLVE_HOST, + CURLPX_SEND_AUTH, + CURLPX_SEND_CONNECT, + CURLPX_SEND_REQUEST, + CURLPX_UNKNOWN_FAIL, + CURLPX_UNKNOWN_MODE, + CURLPX_USER_REJECTED, + CURLPX_LAST /* never use */ +} CURLproxycode; + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_ERROR, long *detail); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive a detailed error code when the most recent +transfer returned a **CURLE_PROXY** error. That error code matches the +**CURLproxycode** set. + +The error code is zero (**CURLPX_OK**) if no response code was available. + +# PROTOCOLS + +All that can be done over SOCKS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://127.0.0.1"); + res = curl_easy_perform(curl); + if(res == CURLE_PROXY) { + long proxycode; + res = curl_easy_getinfo(curl, CURLINFO_PROXY_ERROR, &proxycode); + if(!res && proxycode) + printf("The detailed proxy error: %ld\n", proxycode); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.73.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3 b/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3 deleted file mode 100644 index c2a311a2a..000000000 --- a/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_PROXY_SSL_VERIFYRESULT 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLINFO_PROXY_SSL_VERIFYRESULT \- get the result of the proxy certificate verification -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_SSL_VERIFYRESULT, - long *result); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the result of the certificate verification -that was requested (using the \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP -option. This is only used for HTTPS proxies. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - long verifyresult; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443"); - res = curl_easy_perform(curl); - if(res) - printf("error: %s\\n", curl_easy_strerror(res)); - curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT, &verifyresult); - printf("The peer verification said %s\\n", verifyresult? - "fine" : "bad"); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SSL_VERIFYRESULT (3) diff --git a/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.md b/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.md new file mode 100644 index 000000000..d97f5e78e --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_PROXY_SSL_VERIFYRESULT.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_PROXY_SSL_VERIFYRESULT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SSL_VERIFYRESULT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_PROXY_SSL_VERIFYRESULT - get the result of the proxy certificate verification + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXY_SSL_VERIFYRESULT, + long *result); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the result of the certificate verification +that was requested (using the CURLOPT_PROXY_SSL_VERIFYPEER(3) +option. This is only used for HTTPS proxies. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + long verifyresult; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy:443"); + res = curl_easy_perform(curl); + if(res) + printf("error: %s\n", curl_easy_strerror(res)); + curl_easy_getinfo(curl, CURLINFO_PROXY_SSL_VERIFYRESULT, &verifyresult); + printf("The peer verification said %s\n", verifyresult? + "fine" : "bad"); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.3 b/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.3 deleted file mode 100644 index 5ccd7c48a..000000000 --- a/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_QUEUE_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_QUEUE_TIME_T \- time this transfer was queued -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_QUEUE_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the time, in microseconds, this -transfer was held in a waiting queue before it started "for real". A transfer -might be put in a queue if after getting started, it cannot create a new -connection etc due to set conditions and limits imposed by the application. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t queue; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_QUEUE_TIME_T, &queue); - if(CURLE_OK == res) { - printf("Queued: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", queue / 1000000, - (long)(queue % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 8.6.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_STARTTRANSFER_TIME_T (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.md b/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.md new file mode 100644 index 000000000..00454e752 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_QUEUE_TIME_T.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_QUEUE_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_STARTTRANSFER_TIME_T (3) + - CURLOPT_TIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_QUEUE_TIME_T - time this transfer was queued + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_QUEUE_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the time, in microseconds, this +transfer was held in a waiting queue before it started "for real". A transfer +might be put in a queue if after getting started, it cannot create a new +connection etc due to set conditions and limits imposed by the application. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t queue; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_QUEUE_TIME_T, &queue); + if(CURLE_OK == res) { + printf("Queued: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", queue / 1000000, + (long)(queue % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 8.6.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 deleted file mode 100644 index a0017d706..000000000 --- a/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REDIRECT_COUNT 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_REDIRECT_COUNT \- get the number of redirects -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT, - long *countp); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the total number of redirections that were -actually followed. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long redirects; - curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.9.7 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLOPT_FOLLOWLOCATION (3) diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.md b/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.md new file mode 100644 index 000000000..aa75bdb22 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REDIRECT_COUNT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_URL (3) + - CURLOPT_FOLLOWLOCATION (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REDIRECT_COUNT - get the number of redirects + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_COUNT, + long *countp); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the total number of redirections that were +actually followed. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long redirects; + curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3 deleted file mode 100644 index ece2055c0..000000000 --- a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REDIRECT_TIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_REDIRECT_TIME \- get the time for all redirection steps -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME, - double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total time, in seconds, it took for -all redirection steps include name lookup, connect, pretransfer and transfer -before final transaction was started. \fICURLINFO_REDIRECT_TIME(3)\fP contains -the complete execution time for multiple redirections. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - double redirect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect); - if(CURLE_OK == res) { - printf("Time: %.1f", redirect); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.9.7 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLINFO_REDIRECT_TIME_T (3), -.BR CURLINFO_REDIRECT_URL (3) diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.md b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.md new file mode 100644 index 000000000..26d9af2a0 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REDIRECT_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLINFO_REDIRECT_TIME_T (3) + - CURLINFO_REDIRECT_URL (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REDIRECT_TIME - get the time for all redirection steps + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME, + double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total time, in seconds, it took for +all redirection steps include name lookup, connect, pretransfer and transfer +before final transaction was started. CURLINFO_REDIRECT_TIME(3) contains +the complete execution time for multiple redirections. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + double redirect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect); + if(CURLE_OK == res) { + printf("Time: %.1f", redirect); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 deleted file mode 100644 index cbda42035..000000000 --- a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REDIRECT_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_REDIRECT_TIME_T \- get the time for all redirection steps -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the total time, in microseconds, it -took for all redirection steps include name lookup, connect, pretransfer and -transfer before final transaction was started. -\fICURLINFO_REDIRECT_TIME_T(3)\fP holds the complete execution time for -multiple redirections. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_off_t redirect; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(CURLE_OK == res) { - res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect); - if(CURLE_OK == res) { - printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000, - (long)(redirect % 1000000)); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLINFO_REDIRECT_TIME (3), -.BR CURLINFO_REDIRECT_URL (3) diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.md b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.md new file mode 100644 index 000000000..f4ee71089 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REDIRECT_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLINFO_REDIRECT_TIME (3) + - CURLINFO_REDIRECT_URL (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REDIRECT_TIME_T - get the time for all redirection steps + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the total time, in microseconds, it +took for all redirection steps include name lookup, connect, pretransfer and +transfer before final transaction was started. +CURLINFO_REDIRECT_TIME_T(3) holds the complete execution time for +multiple redirections. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_off_t redirect; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(CURLE_OK == res) { + res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect); + if(CURLE_OK == res) { + printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000, + (long)(redirect % 1000000)); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_URL.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_URL.3 deleted file mode 100644 index 61422f6db..000000000 --- a/docs/libcurl/opts/CURLINFO_REDIRECT_URL.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REDIRECT_URL 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_REDIRECT_URL \- get the URL a redirect would go to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_URL, char **urlp); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the URL a redirect \fIwould\fP -take you to if you would enable \fICURLOPT_FOLLOWLOCATION(3)\fP. This can come -handy if you think using the built-in libcurl redirect logic is not good enough -for you but you would still prefer to avoid implementing all the magic of -figuring out the new URL. - -This URL is also set if the \fICURLOPT_MAXREDIRS(3)\fP limit prevented a -redirect to happen (since 7.54.1). -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - char *url = NULL; - curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &url); - if(url) - printf("Redirect to: %s\\n", url); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.18.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLINFO_REDIRECT_TIME_T (3), -.BR CURLOPT_FOLLOWLOCATION (3) diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_URL.md b/docs/libcurl/opts/CURLINFO_REDIRECT_URL.md new file mode 100644 index 000000000..8d7fc5c10 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REDIRECT_URL.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REDIRECT_URL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLINFO_REDIRECT_TIME_T (3) + - CURLOPT_FOLLOWLOCATION (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REDIRECT_URL - get the URL a redirect would go to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_URL, char **urlp); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the URL a redirect *would* +take you to if you would enable CURLOPT_FOLLOWLOCATION(3). This can come +handy if you think using the built-in libcurl redirect logic is not good enough +for you but you would still prefer to avoid implementing all the magic of +figuring out the new URL. + +This URL is also set if the CURLOPT_MAXREDIRS(3) limit prevented a +redirect to happen (since 7.54.1). + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + char *url = NULL; + curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &url); + if(url) + printf("Redirect to: %s\n", url); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.18.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REFERER.3 b/docs/libcurl/opts/CURLINFO_REFERER.3 deleted file mode 100644 index cc1a3c667..000000000 --- a/docs/libcurl/opts/CURLINFO_REFERER.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REFERER 3 "11 Feb 2021" libcurl libcurl -.SH NAME -CURLINFO_REFERER \- get the used referrer request header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REFERER, char **hdrp); -.fi -.SH DESCRIPTION -Pass in a pointer to a char pointer and get the referrer header used in the -most recent request. - -The \fBhdrp\fP pointer is NULL or points to private memory you MUST NOT free - -it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - curl_easy_setopt(curl, CURLOPT_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); - } -} -.fi -.SH AVAILABILITY -Added in 7.76.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_header (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_REFERER (3) diff --git a/docs/libcurl/opts/CURLINFO_REFERER.md b/docs/libcurl/opts/CURLINFO_REFERER.md new file mode 100644 index 000000000..fabc652a7 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REFERER.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REFERER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_REFERER (3) + - curl_easy_getinfo (3) + - curl_easy_header (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REFERER - get the used referrer request header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REFERER, char **hdrp); +~~~ + +# DESCRIPTION + +Pass in a pointer to a char pointer and get the referrer header used in the +most recent request. + +The **hdrp** pointer is NULL or points to private memory you MUST NOT free - +it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.76.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3 b/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3 deleted file mode 100644 index 9f7029107..000000000 --- a/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_REQUEST_SIZE 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_REQUEST_SIZE \- get size of sent request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REQUEST_SIZE, long *sizep); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the total size of the issued -requests. This is so far only for HTTP requests. Note that this may be more -than one request if \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long req; - res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req); - if(!res) - printf("Request size: %ld bytes\\n", req); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_HEADER_SIZE (3), -.BR CURLINFO_SIZE_DOWNLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.md b/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.md new file mode 100644 index 000000000..444f4ec23 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_REQUEST_SIZE.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_REQUEST_SIZE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_HEADER_SIZE (3) + - CURLINFO_SIZE_DOWNLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_REQUEST_SIZE - get size of sent request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REQUEST_SIZE, long *sizep); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the total size of the issued +requests. This is so far only for HTTP requests. Note that this may be more +than one request if CURLOPT_FOLLOWLOCATION(3) is enabled. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long req; + res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req); + if(!res) + printf("Request size: %ld bytes\n", req); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 b/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 deleted file mode 100644 index c006a1580..000000000 --- a/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RESPONSE_CODE 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_RESPONSE_CODE \- get the last response code -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RESPONSE_CODE, long *codep); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the last received HTTP, FTP, SMTP or LDAP -(OpenLDAP only) response code. This option was previously known as -CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. The stored value is zero if -no server response code has been received. - -Note that a proxy's CONNECT response should be read with -\fICURLINFO_HTTP_CONNECTCODE(3)\fP and not this. -.SH PROTOCOLS -HTTP, FTP, SMTP and LDAP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - long response_code; - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.8. CURLINFO_HTTP_CODE was added in 7.4.1. -Support for SMTP responses added in 7.25.0, for OpenLDAP in 7.81.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_HTTP_CONNECTCODE (3) diff --git a/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.md b/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.md new file mode 100644 index 000000000..43cf8378d --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RESPONSE_CODE.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RESPONSE_CODE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_HTTP_CONNECTCODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_RESPONSE_CODE - get the last response code + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RESPONSE_CODE, long *codep); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the last received HTTP, FTP, SMTP or LDAP +(OpenLDAP only) response code. This option was previously known as +CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. The stored value is zero if +no server response code has been received. + +Note that a proxy's CONNECT response should be read with +CURLINFO_HTTP_CONNECTCODE(3) and not this. + +# PROTOCOLS + +HTTP, FTP, SMTP and LDAP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + long response_code; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.8. CURLINFO_HTTP_CODE was added in 7.4.1. +Support for SMTP responses added in 7.25.0, for OpenLDAP in 7.81.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 b/docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 deleted file mode 100644 index 5a7450ccb..000000000 --- a/docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RETRY_AFTER 3 "6 Aug 2019" libcurl libcurl -.SH NAME -CURLINFO_RETRY_AFTER \- returns the Retry-After retry delay -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RETRY_AFTER, - curl_off_t *retry); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t variable to receive the number of seconds the -HTTP server suggests the client should wait until the next request is -issued. The information from the "Retry-After:" header. - -While the HTTP header might contain a fixed date string, the -\fICURLINFO_RETRY_AFTER(3)\fP always returns the number of seconds to wait - -or zero if there was no header or the header could not be parsed. -.SH DEFAULT -Returns zero delay if there was no header. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.66.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_header (3), -.BR CURLOPT_HEADERFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLINFO_RETRY_AFTER.md b/docs/libcurl/opts/CURLINFO_RETRY_AFTER.md new file mode 100644 index 000000000..adc120077 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RETRY_AFTER.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RETRY_AFTER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERFUNCTION (3) + - CURLOPT_STDERR (3) + - curl_easy_header (3) +--- + +# NAME + +CURLINFO_RETRY_AFTER - returns the Retry-After retry delay + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RETRY_AFTER, + curl_off_t *retry); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t variable to receive the number of seconds the +HTTP server suggests the client should wait until the next request is +issued. The information from the "Retry-After:" header. + +While the HTTP header might contain a fixed date string, the +CURLINFO_RETRY_AFTER(3) always returns the number of seconds to wait - +or zero if there was no header or the header could not be parsed. + +# DEFAULT + +Returns zero delay if there was no header. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.66.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3 b/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3 deleted file mode 100644 index bd8ec271e..000000000 --- a/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RTSP_CLIENT_CSEQ 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_RTSP_CLIENT_CSEQ \- get the next RTSP client CSeq -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_CLIENT_CSEQ, - long *cseq); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the next CSeq that is expected to be used -by the application. -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RTSP_CSEQ_RECV (3), -.BR CURLINFO_RTSP_SERVER_CSEQ (3) diff --git a/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.md b/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.md new file mode 100644 index 000000000..8b515b427 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RTSP_CLIENT_CSEQ +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_CSEQ_RECV (3) + - CURLINFO_RTSP_SERVER_CSEQ (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_RTSP_CLIENT_CSEQ - get the next RTSP client CSeq + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_CLIENT_CSEQ, + long *cseq); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the next CSeq that is expected to be used +by the application. + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3 b/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3 deleted file mode 100644 index dc840a847..000000000 --- a/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RTSP_CSEQ_RECV 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_RTSP_CSEQ_RECV \- get the recently received CSeq -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_CSEQ_RECV, long *cseq); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the most recently received CSeq from the -server. If your application encounters a \fICURLE_RTSP_CSEQ_ERROR\fP then you -may wish to troubleshoot and/or fix the CSeq mismatch by peeking at this -value. -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RTSP_SERVER_CSEQ (3) diff --git a/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.md b/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.md new file mode 100644 index 000000000..9eb813aa4 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RTSP_CSEQ_RECV +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_SERVER_CSEQ (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_RTSP_CSEQ_RECV - get the recently received CSeq + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_CSEQ_RECV, long *cseq); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the most recently received CSeq from the +server. If your application encounters a *CURLE_RTSP_CSEQ_ERROR* then you +may wish to troubleshoot and/or fix the CSeq mismatch by peeking at this +value. + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3 b/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3 deleted file mode 100644 index 8cf052261..000000000 --- a/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RTSP_SERVER_CSEQ 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_RTSP_SERVER_CSEQ \- get the next RTSP server CSeq -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_SERVER_CSEQ, - long *cseq); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the next CSeq that is expected to be used -by the application. - -Listening for server initiated requests is not implemented! - -Applications wishing to resume an RTSP session on another connection should -retrieve this info before closing the active connection. -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RTSP_CSEQ_RECV (3) diff --git a/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.md b/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.md new file mode 100644 index 000000000..7826f8a3c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RTSP_SERVER_CSEQ +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_CSEQ_RECV (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_RTSP_SERVER_CSEQ - get the next RTSP server CSeq + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_SERVER_CSEQ, + long *cseq); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the next CSeq that is expected to be used +by the application. + +Listening for server initiated requests is not implemented! + +Applications wishing to resume an RTSP session on another connection should +retrieve this info before closing the active connection. + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.3 b/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.3 deleted file mode 100644 index fe1e3fd0d..000000000 --- a/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_RTSP_SESSION_ID 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_RTSP_SESSION_ID \- get RTSP session ID -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_SESSION_ID, char **id); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive a pointer to a string holding the -most recent RTSP Session ID. - -Applications wishing to resume an RTSP session on another connection should -retrieve this info before closing the active connection. - -The \fBid\fP pointer is NULL or points to private memory. You MUST NOT free - -it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the corresponding -CURL handle. -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_RTSP_CSEQ_RECV (3) diff --git a/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.md b/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.md new file mode 100644 index 000000000..402a122f8 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_RTSP_SESSION_ID.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_RTSP_SESSION_ID +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_CSEQ_RECV (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_RTSP_SESSION_ID - get RTSP session ID + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_RTSP_SESSION_ID, char **id); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive a pointer to a string holding the +most recent RTSP Session ID. + +Applications wishing to resume an RTSP session on another connection should +retrieve this info before closing the active connection. + +The **id** pointer is NULL or points to private memory. You MUST NOT free - +it gets freed when you call curl_easy_cleanup(3) on the corresponding +CURL handle. + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SCHEME.3 b/docs/libcurl/opts/CURLINFO_SCHEME.3 deleted file mode 100644 index 018866a68..000000000 --- a/docs/libcurl/opts/CURLINFO_SCHEME.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SCHEME 3 "23 November 2016" libcurl libcurl -.SH NAME -CURLINFO_SCHEME \- get the URL scheme (sometimes called protocol) used in the connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SCHEME, char **scheme); -.fi -.SH DESCRIPTION -Pass a pointer to a char pointer to receive the pointer to a null-terminated -string holding the URL scheme used for the most recent connection done with -this CURL \fBhandle\fP. - -The \fBscheme\fP pointer is NULL or points to private memory. You MUST NOT -free - it gets freed when you call \fIcurl_easy_cleanup(3)\fP on the -corresponding CURL handle. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - res = curl_easy_perform(curl); - if(res == CURLE_OK) { - char *scheme = NULL; - curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme); - if(scheme) - printf("scheme: %s\\n", scheme); /* scheme: HTTP */ - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_EFFECTIVE_URL (3), -.BR CURLINFO_PROTOCOL (3), -.BR CURLINFO_RESPONSE_CODE (3) diff --git a/docs/libcurl/opts/CURLINFO_SCHEME.md b/docs/libcurl/opts/CURLINFO_SCHEME.md new file mode 100644 index 000000000..db567fc98 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SCHEME.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SCHEME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_EFFECTIVE_URL (3) + - CURLINFO_PROTOCOL (3) + - CURLINFO_RESPONSE_CODE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SCHEME - get the URL scheme (sometimes called protocol) used in the connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SCHEME, char **scheme); +~~~ + +# DESCRIPTION + +Pass a pointer to a char pointer to receive the pointer to a null-terminated +string holding the URL scheme used for the most recent connection done with +this CURL **handle**. + +The **scheme** pointer is NULL or points to private memory. You MUST NOT +free - it gets freed when you call curl_easy_cleanup(3) on the +corresponding CURL handle. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + res = curl_easy_perform(curl); + if(res == CURLE_OK) { + char *scheme = NULL; + curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme); + if(scheme) + printf("scheme: %s\n", scheme); /* scheme: HTTP */ + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 deleted file mode 100644 index 7ac1f9231..000000000 --- a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SIZE_DOWNLOAD 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_SIZE_DOWNLOAD \- get the number of downloaded bytes -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD, double *dlp); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total amount of bytes that were -downloaded. The amount is only for the latest transfer and gets reset again -for each new transfer. This counts actual payload data, what's also commonly -called body. All meta and header data is excluded and not included in this -number. - -\fICURLINFO_SIZE_DOWNLOAD_T(3)\fP is a newer replacement that returns a more -sensible variable type. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - double dl; - res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl); - if(!res) { - printf("Downloaded %.0f bytes\\n", dl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_DOWNLOAD_T (3), -.BR CURLINFO_SIZE_UPLOAD_T (3), -.BR CURLOPT_MAXFILESIZE (3) diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.md b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.md new file mode 100644 index 000000000..ff19908cf --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SIZE_DOWNLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_DOWNLOAD_T (3) + - CURLINFO_SIZE_UPLOAD_T (3) + - CURLOPT_MAXFILESIZE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SIZE_DOWNLOAD - get the number of downloaded bytes + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD, double *dlp); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total amount of bytes that were +downloaded. The amount is only for the latest transfer and gets reset again +for each new transfer. This counts actual payload data, what's also commonly +called body. All meta and header data is excluded and not included in this +number. + +CURLINFO_SIZE_DOWNLOAD_T(3) is a newer replacement that returns a more +sensible variable type. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + double dl; + res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl); + if(!res) { + printf("Downloaded %.0f bytes\n", dl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3 b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3 deleted file mode 100644 index 5e424f235..000000000 --- a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SIZE_DOWNLOAD_T 3 "25 May 2017" libcurl libcurl -.SH NAME -CURLINFO_SIZE_DOWNLOAD_T \- get the number of downloaded bytes -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T, - curl_off_t *dlp); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the total amount of bytes that -were downloaded. The amount is only for the latest transfer and gets reset -again for each new transfer. This counts actual payload data, what's also -commonly called body. All meta and header data is excluded from this amount. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - /* check the size */ - curl_off_t dl; - res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl); - if(!res) { - printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", dl); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_DOWNLOAD (3), -.BR CURLINFO_SIZE_UPLOAD_T (3), -.BR CURLOPT_MAXFILESIZE (3) diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.md b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.md new file mode 100644 index 000000000..f5468db9d --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SIZE_DOWNLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_DOWNLOAD (3) + - CURLINFO_SIZE_UPLOAD_T (3) + - CURLOPT_MAXFILESIZE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SIZE_DOWNLOAD_T - get the number of downloaded bytes + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T, + curl_off_t *dlp); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the total amount of bytes that +were downloaded. The amount is only for the latest transfer and gets reset +again for each new transfer. This counts actual payload data, what's also +commonly called body. All meta and header data is excluded from this amount. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + /* check the size */ + curl_off_t dl; + res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl); + if(!res) { + printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 deleted file mode 100644 index ba01b3119..000000000 --- a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SIZE_UPLOAD 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_SIZE_UPLOAD \- get the number of uploaded bytes -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_UPLOAD, - double *uploadp); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total amount of bytes that were -uploaded. - -\fICURLINFO_SIZE_UPLOAD_T(3)\fP is a newer replacement that returns a more -sensible variable type. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - double ul; - res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &ul); - if(!res) { - printf("Uploaded %.0f bytes\\n", ul); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_DOWNLOAD_T (3), -.BR CURLINFO_SIZE_UPLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.md b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.md new file mode 100644 index 000000000..175fe718d --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SIZE_UPLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_DOWNLOAD_T (3) + - CURLINFO_SIZE_UPLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SIZE_UPLOAD - get the number of uploaded bytes + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_UPLOAD, + double *uploadp); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total amount of bytes that were +uploaded. + +CURLINFO_SIZE_UPLOAD_T(3) is a newer replacement that returns a more +sensible variable type. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + double ul; + res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &ul); + if(!res) { + printf("Uploaded %.0f bytes\n", ul); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3 b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3 deleted file mode 100644 index 5f5dd766a..000000000 --- a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SIZE_UPLOAD_T 3 "25 May 2017" libcurl libcurl -.SH NAME -CURLINFO_SIZE_UPLOAD_T \- get the number of uploaded bytes -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_UPLOAD_T, - curl_off_t *uploadp); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the total amount of bytes that -were uploaded. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - curl_off_t ul; - res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &ul); - if(!res) { - printf("Uploaded %" CURL_FORMAT_CURL_OFF_T " bytes\\n", ul); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_DOWNLOAD_T (3), -.BR CURLINFO_SIZE_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.md b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.md new file mode 100644 index 000000000..29874f9fd --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD_T.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SIZE_UPLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_DOWNLOAD_T (3) + - CURLINFO_SIZE_UPLOAD (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SIZE_UPLOAD_T - get the number of uploaded bytes + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_UPLOAD_T, + curl_off_t *uploadp); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the total amount of bytes that +were uploaded. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + curl_off_t ul; + res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &ul); + if(!res) { + printf("Uploaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", ul); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 deleted file mode 100644 index 7c277d51d..000000000 --- a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SPEED_DOWNLOAD 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_SPEED_DOWNLOAD \- get download speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD, - double *speed); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the average download speed that curl -measured for the complete download. Measured in bytes/second. - -\fICURLINFO_SPEED_DOWNLOAD_T(3)\fP is a newer replacement that returns a more -sensible variable type. -.SH PROTOCOLS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - double speed; - res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed); - if(!res) { - printf("Download speed %.0f bytes/sec\\n", speed); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_UPLOAD_T (3), -.BR CURLINFO_SPEED_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.md b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.md new file mode 100644 index 000000000..fe0766939 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SPEED_DOWNLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_UPLOAD_T (3) + - CURLINFO_SPEED_UPLOAD (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SPEED_DOWNLOAD - get download speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD, + double *speed); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the average download speed that curl +measured for the complete download. Measured in bytes/second. + +CURLINFO_SPEED_DOWNLOAD_T(3) is a newer replacement that returns a more +sensible variable type. + +# PROTOCOLS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + double speed; + res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed); + if(!res) { + printf("Download speed %.0f bytes/sec\n", speed); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3 b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3 deleted file mode 100644 index 5bf2c285b..000000000 --- a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SPEED_DOWNLOAD_T 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_SPEED_DOWNLOAD_T \- get download speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD_T, - curl_off_t *speed); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the average download speed -that curl measured for the complete download. Measured in bytes/second. -.SH PROTOCOLS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - curl_off_t 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); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SIZE_UPLOAD_T (3), -.BR CURLINFO_SPEED_UPLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.md b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.md new file mode 100644 index 000000000..c8bc2f867 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SPEED_DOWNLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SIZE_UPLOAD_T (3) + - CURLINFO_SPEED_UPLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SPEED_DOWNLOAD_T - get download speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD_T, + curl_off_t *speed); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the average download speed +that curl measured for the complete download. Measured in bytes/second. + +# PROTOCOLS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + curl_off_t 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); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 deleted file mode 100644 index c42f3b517..000000000 --- a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SPEED_UPLOAD 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_SPEED_UPLOAD \- get upload speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD, double *speed); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the average upload speed that curl -measured for the complete upload. Measured in bytes/second. - -\fICURLINFO_SPEED_UPLOAD_T(3)\fP is a newer replacement that returns a more -sensible variable type. -.SH PROTOCOLS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - double speed; - res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed); - if(!res) { - printf("Upload speed %.0f bytes/sec\\n", speed); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1. Deprecated since 7.55.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SPEED_DOWNLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.md b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.md new file mode 100644 index 000000000..11ce92923 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SPEED_UPLOAD +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SPEED_DOWNLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SPEED_UPLOAD - get upload speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD, double *speed); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the average upload speed that curl +measured for the complete upload. Measured in bytes/second. + +CURLINFO_SPEED_UPLOAD_T(3) is a newer replacement that returns a more +sensible variable type. + +# PROTOCOLS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the 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); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1. Deprecated since 7.55.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3 b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3 deleted file mode 100644 index f2bf1d735..000000000 --- a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SPEED_UPLOAD_T 3 "25 May 2017" libcurl libcurl -.SH NAME -CURLINFO_SPEED_UPLOAD_T \- get upload speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD_T, - curl_off_t *speed); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the average upload speed that -curl measured for the complete upload. Measured in bytes/second. -.SH PROTOCOLS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - curl_off_t 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); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_SPEED_DOWNLOAD_T (3) diff --git a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.md b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.md new file mode 100644 index 000000000..178e9a526 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD_T.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SPEED_UPLOAD_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SPEED_DOWNLOAD_T (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SPEED_UPLOAD_T - get upload speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD_T, + curl_off_t *speed); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the average upload speed that +curl measured for the complete upload. Measured in bytes/second. + +# PROTOCOLS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + curl_off_t 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); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SSL_ENGINES.3 b/docs/libcurl/opts/CURLINFO_SSL_ENGINES.3 deleted file mode 100644 index 03db5bbb4..000000000 --- a/docs/libcurl/opts/CURLINFO_SSL_ENGINES.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SSL_ENGINES 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_SSL_ENGINES \- get an slist of OpenSSL crypto-engines -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_ENGINES, - struct curl_slist **engine_list); -.fi -.SH DESCRIPTION -Pass the address of a 'struct curl_slist *' to receive a linked-list of -OpenSSL crypto-engines supported. Note that engines are normally implemented -in separate dynamic libraries. Hence not all the returned engines may be -available at runtime. \fBNOTE:\fP you must call \fIcurl_slist_free_all(3)\fP -on the list pointer once you are done with it, as libcurl does not free this -data for you. -.SH PROTOCOLS -All TLS based ones. -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.12.3. Available in OpenSSL builds with "engine" support. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLOPT_SSLENGINE (3) diff --git a/docs/libcurl/opts/CURLINFO_SSL_ENGINES.md b/docs/libcurl/opts/CURLINFO_SSL_ENGINES.md new file mode 100644 index 000000000..9dbb0a1d1 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SSL_ENGINES.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SSL_ENGINES +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLENGINE (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SSL_ENGINES - get an slist of OpenSSL crypto-engines + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_ENGINES, + struct curl_slist **engine_list); +~~~ + +# DESCRIPTION + +Pass the address of a 'struct curl_slist *' to receive a linked-list of +OpenSSL crypto-engines supported. Note that engines are normally implemented +in separate dynamic libraries. Hence not all the returned engines may be +available at runtime. **NOTE:** you must call curl_slist_free_all(3) +on the list pointer once you are done with it, as libcurl does not free this +data for you. + +# PROTOCOLS + +All TLS based ones. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.12.3. Available in OpenSSL builds with "engine" support. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3 b/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3 deleted file mode 100644 index cf881ec81..000000000 --- a/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_SSL_VERIFYRESULT 3 "1 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_SSL_VERIFYRESULT \- get the result of the certificate verification -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT, - long *result); -.fi -.SH DESCRIPTION -Pass a pointer to a long to receive the result of the server SSL certificate -verification that was requested (using the \fICURLOPT_SSL_VERIFYPEER(3)\fP -option). - -0 is a positive result. Non-zero is an error. -.SH PROTOCOLS -All using TLS -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - long verifyresult; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - 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 -Added in 7.5. Only set by the OpenSSL/libressl/boringssl and GnuTLS backends. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_PROXY_SSL_VERIFYRESULT (3) diff --git a/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.md b/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.md new file mode 100644 index 000000000..fdc38f016 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_SSL_VERIFYRESULT.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_SSL_VERIFYRESULT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PROXY_SSL_VERIFYRESULT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_SSL_VERIFYRESULT - get the result of the certificate verification + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT, + long *result); +~~~ + +# DESCRIPTION + +Pass a pointer to a long to receive the result of the server SSL certificate +verification that was requested (using the CURLOPT_SSL_VERIFYPEER(3) +option). + +0 is a positive result. Non-zero is an error. + +# PROTOCOLS + +All using TLS + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + long verifyresult; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.5. Only set by the OpenSSL/libressl/boringssl and GnuTLS backends. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3 b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3 deleted file mode 100644 index c9879d2e5..000000000 --- a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_STARTTRANSFER_TIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_STARTTRANSFER_TIME \- get the time until the first byte is received -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME, - double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the first byte is received by libcurl. This includes -\fICURLINFO_PRETRANSFER_TIME(3)\fP and also the time the server needs to -calculate the result. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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) { - res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start); - if(CURLE_OK == res) { - printf("Time: %.1f", start); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.9.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_STARTTRANSFER_TIME_T (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.md b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.md new file mode 100644 index 000000000..d7c1f0884 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_STARTTRANSFER_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_STARTTRANSFER_TIME_T (3) + - CURLOPT_TIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_STARTTRANSFER_TIME - get the time until the first byte is received + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME, + double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the time, in seconds, it took from the +start until the first byte is received by libcurl. This includes +CURLINFO_PRETRANSFER_TIME(3) and also the time the server needs to +calculate the result. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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) { + res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start); + if(CURLE_OK == res) { + printf("Time: %.1f", start); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 deleted file mode 100644 index 7638f115e..000000000 --- a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_STARTTRANSFER_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_STARTTRANSFER_TIME_T \- get the time until the first byte is received -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the time, in microseconds, -it took from the -start until the first byte is received by libcurl. This includes -\fICURLINFO_PRETRANSFER_TIME_T(3)\fP and also the time the server needs to -calculate the result. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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) { - 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_STARTTRANSFER_TIME (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.md b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.md new file mode 100644 index 000000000..481c7f5bd --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_STARTTRANSFER_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_STARTTRANSFER_TIME (3) + - CURLOPT_TIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_STARTTRANSFER_TIME_T - get the time until the first byte is received + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the time, in microseconds, +it took from the +start until the first byte is received by libcurl. This includes +CURLINFO_PRETRANSFER_TIME_T(3) and also the time the server needs to +calculate the result. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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) { + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_TLS_SESSION.3 b/docs/libcurl/opts/CURLINFO_TLS_SESSION.3 deleted file mode 100644 index 60d648552..000000000 --- a/docs/libcurl/opts/CURLINFO_TLS_SESSION.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_TLS_SESSION 3 "12 Sep 2015" libcurl libcurl -.SH NAME -CURLINFO_TLS_SESSION \- get TLS session info -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION, - struct curl_tlssessioninfo **session); -.SH DESCRIPTION -\fBThis option has been superseded\fP by \fICURLINFO_TLS_SSL_PTR(3)\fP which -was added in 7.48.0. The only reason you would use this option instead is if -you could be using a version of libcurl earlier than 7.48.0. - -This option is exactly the same as \fICURLINFO_TLS_SSL_PTR(3)\fP except in the -case of OpenSSL. If the session \fIbackend\fP is CURLSSLBACKEND_OPENSSL the -session \fIinternals\fP pointer varies depending on the option: - -\fICURLINFO_TLS_SESSION(3)\fP OpenSSL session \fIinternals\fP is \fBSSL_CTX *\fP. - -\fICURLINFO_TLS_SSL_PTR(3)\fP OpenSSL session \fIinternals\fP is \fBSSL *\fP. - -You can obtain an \fBSSL_CTX\fP pointer from an SSL pointer using OpenSSL -function \fISSL_get_SSL_CTX(3)\fP. Therefore unless you need compatibility -with older versions of libcurl use \fICURLINFO_TLS_SSL_PTR(3)\fP. Refer to -that document for more information. -.SH PROTOCOLS -All TLS-based -.SH EXAMPLE -.nf -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 -Added in 7.34.0. Deprecated since 7.48.0 and supported OpenSSL, GnuTLS, and -NSS only up until this version was released. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_TLS_SSL_PTR (3) diff --git a/docs/libcurl/opts/CURLINFO_TLS_SESSION.md b/docs/libcurl/opts/CURLINFO_TLS_SESSION.md new file mode 100644 index 000000000..98cc2d67c --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_TLS_SESSION.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_TLS_SESSION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_TLS_SSL_PTR (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_TLS_SESSION - get TLS session info + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION, + struct curl_tlssessioninfo **session); +~~~ + +# DESCRIPTION + +**This option has been superseded** by CURLINFO_TLS_SSL_PTR(3) which +was added in 7.48.0. The only reason you would use this option instead is if +you could be using a version of libcurl earlier than 7.48.0. + +This option is exactly the same as CURLINFO_TLS_SSL_PTR(3) except in the +case of OpenSSL. If the session *backend* is CURLSSLBACKEND_OPENSSL the +session *internals* pointer varies depending on the option: + +CURLINFO_TLS_SESSION(3) OpenSSL session *internals* is **SSL_CTX ***. + +CURLINFO_TLS_SSL_PTR(3) OpenSSL session *internals* is **SSL ***. + +You can obtain an **SSL_CTX** pointer from an SSL pointer using OpenSSL +function *SSL_get_SSL_CTX(3)*. Therefore unless you need compatibility +with older versions of libcurl use CURLINFO_TLS_SSL_PTR(3). Refer to +that document for more information. + +# PROTOCOLS + +All TLS-based + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.34.0. Deprecated since 7.48.0 and supported OpenSSL, GnuTLS, and +NSS only up until this version was released. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 b/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.md similarity index 54% rename from docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 rename to docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.md index 8c5f2525e..23b2a2c3f 100644 --- a/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 +++ b/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.md @@ -1,32 +1,22 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_TLS_SSL_PTR 3 "23 Feb 2016" libcurl libcurl -.SH NAME -CURLINFO_TLS_SESSION, CURLINFO_TLS_SSL_PTR \- get TLS session info -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_TLS_SSL_PTR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_TLS_SESSION (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_TLS_SESSION, CURLINFO_TLS_SSL_PTR - get TLS session info + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SSL_PTR, @@ -37,60 +27,75 @@ CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SSL_PTR, CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION, struct curl_tlssessioninfo **session); -.SH DESCRIPTION -Pass a pointer to a \fIstruct curl_tlssessioninfo *\fP. The pointer is -initialized to refer to a \fIstruct curl_tlssessioninfo *\fP that contains an -enum indicating the SSL library used for the handshake and a pointer to the -respective internal TLS session structure of this underlying SSL library. +~~~ + +# DESCRIPTION + +Pass a pointer to a *struct curl_tlssessioninfo **. The pointer is initialized +to refer to a *struct curl_tlssessioninfo ** that contains an enum indicating +the SSL library used for the handshake and a pointer to the respective +internal TLS session structure of this underlying SSL library. This option may be useful for example to extract certificate information in a format convenient for further processing, such as manual validation. Refer to -the \fBLIMITATIONS\fP section. +the **LIMITATIONS** section. -.nf +~~~c struct curl_tlssessioninfo { curl_sslbackend backend; void *internals; }; -.fi +~~~ -The \fIbackend\fP struct member is one of the defines in the CURLSSLBACKEND_* +The *backend* struct member is one of the defines in the CURLSSLBACKEND_* series: CURLSSLBACKEND_NONE (when built without TLS support), CURLSSLBACKEND_WOLFSSL, CURLSSLBACKEND_SECURETRANSPORT, CURLSSLBACKEND_GNUTLS, CURLSSLBACKEND_MBEDTLS, CURLSSLBACKEND_NSS, CURLSSLBACKEND_OPENSSL, CURLSSLBACKEND_SCHANNEL or CURLSSLBACKEND_MESALINK. (Note that the OpenSSL forks are all reported as just OpenSSL here.) -The \fIinternals\fP struct member points to a TLS library specific pointer for +The *internals* struct member points to a TLS library specific pointer for the active ("in use") SSL connection, with the following underlying types: -.RS -.IP GnuTLS -\fBgnutls_session_t\fP -.IP NSS -\fBPRFileDesc *\fP -.IP OpenSSL -\fICURLINFO_TLS_SESSION(3)\fP: \fBSSL_CTX *\fP -\fICURLINFO_TLS_SSL_PTR(3)\fP: \fBSSL *\fP -.RE -Since 7.48.0 the \fIinternals\fP member can point to these other SSL backends +## GnuTLS + +**gnutls_session_t** + +## NSS + +**PRFileDesc *** + +## OpenSSL + +CURLINFO_TLS_SESSION(3): **SSL_CTX *** + +CURLINFO_TLS_SSL_PTR(3): **SSL *** +Since 7.48.0 the *internals* member can point to these other SSL backends as well: -.RS -.IP mbedTLS -\fBmbedTLS_ssl_context *\fP -.IP "Secure Channel" -\fBCtxtHandle *\fP -.IP "Secure Transport" -\fBSSLContext *\fP -.IP "wolfSSL" -\fBSSL *\fP -.RE -If the \fIinternals\fP pointer is NULL then either the SSL backend is not +## mbedTLS + +**mbedTLS_ssl_context *** + +## Secure Channel + +**CtxtHandle *** + +## Secure Transport + +**SSLContext *** + +## wolfSSL + +**SSL *** + +If the *internals* pointer is NULL then either the SSL backend is not supported, an SSL session has not yet been established or the connection is no -longer associated with the easy handle (e.g. \fIcurl_easy_perform(3)\fP has +longer associated with the easy handle (e.g. curl_easy_perform(3) has returned). -.SH LIMITATIONS + +# LIMITATIONS + This option has some limitations that could make it unsafe when it comes to the manual verification of certificates. @@ -102,7 +107,7 @@ retrieve a second in-use SSL session associated with an easy handle. This option has not been thoroughly tested with clear text protocols that can be upgraded/downgraded to/from SSL: FTP, SMTP, POP3, IMAP when used with -\fICURLOPT_USE_SSL(3)\fP. Though you can to retrieve the SSL pointer, it's +CURLOPT_USE_SSL(3). Though you can to retrieve the SSL pointer, it's possible that before you can do that, data (including auth) may have already been sent over a connection after it was upgraded. @@ -113,16 +118,20 @@ after renegotiation but before you are able to get the (possibly) changed SSL pointer, with the (possibly) changed certificate information. Instead of using this option to poll for certificate changes use -\fICURLOPT_SSL_CTX_FUNCTION(3)\fP to set a verification callback, if supported. +CURLOPT_SSL_CTX_FUNCTION(3) to set a verification callback, if supported. That is safer and does not suffer from any of the problems above. How are you using this option? Are you affected by any of these limitations? Please let us know by making a comment at https://github.com/curl/curl/issues/685 -.SH PROTOCOLS + +# PROTOCOLS + All TLS-based -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include #include @@ -133,7 +142,7 @@ 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; @@ -151,15 +160,15 @@ int main(int argc, char **argv) } return res; } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.48.0. -This option supersedes \fICURLINFO_TLS_SESSION(3)\fP which was added in 7.34.0. +This option supersedes CURLINFO_TLS_SESSION(3) which was added in 7.34.0. This option is exactly the same as that option except in the case of OpenSSL. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_TLS_SESSION (3) diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 b/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 deleted file mode 100644 index c5519fcb0..000000000 --- a/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_TOTAL_TIME 3 "28 Aug 2015" libcurl libcurl -.SH NAME -CURLINFO_TOTAL_TIME \- get total time of previous transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a double to receive the total time in seconds for the -previous transfer, including name resolving, TCP connect etc. The double -represents the time in seconds, including fractions. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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) { - res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total); - if(CURLE_OK == res) { - printf("Time: %.1f", total); - } - } - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.4.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_TOTAL_TIME_T (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME.md b/docs/libcurl/opts/CURLINFO_TOTAL_TIME.md new file mode 100644 index 000000000..c6af1694e --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_TOTAL_TIME.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_TOTAL_TIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_TOTAL_TIME_T (3) + - CURLOPT_TIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_TOTAL_TIME - get total time of previous transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a double to receive the total time in seconds for the +previous transfer, including name resolving, TCP connect etc. The double +represents the time in seconds, including fractions. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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) { + res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total); + if(CURLE_OK == res) { + printf("Time: %.1f", total); + } + } + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.4.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 b/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 deleted file mode 100644 index 54a0d547c..000000000 --- a/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_TOTAL_TIME_T 3 "28 Apr 2018" libcurl libcurl -.SH NAME -CURLINFO_TOTAL_TIME_T \- get total time of previous transfer in microseconds -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T, - curl_off_t *timep); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_off_t to receive the total time in microseconds -for the previous transfer, including name resolving, TCP connect etc. -The curl_off_t represents the time in microseconds. - -When a redirect is followed, the time from each request is added together. - -See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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) { - 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_TOTAL_TIME (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.md b/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.md new file mode 100644 index 000000000..488d5d3aa --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_TOTAL_TIME_T +Section: 3 +Source: libcurl +See-also: + - CURLINFO_TOTAL_TIME (3) + - CURLOPT_TIMEOUT (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_TOTAL_TIME_T - get total time of previous transfer in microseconds + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T, + curl_off_t *timep); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_off_t to receive the total time in microseconds +for the previous transfer, including name resolving, TCP connect etc. +The curl_off_t represents the time in microseconds. + +When a redirect is followed, the time from each request is added together. + +See also the TIMES overview in the curl_easy_getinfo(3) man page. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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) { + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLINFO_XFER_ID.3 b/docs/libcurl/opts/CURLINFO_XFER_ID.3 deleted file mode 100644 index b166b20bf..000000000 --- a/docs/libcurl/opts/CURLINFO_XFER_ID.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLINFO_XFER_ID 3 "07 June 2023" "libcurl" "libcurl" -.SH NAME -CURLINFO_XFER_ID \- get the ID of a transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_XFER_ID, - curl_off_t *xfer_id); -.fi -.SH DESCRIPTION -Pass a pointer to a \fIcurl_off_t\fP to receive the identifier of the -current/last transfer done with the handle. Stores -1 if no transfer -has been started yet for the handle. - -The transfer id is unique among all transfers performed using the same -connection cache. This is implicitly the case for all transfers in the -same multi handle. - -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Perform the request */ - res = curl_easy_perform(curl); - - if(!res) { - curl_off_t 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); - } - } - } -} -.fi -.SH AVAILABILITY -Added in 8.2.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR curl_easy_setopt (3), -.BR CURLINFO_CONN_ID (3) diff --git a/docs/libcurl/opts/CURLINFO_XFER_ID.md b/docs/libcurl/opts/CURLINFO_XFER_ID.md new file mode 100644 index 000000000..b32a46b12 --- /dev/null +++ b/docs/libcurl/opts/CURLINFO_XFER_ID.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLINFO_XFER_ID +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONN_ID (3) + - curl_easy_getinfo (3) + - curl_easy_setopt (3) +--- + +# NAME + +CURLINFO_XFER_ID - get the ID of a transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_XFER_ID, + curl_off_t *xfer_id); +~~~ + +# DESCRIPTION + +Pass a pointer to a *curl_off_t* to receive the identifier of the +current/last transfer done with the handle. Stores -1 if no transfer +has been started yet for the handle. + +The transfer id is unique among all transfers performed using the same +connection cache. This is implicitly the case for all transfers in the +same multi handle. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Perform the request */ + res = curl_easy_perform(curl); + + if(!res) { + curl_off_t 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); + } + } + } +} +~~~ + +# AVAILABILITY + +Added in 8.2.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 b/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 deleted file mode 100644 index 932e33397..000000000 --- a/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE \- chunk length threshold for pipelining -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, - long size); -.fi -.SH DESCRIPTION -No function since pipelining was removed in 7.62.0. - -Pass a long with a \fBsize\fP in bytes. If a transfer in a pipeline is -currently processing a chunked (Transfer-encoding: chunked) request with a -current chunk length larger than \fICURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)\fP, -that pipeline is not considered for additional requests, even if it is shorter -than \fICURLMOPT_MAX_PIPELINE_LENGTH(3)\fP. -.SH DEFAULT -The default value is 0, which means that the penalization is inactive. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE (3), -.BR CURLMOPT_MAX_PIPELINE_LENGTH (3), -.BR CURLMOPT_PIPELINING (3) diff --git a/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.md b/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.md new file mode 100644 index 000000000..127f4dd06 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE (3) + - CURLMOPT_MAX_PIPELINE_LENGTH (3) + - CURLMOPT_PIPELINING (3) +--- + +# NAME + +CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE - chunk length threshold for pipelining + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, + long size); +~~~ + +# DESCRIPTION + +No function since pipelining was removed in 7.62.0. + +Pass a long with a **size** in bytes. If a transfer in a pipeline is +currently processing a chunked (Transfer-encoding: chunked) request with a +current chunk length larger than CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3), +that pipeline is not considered for additional requests, even if it is shorter +than CURLMOPT_MAX_PIPELINE_LENGTH(3). + +# DEFAULT + +The default value is 0, which means that the penalization is inactive. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + long maxchunk = 10000; + curl_multi_setopt(m, CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, maxchunk); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 b/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 deleted file mode 100644 index 30bbe99ec..000000000 --- a/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE \- size threshold for pipelining penalty -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, - long size); -.fi -.SH DESCRIPTION -No function since pipelining was removed in 7.62.0. - -Pass a long with a \fBsize\fP in bytes. If a transfer in a pipeline is -currently processing a request with a Content-Length larger than this -\fICURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)\fP, that pipeline is not considered -for additional requests, even if it is shorter than -\fICURLMOPT_MAX_PIPELINE_LENGTH(3)\fP. -.SH DEFAULT -The default value is 0, which means that the size penalization is inactive. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE (3) diff --git a/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.md b/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.md new file mode 100644 index 000000000..d3e7abaf0 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.md @@ -0,0 +1,60 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE (3) + - CURLMOPT_PIPELINING (3) +--- + +# NAME + +CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE - size threshold for pipelining penalty + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, + long size); +~~~ + +# DESCRIPTION + +No function since pipelining was removed in 7.62.0. + +Pass a long with a **size** in bytes. If a transfer in a pipeline is +currently processing a request with a Content-Length larger than this +CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3), that pipeline is not considered +for additional requests, even if it is shorter than +CURLMOPT_MAX_PIPELINE_LENGTH(3). + +# DEFAULT + +The default value is 0, which means that the size penalization is inactive. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + long maxlength = 10000; + curl_multi_setopt(m, CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, maxlength); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3 b/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3 deleted file mode 100644 index e0d75f2d5..000000000 --- a/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_MAXCONNECTS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLMOPT_MAXCONNECTS \- size of connection cache -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max); -.fi -.SH DESCRIPTION -Pass a long indicating the \fBmax\fP. The set number is used as the maximum -amount of simultaneously open connections that libcurl may keep in its -connection cache after completed use. By default libcurl enlarges the size for -each added easy handle to make it fit 4 times the number of added easy -handles. - -By setting this option, you can prevent the cache size from growing beyond the -limit set by you. - -When the cache is full, curl closes the oldest one in the cache to prevent the -number of open connections from increasing. - -This option is for the multi handle's use only, when using the easy interface -you should instead use the \fICURLOPT_MAXCONNECTS(3)\fP option. - -See \fICURLMOPT_MAX_TOTAL_CONNECTIONS(3)\fP for limiting the number of active -connections. - -.SH DEFAULT -See DESCRIPTION -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3), -.BR CURLOPT_MAXCONNECTS (3) diff --git a/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.md b/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.md new file mode 100644 index 000000000..9a5457fa5 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_MAXCONNECTS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAX_HOST_CONNECTIONS (3) + - CURLOPT_MAXCONNECTS (3) +--- + +# NAME + +CURLMOPT_MAXCONNECTS - size of connection cache + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max); +~~~ + +# DESCRIPTION + +Pass a long indicating the **max**. The set number is used as the maximum +amount of simultaneously open connections that libcurl may keep in its +connection cache after completed use. By default libcurl enlarges the size for +each added easy handle to make it fit 4 times the number of added easy +handles. + +By setting this option, you can prevent the cache size from growing beyond the +limit set by you. + +When the cache is full, curl closes the oldest one in the cache to prevent the +number of open connections from increasing. + +This option is for the multi handle's use only, when using the easy interface +you should instead use the CURLOPT_MAXCONNECTS(3) option. + +See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) for limiting the number of active +connections. + +# DEFAULT + +See DESCRIPTION + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + /* only keep 10 connections in the cache */ + curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L); +} +~~~ + +# AVAILABILITY + +Added in 7.16.3 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 b/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 deleted file mode 100644 index 7b5741e58..000000000 --- a/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_MAX_CONCURRENT_STREAMS 3 "06 Nov 2019" libcurl libcurl -.SH NAME -CURLMOPT_MAX_CONCURRENT_STREAMS \- max concurrent streams for http2 -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_CONCURRENT_STREAMS, - long max); -.fi -.SH DESCRIPTION -Pass a long indicating the \fBmax\fP. The set number is used as the maximum -number of concurrent streams libcurl should support on connections done using -HTTP/2 or HTTP/3. - -Valid values range from 1 to 2147483647 (2^31 - 1) and defaults to 100. The -value passed here would be honored based on other system resources properties. -.SH DEFAULT -100 -.SH PROTOCOLS -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_MAXCONNECTS (3), -.BR CURLOPT_MAXCONNECTS (3) diff --git a/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.md b/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.md new file mode 100644 index 000000000..247199444 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.md @@ -0,0 +1,59 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_MAX_CONCURRENT_STREAMS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAXCONNECTS (3) + - CURLOPT_MAXCONNECTS (3) +--- + +# NAME + +CURLMOPT_MAX_CONCURRENT_STREAMS - max concurrent streams for http2 + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_CONCURRENT_STREAMS, + long max); +~~~ + +# DESCRIPTION + +Pass a long indicating the **max**. The set number is used as the maximum +number of concurrent streams libcurl should support on connections done using +HTTP/2 or HTTP/3. + +Valid values range from 1 to 2147483647 (2^31 - 1) and defaults to 100. The +value passed here would be honored based on other system resources properties. + +# DEFAULT + +100 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + /* max concurrent streams 200 */ + curl_multi_setopt(m, CURLMOPT_MAX_CONCURRENT_STREAMS, 200L); +} +~~~ + +# AVAILABILITY + +Added in 7.67.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.3 b/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.3 deleted file mode 100644 index fb0f6787c..000000000 --- a/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_MAX_HOST_CONNECTIONS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLMOPT_MAX_HOST_CONNECTIONS \- max number of connections to a single host -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNECTIONS, - long max); -.fi -.SH DESCRIPTION -Pass a long to indicate \fBmax\fP. The set number is used as the maximum -amount of simultaneously open connections to a single host (a host being the -same as a host name + port number pair). For each new session to a host, -libcurl might open a new connection up to the limit set by -\fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP. When the limit is reached, new -sessions are kept pending until a connection becomes available. - -The default \fBmax\fP value is 0, unlimited. This set limit is also used for -proxy connections, and then the proxy is considered to be the host for which -this limit counts. - -When more transfers are added to the multi handle than what can be performed -due to the set limit, they are queued up waiting for their chance. When that -happens, the \fICURLOPT_TIMEOUT_MS(3)\fP timeout is inclusive of the waiting -time, meaning that if you set a too narrow timeout in such a case the transfer -might never even start before it times out. - -Even in the queued up situation, the \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP -timeout is however treated as a per-connect timeout. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_MAXCONNECTS (3), -.BR CURLMOPT_MAX_TOTAL_CONNECTIONS (3) diff --git a/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.md b/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.md new file mode 100644 index 000000000..f25778b7c --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAX_HOST_CONNECTIONS.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_MAX_HOST_CONNECTIONS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAXCONNECTS (3) + - CURLMOPT_MAX_TOTAL_CONNECTIONS (3) +--- + +# NAME + +CURLMOPT_MAX_HOST_CONNECTIONS - max number of connections to a single host + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNECTIONS, + long max); +~~~ + +# DESCRIPTION + +Pass a long to indicate **max**. The set number is used as the maximum +amount of simultaneously open connections to a single host (a host being the +same as a host name + port number pair). For each new session to a host, +libcurl might open a new connection up to the limit set by +CURLMOPT_MAX_HOST_CONNECTIONS(3). When the limit is reached, new +sessions are kept pending until a connection becomes available. + +The default **max** value is 0, unlimited. This set limit is also used for +proxy connections, and then the proxy is considered to be the host for which +this limit counts. + +When more transfers are added to the multi handle than what can be performed +due to the set limit, they are queued up waiting for their chance. When that +happens, the CURLOPT_TIMEOUT_MS(3) timeout is inclusive of the waiting +time, meaning that if you set a too narrow timeout in such a case the transfer +might never even start before it times out. + +Even in the queued up situation, the CURLOPT_CONNECTTIMEOUT_MS(3) +timeout is however treated as a per-connect timeout. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.3 b/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.3 deleted file mode 100644 index 9f2c6ffbe..000000000 --- a/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_MAX_PIPELINE_LENGTH 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_MAX_PIPELINE_LENGTH \- maximum number of requests in a pipeline -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_PIPELINE_LENGTH, - long max); -.fi -.SH DESCRIPTION -No function since pipelining was removed in 7.62.0. - -Pass a long. The set \fBmax\fP number is used as the maximum amount of -outstanding requests in an HTTP/1.1 pipeline. This option is only used for -HTTP/1.1 pipelining, not for HTTP/2 multiplexing. - -When this limit is reached, libcurl creates another connection to the same -host (see \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP), or queue the request until -one of the pipelines to the host is ready to accept a request. Thus, the -total number of requests in-flight is \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP * -\fICURLMOPT_MAX_PIPELINE_LENGTH(3)\fP. -.SH DEFAULT -5 -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3) diff --git a/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.md b/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.md new file mode 100644 index 000000000..bad638e5f --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAX_PIPELINE_LENGTH.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_MAX_PIPELINE_LENGTH +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAX_HOST_CONNECTIONS (3) + - CURLMOPT_PIPELINING (3) +--- + +# NAME + +CURLMOPT_MAX_PIPELINE_LENGTH - maximum number of requests in a pipeline + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_PIPELINE_LENGTH, + long max); +~~~ + +# DESCRIPTION + +No function since pipelining was removed in 7.62.0. + +Pass a long. The set **max** number is used as the maximum amount of +outstanding requests in an HTTP/1.1 pipeline. This option is only used for +HTTP/1.1 pipelining, not for HTTP/2 multiplexing. + +When this limit is reached, libcurl creates another connection to the same +host (see CURLMOPT_MAX_HOST_CONNECTIONS(3)), or queue the request until one + of the pipelines to the host is ready to accept a request. Thus, the total +number of requests in-flight is CURLMOPT_MAX_HOST_CONNECTIONS(3) * +CURLMOPT_MAX_PIPELINE_LENGTH(3). + +# DEFAULT + +5 + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + /* set a more conservative pipe length */ + curl_multi_setopt(m, CURLMOPT_MAX_PIPELINE_LENGTH, 3L); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3 b/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3 deleted file mode 100644 index 130822f56..000000000 --- a/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_MAX_TOTAL_CONNECTIONS 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_MAX_TOTAL_CONNECTIONS \- max simultaneously open connections -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_TOTAL_CONNECTIONS, - long amount); -.fi -.SH DESCRIPTION -Pass a long for the \fBamount\fP. The set number is used as the maximum number -of simultaneously open connections in total using this multi handle. For each -new session, libcurl might open a new connection up to the limit set by -\fICURLMOPT_MAX_TOTAL_CONNECTIONS(3)\fP. When the limit is reached, new -sessions are held pending until there are available connections. If -\fICURLMOPT_PIPELINING(3)\fP is enabled, libcurl can try multiplexing if the -host is capable of it. - -When more transfers are added to the multi handle than what can be performed -due to the set limit, they get queued up waiting for their chance. When that -happens, the \fICURLOPT_TIMEOUT_MS(3)\fP timeout is counted inclusive of the -waiting time, meaning that if you set a too narrow timeout in such a case the -transfer might never even start before it times out. - -Even in the queued up situation, the \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP -timeout is however treated as a per-connect timeout. -.SH DEFAULT -The default value is 0, which means that there is no limit. It is then simply -controlled by the number of easy handles added. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_MAXCONNECTS (3), -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3) diff --git a/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.md b/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.md new file mode 100644 index 000000000..859bb2ad5 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_MAX_TOTAL_CONNECTIONS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAXCONNECTS (3) + - CURLMOPT_MAX_HOST_CONNECTIONS (3) +--- + +# NAME + +CURLMOPT_MAX_TOTAL_CONNECTIONS - max simultaneously open connections + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_TOTAL_CONNECTIONS, + long amount); +~~~ + +# DESCRIPTION + +Pass a long for the **amount**. The set number is used as the maximum number +of simultaneously open connections in total using this multi handle. For each +new session, libcurl might open a new connection up to the limit set by +CURLMOPT_MAX_TOTAL_CONNECTIONS(3). When the limit is reached, new +sessions are held pending until there are available connections. If +CURLMOPT_PIPELINING(3) is enabled, libcurl can try multiplexing if the +host is capable of it. + +When more transfers are added to the multi handle than what can be performed +due to the set limit, they get queued up waiting for their chance. When that +happens, the CURLOPT_TIMEOUT_MS(3) timeout is counted inclusive of the +waiting time, meaning that if you set a too narrow timeout in such a case the +transfer might never even start before it times out. + +Even in the queued up situation, the CURLOPT_CONNECTTIMEOUT_MS(3) +timeout is however treated as a per-connect timeout. + +# DEFAULT + +The default value is 0, which means that there is no limit. It is then simply +controlled by the number of easy handles added. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + /* never do more than 15 connections */ + curl_multi_setopt(m, CURLMOPT_MAX_TOTAL_CONNECTIONS, 15L); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING.3 b/docs/libcurl/opts/CURLMOPT_PIPELINING.3 deleted file mode 100644 index 88777320f..000000000 --- a/docs/libcurl/opts/CURLMOPT_PIPELINING.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_PIPELINING 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLMOPT_PIPELINING \- enable HTTP pipelining and multiplexing -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, long bitmask); -.fi -.SH DESCRIPTION -Pass in the correct value in the \fBbitmask\fP parameter to instruct libcurl -to enable multiplexing for this multi handle. - -With multiplexing enabled, libcurl attempts to do multiple transfers over the -same connection when doing parallel transfers to the same hosts. - -.IP CURLPIPE_NOTHING (0) -Default, which means doing no attempts at multiplexing. -.IP CURLPIPE_HTTP1 (1) -This bit is deprecated and has no effect since version 7.62.0. -.IP CURLPIPE_MULTIPLEX (2) -If this bit is set, libcurl tries to multiplex the new transfer over an -existing connection if possible. This requires HTTP/2 or HTTP/3. -.SH DEFAULT -Since 7.62.0, \fBCURLPIPE_MULTIPLEX\fP is enabled by default. - -Before that, default was \fBCURLPIPE_NOTHING\fP. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -support was disabled in 7.62.0. -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE (3), -.BR CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE (3), -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3), -.BR CURLMOPT_MAX_PIPELINE_LENGTH (3), -.BR CURLMOPT_MAXCONNECTS (3), -.BR CURLMOPT_PIPELINING_SITE_BL (3) diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING.md b/docs/libcurl/opts/CURLMOPT_PIPELINING.md new file mode 100644 index 000000000..3df71b54f --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_PIPELINING.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_PIPELINING +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE (3) + - CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE (3) + - CURLMOPT_MAXCONNECTS (3) + - CURLMOPT_MAX_HOST_CONNECTIONS (3) + - CURLMOPT_MAX_PIPELINE_LENGTH (3) + - CURLMOPT_PIPELINING_SITE_BL (3) +--- + +# NAME + +CURLMOPT_PIPELINING - enable HTTP pipelining and multiplexing + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, long bitmask); +~~~ + +# DESCRIPTION + +Pass in the correct value in the **bitmask** parameter to instruct libcurl +to enable multiplexing for this multi handle. + +With multiplexing enabled, libcurl attempts to do multiple transfers over the +same connection when doing parallel transfers to the same hosts. + +## CURLPIPE_NOTHING (0) + +Default, which means doing no attempts at multiplexing. + +## CURLPIPE_HTTP1 (1) + +This bit is deprecated and has no effect since version 7.62.0. + +## CURLPIPE_MULTIPLEX (2) + +If this bit is set, libcurl tries to multiplex the new transfer over an +existing connection if possible. This requires HTTP/2 or HTTP/3. + +# DEFAULT + +Since 7.62.0, **CURLPIPE_MULTIPLEX** is enabled by default. + +Before that, default was **CURLPIPE_NOTHING**. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +int main(void) +{ + CURLM *m = curl_multi_init(); + /* try HTTP/2 multiplexing */ + curl_multi_setopt(m, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); +} +~~~ + +# AVAILABILITY + +Added in 7.16.0. Multiplex support bit added in 7.43.0. HTTP/1 Pipelining +support was disabled in 7.62.0. + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.3 b/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.3 deleted file mode 100644 index b59232fb8..000000000 --- a/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_PIPELINING_SERVER_BL 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_PIPELINING_SERVER_BL \- pipelining server block list -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING_SERVER_BL, - char **servers); -.fi -.SH DESCRIPTION -No function since pipelining was removed in 7.62.0. - -Pass a \fBservers\fP array of char *, ending with a NULL entry. This is a list -of server types prefixes (in the Server: HTTP header) that are blocked from -pipelining, i.e server types that are known to not support HTTP -pipelining. The array is copied by libcurl. - -Note that the comparison matches if the Server: header begins with the string -in the block list, i.e "Server: Ninja 1.2.3" and "Server: Ninja 1.4.0" can -both be blocked by having "Ninja" in the list. - -Pass a NULL pointer to clear the block list. -.SH DEFAULT -The default value is NULL, which means that there is no block list. -.SH PROTOCOLS -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLMOPT_PIPELINING_SITE_BL (3) diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.md b/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.md new file mode 100644 index 000000000..226700806 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_PIPELINING_SERVER_BL.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_PIPELINING_SERVER_BL +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLMOPT_PIPELINING_SITE_BL (3) +--- + +# NAME + +CURLMOPT_PIPELINING_SERVER_BL - pipelining server block list + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING_SERVER_BL, + char **servers); +~~~ + +# DESCRIPTION + +No function since pipelining was removed in 7.62.0. + +Pass a **servers** array of char *, ending with a NULL entry. This is a list +of server types prefixes (in the Server: HTTP header) that are blocked from +pipelining, i.e server types that are known to not support HTTP +pipelining. The array is copied by libcurl. + +Note that the comparison matches if the Server: header begins with the string +in the block list, i.e "Server: Ninja 1.2.3" and "Server: Ninja 1.4.0" can +both be blocked by having "Ninja" in the list. + +Pass a NULL pointer to clear the block list. + +# DEFAULT + +The default value is NULL, which means that there is no block list. + +# PROTOCOLS + +# EXAMPLE + +~~~c +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); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.3 b/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.3 deleted file mode 100644 index 2bbfbfe26..000000000 --- a/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_PIPELINING_SITE_BL 3 "4 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_PIPELINING_SITE_BL \- pipelining host block list -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING_SITE_BL, - char **hosts); -.fi -.SH DESCRIPTION -No function since pipelining was removed in 7.62.0. - -Pass a \fBhosts\fP array of char *, ending with a NULL entry. This is a list -of sites that are blocked from pipelining, i.e sites that are known to not -support HTTP pipelining. The array is copied by libcurl. - -Pass a NULL pointer to clear the block list. -.SH DEFAULT -The default value is NULL, which means that there is no block list. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLMOPT_PIPELINING_SERVER_BL (3) diff --git a/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.md b/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.md new file mode 100644 index 000000000..a212c4f63 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_PIPELINING_SITE_BL.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_PIPELINING_SITE_BL +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLMOPT_PIPELINING_SERVER_BL (3) +--- + +# NAME + +CURLMOPT_PIPELINING_SITE_BL - pipelining host block list + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING_SITE_BL, + char **hosts); +~~~ + +# DESCRIPTION + +No function since pipelining was removed in 7.62.0. + +Pass a **hosts** array of char *, ending with a NULL entry. This is a list +of sites that are blocked from pipelining, i.e sites that are known to not +support HTTP pipelining. The array is copied by libcurl. + +Pass a NULL pointer to clear the block list. + +# DEFAULT + +The default value is NULL, which means that there is no block list. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); +} +~~~ + +# AVAILABILITY + +Added in 7.30.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_PUSHDATA.3 b/docs/libcurl/opts/CURLMOPT_PUSHDATA.3 deleted file mode 100644 index 8ff04bbe0..000000000 --- a/docs/libcurl/opts/CURLMOPT_PUSHDATA.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_PUSHDATA 3 "1 Jun 2015" libcurl libcurl -.SH NAME -CURLMOPT_PUSHDATA \- pointer to pass to push callback -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer); -.fi -.SH DESCRIPTION -Set a \fIpointer\fP to pass as the last argument to the -\fICURLMOPT_PUSHFUNCTION(3)\fP callback. The pointer is not touched or used by -libcurl itself, only passed on to the callback function. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -#include - -/* only allow pushes for file names starting with "push-" */ -int push_callback(CURL *parent, - CURL *easy, - size_t num_headers, - struct curl_pushheaders *headers, - void *clientp) -{ - char *headp; - int *transfers = (int *)clientp; - FILE *out; - headp = curl_pushheader_byname(headers, ":path"); - if(headp && !strncmp(headp, "/push-", 6)) { - fprintf(stderr, "The PATH is %s\\n", headp); - - /* save the push here */ - out = fopen("pushed-stream", "wb"); - - /* write to this file */ - curl_easy_setopt(easy, CURLOPT_WRITEDATA, out); - - (*transfers)++; /* one more */ - - return CURL_PUSH_OK; - } - return CURL_PUSH_DENY; -} - -int main(void) -{ - int counter; - CURLM *multi = curl_multi_init(); - curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback); - curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter); -} -.fi -.SH AVAILABILITY -Added in 7.44.0 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLMOPT_PUSHFUNCTION (3), -.BR CURLOPT_PIPEWAIT (3), -.BR RFC 7540 diff --git a/docs/libcurl/opts/CURLMOPT_PUSHDATA.md b/docs/libcurl/opts/CURLMOPT_PUSHDATA.md new file mode 100644 index 000000000..23e8785f2 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_PUSHDATA.md @@ -0,0 +1,87 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_PUSHDATA +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLMOPT_PUSHFUNCTION (3) + - CURLOPT_PIPEWAIT (3) + - RFC 7540 +--- + +# NAME + +CURLMOPT_PUSHDATA - pointer to pass to push callback + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer); +~~~ + +# DESCRIPTION + +Set a *pointer* to pass as the last argument to the +CURLMOPT_PUSHFUNCTION(3) callback. The pointer is not touched or used by +libcurl itself, only passed on to the callback function. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +#include + +/* only allow pushes for file names starting with "push-" */ +int push_callback(CURL *parent, + CURL *easy, + size_t num_headers, + struct curl_pushheaders *headers, + void *clientp) +{ + char *headp; + int *transfers = (int *)clientp; + FILE *out; + headp = curl_pushheader_byname(headers, ":path"); + if(headp && !strncmp(headp, "/push-", 6)) { + fprintf(stderr, "The PATH is %s\n", headp); + + /* save the push here */ + out = fopen("pushed-stream", "wb"); + + /* write to this file */ + curl_easy_setopt(easy, CURLOPT_WRITEDATA, out); + + (*transfers)++; /* one more */ + + return CURL_PUSH_OK; + } + return CURL_PUSH_DENY; +} + +int main(void) +{ + int counter; + CURLM *multi = curl_multi_init(); + curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback); + curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter); +} +~~~ + +# AVAILABILITY + +Added in 7.44.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 b/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.md similarity index 55% rename from docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 rename to docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.md index e1a96218f..903ac06fb 100644 --- a/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 +++ b/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.md @@ -1,32 +1,23 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_PUSHFUNCTION 3 "1 Jun 2015" libcurl libcurl -.SH NAME -CURLMOPT_PUSHFUNCTION \- callback that approves or denies server pushes -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_PUSHFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLMOPT_PUSHDATA (3) + - CURLOPT_PIPEWAIT (3) + - RFC 7540 +--- + +# NAME + +CURLMOPT_PUSHFUNCTION - callback that approves or denies server pushes + +# SYNOPSIS + +~~~c #include int curl_push_callback(CURL *parent, @@ -37,60 +28,79 @@ int curl_push_callback(CURL *parent, CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHFUNCTION, curl_push_callback func); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This callback gets called when a new HTTP/2 stream is being pushed by the server (using the PUSH_PROMISE frame). If no push callback is set, all offered pushes are denied automatically. -.SH CALLBACK DESCRIPTION + +# CALLBACK DESCRIPTION + The callback gets its arguments like this: -\fIparent\fP is the handle of the stream on which this push arrives. The new +*parent* is the handle of the stream on which this push arrives. The new handle has been duplicated from the parent, meaning that it has gotten all its options inherited. It is then up to the application to alter any options if desired. -\fIeasy\fP is a newly created handle that represents this upcoming transfer. +*easy* is a newly created handle that represents this upcoming transfer. -\fInum_headers\fP is the number of name+value pairs that was received and can +*num_headers* is the number of name+value pairs that was received and can be accessed -\fIheaders\fP is a handle used to access push headers using the accessor +*headers* is a handle used to access push headers using the accessor functions described below. This only accesses and provides the PUSH_PROMISE headers, the normal response headers are provided in the header callback as usual. -\fIclientp\fP is the pointer set with \fICURLMOPT_PUSHDATA(3)\fP +*clientp* is the pointer set with CURLMOPT_PUSHDATA(3) If the callback returns CURL_PUSH_OK, the new easy handle is added to the multi handle, the callback must not do that by itself. The callback can access PUSH_PROMISE headers with two accessor functions. These functions can only be used from within this callback and they -can only access the PUSH_PROMISE headers: \fIcurl_pushheader_byname(3)\fP and -\fIcurl_pushheader_bynum(3)\fP. The normal response headers are passed to the +can only access the PUSH_PROMISE headers: curl_pushheader_byname(3) and +curl_pushheader_bynum(3). The normal response headers are passed to the header callback for pushed streams just as for normal streams. -The header fields can also be accessed with \fIcurl_easy_header(3)\fP, +The header fields can also be accessed with curl_easy_header(3), introduced in later libcurl versions. -.SH CALLBACK RETURN VALUE -.IP "CURL_PUSH_OK (0)" + +# CALLBACK RETURN VALUE + +## CURL_PUSH_OK (0) + The application has accepted the stream and it can now start receiving data, the ownership of the CURL handle has been taken over by the application. -.IP "CURL_PUSH_DENY (1)" + +## CURL_PUSH_DENY (1) + The callback denies the stream and no data reaches the application, the easy handle is destroyed by libcurl. -.IP "CURL_PUSH_ERROROUT (2)" + +## CURL_PUSH_ERROROUT (2) + Returning this code rejects the pushed stream and returns an error back on the parent stream making it get closed with an error. (Added in 7.72.0) -.IP * + +## * + All other return codes are reserved for future use. -.SH DEFAULT + +# DEFAULT + NULL, no callback -.SH PROTOCOLS + +# PROTOCOLS + HTTP(S) (HTTP/2 only) -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include /* only allow pushes for file names starting with "push-" */ @@ -105,7 +115,7 @@ int push_callback(CURL *parent, FILE *out; headp = curl_pushheader_byname(headers, ":path"); if(headp && !strncmp(headp, "/push-", 6)) { - fprintf(stderr, "The PATH is %s\\n", headp); + fprintf(stderr, "The PATH is %s\n", headp); /* save the push here */ out = fopen("pushed-stream", "wb"); @@ -127,13 +137,12 @@ int main(void) curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback); curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.44.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PUSHDATA (3), -.BR CURLMOPT_PIPELINING (3), -.BR CURLOPT_PIPEWAIT (3), -.BR RFC 7540 diff --git a/docs/libcurl/opts/CURLMOPT_SOCKETDATA.3 b/docs/libcurl/opts/CURLMOPT_SOCKETDATA.3 deleted file mode 100644 index aeb04daba..000000000 --- a/docs/libcurl/opts/CURLMOPT_SOCKETDATA.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_SOCKETDATA 3 "3 Nov 2014" libcurl libcurl -.SH NAME -CURLMOPT_SOCKETDATA \- custom pointer passed to the socket callback -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETDATA, void *pointer); -.SH DESCRIPTION -A data \fIpointer\fP to pass to the socket callback set with the -\fICURLMOPT_SOCKETFUNCTION(3)\fP option. - -This pointer is not touched by libcurl but is only passed in as the socket -callbacks's \fBclientp\fP argument. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct priv { - void *ours; -}; - -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - struct priv *p = sockp; - printf("my ptr: %p\\n", p->ours); - - if(what == CURL_POLL_REMOVE) { - /* remove the socket from our collection */ - } - if(what & CURL_POLL_IN) { - /* wait for read on this socket */ - } - if(what & CURL_POLL_OUT) { - /* wait for write on this socket */ - } - - return 0; -} - -int main(void) -{ - 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); -} -.fi -.SH AVAILABILITY -Added in 7.15.4 -.SH RETURN VALUE -Returns CURLM_OK. -.SH "SEE ALSO" -.BR curl_multi_socket_action (3), -.BR CURLMOPT_SOCKETFUNCTION (3), -.BR CURLMOPT_TIMERFUNCTION (3) diff --git a/docs/libcurl/opts/CURLMOPT_SOCKETDATA.md b/docs/libcurl/opts/CURLMOPT_SOCKETDATA.md new file mode 100644 index 000000000..f4de8c331 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_SOCKETDATA.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_SOCKETDATA +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_SOCKETFUNCTION (3) + - CURLMOPT_TIMERFUNCTION (3) + - curl_multi_socket_action (3) +--- + +# NAME + +CURLMOPT_SOCKETDATA - custom pointer passed to the socket callback + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETDATA, void *pointer); +~~~ + +# DESCRIPTION + +A data *pointer* to pass to the socket callback set with the +CURLMOPT_SOCKETFUNCTION(3) option. + +This pointer is not touched by libcurl but is only passed in as the socket +callbacks's **clientp** argument. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct priv { + void *ours; +}; + +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + struct priv *p = sockp; + printf("my ptr: %p\n", p->ours); + + if(what == CURL_POLL_REMOVE) { + /* remove the socket from our collection */ + } + if(what & CURL_POLL_IN) { + /* wait for read on this socket */ + } + if(what & CURL_POLL_OUT) { + /* wait for write on this socket */ + } + + return 0; +} + +int main(void) +{ + 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); +} +~~~ + +# AVAILABILITY + +Added in 7.15.4 + +# RETURN VALUE + +Returns CURLM_OK. diff --git a/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 b/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 deleted file mode 100644 index 701715dd2..000000000 --- a/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 +++ /dev/null @@ -1,126 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_SOCKETFUNCTION 3 "3 Nov 2016" libcurl libcurl -.SH NAME -CURLMOPT_SOCKETFUNCTION \- callback informed about what to wait for -.SH SYNOPSIS -.nf -#include - -int socket_callback(CURL *easy, /* easy handle */ - curl_socket_t s, /* socket */ - int what, /* describes the socket */ - void *clientp, /* private callback pointer */ - void *socketp); /* private socket pointer */ - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETFUNCTION, socket_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -When the \fIcurl_multi_socket_action(3)\fP function is called, it uses this -callback to inform the application about updates in the socket (file -descriptor) status by doing none, one, or multiple calls to the -\fBsocket_callback\fP. The callback function gets status updates with changes -since the previous time the callback was called. If the given callback pointer -is set to NULL, no callback is called. - -libcurl then expects the application to monitor the sockets for the specific -activities and tell libcurl again when something happens on one of them. Tell -libcurl by calling \fIcurl_multi_socket_action(3)\fP. -.SH "CALLBACK ARGUMENTS" -\fIeasy\fP identifies the specific transfer for which this update is related. - -\fIs\fP is the specific socket this function invocation concerns. If the -\fBwhat\fP argument is not CURL_POLL_REMOVE then it holds information about -what activity on this socket the application is supposed to -monitor. Subsequent calls to this callback might update the \fBwhat\fP bits -for a socket that is already monitored. - -The socket callback should return 0 on success, and -1 on error. If this -callback returns error, \fBall\fP transfers currently in progress in this -multi handle are aborted and made to fail. - -\fBclientp\fP is set with \fICURLMOPT_SOCKETDATA(3)\fP. - -\fBsocketp\fP is set with \fIcurl_multi_assign(3)\fP or NULL. - -The \fBwhat\fP parameter informs the callback on the status of the given -socket. It can hold one of these values: -.IP CURL_POLL_IN -Wait for incoming data. For the socket to become readable. -.IP CURL_POLL_OUT -Wait for outgoing data. For the socket to become writable. -.IP CURL_POLL_INOUT -Wait for incoming and outgoing data. For the socket to become readable or -writable. -.IP CURL_POLL_REMOVE -The specified socket/file descriptor is no longer used by libcurl for any -active transfer. It might soon be added again. -.SH DEFAULT -NULL (no callback) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct priv { - void *ours; -}; - -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - struct priv *p = sockp; - printf("our ptr: %p\\n", p->ours); - - if(what == CURL_POLL_REMOVE) { - /* remove the socket from our collection */ - } - if(what & CURL_POLL_IN) { - /* wait for read on this socket */ - } - if(what & CURL_POLL_OUT) { - /* wait for write on this socket */ - } - - return 0; -} - -int main(void) -{ - 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); -} -.fi -.SH AVAILABILITY -Added in 7.15.4 -.SH RETURN VALUE -Returns CURLM_OK. -.SH "SEE ALSO" -.BR curl_multi_socket_action (3), -.BR CURLMOPT_SOCKETDATA (3), -.BR CURLMOPT_TIMERFUNCTION (3) diff --git a/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.md b/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.md new file mode 100644 index 000000000..5b34db5f3 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.md @@ -0,0 +1,135 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_SOCKETFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_SOCKETDATA (3) + - CURLMOPT_TIMERFUNCTION (3) + - curl_multi_socket_action (3) +--- + +# NAME + +CURLMOPT_SOCKETFUNCTION - callback informed about what to wait for + +# SYNOPSIS + +~~~c +#include + +int socket_callback(CURL *easy, /* easy handle */ + curl_socket_t s, /* socket */ + int what, /* describes the socket */ + void *clientp, /* private callback pointer */ + void *socketp); /* private socket pointer */ + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETFUNCTION, socket_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +When the curl_multi_socket_action(3) function is called, it uses this +callback to inform the application about updates in the socket (file +descriptor) status by doing none, one, or multiple calls to the +**socket_callback**. The callback function gets status updates with changes +since the previous time the callback was called. If the given callback pointer +is set to NULL, no callback is called. + +libcurl then expects the application to monitor the sockets for the specific +activities and tell libcurl again when something happens on one of them. Tell +libcurl by calling curl_multi_socket_action(3). + +# CALLBACK ARGUMENTS + +*easy* identifies the specific transfer for which this update is related. + +*s* is the specific socket this function invocation concerns. If the +**what** argument is not CURL_POLL_REMOVE then it holds information about +what activity on this socket the application is supposed to +monitor. Subsequent calls to this callback might update the **what** bits +for a socket that is already monitored. + +The socket callback should return 0 on success, and -1 on error. If this +callback returns error, **all** transfers currently in progress in this +multi handle are aborted and made to fail. + +**clientp** is set with CURLMOPT_SOCKETDATA(3). + +**socketp** is set with curl_multi_assign(3) or NULL. + +The **what** parameter informs the callback on the status of the given +socket. It can hold one of these values: + +## CURL_POLL_IN + +Wait for incoming data. For the socket to become readable. + +## CURL_POLL_OUT + +Wait for outgoing data. For the socket to become writable. + +## CURL_POLL_INOUT + +Wait for incoming and outgoing data. For the socket to become readable or +writable. + +## CURL_POLL_REMOVE + +The specified socket/file descriptor is no longer used by libcurl for any +active transfer. It might soon be added again. + +# DEFAULT + +NULL (no callback) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct priv { + void *ours; +}; + +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + struct priv *p = sockp; + printf("our ptr: %p\n", p->ours); + + if(what == CURL_POLL_REMOVE) { + /* remove the socket from our collection */ + } + if(what & CURL_POLL_IN) { + /* wait for read on this socket */ + } + if(what & CURL_POLL_OUT) { + /* wait for write on this socket */ + } + + return 0; +} + +int main(void) +{ + 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); +} +~~~ + +# AVAILABILITY + +Added in 7.15.4 + +# RETURN VALUE + +Returns CURLM_OK. diff --git a/docs/libcurl/opts/CURLMOPT_TIMERDATA.3 b/docs/libcurl/opts/CURLMOPT_TIMERDATA.3 deleted file mode 100644 index b3f853d23..000000000 --- a/docs/libcurl/opts/CURLMOPT_TIMERDATA.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_TIMERDATA 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLMOPT_TIMERDATA \- custom pointer to pass to timer callback -.SH SYNOPSIS -.nf -#include - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERDATA, void *pointer); -.SH DESCRIPTION -A data \fBpointer\fP to pass to the timer callback set with the -\fICURLMOPT_TIMERFUNCTION(3)\fP option. - -This pointer is not touched by libcurl but is only be passed in to the timer -callbacks's \fBclientp\fP argument. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct priv { - void *custom; -}; - -static int timerfunc(CURLM *multi, long timeout_ms, void *clientp) -{ - struct priv *mydata = clientp; - printf("our ptr: %p\\n", mydata->custom); - - if(timeout_ms) { - /* this is the new single timeout to wait for */ - } - else { - /* delete the timeout, nothing to wait for now */ - } -} - -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_TIMERFUNCTION (3), -.BR CURLMOPT_SOCKETFUNCTION (3) diff --git a/docs/libcurl/opts/CURLMOPT_TIMERDATA.md b/docs/libcurl/opts/CURLMOPT_TIMERDATA.md new file mode 100644 index 000000000..13bbd925b --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_TIMERDATA.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_TIMERDATA +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_SOCKETFUNCTION (3) + - CURLMOPT_TIMERFUNCTION (3) +--- + +# NAME + +CURLMOPT_TIMERDATA - custom pointer to pass to timer callback + +# SYNOPSIS + +~~~c +#include + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERDATA, void *pointer); +~~~ + +# DESCRIPTION + +A data **pointer** to pass to the timer callback set with the +CURLMOPT_TIMERFUNCTION(3) option. + +This pointer is not touched by libcurl but is only be passed in to the timer +callbacks's **clientp** argument. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct priv { + void *custom; +}; + +static int timerfunc(CURLM *multi, long timeout_ms, void *clientp) +{ + struct priv *mydata = clientp; + printf("our ptr: %p\n", mydata->custom); + + if(timeout_ms) { + /* this is the new single timeout to wait for */ + } + else { + /* delete the timeout, nothing to wait for now */ + } +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.16.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.3 b/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.3 deleted file mode 100644 index 69ad15167..000000000 --- a/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.3 +++ /dev/null @@ -1,104 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLMOPT_TIMERFUNCTION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLMOPT_TIMERFUNCTION \- callback to receive timeout values -.SH SYNOPSIS -.nf -#include - -int timer_callback(CURLM *multi, /* multi handle */ - long timeout_ms, /* timeout in number of ms */ - void *clientp); /* private callback pointer */ - -CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERFUNCTION, timer_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -Certain features, such as timeouts and retries, require you to call libcurl -even when there is no activity on the file descriptors. - -Your callback function \fBtimer_callback\fP should install a non-repeating -timer with an expire time of \fBtimeout_ms\fP milliseconds. When that timer -fires, call either \fIcurl_multi_socket_action(3)\fP or -\fIcurl_multi_perform(3)\fP, depending on which interface you use. - -A \fBtimeout_ms\fP value of -1 passed to this callback means you should delete -the timer. All other values are valid expire times in number of milliseconds. - -The \fBtimer_callback\fP is called when the timeout expire time is changed. - -The \fBclientp\fP pointer is set with \fICURLMOPT_TIMERDATA(3)\fP. - -The timer callback should return 0 on success, and -1 on error. If this -callback returns error, \fBall\fP transfers currently in progress in this -multi handle are aborted and made to fail. - -This callback can be used instead of, or in addition to, -\fIcurl_multi_timeout(3)\fP. - -\fBWARNING:\fP do not call libcurl directly from within the callback itself -when the \fBtimeout_ms\fP value is zero, since it risks triggering an -unpleasant recursive behavior that immediately calls another call to the -callback with a zero timeout... -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct priv { - void *custom; -}; - -static int timerfunc(CURLM *multi, long timeout_ms, void *clientp) -{ - struct priv *mydata = clientp; - printf("our ptr: %p\\n", mydata->custom); - - if(timeout_ms) { - /* this is the new single timeout to wait for */ - } - else { - /* delete the timeout, nothing to wait for now */ - } -} - -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 -.SH RETURN VALUE -Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_TIMERDATA (3), -.BR CURLMOPT_SOCKETFUNCTION (3) diff --git a/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.md b/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.md new file mode 100644 index 000000000..83a8fe7e0 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_TIMERFUNCTION.md @@ -0,0 +1,103 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLMOPT_TIMERFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_SOCKETFUNCTION (3) + - CURLMOPT_TIMERDATA (3) +--- + +# NAME + +CURLMOPT_TIMERFUNCTION - callback to receive timeout values + +# SYNOPSIS + +~~~c +#include + +int timer_callback(CURLM *multi, /* multi handle */ + long timeout_ms, /* timeout in number of ms */ + void *clientp); /* private callback pointer */ + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_TIMERFUNCTION, timer_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +Certain features, such as timeouts and retries, require you to call libcurl +even when there is no activity on the file descriptors. + +Your callback function **timer_callback** should install a non-repeating +timer with an expire time of **timeout_ms** milliseconds. When that timer +fires, call either curl_multi_socket_action(3) or +curl_multi_perform(3), depending on which interface you use. + +A **timeout_ms** value of -1 passed to this callback means you should delete +the timer. All other values are valid expire times in number of milliseconds. + +The **timer_callback** is called when the timeout expire time is changed. + +The **clientp** pointer is set with CURLMOPT_TIMERDATA(3). + +The timer callback should return 0 on success, and -1 on error. If this +callback returns error, **all** transfers currently in progress in this +multi handle are aborted and made to fail. + +This callback can be used instead of, or in addition to, +curl_multi_timeout(3). + +**WARNING:** do not call libcurl directly from within the callback itself +when the **timeout_ms** value is zero, since it risks triggering an +unpleasant recursive behavior that immediately calls another call to the +callback with a zero timeout... + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct priv { + void *custom; +}; + +static int timerfunc(CURLM *multi, long timeout_ms, void *clientp) +{ + struct priv *mydata = clientp; + printf("our ptr: %p\n", mydata->custom); + + if(timeout_ms) { + /* this is the new single timeout to wait for */ + } + else { + /* delete the timeout, nothing to wait for now */ + } +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.16.0 + +# RETURN VALUE + +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3 b/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3 deleted file mode 100644 index 0e89be55f..000000000 --- a/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ABSTRACT_UNIX_SOCKET 3 "08 Jan 2017" libcurl libcurl -.SH NAME -CURLOPT_ABSTRACT_UNIX_SOCKET \- abstract Unix domain socket -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ABSTRACT_UNIX_SOCKET, - char *path); -.fi -.SH DESCRIPTION -Enables the use of an abstract Unix domain socket instead of establishing a -TCP connection to a host. The parameter should be a char * to a -null-terminated string holding the path of the socket. The path is set to -\fIpath\fP prefixed by a NULL byte. This is the convention for abstract -sockets, however it should be stressed that the path passed to this function -should not contain a leading NULL byte. - -On non-supporting platforms, the abstract address is interpreted as an empty -string and fails gracefully, generating a runtime error. - -This option shares the same semantics as \fICURLOPT_UNIX_SOCKET_PATH(3)\fP in -which documentation more details can be found. Internally, these two options -share the same storage and therefore only one of them can be set per handle. -.SH DEFAULT -Default is NULL. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_UNIX_SOCKET_PATH (3), -.BR unix (7) diff --git a/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.md b/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.md new file mode 100644 index 000000000..33d2b7bcc --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ABSTRACT_UNIX_SOCKET.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ABSTRACT_UNIX_SOCKET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_UNIX_SOCKET_PATH (3) + - unix (7) +--- + +# NAME + +CURLOPT_ABSTRACT_UNIX_SOCKET - abstract Unix domain socket + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ABSTRACT_UNIX_SOCKET, + char *path); +~~~ + +# DESCRIPTION + +Enables the use of an abstract Unix domain socket instead of establishing a +TCP connection to a host. The parameter should be a char * to a +null-terminated string holding the path of the socket. The path is set to +*path* prefixed by a NULL byte. This is the convention for abstract +sockets, however it should be stressed that the path passed to this function +should not contain a leading NULL byte. + +On non-supporting platforms, the abstract address is interpreted as an empty +string and fails gracefully, generating a runtime error. + +This option shares the same semantics as CURLOPT_UNIX_SOCKET_PATH(3) in +which documentation more details can be found. Internally, these two options +share the same storage and therefore only one of them can be set per handle. + +# DEFAULT + +Default is NULL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.53.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3 deleted file mode 100644 index b93142599..000000000 --- a/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ACCEPTTIMEOUT_MS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_ACCEPTTIMEOUT_MS \- timeout waiting for FTP server to connect back -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ACCEPTTIMEOUT_MS, long ms); -.fi -.SH DESCRIPTION -Pass a long telling libcurl the maximum number of milliseconds to wait for a -server to connect back to libcurl when an active FTP connection is used. -.SH DEFAULT -60000 milliseconds -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.24.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT_MS (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.md new file mode 100644 index 000000000..77615d886 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ACCEPTTIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT_MS (3) + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_ACCEPTTIMEOUT_MS - timeout waiting for FTP server to connect back + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ACCEPTTIMEOUT_MS, long ms); +~~~ + +# DESCRIPTION + +Pass a long telling libcurl the maximum number of milliseconds to wait for a +server to connect back to libcurl when an active FTP connection is used. + +# DEFAULT + +60000 milliseconds + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.24.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.3 b/docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.3 rename to docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.md index 230b6b07f..9bba40d9d 100644 --- a/docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.3 +++ b/docs/libcurl/opts/CURLOPT_ACCEPT_ENCODING.md @@ -1,38 +1,30 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ACCEPT_ENCODING 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_ACCEPT_ENCODING \- automatic decompression of HTTP downloads -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ACCEPT_ENCODING +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPHEADER (3) + - CURLOPT_HTTP_CONTENT_DECODING (3) + - CURLOPT_TRANSFER_ENCODING (3) +--- + +# NAME + +CURLOPT_ACCEPT_ENCODING - automatic decompression of HTTP downloads + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ACCEPT_ENCODING, char *enc); -.fi -.SH DESCRIPTION -Pass a char * argument specifying what encoding you would like. +~~~ + +# DESCRIPTION + +Pass a char pointer argument specifying what encoding you would like. Sets the contents of the Accept-Encoding: header sent in an HTTP request, and enables decoding of a response when a Content-Encoding: header is received. @@ -46,22 +38,22 @@ set ("") to ask for an Accept-Encoding: header to be used that contains all built-in supported encodings. Alternatively, you can specify exactly the encoding or list of encodings you -want in the response. The following encodings are supported: \fIidentity\fP, -meaning non-compressed, \fIdeflate\fP which requests the server to compress -its response using the zlib algorithm, \fIgzip\fP which requests the gzip -algorithm, (since curl 7.57.0) \fIbr\fP which is brotli and (since curl -7.72.0) \fIzstd\fP which is zstd. Provide them in the string as a -comma-separated list of accepted encodings, like: \fB"br, gzip, deflate"\fP. +want in the response. The following encodings are supported: *identity*, +meaning non-compressed, *deflate* which requests the server to compress +its response using the zlib algorithm, *gzip* which requests the gzip +algorithm, (since curl 7.57.0) *br* which is brotli and (since curl +7.72.0) *zstd* which is zstd. Provide them in the string as a +comma-separated list of accepted encodings, like: **"br, gzip, deflate"**. -Set \fICURLOPT_ACCEPT_ENCODING(3)\fP to NULL to explicitly disable it, which +Set CURLOPT_ACCEPT_ENCODING(3) to NULL to explicitly disable it, which makes libcurl not send an Accept-Encoding: header and not decompress received contents automatically. You can also opt to just include the Accept-Encoding: header in your request -with \fICURLOPT_HTTPHEADER(3)\fP but then there is no automatic decompressing +with CURLOPT_HTTPHEADER(3) but then there is no automatic decompressing when receiving data. -This is a request, not an order; the server may or may not do it. This option +This is a request, not an order; the server may or may not do it. This option must be set (to any non-NULL value) or else any unsolicited encoding done by the server is ignored. @@ -76,12 +68,18 @@ sending the length of the non-compressed content is a common server mistake). The application does not have to keep the string around after setting this option. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -95,18 +93,18 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + This option was called CURLOPT_ENCODING before 7.21.6 The specific libcurl you are using must have been built with zlib to be able to decompress gzip and deflate responses, with the brotli library to decompress brotli responses and with the zstd library to decompress zstd responses. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_CONTENT_DECODING (3), -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_TRANSFER_ENCODING (3) diff --git a/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3 b/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3 deleted file mode 100644 index eea7f8847..000000000 --- a/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ADDRESS_SCOPE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_ADDRESS_SCOPE \- scope id for IPv6 addresses -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope); -.fi -.SH DESCRIPTION -Pass a long specifying the scope id value to use when connecting to IPv6 addresses. -.SH DEFAULT -0 -.SH PROTOCOLS -All, when using IPv6 -.SH EXAMPLE -.nf -#include /* 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 -Added in 7.19.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value. -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.md b/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.md new file mode 100644 index 000000000..78526bd39 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ADDRESS_SCOPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_ADDRESS_SCOPE - scope id for IPv6 addresses + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope); +~~~ + +# DESCRIPTION + +Pass a long specifying the scope id value to use when connecting to IPv6 addresses. + +# DEFAULT + +0 + +# PROTOCOLS + +All, when using IPv6 + +# EXAMPLE + +~~~c +#include /* 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. +Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value. diff --git a/docs/libcurl/opts/CURLOPT_ALTSVC.3 b/docs/libcurl/opts/CURLOPT_ALTSVC.3 deleted file mode 100644 index 5af38437d..000000000 --- a/docs/libcurl/opts/CURLOPT_ALTSVC.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ALTSVC 3 "5 Feb 2019" libcurl libcurl -.SH NAME -CURLOPT_ALTSVC \- alt-svc cache file name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename); -.fi -.SH DESCRIPTION -Pass in a pointer to a \fIfilename\fP to instruct libcurl to use that file as -the Alt-Svc cache to read existing cache contents from and possibly also write -it back to after a transfer, unless \fBCURLALTSVC_READONLYFILE\fP is set in -\fICURLOPT_ALTSVC_CTRL(3)\fP. - -Specify a blank file name ("") to make libcurl not load from a file at all. -.SH DEFAULT -NULL. The alt-svc cache is not read nor written to file. -.SH PROTOCOLS -HTTPS -.SH EXAMPLE -.nf -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" -A text based file with one line per alt-svc entry and each line consists of -nine space-separated fields. - -An example line could look like - - h2 www.example 8443 h3 second.example 443 "20190808 06:18:37" 1 0 - -The fields of that line are: - -.IP h2 -ALPN id for the source origin -.IP www.example -Host name for the source origin -.IP 8443 -Port number for the source origin -.IP h3 -ALPN id for the destination host -.IP second.example -Host name for the destination host -.IP 443 -Port number for the destination host -.IP 2019* -Expiration date and time of this entry within double quotes. The date format -is "YYYYMMDD HH:MM:SS" and the time zone is GMT. -.IP 1 -Boolean (1 or 0) if "persist" was set for this entry -.IP 0 -Integer priority value (not currently used) -.SH AVAILABILITY -Added in 7.64.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ALTSVC_CTRL (3), -.BR CURLOPT_CONNECT_TO (3), -.BR CURLOPT_COOKIEFILE (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_ALTSVC.md b/docs/libcurl/opts/CURLOPT_ALTSVC.md new file mode 100644 index 000000000..23a353c15 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ALTSVC.md @@ -0,0 +1,111 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ALTSVC +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ALTSVC_CTRL (3) + - CURLOPT_CONNECT_TO (3) + - CURLOPT_COOKIEFILE (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_ALTSVC - alt-svc cache file name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename); +~~~ + +# DESCRIPTION + +Pass in a pointer to a *filename* to instruct libcurl to use that file as +the Alt-Svc cache to read existing cache contents from and possibly also write +it back to after a transfer, unless **CURLALTSVC_READONLYFILE** is set in +CURLOPT_ALTSVC_CTRL(3). + +Specify a blank file name ("") to make libcurl not load from a file at all. + +# DEFAULT + +NULL. The alt-svc cache is not read nor written to file. + +# PROTOCOLS + +HTTPS + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# FILE FORMAT + +A text based file with one line per alt-svc entry and each line consists of +nine space-separated fields. + +An example line could look like + + h2 www.example.com 8443 h3 second.example.com 443 "20190808 06:18:37" 1 0 + +The fields of that line are: + +## h2 + +ALPN id for the source origin + +## www.example.comp + +Host name for the source origin + +## 8443 + +Port number for the source origin + +## h3 + +ALPN id for the destination host + +## second.example.com + +Host name for the destination host + +## 443 + +Port number for the destination host + +## 2019* + +Expiration date and time of this entry within double quotes. The date format +is "YYYYMMDD HH:MM:SS" and the time zone is GMT. + +## 1 + +Boolean (1 or 0) if "persist" was set for this entry + +## 0 + +Integer priority value (not currently used) + +# AVAILABILITY + +Added in 7.64.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 b/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 deleted file mode 100644 index 5ba91c440..000000000 --- a/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ALTSVC_CTRL 3 "5 Feb 2019" libcurl libcurl -.SH NAME -CURLOPT_ALTSVC_CTRL \- control alt-svc behavior -.SH SYNOPSIS -.nf -#include - -#define CURLALTSVC_READONLYFILE (1<<2) -#define CURLALTSVC_H1 (1<<3) -#define CURLALTSVC_H2 (1<<4) -#define CURLALTSVC_H3 (1<<5) - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask); -.fi -.SH DESCRIPTION -Populate the long \fIbitmask\fP with the correct set of features to instruct -libcurl how to handle Alt-Svc for the transfers using this handle. - -libcurl only accepts Alt-Svc headers over a secure transport, meaning -HTTPS. It also only completes a request to an alternative origin if that -origin is properly hosted over HTTPS. These requirements are there to make -sure both the source and the destination are legitimate. - -Alternative services are only used when setting up new connections. If there -exists an existing connection to the host in the connection pool, then that is -preferred. - -Setting any bit enables the alt-svc engine. -.IP "CURLALTSVC_READONLYFILE" -Do not write the alt-svc cache back to the file specified with -\fICURLOPT_ALTSVC(3)\fP even if it gets updated. By default a file specified -with that option is read and written to as deemed necessary. -.IP "CURLALTSVC_H1" -Accept alternative services offered over HTTP/1.1. -.IP "CURLALTSVC_H2" -Accept alternative services offered over HTTP/2. This is only used if libcurl -was also built to actually support HTTP/2, otherwise this bit is ignored. -.IP "CURLALTSVC_H3" -Accept alternative services offered over HTTP/3. This is only used if libcurl -was also built to actually support HTTP/3, otherwise this bit is ignored. -.SH DEFAULT -Alt-Svc handling is disabled by default. If \fICURLOPT_ALTSVC(3)\fP is set, -\fICURLOPT_ALTSVC_CTRL(3)\fP has a default value corresponding to -CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2 and HTTP/3 bits are -only set if libcurl was built with support for those versions. -.SH PROTOCOLS -HTTPS -.SH EXAMPLE -.nf -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 -Added in 7.64.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ALTSVC (3), -.BR CURLOPT_CONNECT_TO (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.md b/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.md new file mode 100644 index 000000000..538fc801a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.md @@ -0,0 +1,97 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ALTSVC_CTRL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ALTSVC (3) + - CURLOPT_CONNECT_TO (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_ALTSVC_CTRL - control alt-svc behavior + +# SYNOPSIS + +~~~c +#include + +#define CURLALTSVC_READONLYFILE (1<<2) +#define CURLALTSVC_H1 (1<<3) +#define CURLALTSVC_H2 (1<<4) +#define CURLALTSVC_H3 (1<<5) + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask); +~~~ + +# DESCRIPTION + +Populate the long *bitmask* with the correct set of features to instruct +libcurl how to handle Alt-Svc for the transfers using this handle. + +libcurl only accepts Alt-Svc headers over a secure transport, meaning +HTTPS. It also only completes a request to an alternative origin if that +origin is properly hosted over HTTPS. These requirements are there to make +sure both the source and the destination are legitimate. + +Alternative services are only used when setting up new connections. If there +exists an existing connection to the host in the connection pool, then that is +preferred. + +Setting any bit enables the alt-svc engine. + +## CURLALTSVC_READONLYFILE + +Do not write the alt-svc cache back to the file specified with +CURLOPT_ALTSVC(3) even if it gets updated. By default a file specified +with that option is read and written to as deemed necessary. + +## CURLALTSVC_H1 + +Accept alternative services offered over HTTP/1.1. + +## CURLALTSVC_H2 + +Accept alternative services offered over HTTP/2. This is only used if libcurl +was also built to actually support HTTP/2, otherwise this bit is ignored. + +## CURLALTSVC_H3 + +Accept alternative services offered over HTTP/3. This is only used if libcurl +was also built to actually support HTTP/3, otherwise this bit is ignored. + +# DEFAULT + +Alt-Svc handling is disabled by default. If CURLOPT_ALTSVC(3) is set, +CURLOPT_ALTSVC_CTRL(3) has a default value corresponding to +CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2 and HTTP/3 bits are +only set if libcurl was built with support for those versions. + +# PROTOCOLS + +HTTPS + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.64.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_APPEND.3 b/docs/libcurl/opts/CURLOPT_APPEND.3 deleted file mode 100644 index 0830c1a50..000000000 --- a/docs/libcurl/opts/CURLOPT_APPEND.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_APPEND 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_APPEND \- append to the remote file -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_APPEND, long append); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to append to the remote file -instead of overwrite it. This is only useful when uploading to an FTP site. -.SH DEFAULT -0 (disabled) -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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_perform(curl); - } -} -.fi -.SH AVAILABILITY -This option was known as CURLOPT_FTPAPPEND up to 7.16.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DIRLISTONLY (3), -.BR CURLOPT_RESUME_FROM (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_APPEND.md b/docs/libcurl/opts/CURLOPT_APPEND.md new file mode 100644 index 000000000..d507c3812 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_APPEND.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_APPEND +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DIRLISTONLY (3) + - CURLOPT_RESUME_FROM (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_APPEND - append to the remote file + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_APPEND, long append); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to append to the remote file +instead of overwrite it. This is only useful when uploading to an FTP site. + +# DEFAULT + +0 (disabled) + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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_perform(curl); + } +} +~~~ + +# AVAILABILITY + +This option was known as CURLOPT_FTPAPPEND up to 7.16.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_AUTOREFERER.3 b/docs/libcurl/opts/CURLOPT_AUTOREFERER.3 deleted file mode 100644 index e35f70411..000000000 --- a/docs/libcurl/opts/CURLOPT_AUTOREFERER.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_AUTOREFERER 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_AUTOREFERER \- automatically update the referer header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long autorefer); -.fi -.SH DESCRIPTION -Pass a long parameter set to 1 to enable this. When enabled, libcurl -automatically sets the Referer: header field in HTTP requests to the full URL -when it follows a Location: redirect to a new destination. - -The automatic referer is set to the full previous URL even when redirects are -done cross-origin or following redirects to insecure protocols. This is -considered a minor privacy leak by some. - -With \fICURLINFO_REFERER(3)\fP, applications can extract the actually used -referer header after the transfer. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - - /* set Referer: automatically when following redirects */ - curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_EFFECTIVE_URL (3), -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLINFO_REFERER (3), -.BR CURLOPT_FOLLOWLOCATION (3), -.BR CURLOPT_REFERER (3) diff --git a/docs/libcurl/opts/CURLOPT_AUTOREFERER.md b/docs/libcurl/opts/CURLOPT_AUTOREFERER.md new file mode 100644 index 000000000..d201a71ad --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_AUTOREFERER.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_AUTOREFERER +Section: 3 +Source: libcurl +See-also: + - CURLINFO_EFFECTIVE_URL (3) + - CURLINFO_REDIRECT_URL (3) + - CURLINFO_REFERER (3) + - CURLOPT_FOLLOWLOCATION (3) + - CURLOPT_REFERER (3) +--- + +# NAME + +CURLOPT_AUTOREFERER - automatically update the referer header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long autorefer); +~~~ + +# DESCRIPTION + +Pass a long parameter set to 1 to enable this. When enabled, libcurl +automatically sets the Referer: header field in HTTP requests to the full URL +when it follows a Location: redirect to a new destination. + +The automatic referer is set to the full previous URL even when redirects are +done cross-origin or following redirects to insecure protocols. This is +considered a minor privacy leak by some. + +With CURLINFO_REFERER(3), applications can extract the actually used +referer header after the transfer. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + + /* set Referer: automatically when following redirects */ + curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 b/docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 deleted file mode 100644 index edc2e6afd..000000000 --- a/docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 +++ /dev/null @@ -1,111 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_AWS_SIGV4 3 "03 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_AWS_SIGV4 \- V4 signature -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param); -.fi -.SH DESCRIPTION -Provides AWS V4 signature authentication on HTTP(S) header. - -Pass a char * that is the collection of specific arguments are used for -creating outgoing authentication headers. The format of the \fIparam\fP -option is: -.IP provider1[:provider2[:region[:service]]] -.IP "provider1, provider2" -The providers arguments are used for generating some authentication parameters -such as "Algorithm", "date", "request type" and "signed headers". -.IP region -The argument is a geographic area of a resources collection. -It is extracted from the host name specified in the URL if omitted. -.IP service -The argument is a function provided by a cloud. -It is extracted from the host name specified in the URL if omitted. - -NOTE: This call set \fICURLOPT_HTTPAUTH(3)\fP to CURLAUTH_AWS_SIGV4. -Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same -as calling this with \fB"aws:amz"\fP in parameter. - -Example with "Test:Try", when curl uses the algorithm, it generates -\fB"TEST-HMAC-SHA256"\fP for "Algorithm", \fB"x-try-date"\fP and -\fB"X-Try-Date"\fP for "date", \fB"test4_request"\fP for "request type", -\fB"SignedHeaders=content-type;host;x-try-date"\fP for "signed headers" - -If you use just "test", instead of "test:try", test is used for every -generated string. -.SH DEFAULT -By default, the value of this parameter is NULL. -Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same -as calling this with \fB"aws:amz"\fP in parameter. -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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(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(curl, CURLOPT_AWS_SIGV4, - "provider1:provider2:region:service"); - - curl_easy_setopt(curl, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY"); - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.75.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH NOTES -This option overrides the other auth types you might have set in -\fICURLOPT_HTTPAUTH(3)\fP which should be highlighted as this makes this auth -method special. This method cannot be combined with other auth types. - -A sha256 checksum of the request payload is used as input to the signature -calculation. For POST requests, this is a checksum of the provided -\fICURLOPT_POSTFIELDS(3)\fP. Otherwise, it's the checksum of an empty buffer. -For requests like PUT, you can provide your own checksum in an HTTP header named -\fBx-provider2-content-sha256\fP. - -For \fBaws:s3\fP, a \fBx-amz-content-sha256\fP header is added to every request -if not already present. For s3 requests with unknown payload, this header takes -the special value "UNSIGNED-PAYLOAD". -.SH "SEE ALSO" -.BR CURLOPT_HEADEROPT (3), -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_PROXYAUTH (3) diff --git a/docs/libcurl/opts/CURLOPT_AWS_SIGV4.md b/docs/libcurl/opts/CURLOPT_AWS_SIGV4.md new file mode 100644 index 000000000..0a5cec9f0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_AWS_SIGV4.md @@ -0,0 +1,118 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_AWS_SIGV4 +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADEROPT (3) + - CURLOPT_HTTPAUTH (3) + - CURLOPT_HTTPHEADER (3) + - CURLOPT_PROXYAUTH (3) +--- + +# NAME + +CURLOPT_AWS_SIGV4 - V4 signature + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param); +~~~ + +# DESCRIPTION + +Provides AWS V4 signature authentication on HTTP(S) header. + +Pass a char pointer that is the collection of specific arguments are used for +creating outgoing authentication headers. The format of the *param* option +is: + +## provider1[:provider2[:region[:service]]] + +## provider1, provider2 + +The providers arguments are used for generating some authentication parameters +such as "Algorithm", "date", "request type" and "signed headers". + +## region + +The argument is a geographic area of a resources collection. +It is extracted from the host name specified in the URL if omitted. + +## service + +The argument is a function provided by a cloud. +It is extracted from the host name specified in the URL if omitted. + +NOTE: This call set CURLOPT_HTTPAUTH(3) to CURLAUTH_AWS_SIGV4. +Calling CURLOPT_HTTPAUTH(3) with CURLAUTH_AWS_SIGV4 is the same +as calling this with **"aws:amz"** in parameter. + +Example with "Test:Try", when curl uses the algorithm, it generates +**"TEST-HMAC-SHA256"** for "Algorithm", **"x-try-date"** and +**"X-Try-Date"** for "date", **"test4_request"** for "request type", +**"SignedHeaders=content-type;host;x-try-date"** for "signed headers" + +If you use just "test", instead of "test:try", test is used for every +generated string. + +# DEFAULT + +By default, the value of this parameter is NULL. +Calling CURLOPT_HTTPAUTH(3) with CURLAUTH_AWS_SIGV4 is the same +as calling this with **"aws:amz"** in parameter. + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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(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(curl, CURLOPT_AWS_SIGV4, + "provider1:provider2:region:service"); + + curl_easy_setopt(curl, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY"); + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.75.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. + +# NOTES + +This option overrides the other auth types you might have set in +CURLOPT_HTTPAUTH(3) which should be highlighted as this makes this auth +method special. This method cannot be combined with other auth types. + +A sha256 checksum of the request payload is used as input to the signature +calculation. For POST requests, this is a checksum of the provided +CURLOPT_POSTFIELDS(3). Otherwise, it's the checksum of an empty buffer. +For requests like PUT, you can provide your own checksum in an HTTP header named +**x-provider2-content-sha256**. + +For **aws:s3**, a **x-amz-content-sha256** header is added to every request +if not already present. For s3 requests with unknown payload, this header takes +the special value "UNSIGNED-PAYLOAD". diff --git a/docs/libcurl/opts/CURLOPT_BUFFERSIZE.3 b/docs/libcurl/opts/CURLOPT_BUFFERSIZE.3 deleted file mode 100644 index 5ec1a450e..000000000 --- a/docs/libcurl/opts/CURLOPT_BUFFERSIZE.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_BUFFERSIZE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_BUFFERSIZE \- receive buffer size -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size); -.fi -.SH DESCRIPTION -Pass a long specifying your preferred \fIsize\fP (in bytes) for the receive -buffer in libcurl. The main point of this would be that the write callback -gets called more often and with smaller chunks. Secondly, for some protocols, -there is a benefit of having a larger buffer for performance. - -This is just treated as a request, not an order. You cannot be guaranteed to -actually get the given size. - -This buffer size is by default \fICURL_MAX_WRITE_SIZE\fP (16kB). The maximum -buffer size allowed to be set is \fICURL_MAX_READ_SIZE\fP (10MB). The minimum -buffer size allowed to be set is 1024. - -DO NOT set this option on a handle that is currently used for an active -transfer as that may lead to unintended consequences. - -The maximum size was 512kB until 7.88.0. -.SH DEFAULT -CURL_MAX_WRITE_SIZE (16kB) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10. Growing the buffer was added in 7.53.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_MAXFILESIZE (3), -.BR CURLOPT_UPLOAD_BUFFERSIZE (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_BUFFERSIZE.md b/docs/libcurl/opts/CURLOPT_BUFFERSIZE.md new file mode 100644 index 000000000..1faebeef5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_BUFFERSIZE.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_BUFFERSIZE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAXFILESIZE (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) + - CURLOPT_UPLOAD_BUFFERSIZE (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_BUFFERSIZE - receive buffer size + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size); +~~~ + +# DESCRIPTION + +Pass a long specifying your preferred *size* (in bytes) for the receive buffer +in libcurl. The main point of this would be that the write callback gets +called more often and with smaller chunks. Secondly, for some protocols, there +is a benefit of having a larger buffer for performance. + +This is just treated as a request, not an order. You cannot be guaranteed to +actually get the given size. + +This buffer size is by default *CURL_MAX_WRITE_SIZE* (16kB). The maximum +buffer size allowed to be set is *CURL_MAX_READ_SIZE* (10MB). The minimum +buffer size allowed to be set is 1024. + +DO NOT set this option on a handle that is currently used for an active +transfer as that may lead to unintended consequences. + +The maximum size was 512kB until 7.88.0. + +# DEFAULT + +CURL_MAX_WRITE_SIZE (16kB) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10. Growing the buffer was added in 7.53.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CAINFO.3 b/docs/libcurl/opts/CURLOPT_CAINFO.3 deleted file mode 100644 index f4e151eff..000000000 --- a/docs/libcurl/opts/CURLOPT_CAINFO.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CAINFO 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CAINFO \- path to Certificate Authority (CA) bundle -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a file holding one or more -certificates to verify the peer with. - -If \fICURLOPT_SSL_VERIFYPEER(3)\fP is zero and you avoid verifying the -server's certificate, \fICURLOPT_CAINFO(3)\fP need not even indicate an -accessible file. - -This option is by default set to the system path where libcurl's CA -certificate bundle is assumed to be stored, as established at build time. - -(iOS and macOS) When curl uses Secure Transport this option is supported. If -the option is not set, then curl uses the certificates in the system and user -Keychain to verify the peer. - -(Schannel) This option is supported for Schannel in Windows 7 or later but we -recommend not using it until Windows 8 since it works better starting then. -If the option is not set, then curl uses the certificates in the Windows' -store of root certificates (the default for Schannel). - -The application does not have to keep the string around after setting this -option. - -The default value for this can be figured out with \fICURLINFO_CAINFO(3)\fP. -.SH DEFAULT -Built-in system specific. When curl is built with Secure Transport or -Schannel, this option is not set by default. -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -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 -For the SSL engines that do not support certificate files the -\fICURLOPT_CAINFO(3)\fP option is ignored. Schannel support added in libcurl -7.60. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_CAINFO (3), -.BR CURLOPT_CA_CACHE_TIMEOUT (3), -.BR CURLOPT_CAINFO_BLOB (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_CAINFO.md b/docs/libcurl/opts/CURLOPT_CAINFO.md new file mode 100644 index 000000000..c46073ff8 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CAINFO.md @@ -0,0 +1,87 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CAINFO +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAINFO (3) + - CURLOPT_CAINFO_BLOB (3) + - CURLOPT_CAPATH (3) + - CURLOPT_CA_CACHE_TIMEOUT (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_CAINFO - path to Certificate Authority (CA) bundle + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a file holding one or +more certificates to verify the peer with. + +If CURLOPT_SSL_VERIFYPEER(3) is zero and you avoid verifying the +server's certificate, CURLOPT_CAINFO(3) need not even indicate an +accessible file. + +This option is by default set to the system path where libcurl's CA +certificate bundle is assumed to be stored, as established at build time. + +(iOS and macOS) When curl uses Secure Transport this option is supported. If +the option is not set, then curl uses the certificates in the system and user +Keychain to verify the peer. + +(Schannel) This option is supported for Schannel in Windows 7 or later but we +recommend not using it until Windows 8 since it works better starting then. +If the option is not set, then curl uses the certificates in the Windows' +store of root certificates (the default for Schannel). + +The application does not have to keep the string around after setting this +option. + +The default value for this can be figured out with CURLINFO_CAINFO(3). + +# DEFAULT + +Built-in system specific. When curl is built with Secure Transport or +Schannel, this option is not set by default. + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +For the SSL engines that do not support certificate files the +CURLOPT_CAINFO(3) option is ignored. Schannel support added in libcurl +7.60. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 b/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 deleted file mode 100644 index db3bed941..000000000 --- a/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CAINFO_BLOB 3 "31 March 2021" libcurl libcurl -.SH NAME -CURLOPT_CAINFO_BLOB \- Certificate Authority (CA) bundle in PEM format -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO_BLOB, - struct curl_blob *stblob); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_blob structure, which contains information (pointer -and size) about a memory block with binary data of PEM encoded content holding -one or more certificates to verify the HTTPS server with. - -If the blob is initialized with the flags member of struct curl_blob set to -CURL_BLOB_COPY, the application does not have to keep the buffer around after -setting this. - -If \fICURLOPT_SSL_VERIFYPEER(3)\fP is zero and you avoid verifying the -server's certificate, \fICURLOPT_CAINFO_BLOB(3)\fP is not needed. - -This option overrides \fICURLOPT_CAINFO(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -#include - -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 -Added in 7.77.0. - -This option is supported by the BearSSL (since 7.79.0), mbedTLS (since 7.81.0), -rustls (since 7.82.0), wolfSSL (since 8.2.0), OpenSSL, Secure Transport and Schannel backends. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3) diff --git a/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.md b/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.md new file mode 100644 index 000000000..be30446ff --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.md @@ -0,0 +1,84 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CAINFO_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAPATH (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_CAINFO_BLOB - Certificate Authority (CA) bundle in PEM format + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO_BLOB, + struct curl_blob *stblob); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_blob structure, which contains information (pointer +and size) about a memory block with binary data of PEM encoded content holding +one or more certificates to verify the HTTPS server with. + +If the blob is initialized with the flags member of struct curl_blob set to +CURL_BLOB_COPY, the application does not have to keep the buffer around after +setting this. + +If CURLOPT_SSL_VERIFYPEER(3) is zero and you avoid verifying the +server's certificate, CURLOPT_CAINFO_BLOB(3) is not needed. + +This option overrides CURLOPT_CAINFO(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +#include + +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.77.0. + +This option is supported by the BearSSL (since 7.79.0), mbedTLS (since +7.81.0), rustls (since 7.82.0), wolfSSL (since 8.2.0), OpenSSL, Secure +Transport and Schannel backends. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_CAPATH.3 b/docs/libcurl/opts/CURLOPT_CAPATH.3 deleted file mode 100644 index 8288ee334..000000000 --- a/docs/libcurl/opts/CURLOPT_CAPATH.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CAPATH 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CAPATH \- directory holding CA certificates -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAPATH, char *capath); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a directory holding multiple -CA certificates to verify the peer with. If libcurl is built against OpenSSL, -the certificate directory must be prepared using the OpenSSL c_rehash utility. -This makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER(3)\fP option. - -The \fICURLOPT_CAPATH(3)\fP function apparently does not work in Windows due -to some limitation in OpenSSL. - -The application does not have to keep the string around after setting this -option. - -The default value for this can be figured out with \fICURLINFO_CAPATH(3)\fP. -.SH DEFAULT -A default path detected at build time. -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -This option is supported by the OpenSSL, GnuTLS and mbedTLS (since 7.56.0) -backends. -.SH RETURN VALUE -CURLE_OK if supported; or an error such as: - -CURLE_NOT_BUILT_IN - Not supported by the SSL backend - -CURLE_UNKNOWN_OPTION - -CURLE_OUT_OF_MEMORY -.SH "SEE ALSO" -.BR CURLINFO_CAPATH (3), -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_CAPATH.md b/docs/libcurl/opts/CURLOPT_CAPATH.md new file mode 100644 index 000000000..ff1362f52 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CAPATH.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CAPATH +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAPATH (3) + - CURLOPT_CAINFO (3) + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_CAPATH - directory holding CA certificates + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAPATH, char *capath); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a directory holding +multiple CA certificates to verify the peer with. If libcurl is built against +OpenSSL, the certificate directory must be prepared using the OpenSSL c_rehash +utility. This makes sense only when used in combination with the +CURLOPT_SSL_VERIFYPEER(3) option. + +The CURLOPT_CAPATH(3) function apparently does not work in Windows due +to some limitation in OpenSSL. + +The application does not have to keep the string around after setting this +option. + +The default value for this can be figured out with CURLINFO_CAPATH(3). + +# DEFAULT + +A default path detected at build time. + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +This option is supported by the OpenSSL, GnuTLS and mbedTLS (since 7.56.0) +backends. + +# RETURN VALUE + +CURLE_OK if supported; or an error such as: + +CURLE_NOT_BUILT_IN - Not supported by the SSL backend + +CURLE_UNKNOWN_OPTION + +CURLE_OUT_OF_MEMORY diff --git a/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.3 b/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.3 deleted file mode 100644 index 8c2635120..000000000 --- a/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CA_CACHE_TIMEOUT 3 "21 Dec 2022" libcurl libcurl -.SH NAME -CURLOPT_CA_CACHE_TIMEOUT \- life-time for cached certificate stores -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age); -.fi -.SH DESCRIPTION -Pass a long, this sets the timeout in seconds. This tells libcurl the maximum -time any cached certificate store it has in memory may be kept and reused for -new connections. Once the timeout has expired, a subsequent fetch requiring a -certificate has to reload it. - -Building a certificate store from a \fICURLOPT_CAINFO(3)\fP file is a slow -operation so curl may cache the generated certificate store internally to speed -up future connections. - -Set to zero to completely disable caching, or set to -1 to retain the cached -store remain forever. By default, libcurl caches this info for 24 hours. -.SH DEFAULT -86400 (24 hours) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - res = 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); - } -} -.fi -.SH AVAILABILITY -This option was added in curl 7.87.0. - -This option is supported by OpenSSL and its forks (since 7.87.0) and Schannel -(since 8.5.0). -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAINFO_BLOB (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3) diff --git a/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.md b/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.md new file mode 100644 index 000000000..ef52f976d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CA_CACHE_TIMEOUT.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CA_CACHE_TIMEOUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAINFO_BLOB (3) + - CURLOPT_CAPATH (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_CA_CACHE_TIMEOUT - life-time for cached certificate stores + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age); +~~~ + +# DESCRIPTION + +Pass a long, this sets the timeout in seconds. This tells libcurl the maximum +time any cached certificate store it has in memory may be kept and reused for +new connections. Once the timeout has expired, a subsequent fetch requiring a +certificate has to reload it. + +Building a certificate store from a CURLOPT_CAINFO(3) file is a slow +operation so curl may cache the generated certificate store internally to speed +up future connections. + +Set to zero to completely disable caching, or set to -1 to retain the cached +store remain forever. By default, libcurl caches this info for 24 hours. + +# DEFAULT + +86400 (24 hours) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + res = 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); + } +} +~~~ + +# AVAILABILITY + +This option was added in curl 7.87.0. + +This option is supported by OpenSSL and its forks (since 7.87.0) and Schannel +(since 8.5.0). + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_CERTINFO.3 b/docs/libcurl/opts/CURLOPT_CERTINFO.3 deleted file mode 100644 index 7b2013407..000000000 --- a/docs/libcurl/opts/CURLOPT_CERTINFO.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CERTINFO 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CERTINFO \- request SSL certificate information -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CERTINFO, long certinfo); -.fi -.SH DESCRIPTION -Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With -this enabled, libcurl extracts lots of information and data about the -certificates in the certificate chain used in the SSL connection. This data -may then be retrieved after a transfer using \fIcurl_easy_getinfo(3)\fP and -its option \fICURLINFO_CERTINFO(3)\fP. -.SH DEFAULT -0 -.SH PROTOCOLS -All TLS-based -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); - - /* connect to any HTTPS site, trusted or not */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - - curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); - - res = curl_easy_perform(curl); - - if(!res) { - struct curl_certinfo *ci; - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); - - 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(slist = ci->certinfo[i]; slist; slist = slist->next) - printf("%s\\n", slist->data); - } - } - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -This option is supported by the OpenSSL, GnuTLS, Schannel and Secure -Transport backends. Schannel support added in 7.50.0. Secure Transport support -added in 7.79.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_CAINFO (3), -.BR CURLINFO_CAPATH (3), -.BR CURLINFO_CERTINFO (3), -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_CERTINFO.md b/docs/libcurl/opts/CURLOPT_CERTINFO.md new file mode 100644 index 000000000..a69e1e950 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CERTINFO.md @@ -0,0 +1,90 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CERTINFO +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAINFO (3) + - CURLINFO_CAPATH (3) + - CURLINFO_CERTINFO (3) + - CURLOPT_CAINFO (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_CERTINFO - request SSL certificate information + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CERTINFO, long certinfo); +~~~ + +# DESCRIPTION + +Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With +this enabled, libcurl extracts lots of information and data about the +certificates in the certificate chain used in the SSL connection. This data +may then be retrieved after a transfer using curl_easy_getinfo(3) and +its option CURLINFO_CERTINFO(3). + +# DEFAULT + +0 + +# PROTOCOLS + +All TLS-based + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); + + /* connect to any HTTPS site, trusted or not */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + + curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + struct curl_certinfo *ci; + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); + + 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(slist = ci->certinfo[i]; slist; slist = slist->next) + printf("%s\n", slist->data); + } + } + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +This option is supported by the OpenSSL, GnuTLS, Schannel and Secure +Transport backends. Schannel support added in 7.50.0. Secure Transport support +added in 7.79.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3 rename to docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.md index 88f3768c9..a208c9bbe 100644 --- a/docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.md @@ -1,32 +1,21 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CHUNK_BGN_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CHUNK_BGN_FUNCTION \- callback before a transfer with FTP wildcard match -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CHUNK_BGN_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CHUNK_END_FUNCTION (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_CHUNK_BGN_FUNCTION - callback before a transfer with FTP wildcard match + +# SYNOPSIS + +~~~c #include struct curl_fileinfo { @@ -61,35 +50,44 @@ long chunk_bgn_callback(const void *transfer_info, void *ptr, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_BGN_FUNCTION, chunk_bgn_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. This callback function gets called by libcurl before a part of the stream is going to be transferred (if the transfer supports chunks). -The \fItransfer_info\fP pointer points to a \fBcurl_fileinfo\fP struct with +The *transfer_info* pointer points to a **curl_fileinfo** struct with details about the file that is about to get transferred. -This callback makes sense only when using the \fICURLOPT_WILDCARDMATCH(3)\fP +This callback makes sense only when using the CURLOPT_WILDCARDMATCH(3) option for now. The target of transfer_info parameter is a "feature depended" structure. For -the FTP wildcard download, the target is \fBcurl_fileinfo\fP structure (see -\fIcurl/curl.h\fP). The parameter \fIptr\fP is a pointer given by -\fICURLOPT_CHUNK_DATA(3)\fP. The parameter remains contains number of chunks +the FTP wildcard download, the target is **curl_fileinfo** structure (see +*curl/curl.h*). The parameter *ptr* is a pointer given by +CURLOPT_CHUNK_DATA(3). The parameter remains contains number of chunks remaining per the transfer. If the feature is not available, the parameter has zero value. -Return \fICURL_CHUNK_BGN_FUNC_OK\fP if everything is fine, -\fICURL_CHUNK_BGN_FUNC_SKIP\fP if you want to skip the concrete chunk or -\fICURL_CHUNK_BGN_FUNC_FAIL\fP to tell libcurl to stop if some error occurred. -.SH DEFAULT +Return *CURL_CHUNK_BGN_FUNC_OK* if everything is fine, +*CURL_CHUNK_BGN_FUNC_SKIP* if you want to skip the concrete chunk or +*CURL_CHUNK_BGN_FUNC_FAIL* to tell libcurl to stop if some error occurred. + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + FTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include struct callback_data { @@ -106,20 +104,20 @@ static long file_is_coming(struct curl_fileinfo *finfo, switch(finfo->filetype) { case CURLFILETYPE_DIRECTORY: - printf(" DIR\\n"); + printf(" DIR\n"); break; case CURLFILETYPE_FILE: printf("FILE "); break; default: - printf("OTHER\\n"); + printf("OTHER\n"); break; } if(finfo->filetype == CURLFILETYPE_FILE) { /* do not transfer files >= 50B */ if(finfo->size > 50) { - printf("SKIPPED\\n"); + printf("SKIPPED\n"); return CURL_CHUNK_BGN_FUNC_SKIP; } @@ -143,11 +141,12 @@ int main() curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming); curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + This was added in 7.21.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CHUNK_END_FUNCTION (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 b/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 deleted file mode 100644 index a4e35244d..000000000 --- a/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 +++ /dev/null @@ -1,104 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CHUNK_DATA 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CHUNK_DATA \- pointer passed to the FTP chunk callbacks -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_DATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the ptr -argument to the \fICURLOPT_CHUNK_BGN_FUNCTION(3)\fP and -\fICURLOPT_CHUNK_END_FUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -#include - -struct callback_data { - FILE *output; -}; - -static long file_is_coming(struct curl_fileinfo *finfo, - void *ptr, - int remains) -{ - struct callback_data *data = ptr; - printf("%3d %40s %10luB ", remains, finfo->filename, - (unsigned long)finfo->size); - - switch(finfo->filetype) { - case CURLFILETYPE_DIRECTORY: - printf(" DIR\\n"); - break; - case CURLFILETYPE_FILE: - printf("FILE "); - break; - default: - printf("OTHER\\n"); - break; - } - - if(finfo->filetype == CURLFILETYPE_FILE) { - /* do not transfer files >= 50B */ - if(finfo->size > 50) { - printf("SKIPPED\\n"); - return CURL_CHUNK_BGN_FUNC_SKIP; - } - - data->output = fopen(finfo->filename, "wb"); - if(!data->output) { - return CURL_CHUNK_BGN_FUNC_FAIL; - } - } - - return CURL_CHUNK_BGN_FUNC_OK; -} - -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); -} -.fi -.SH AVAILABILITY -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CHUNK_BGN_FUNCTION (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_DATA.md b/docs/libcurl/opts/CURLOPT_CHUNK_DATA.md new file mode 100644 index 000000000..3640ec8df --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CHUNK_DATA.md @@ -0,0 +1,102 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CHUNK_DATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CHUNK_BGN_FUNCTION (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_CHUNK_DATA - pointer passed to the FTP chunk callbacks + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_DATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the ptr +argument to the CURLOPT_CHUNK_BGN_FUNCTION(3) and +CURLOPT_CHUNK_END_FUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +#include + +struct callback_data { + FILE *output; +}; + +static long file_is_coming(struct curl_fileinfo *finfo, + void *ptr, + int remains) +{ + struct callback_data *data = ptr; + printf("%3d %40s %10luB ", remains, finfo->filename, + (unsigned long)finfo->size); + + switch(finfo->filetype) { + case CURLFILETYPE_DIRECTORY: + printf(" DIR\n"); + break; + case CURLFILETYPE_FILE: + printf("FILE "); + break; + default: + printf("OTHER\n"); + break; + } + + if(finfo->filetype == CURLFILETYPE_FILE) { + /* do not transfer files >= 50B */ + if(finfo->size > 50) { + printf("SKIPPED\n"); + return CURL_CHUNK_BGN_FUNC_SKIP; + } + + data->output = fopen(finfo->filename, "wb"); + if(!data->output) { + return CURL_CHUNK_BGN_FUNC_FAIL; + } + } + + return CURL_CHUNK_BGN_FUNC_OK; +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3 deleted file mode 100644 index c6bf88e45..000000000 --- a/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CHUNK_END_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CHUNK_END_FUNCTION \- callback after a transfer with FTP wildcard match -.SH SYNOPSIS -.nf -#include - -long chunk_end_callback(void *ptr); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_END_FUNCTION, - chunk_end_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -This function gets called by libcurl as soon as a part of the stream has been -transferred (or skipped). - -Return \fICURL_CHUNK_END_FUNC_OK\fP if everything is fine or -\fBCURL_CHUNK_END_FUNC_FAIL\fP to tell the lib to stop if some error occurred. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -#include - -struct callback_data { - FILE *output; -}; - -static long file_is_downloaded(struct callback_data *data) -{ - if(data->output) { - fclose(data->output); - data->output = 0x0; - } - return CURL_CHUNK_END_FUNC_OK; -} - -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); -} -.fi -.SH AVAILABILITY -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CHUNK_BGN_FUNCTION (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.md b/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.md new file mode 100644 index 000000000..2d67afe20 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CHUNK_END_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CHUNK_BGN_FUNCTION (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_CHUNK_END_FUNCTION - callback after a transfer with FTP wildcard match + +# SYNOPSIS + +~~~c +#include + +long chunk_end_callback(void *ptr); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_END_FUNCTION, + chunk_end_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +This function gets called by libcurl as soon as a part of the stream has been +transferred (or skipped). + +Return *CURL_CHUNK_END_FUNC_OK* if everything is fine or +**CURL_CHUNK_END_FUNC_FAIL** to tell the lib to stop if some error occurred. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +#include + +struct callback_data { + FILE *output; +}; + +static long file_is_downloaded(struct callback_data *data) +{ + if(data->output) { + fclose(data->output); + data->output = 0x0; + } + return CURL_CHUNK_END_FUNC_OK; +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.3 b/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.3 deleted file mode 100644 index d1f870575..000000000 --- a/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CLOSESOCKETDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CLOSESOCKETDATA \- pointer passed to the socket close callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CLOSESOCKETDATA, - void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that remains untouched by libcurl and passed as the first -argument in the closesocket callback set with -\fICURLOPT_CLOSESOCKETFUNCTION(3)\fP. -.SH DEFAULT -The default value of this parameter is NULL. -.SH PROTOCOLS -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; -} - -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 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CLOSESOCKETFUNCTION (3), -.BR CURLOPT_OPENSOCKETFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md b/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md new file mode 100644 index 000000000..2dd74777b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CLOSESOCKETDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CLOSESOCKETFUNCTION (3) + - CURLOPT_OPENSOCKETFUNCTION (3) +--- + +# NAME + +CURLOPT_CLOSESOCKETDATA - pointer passed to the socket close callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CLOSESOCKETDATA, + void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that remains untouched by libcurl and passed as the first +argument in the closesocket callback set with +CURLOPT_CLOSESOCKETFUNCTION(3). + +# DEFAULT + +The default value of this parameter is NULL. + +# PROTOCOLS + +All except file: + +# EXAMPLE + +~~~c +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; +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.21.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.3 b/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.3 deleted file mode 100644 index fb81f696f..000000000 --- a/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CLOSESOCKETFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CLOSESOCKETFUNCTION \- callback to socket close replacement -.SH SYNOPSIS -.nf -#include - -int closesocket_callback(void *clientp, curl_socket_t item); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CLOSESOCKETFUNCTION, - closesocket_callback); -.fi -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -This callback function gets called by libcurl instead of the \fIclose(3)\fP or -\fIclosesocket(3)\fP call when sockets are closed (not for any other file -descriptors). This is pretty much the reverse to the -\fICURLOPT_OPENSOCKETFUNCTION(3)\fP option. Return 0 to signal success and 1 -if there was an error. - -The \fIclientp\fP pointer is set with -\fICURLOPT_CLOSESOCKETDATA(3)\fP. \fIitem\fP is the socket libcurl wants to be -closed. -.SH DEFAULT -By default libcurl uses the standard socket close function. -.SH PROTOCOLS -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; -} - -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 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CLOSESOCKETDATA (3), -.BR CURLOPT_OPENSOCKETFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md b/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md new file mode 100644 index 000000000..e93e28c1e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CLOSESOCKETFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CLOSESOCKETDATA (3) + - CURLOPT_OPENSOCKETFUNCTION (3) +--- + +# NAME + +CURLOPT_CLOSESOCKETFUNCTION - callback to socket close replacement + +# SYNOPSIS + +~~~c +#include + +int closesocket_callback(void *clientp, curl_socket_t item); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CLOSESOCKETFUNCTION, + closesocket_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +This callback function gets called by libcurl instead of the *close(3)* or +*closesocket(3)* call when sockets are closed (not for any other file +descriptors). This is pretty much the reverse to the +CURLOPT_OPENSOCKETFUNCTION(3) option. Return 0 to signal success and 1 +if there was an error. + +The *clientp* pointer is set with +CURLOPT_CLOSESOCKETDATA(3). *item* is the socket libcurl wants to be +closed. + +# DEFAULT + +By default libcurl uses the standard socket close function. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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; +} + +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); +} +~~~ + +# AVAILABILITY + +Added in 7.21.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.3 b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.3 deleted file mode 100644 index 1d4a2ed54..000000000 --- a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONNECTTIMEOUT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONNECTTIMEOUT \- timeout for the connect phase -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT, long timeout); -.fi -.SH DESCRIPTION -Pass a long. It should contain the maximum time in seconds that you allow the -connection phase to the server to take. This timeout only limits the -connection phase, it has no impact once it has connected. Set to zero to -switch to the default built-in connection timeout - 300 seconds. See also the -\fICURLOPT_TIMEOUT(3)\fP option. - -\fICURLOPT_CONNECTTIMEOUT_MS(3)\fP is the same function but set in milliseconds. - -If both \fICURLOPT_CONNECTTIMEOUT(3)\fP and \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP -are set, the value set last is used. - -The "connection phase" is considered complete when the requested TCP, TLS or -QUIC handshakes are done. - -The connection timeout set with \fICURLOPT_CONNECTTIMEOUT(3)\fP is included in -the general all-covering \fICURLOPT_TIMEOUT(3)\fP. - -With \fICURLOPT_CONNECTTIMEOUT(3)\fP set to 3 and \fICURLOPT_TIMEOUT(3)\fP set -to 5, the operation can never last longer than 5 seconds, and the connection -phase cannot last longer than 3 seconds. - -With \fICURLOPT_CONNECTTIMEOUT(3)\fP set to 4 and \fICURLOPT_TIMEOUT(3)\fP set -to 2, the operation can never last longer than 2 seconds. Including the -connection phase. - -This option may cause libcurl to use the SIGALRM signal to timeout system -calls on builds not using asynch DNS. In unix-like systems, this might cause -signals to be used unless \fICURLOPT_NOSIGNAL(3)\fP is set. -.SH DEFAULT -300 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative -value or a value that when converted to milliseconds is too large. -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT_MS (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.md b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.md new file mode 100644 index 000000000..07513fdee --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONNECTTIMEOUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT_MS (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_CONNECTTIMEOUT - timeout for the connect phase + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT, long timeout); +~~~ + +# DESCRIPTION + +Pass a long. It should contain the maximum time in seconds that you allow the +connection phase to the server to take. This timeout only limits the +connection phase, it has no impact once it has connected. Set to zero to +switch to the default built-in connection timeout - 300 seconds. See also the +CURLOPT_TIMEOUT(3) option. + +CURLOPT_CONNECTTIMEOUT_MS(3) is the same function but set in milliseconds. + +If both CURLOPT_CONNECTTIMEOUT(3) and CURLOPT_CONNECTTIMEOUT_MS(3) +are set, the value set last is used. + +The "connection phase" is considered complete when the requested TCP, TLS or +QUIC handshakes are done. + +The connection timeout set with CURLOPT_CONNECTTIMEOUT(3) is included in +the general all-covering CURLOPT_TIMEOUT(3). + +With CURLOPT_CONNECTTIMEOUT(3) set to 3 and CURLOPT_TIMEOUT(3) set +to 5, the operation can never last longer than 5 seconds, and the connection +phase cannot last longer than 3 seconds. + +With CURLOPT_CONNECTTIMEOUT(3) set to 4 and CURLOPT_TIMEOUT(3) set +to 2, the operation can never last longer than 2 seconds. Including the +connection phase. + +This option may cause libcurl to use the SIGALRM signal to timeout system +calls on builds not using asynch DNS. In unix-like systems, this might cause +signals to be used unless CURLOPT_NOSIGNAL(3) is set. + +# DEFAULT + +300 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative +value or a value that when converted to milliseconds is too large. diff --git a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3 deleted file mode 100644 index 67c0097ef..000000000 --- a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONNECTTIMEOUT_MS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONNECTTIMEOUT_MS \- timeout for the connect phase -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS, - long timeout); -.fi -.SH DESCRIPTION -Pass a long. It should contain the maximum time in milliseconds that you allow -the connection phase to the server to take. - -See \fICURLOPT_CONNECTTIMEOUT(3)\fP for details. -.SH DEFAULT -300000 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.md new file mode 100644 index 000000000..b8508e7de --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONNECTTIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_CONNECTTIMEOUT_MS - timeout for the connect phase + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS, + long timeout); +~~~ + +# DESCRIPTION + +Pass a long. It should contain the maximum time in milliseconds that you allow +the connection phase to the server to take. + +See CURLOPT_CONNECTTIMEOUT(3) for details. + +# DEFAULT + +300000 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3 b/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3 deleted file mode 100644 index 014c5f2cf..000000000 --- a/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONNECT_ONLY 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONNECT_ONLY \- stop when connected to target server -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_ONLY, long only); -.fi -.SH DESCRIPTION -Pass a long. If the parameter equals 1, it tells the library to perform all -the required proxy authentication and connection setup, but no data transfer, -and then return. - -The option can be used to simply test a connection to a server, but is more -useful when used with the \fICURLINFO_ACTIVESOCKET(3)\fP option to -\fIcurl_easy_getinfo(3)\fP as the library can set up the connection and then -the application can obtain the most recently used socket for special data -transfers. - -Since 7.86.0, this option can be set to '2' and if HTTP or WebSocket are used, -libcurl performs the request and reads all response headers before handing -over control to the application. - -Transfers marked connect only do not reuse any existing connections and -connections marked connect only are not allowed to get reused. - -If the connect only transfer is done using the multi interface, the particular -easy handle must remain added to the multi handle for as long as the -application wants to use it. Once it has been removed with -\fIcurl_multi_remove_handle(3)\fP, \fIcurl_easy_send(3)\fP and -\fIcurl_easy_recv(3)\fP do not function. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP, SMTP, POP3 and IMAP. For WS and WSS starting in 7.86.0. -.SH EXAMPLE -.nf -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 -.SH AVAILABILITY -Added in 7.15.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_recv (3), -.BR curl_easy_send (3), -.BR CURLOPT_HTTPPROXYTUNNEL (3), -.BR CURLOPT_VERBOSE (3) diff --git a/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.md b/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.md new file mode 100644 index 000000000..3312936af --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONNECT_ONLY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_VERBOSE (3) + - curl_easy_recv (3) + - curl_easy_send (3) +--- + +# NAME + +CURLOPT_CONNECT_ONLY - stop when connected to target server + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_ONLY, long only); +~~~ + +# DESCRIPTION + +Pass a long. If the parameter equals 1, it tells the library to perform all +the required proxy authentication and connection setup, but no data transfer, +and then return. + +The option can be used to simply test a connection to a server, but is more +useful when used with the CURLINFO_ACTIVESOCKET(3) option to +curl_easy_getinfo(3) as the library can set up the connection and then +the application can obtain the most recently used socket for special data +transfers. + +Since 7.86.0, this option can be set to '2' and if HTTP or WebSocket are used, +libcurl performs the request and reads all response headers before handing +over control to the application. + +Transfers marked connect only do not reuse any existing connections and +connections marked connect only are not allowed to get reused. + +If the connect only transfer is done using the multi interface, the particular +easy handle must remain added to the multi handle for as long as the +application wants to use it. Once it has been removed with +curl_multi_remove_handle(3), curl_easy_send(3) and +curl_easy_recv(3) do not function. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP, SMTP, POP3 and IMAP. For WS and WSS starting in 7.86.0. + +# EXAMPLE + +~~~c +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! */ + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CONNECT_TO.3 b/docs/libcurl/opts/CURLOPT_CONNECT_TO.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_CONNECT_TO.3 rename to docs/libcurl/opts/CURLOPT_CONNECT_TO.md index e0a45031b..98d7acc4a 100644 --- a/docs/libcurl/opts/CURLOPT_CONNECT_TO.3 +++ b/docs/libcurl/opts/CURLOPT_CONNECT_TO.md @@ -1,43 +1,36 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONNECT_TO 3 "10 April 2016" libcurl libcurl -.SH NAME -CURLOPT_CONNECT_TO \- connect to a specific host and port instead of the URL's host and port -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONNECT_TO +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FOLLOWLOCATION (3) + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_RESOLVE (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_CONNECT_TO - connect to another host and port instead + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_TO, struct curl_slist *connect_to); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a linked list of strings with "connect to" information to use for establishing network connections with this handle. The linked list -should be a fully valid list of \fBstruct curl_slist\fP structs properly -filled in. Use \fIcurl_slist_append(3)\fP to create the list and -\fIcurl_slist_free_all(3)\fP to clean up an entire list. +should be a fully valid list of **struct curl_slist** structs properly filled +in. Use curl_slist_append(3) to create the list and curl_slist_free_all(3) to +clean up an entire list. Each single string should be written using the format HOST:PORT:CONNECT-TO-HOST:CONNECT-TO-PORT where HOST is the host of the @@ -62,10 +55,9 @@ The "connect to" host and port are only used to establish the network connection. They do NOT affect the host and port that are used for TLS/SSL (e.g. SNI, certificate verification) or for the application protocols. -In contrast to \fICURLOPT_RESOLVE(3)\fP, the option -\fICURLOPT_CONNECT_TO(3)\fP does not pre-populate the DNS cache and therefore -it does not affect future transfers of other easy handles that have been added -to the same multi handle. +In contrast to CURLOPT_RESOLVE(3), the option CURLOPT_CONNECT_TO(3) does not +pre-populate the DNS cache and therefore it does not affect future transfers +of other easy handles that have been added to the same multi handle. The "connect to" host and port are ignored if they are equal to the host and the port in the request URL, because connecting to the host and the port in @@ -77,17 +69,21 @@ port, the HTTP proxy is automatically switched to tunnel mode for this specific request. This is necessary because it is not possible to connect to a specific host or port in normal (non-tunnel) mode. -When this option is passed to \fIcurl_easy_setopt(3)\fP, libcurl does not copy -the list so you \fBmust\fP keep it around until you no longer use this -\fIhandle\fP for a transfer before you call \fIcurl_slist_free_all(3)\fP on -the list. +When this option is passed to curl_easy_setopt(3), libcurl does not copy the +list so you **must** keep it around until you no longer use this *handle* for +a transfer before you call curl_slist_free_all(3) on the list. + +# DEFAULT -.SH DEFAULT NULL -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl; @@ -107,13 +103,12 @@ int main(void) curl_slist_free_all(connect_to); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.49.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FOLLOWLOCATION (3), -.BR CURLOPT_HTTPPROXYTUNNEL (3), -.BR CURLOPT_RESOLVE (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3 deleted file mode 100644 index 2baf5f46f..000000000 --- a/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3 +++ /dev/null @@ -1,111 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONV_FROM_NETWORK_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONV_FROM_NETWORK_FUNCTION \- convert data from network to host encoding -.SH SYNOPSIS -.nf -#include - -CURLcode conv_callback(char *ptr, size_t length); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_NETWORK_FUNCTION, - conv_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -Applies to non-ASCII platforms. \fIcurl_version_info(3)\fP returns the -\fBCURL_VERSION_CONV\fP feature bit set if this option is provided. - -The data to be converted is in a buffer pointed to by the \fIptr\fP parameter. -The amount of data to convert is indicated by the \fIlength\fP parameter. The -converted data overlays the input data in the buffer pointed to by the ptr -parameter. \fICURLE_OK\fP must be returned upon successful conversion. A -CURLcode return value defined by curl.h, such as \fICURLE_CONV_FAILED\fP, -should be returned if an error was encountered. - -\fICURLOPT_CONV_FROM_NETWORK_FUNCTION(3)\fP converts to host encoding from the -network encoding. It is used when commands or ASCII data are received over -the network. - -If you set a callback pointer to NULL, or do not set it at all, the built-in -libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl -was built, and no callback has been established, the conversion returns the -\fBCURLE_CONV_REQD\fP error code. - -If \fBHAVE_ICONV\fP is defined, \fBCURL_ICONV_CODESET_OF_HOST\fP must also be -defined. For example: - - \&#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" - -The iconv code in libcurl defaults the network and UTF8 codeset names as -follows: - - \&#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" - - \&#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" - -You need to override these definitions if they are different on your system. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP, SMTP, IMAP, POP3 -.SH EXAMPLE -.nf -static CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length) -{ - int rc = 0; - - /* in-place convert 'buffer' from ASCII to EBCDIC */ - - if(rc == 0) { - /* success */ - return CURLE_OK; - } - else { - return CURLE_CONV_FAILED; - } -} - -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. - -Available only if \fBCURL_DOES_CONVERSIONS\fP was defined when libcurl was -built. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CONV_FROM_UTF8_FUNCTION (3), -.BR CURLOPT_CONV_TO_NETWORK_FUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.md b/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.md new file mode 100644 index 000000000..7460a1e90 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.md @@ -0,0 +1,114 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONV_FROM_NETWORK_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONV_FROM_UTF8_FUNCTION (3) + - CURLOPT_CONV_TO_NETWORK_FUNCTION (3) +--- + +# NAME + +CURLOPT_CONV_FROM_NETWORK_FUNCTION - convert data from network to host encoding + +# SYNOPSIS + +~~~c +#include + +CURLcode conv_callback(char *ptr, size_t length); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_NETWORK_FUNCTION, + conv_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +Applies to non-ASCII platforms. curl_version_info(3) returns the +**CURL_VERSION_CONV** feature bit set if this option is provided. + +The data to be converted is in a buffer pointed to by the *ptr* parameter. +The amount of data to convert is indicated by the *length* parameter. The +converted data overlays the input data in the buffer pointed to by the ptr +parameter. *CURLE_OK* must be returned upon successful conversion. A +CURLcode return value defined by curl.h, such as *CURLE_CONV_FAILED*, +should be returned if an error was encountered. + +CURLOPT_CONV_FROM_NETWORK_FUNCTION(3) converts to host encoding from the +network encoding. It is used when commands or ASCII data are received over the +network. + +If you set a callback pointer to NULL, or do not set it at all, the built-in +libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl +was built, and no callback has been established, the conversion returns the +**CURLE_CONV_REQD** error code. + +If **HAVE_ICONV** is defined, **CURL_ICONV_CODESET_OF_HOST** must also be +defined. For example: + +~~~c +#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +~~~ + +The iconv code in libcurl defaults the network and UTF8 codeset names as +follows: + +~~~ +#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" + +#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" +~~~ + +You need to override these definitions if they are different on your system. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP, SMTP, IMAP, POP3 + +# EXAMPLE + +~~~c +static CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length) +{ + int rc = 0; + + /* in-place convert 'buffer' from ASCII to EBCDIC */ + + if(rc == 0) { + /* success */ + return CURLE_OK; + } + else { + return CURLE_CONV_FAILED; + } +} + +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); +} +~~~ + +# AVAILABILITY + +Not available and deprecated since 7.82.0. + +Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was +built. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3 deleted file mode 100644 index e6ab8bf5b..000000000 --- a/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3 +++ /dev/null @@ -1,106 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONV_FROM_UTF8_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONV_FROM_UTF8_FUNCTION \- convert data from UTF8 to host encoding -.SH SYNOPSIS -.nf -#include - -CURLcode conv_callback(char *ptr, size_t length); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_UTF8_FUNCTION, - conv_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -Applies to non-ASCII platforms. \fIcurl_version_info(3)\fP returns the -CURL_VERSION_CONV feature bit set if this option is provided. - -The data to be converted is in a buffer pointed to by the \fIptr\fP parameter. -The amount of data to convert is indicated by the \fIlength\fP parameter. The -converted data overlays the input data in the buffer pointed to by the ptr -parameter. \fICURLE_OK\fP must be returned upon successful conversion. A -CURLcode return value defined by curl.h, such as \fICURLE_CONV_FAILED\fP, -should be returned if an error was encountered. - -\fICURLOPT_CONV_FROM_UTF8_FUNCTION(3)\fP converts to host encoding from UTF8 -encoding. It is required only for SSL processing. - -If you set a callback pointer to NULL, or do not set it at all, the built-in -libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl -was built, and no callback has been established, the conversion returns the -CURLE_CONV_REQD error code. - -If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. -For example: - - \&#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" - -The iconv code in libcurl defaults the network and UTF8 codeset names as -follows: - - \&#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" - - \&#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" - -You need to override these definitions if they are different on your system. -.SH DEFAULT -NULL -.SH PROTOCOLS -TLS-based protocols. -.SH EXAMPLE -.nf -static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length) -{ - int rc = 0; - /* in-place convert 'buffer' from UTF-8 to EBCDIC */ - if(rc == 0) { - /* success */ - return CURLE_OK; - } - else { - return CURLE_CONV_FAILED; - } -} - -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. - -Available only if \fBCURL_DOES_CONVERSIONS\fP was defined when libcurl was -built. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CONV_FROM_NETWORK_FUNCTION (3), -.BR CURLOPT_CONV_TO_NETWORK_FUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.md b/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.md new file mode 100644 index 000000000..1f7d704e9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.md @@ -0,0 +1,107 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONV_FROM_UTF8_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONV_FROM_NETWORK_FUNCTION (3) + - CURLOPT_CONV_TO_NETWORK_FUNCTION (3) +--- + +# NAME + +CURLOPT_CONV_FROM_UTF8_FUNCTION - convert data from UTF8 to host encoding + +# SYNOPSIS + +~~~c +#include + +CURLcode conv_callback(char *ptr, size_t length); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_FROM_UTF8_FUNCTION, + conv_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +Applies to non-ASCII platforms. curl_version_info(3) returns the +CURL_VERSION_CONV feature bit set if this option is provided. + +The data to be converted is in a buffer pointed to by the *ptr* parameter. +The amount of data to convert is indicated by the *length* parameter. The +converted data overlays the input data in the buffer pointed to by the ptr +parameter. *CURLE_OK* must be returned upon successful conversion. A +CURLcode return value defined by curl.h, such as *CURLE_CONV_FAILED*, +should be returned if an error was encountered. + +CURLOPT_CONV_FROM_UTF8_FUNCTION(3) converts to host encoding from UTF8 +encoding. It is required only for SSL processing. + +If you set a callback pointer to NULL, or do not set it at all, the built-in +libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl +was built, and no callback has been established, the conversion returns the +CURLE_CONV_REQD error code. + +If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. +For example: +~~~c + #define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +~~~ + +The iconv code in libcurl defaults the network and UTF8 codeset names as +follows: +~~~c +#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" + +#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" +~~~ + +You need to override these definitions if they are different on your system. + +# DEFAULT + +NULL + +# PROTOCOLS + +TLS-based protocols. + +# EXAMPLE + +~~~c +static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length) +{ + int rc = 0; + /* in-place convert 'buffer' from UTF-8 to EBCDIC */ + if(rc == 0) { + /* success */ + return CURLE_OK; + } + else { + return CURLE_CONV_FAILED; + } +} + +int main(void) +{ + CURL *curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION, + my_conv_from_utf8_to_ebcdic); +} +~~~ + +# AVAILABILITY + +Not available and deprecated since 7.82.0. + +Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was +built. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3 deleted file mode 100644 index e2dc7d606..000000000 --- a/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CONV_TO_NETWORK_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CONV_TO_NETWORK_FUNCTION \- convert data to network from host encoding -.SH SYNOPSIS -.nf -#include - -CURLcode conv_callback(char *ptr, size_t length); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_TO_NETWORK_FUNCTION, - conv_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -Applies to non-ASCII platforms. \fIcurl_version_info(3)\fP returns the -CURL_VERSION_CONV feature bit set if this option is provided. - -The data to be converted is in a buffer pointed to by the \fIptr\fP parameter. -The amount of data to convert is indicated by the \fIlength\fP parameter. The -converted data overlays the input data in the buffer pointed to by the ptr -parameter. \fICURLE_OK\fP must be returned upon successful conversion. A -CURLcode return value defined by curl.h, such as \fICURLE_CONV_FAILED\fP, -should be returned if an error was encountered. - -\fICURLOPT_CONV_TO_NETWORK_FUNCTION(3)\fP converts from host encoding to the -network encoding. It is used when commands or ASCII data are sent over the -network. - -If you set a callback pointer to NULL, or do not set it at all, the built-in -libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl -was built, and no callback has been established, the conversion returns the -CURLE_CONV_REQD error code. - -If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. -For example: - - \&#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" - -The iconv code in libcurl defaults the network and UTF8 codeset names as -follows: - - \&#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" - - \&#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" - -You need to override these definitions if they are different on your system. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP, SMTP, IMAP, POP3 -.SH EXAMPLE -.nf -static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length) -{ - int rc = 0; - /* in-place convert 'buffer' from EBCDIC to ASCII */ - if(rc == 0) { - /* success */ - return CURLE_OK; - } - else { - return CURLE_CONV_FAILED; - } -} - -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. - -Available only if \fBCURL_DOES_CONVERSIONS\fP was defined when libcurl was -built. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CONV_FROM_NETWORK_FUNCTION (3), -.BR CURLOPT_CONV_FROM_UTF8_FUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.md b/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.md new file mode 100644 index 000000000..13d9da867 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.md @@ -0,0 +1,110 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CONV_TO_NETWORK_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONV_FROM_NETWORK_FUNCTION (3) + - CURLOPT_CONV_FROM_UTF8_FUNCTION (3) +--- + +# NAME + +CURLOPT_CONV_TO_NETWORK_FUNCTION - convert data to network from host encoding + +# SYNOPSIS + +~~~c +#include + +CURLcode conv_callback(char *ptr, size_t length); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONV_TO_NETWORK_FUNCTION, + conv_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +Applies to non-ASCII platforms. curl_version_info(3) returns the +CURL_VERSION_CONV feature bit set if this option is provided. + +The data to be converted is in a buffer pointed to by the *ptr* parameter. +The amount of data to convert is indicated by the *length* parameter. The +converted data overlays the input data in the buffer pointed to by the ptr +parameter. *CURLE_OK* must be returned upon successful conversion. A CURLcode +return value defined by curl.h, such as *CURLE_CONV_FAILED*, should be +returned if an error was encountered. + +CURLOPT_CONV_TO_NETWORK_FUNCTION(3) converts from host encoding to the +network encoding. It is used when commands or ASCII data are sent over the +network. + +If you set a callback pointer to NULL, or do not set it at all, the built-in +libcurl iconv functions are used. If HAVE_ICONV was not defined when libcurl +was built, and no callback has been established, the conversion returns the +CURLE_CONV_REQD error code. + +If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. +For example: +~~~c +define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +~~~ + +The iconv code in libcurl defaults the network and UTF8 codeset names as +follows: + +~~~c +#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" + +#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" +~~~ + +You need to override these definitions if they are different on your system. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP, SMTP, IMAP, POP3 + +# EXAMPLE + +~~~c +static CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length) +{ + int rc = 0; + /* in-place convert 'buffer' from EBCDIC to ASCII */ + if(rc == 0) { + /* success */ + return CURLE_OK; + } + else { + return CURLE_CONV_FAILED; + } +} + +int main(void) +{ + CURL *curl = curl_easy_init(); + + curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION, + my_conv_from_ebcdic_to_ascii); +} +~~~ + +# AVAILABILITY + +Not available and deprecated since 7.82.0. + +Available only if **CURL_DOES_CONVERSIONS** was defined when libcurl was +built. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_COOKIE.3 b/docs/libcurl/opts/CURLOPT_COOKIE.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_COOKIE.3 rename to docs/libcurl/opts/CURLOPT_COOKIE.md index 4d24fc21e..4e2955d8a 100644 --- a/docs/libcurl/opts/CURLOPT_COOKIE.3 +++ b/docs/libcurl/opts/CURLOPT_COOKIE.md @@ -1,37 +1,31 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COOKIE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COOKIE \- HTTP Cookie header -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COOKIE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_COOKIELIST (3) + - CURLOPT_COOKIEFILE (3) + - CURLOPT_COOKIEJAR (3) + - CURLOPT_COOKIELIST (3) + - CURLOPT_HTTPHEADER (3) +--- + +# NAME + +CURLOPT_COOKIE - HTTP Cookie header + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIE, char *cookie); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a null-terminated string as parameter. It is used to set one or more cookies in the HTTP request. The format of the string should be NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie @@ -48,16 +42,16 @@ The cookies set by this option are separate from the internal cookie storage held by the cookie engine and they are not be modified by it. If you enable the cookie engine and either you have imported a cookie of the same name (e.g. 'foo') or the server has set one, it has no effect on the cookies you -set here. A request to the server sends both the 'foo' held by the cookie +set here. A request to the server sends both the 'foo' held by the cookie engine and the 'foo' held by this option. To set a cookie that is instead held by the cookie engine and can be modified by the server use -\fICURLOPT_COOKIELIST(3)\fP. +CURLOPT_COOKIELIST(3). Using this option multiple times makes the last set string override the previous ones. -This option does not enable the cookie engine. Use \fICURLOPT_COOKIEFILE(3)\fP -or \fICURLOPT_COOKIEJAR(3)\fP to enable parsing and sending cookies +This option does not enable the cookie engine. Use CURLOPT_COOKIEFILE(3) +or CURLOPT_COOKIEJAR(3) to enable parsing and sending cookies automatically. The application does not have to keep the string around after setting this @@ -67,13 +61,19 @@ If libcurl is built with PSL (*Public Suffix List*) support, it detects and discards cookies that are specified for such suffix domains that should not be allowed to have cookies. If libcurl is *not* built with PSL support, it has no ability to stop super cookies. PSL support is identified by the -\fBCURL_VERSION_PSL\fP feature bit returned by \fIcurl_version_info(3)\fP. -.SH DEFAULT +**CURL_VERSION_PSL** feature bit returned by curl_version_info(3). + +# DEFAULT + NULL, no cookies -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -85,15 +85,13 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + If HTTP is enabled -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if HTTP is enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_COOKIELIST (3), -.BR CURLOPT_COOKIEFILE (3), -.BR CURLOPT_COOKIEJAR (3), -.BR CURLOPT_COOKIELIST (3), -.BR CURLOPT_HTTPHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_COOKIEFILE.3 b/docs/libcurl/opts/CURLOPT_COOKIEFILE.md similarity index 57% rename from docs/libcurl/opts/CURLOPT_COOKIEFILE.3 rename to docs/libcurl/opts/CURLOPT_COOKIEFILE.md index e1d5dbd96..4af473b09 100644 --- a/docs/libcurl/opts/CURLOPT_COOKIEFILE.3 +++ b/docs/libcurl/opts/CURLOPT_COOKIEFILE.md @@ -1,37 +1,29 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COOKIEFILE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COOKIEFILE \- file name to read cookies from -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COOKIEFILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COOKIE (3) + - CURLOPT_COOKIEJAR (3) + - CURLOPT_COOKIESESSION (3) +--- + +# NAME + +CURLOPT_COOKIEFILE - file name to read cookies from + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIEFILE, char *filename); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a null-terminated string as parameter. It should point to the file name of your file holding cookie data to read. The cookie data can be in either the old Netscape / Mozilla cookie data format or just regular HTTP @@ -44,8 +36,8 @@ By passing the empty string ("") to this option, you enable the cookie engine without reading any initial cookies. If you tell libcurl the file name is "-" (just a single minus sign), libcurl instead reads from stdin. -This option only \fBreads\fP cookies. To make libcurl write cookies to file, -see \fICURLOPT_COOKIEJAR(3)\fP. +This option only **reads** cookies. To make libcurl write cookies to file, +see CURLOPT_COOKIEJAR(3). If you read cookies from a plain HTTP headers file and it does not specify a domain in the Set-Cookie line, then the cookie is not sent since the cookie @@ -61,17 +53,25 @@ option. Setting this option to NULL (since 7.77.0) explicitly disables the cookie engine and clears the list of files to read cookies from. -.SH SECURITY + +# SECURITY + This document previously mentioned how specifying a non-existing file can also enable the cookie engine. While true, we strongly advise against using that method as it is too hard to be sure that files that stay that way in the long run. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -87,15 +87,17 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH "Cookie file format" +~~~ + +# Cookie file format + The cookie file format and general cookie concepts in curl are described online here: https://curl.se/docs/http-cookies.html -.SH AVAILABILITY + +# AVAILABILITY + As long as HTTP is supported -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_COOKIE (3), -.BR CURLOPT_COOKIEJAR (3), -.BR CURLOPT_COOKIESESSION (3) diff --git a/docs/libcurl/opts/CURLOPT_COOKIEJAR.3 b/docs/libcurl/opts/CURLOPT_COOKIEJAR.3 deleted file mode 100644 index f8d75bea4..000000000 --- a/docs/libcurl/opts/CURLOPT_COOKIEJAR.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COOKIEJAR 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COOKIEJAR \- file name to store cookies to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIEJAR, char *filename); -.fi -.SH DESCRIPTION -Pass a \fIfilename\fP as a char *, null-terminated. This makes libcurl write -all internally known cookies to the specified file when -\fIcurl_easy_cleanup(3)\fP is called. If no cookies are kept in memory at that -time, no file is created. Specify "-" as filename to instead have the cookies -written to stdout. Using this option also enables cookies for this session, so -if you for example follow a redirect it makes matching cookies get sent -accordingly. - -Note that libcurl does not read any cookies from the cookie jar specified with -this option. To read cookies from a file, use \fICURLOPT_COOKIEFILE(3)\fP. - -If the cookie jar file cannot be created or written to (when the -\fIcurl_easy_cleanup(3)\fP is called), libcurl does not and cannot report an -error for this. Using \fICURLOPT_VERBOSE(3)\fP or -\fICURLOPT_DEBUGFUNCTION(3)\fP displays a warning, but that is the only -visible feedback you get about this possibly lethal situation. - -Cookies are imported in the Set-Cookie format without a domain name are not -exported by this option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - /* close the handle, write the cookies! */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_COOKIE (3), -.BR CURLOPT_COOKIEFILE (3), -.BR CURLOPT_COOKIELIST (3) diff --git a/docs/libcurl/opts/CURLOPT_COOKIEJAR.md b/docs/libcurl/opts/CURLOPT_COOKIEJAR.md new file mode 100644 index 000000000..504633de9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_COOKIEJAR.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COOKIEJAR +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COOKIE (3) + - CURLOPT_COOKIEFILE (3) + - CURLOPT_COOKIELIST (3) +--- + +# NAME + +CURLOPT_COOKIEJAR - file name to store cookies to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIEJAR, char *filename); +~~~ + +# DESCRIPTION + +Pass a *filename* as a char *, null-terminated. This makes libcurl write +all internally known cookies to the specified file when +curl_easy_cleanup(3) is called. If no cookies are kept in memory at that +time, no file is created. Specify "-" as filename to instead have the cookies +written to stdout. Using this option also enables cookies for this session, so +if you for example follow a redirect it makes matching cookies get sent +accordingly. + +Note that libcurl does not read any cookies from the cookie jar specified with +this option. To read cookies from a file, use CURLOPT_COOKIEFILE(3). + +If the cookie jar file cannot be created or written to (when the +curl_easy_cleanup(3) is called), libcurl does not and cannot report an +error for this. Using CURLOPT_VERBOSE(3) or +CURLOPT_DEBUGFUNCTION(3) displays a warning, but that is the only +visible feedback you get about this possibly lethal situation. + +Cookies are imported in the Set-Cookie format without a domain name are not +exported by this option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + /* close the handle, write the cookies! */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_COOKIELIST.3 b/docs/libcurl/opts/CURLOPT_COOKIELIST.md similarity index 60% rename from docs/libcurl/opts/CURLOPT_COOKIELIST.3 rename to docs/libcurl/opts/CURLOPT_COOKIELIST.md index 41862311a..18a367ab1 100644 --- a/docs/libcurl/opts/CURLOPT_COOKIELIST.3 +++ b/docs/libcurl/opts/CURLOPT_COOKIELIST.md @@ -1,38 +1,32 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COOKIELIST 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COOKIELIST \- add to or manipulate cookies held in memory -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COOKIELIST +Section: 3 +Source: libcurl +See-also: + - CURLINFO_COOKIELIST (3) + - CURLOPT_COOKIE (3) + - CURLOPT_COOKIEFILE (3) + - CURLOPT_COOKIEJAR (3) +--- + +# NAME + +CURLOPT_COOKIELIST - add to or manipulate cookies held in memory + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIELIST, char *cookie); -.SH DESCRIPTION -Pass a char * to a \fIcookie\fP string. +~~~ + +# DESCRIPTION + +Pass a char pointer to a *cookie* string. Such a cookie can be either a single line in Netscape / Mozilla format or just regular HTTP-style header (Set-Cookie: ...) format. This option also enables @@ -52,27 +46,37 @@ much better: use the Netscape file format. Additionally, there are commands available that perform actions if you pass in these exact strings: -.IP ALL + +## ALL + erases all cookies held in memory -.IP SESS +## SESS + erases all session cookies held in memory -.IP FLUSH -writes all known cookies to the file specified by \fICURLOPT_COOKIEJAR(3)\fP +## FLUSH -.IP RELOAD -loads all cookies from the files specified by \fICURLOPT_COOKIEFILE(3)\fP +writes all known cookies to the file specified by CURLOPT_COOKIEJAR(3) + +## RELOAD + +loads all cookies from the files specified by CURLOPT_COOKIEFILE(3) + +# DEFAULT -.SH DEFAULT NULL -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* an inline import of a cookie in Netscape format. */ -#define SEP "\\t" /* Tab separates the fields */ +#define SEP "\t" /* Tab separates the fields */ int main(void) { @@ -109,23 +113,24 @@ int main(void) curl_easy_cleanup(curl); /* cookies exported to cookies.txt */ } } -.fi -.SH "Cookie file format" +~~~ + +# Cookie file format + The cookie file format and general cookie concepts in curl are described online here: https://curl.se/docs/http-cookies.html -.SH AVAILABILITY -\fBALL\fP was added in 7.14.1 -\fBSESS\fP was added in 7.15.4 +# AVAILABILITY -\fBFLUSH\fP was added in 7.17.1 +**ALL** was added in 7.14.1 + +**SESS** was added in 7.15.4 + +**FLUSH** was added in 7.17.1 + +**RELOAD** was added in 7.39.0 + +# RETURN VALUE -\fBRELOAD\fP was added in 7.39.0 -.SH RETURN VALUE Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_COOKIELIST (3), -.BR CURLOPT_COOKIE (3), -.BR CURLOPT_COOKIEFILE (3), -.BR CURLOPT_COOKIEJAR (3) diff --git a/docs/libcurl/opts/CURLOPT_COOKIESESSION.3 b/docs/libcurl/opts/CURLOPT_COOKIESESSION.3 deleted file mode 100644 index b8894d0fe..000000000 --- a/docs/libcurl/opts/CURLOPT_COOKIESESSION.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COOKIESESSION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COOKIESESSION \- start a new cookie session -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long init); -.fi -.SH DESCRIPTION -Pass a long set to 1 to mark this as a new cookie "session". It forces libcurl -to ignore all cookies it is about to load that are "session cookies" from the -previous session. By default, libcurl always loads all cookies, independent if -they are session cookies or not. Session cookies are cookies without expiry -date and they are meant to be alive and existing for this "session" only. - -A "session" is usually defined in browser land for as long as you have your -browser up, more or less. libcurl needs the application to use this option to -tell it when a new session starts, otherwise it assumes everything is still in -the same session. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - - /* get the (non session) cookies from this file */ - curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_COOKIE (3), -.BR CURLOPT_COOKIEFILE (3), -.BR CURLOPT_COOKIEJAR (3) diff --git a/docs/libcurl/opts/CURLOPT_COOKIESESSION.md b/docs/libcurl/opts/CURLOPT_COOKIESESSION.md new file mode 100644 index 000000000..6f49f025c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_COOKIESESSION.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COOKIESESSION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COOKIE (3) + - CURLOPT_COOKIEFILE (3) + - CURLOPT_COOKIEJAR (3) +--- + +# NAME + +CURLOPT_COOKIESESSION - start a new cookie session + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long init); +~~~ + +# DESCRIPTION + +Pass a long set to 1 to mark this as a new cookie "session". It forces libcurl +to ignore all cookies it is about to load that are "session cookies" from the +previous session. By default, libcurl always loads all cookies, independent if +they are session cookies or not. Session cookies are cookies without expiry +date and they are meant to be alive and existing for this "session" only. + +A "session" is usually defined in browser land for as long as you have your +browser up, more or less. libcurl needs the application to use this option to +tell it when a new session starts, otherwise it assumes everything is still in +the same session. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + + /* get the (non session) cookies from this file */ + curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3 b/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3 deleted file mode 100644 index 447c66833..000000000 --- a/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_COPYPOSTFIELDS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_COPYPOSTFIELDS \- have libcurl copy data to POST -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COPYPOSTFIELDS, char *data); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be the full \fIdata\fP to post in a -HTTP POST operation. It behaves as the \fICURLOPT_POSTFIELDS(3)\fP option, but -the original data is instead copied by the library, allowing the application -to overwrite the original data after setting this option. - -Because data are copied, care must be taken when using this option in -conjunction with \fICURLOPT_POSTFIELDSIZE(3)\fP or -\fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP: If the size has not been set prior to -\fICURLOPT_COPYPOSTFIELDS(3)\fP, the data is assumed to be a null-terminated -string; else the stored size informs the library about the byte count to -copy. In any case, the size must not be changed after -\fICURLOPT_COPYPOSTFIELDS(3)\fP, unless another \fICURLOPT_POSTFIELDS(3)\fP or -\fICURLOPT_COPYPOSTFIELDS(3)\fP option is issued. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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); - - /* send data from the local stack */ - curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, local_buffer); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.17.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_POSTFIELDSIZE (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.md b/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.md new file mode 100644 index 000000000..911e08181 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_COPYPOSTFIELDS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MIMEPOST (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_POSTFIELDSIZE (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_COPYPOSTFIELDS - have libcurl copy data to POST + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COPYPOSTFIELDS, char *data); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be the full *data* to post in a +HTTP POST operation. It behaves as the CURLOPT_POSTFIELDS(3) option, but the +original data is instead copied by the library, allowing the application to +overwrite the original data after setting this option. + +Because data are copied, care must be taken when using this option in +conjunction with CURLOPT_POSTFIELDSIZE(3) or +CURLOPT_POSTFIELDSIZE_LARGE(3): If the size has not been set prior to +CURLOPT_COPYPOSTFIELDS(3), the data is assumed to be a null-terminated +string; else the stored size informs the library about the byte count to +copy. In any case, the size must not be changed after +CURLOPT_COPYPOSTFIELDS(3), unless another CURLOPT_POSTFIELDS(3) or +CURLOPT_COPYPOSTFIELDS(3) option is issued. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); + + /* send data from the local stack */ + curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, local_buffer); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.17.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_CRLF.3 b/docs/libcurl/opts/CURLOPT_CRLF.3 deleted file mode 100644 index b758f2985..000000000 --- a/docs/libcurl/opts/CURLOPT_CRLF.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CRLF 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CRLF \- CRLF conversion -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CRLF, long conv); -.fi -.SH DESCRIPTION -Pass a long. If the value is set to 1 (one), libcurl converts Unix newlines to -CRLF newlines on transfers. Disable this option again by setting the value to -0 (zero). - -This is a legacy option of questionable use. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -SMTP since 7.40.0, other protocols since they were introduced -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CONV_FROM_NETWORK_FUNCTION (3), -.BR CURLOPT_CONV_TO_NETWORK_FUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_CRLF.md b/docs/libcurl/opts/CURLOPT_CRLF.md new file mode 100644 index 000000000..1766c3312 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CRLF.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CRLF +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONV_FROM_NETWORK_FUNCTION (3) + - CURLOPT_CONV_TO_NETWORK_FUNCTION (3) +--- + +# NAME + +CURLOPT_CRLF - CRLF conversion + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CRLF, long conv); +~~~ + +# DESCRIPTION + +Pass a long. If the value is set to 1 (one), libcurl converts Unix newlines to +CRLF newlines on transfers. Disable this option again by setting the value to +0 (zero). + +This is a legacy option of questionable use. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +SMTP since 7.40.0, other protocols since they were introduced + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_CRLFILE.3 b/docs/libcurl/opts/CURLOPT_CRLFILE.3 deleted file mode 100644 index 30a6ad1ad..000000000 --- a/docs/libcurl/opts/CURLOPT_CRLFILE.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CRLFILE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CRLFILE \- Certificate Revocation List file -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CRLFILE, char *file); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a \fIfile\fP with the -concatenation of CRL (in PEM format) to use in the certificate validation that -occurs during the SSL exchange. - -When curl is built to use GnuTLS, there is no way to influence the use of CRL -passed to help in the verification process. - -When libcurl is built with OpenSSL support, X509_V_FLAG_CRL_CHECK and -X509_V_FLAG_CRL_CHECK_ALL are both set, requiring CRL check against all the -elements of the certificate chain if a CRL file is passed. Also note that -\fICURLOPT_CRLFILE(3)\fP implies \fBCURLSSLOPT_NO_PARTIALCHAIN\fP (see -\fICURLOPT_SSL_OPTIONS(3)\fP) since curl 7.71.0 due to an OpenSSL bug. - -This option makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER(3)\fP option. - -A specific error code (\fICURLE_SSL_CRL_BADFILE\fP) is defined with the -option. It is returned when the SSL exchange fails because the CRL file cannot -be loaded. A failure in certificate verification due to a revocation -information found in the CRL does not trigger this specific error. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_CRLFILE, "/etc/certs/crl.pem"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_CRLFILE (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_CRLFILE.md b/docs/libcurl/opts/CURLOPT_CRLFILE.md new file mode 100644 index 000000000..b800f8ce3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CRLFILE.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CRLFILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_CRLFILE (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_CRLFILE - Certificate Revocation List file + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CRLFILE, char *file); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a *file* with the +concatenation of CRL (in PEM format) to use in the certificate validation that +occurs during the SSL exchange. + +When curl is built to use GnuTLS, there is no way to influence the use of CRL +passed to help in the verification process. + +When libcurl is built with OpenSSL support, X509_V_FLAG_CRL_CHECK and +X509_V_FLAG_CRL_CHECK_ALL are both set, requiring CRL check against all the +elements of the certificate chain if a CRL file is passed. Also note that +CURLOPT_CRLFILE(3) implies **CURLSSLOPT_NO_PARTIALCHAIN** (see +CURLOPT_SSL_OPTIONS(3)) since curl 7.71.0 due to an OpenSSL bug. + +This option makes sense only when used in combination with the +CURLOPT_SSL_VERIFYPEER(3) option. + +A specific error code (*CURLE_SSL_CRL_BADFILE*) is defined with the option. It +is returned when the SSL exchange fails because the CRL file cannot be +loaded. A failure in certificate verification due to a revocation information +found in the CRL does not trigger this specific error. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_CRLFILE, "/etc/certs/crl.pem"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_CURLU.3 b/docs/libcurl/opts/CURLOPT_CURLU.3 deleted file mode 100644 index 34e9c53b4..000000000 --- a/docs/libcurl/opts/CURLOPT_CURLU.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CURLU 3 "28 Oct 2018" libcurl libcurl -.SH NAME -CURLOPT_CURLU \- URL in URL handle format -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CURLU, CURLU *pointer); -.fi -.SH DESCRIPTION -Pass in a pointer to the \fIURL\fP handle to work with. The parameter should -be a \fICURLU *\fP. Setting \fICURLOPT_CURLU(3)\fP explicitly overrides -\fICURLOPT_URL(3)\fP. - -\fICURLOPT_URL(3)\fP or \fICURLOPT_CURLU(3)\fP \fBmust\fP be set before a -transfer is started. - -libcurl uses this handle and its contents read-only and does not change its -contents. An application can update the contents of the URL handle after a -transfer is done and if the same handle is used in a subsequent request the -updated contents is used. -.SH DEFAULT -The default value of this parameter is NULL. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_setopt(curl, CURLOPT_CURLU, urlp); - - res = curl_easy_perform(curl); - - curl_url_cleanup(urlp); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.63.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_url (3), -.BR curl_url_cleanup (3), -.BR curl_url_dup (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR curl_url_strerror (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_CURLU.md b/docs/libcurl/opts/CURLOPT_CURLU.md new file mode 100644 index 000000000..a3eeb5c9b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CURLU.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CURLU +Section: 3 +Source: libcurl +See-also: + - CURLOPT_URL (3) + - curl_url (3) + - curl_url_cleanup (3) + - curl_url_dup (3) + - curl_url_get (3) + - curl_url_set (3) + - curl_url_strerror (3) +--- + +# NAME + +CURLOPT_CURLU - URL in URL handle format + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CURLU, CURLU *pointer); +~~~ + +# DESCRIPTION + +Pass in a pointer to the *URL* handle to work with. The parameter should be a +*CURLU pointer*. Setting CURLOPT_CURLU(3) explicitly overrides +CURLOPT_URL(3). + +CURLOPT_URL(3) or CURLOPT_CURLU(3) **must** be set before a +transfer is started. + +libcurl uses this handle and its contents read-only and does not change its +contents. An application can update the contents of the URL handle after a +transfer is done and if the same handle is used in a subsequent request the +updated contents is used. + +# DEFAULT + +The default value of this parameter is NULL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_setopt(curl, CURLOPT_CURLU, urlp); + + res = curl_easy_perform(curl); + + curl_url_cleanup(urlp); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.63.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 b/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 deleted file mode 100644 index 6a1f0eeeb..000000000 --- a/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 +++ /dev/null @@ -1,124 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_CUSTOMREQUEST 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_CUSTOMREQUEST \- custom request method -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CUSTOMREQUEST, char *method); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. - -When you change the request \fImethod\fP by setting -\fICURLOPT_CUSTOMREQUEST(3)\fP to something, you do not actually change how -libcurl behaves or acts in regards to the particular request method, it only -changes the actual string sent in the request. - -libcurl passes on the verbatim string in its request without any filter or -other safe guards. That includes white space and control characters. - -Restore to the internal default by setting this to NULL. - -This option can be used to specify the request: -.IP HTTP -Instead of GET or HEAD when performing HTTP based requests. This is -particularly useful, for example, for performing an HTTP DELETE request. - -For example: - -When you tell libcurl to do a HEAD request, but then specify a GET though a -custom request libcurl still acts as if it sent a HEAD. To switch to a proper -HEAD use \fICURLOPT_NOBODY(3)\fP, to switch to a proper POST use -\fICURLOPT_POST(3)\fP or \fICURLOPT_POSTFIELDS(3)\fP and to switch to a proper -GET use \fICURLOPT_HTTPGET(3)\fP. - -Many people have wrongly used this option to replace the entire request with -their own, including multiple headers and POST contents. While that might work -in many cases, it might cause libcurl to send invalid requests and it could -possibly confuse the remote server badly. Use \fICURLOPT_POST(3)\fP and -\fICURLOPT_POSTFIELDS(3)\fP to set POST data. Use \fICURLOPT_HTTPHEADER(3)\fP -to replace or extend the set of headers sent by libcurl. Use -\fICURLOPT_HTTP_VERSION(3)\fP to change HTTP version. - -.IP FTP -Instead of LIST and NLST when performing FTP directory listings. -.IP IMAP -Instead of LIST when issuing IMAP based requests. -.IP POP3 -Instead of LIST and RETR when issuing POP3 based requests. - -For example: - -When you tell libcurl to use a custom request it behaves like a LIST or RETR -command was sent where it expects data to be returned by the server. As such -\fICURLOPT_NOBODY(3)\fP should be used when specifying commands such as -\fBDELE\fP and \fBNOOP\fP for example. -.IP SMTP -Instead of a \fBHELP\fP or \fBVRFY\fP when issuing SMTP based requests. - -For example: - -Normally a multi line response is returned which can be used, in conjunction -with \fICURLOPT_MAIL_RCPT(3)\fP, to specify an EXPN request. If the -\fICURLOPT_NOBODY(3)\fP option is specified then the request can be used to -issue \fBNOOP\fP and \fBRSET\fP commands. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP, FTP, IMAP, POP3 and SMTP -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_EFFECTIVE_METHOD (3), -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_NOBODY (3), -.BR CURLOPT_REQUEST_TARGET (3) diff --git a/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.md b/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.md new file mode 100644 index 000000000..c4d4ec210 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.md @@ -0,0 +1,130 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_CUSTOMREQUEST +Section: 3 +Source: libcurl +See-also: + - CURLINFO_EFFECTIVE_METHOD (3) + - CURLOPT_HTTPHEADER (3) + - CURLOPT_NOBODY (3) + - CURLOPT_REQUEST_TARGET (3) +--- + +# NAME + +CURLOPT_CUSTOMREQUEST - custom request method + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CUSTOMREQUEST, char *method); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. + +When changing the request *method* by setting CURLOPT_CUSTOMREQUEST(3), you +do not actually change how libcurl behaves or acts: you only change the actual +string sent in the request. + +libcurl passes on the verbatim string in its request without any filter or +other safe guards. That includes white space and control characters. + +Restore to the internal default by setting this to NULL. + +This option can be used to specify the request: + +## HTTP + +Instead of GET or HEAD when performing HTTP based requests. This is +particularly useful, for example, for performing an HTTP DELETE request. + +For example: + +When you tell libcurl to do a HEAD request, but then specify a GET though a +custom request libcurl still acts as if it sent a HEAD. To switch to a proper +HEAD use CURLOPT_NOBODY(3), to switch to a proper POST use +CURLOPT_POST(3) or CURLOPT_POSTFIELDS(3) and to switch to a proper +GET use CURLOPT_HTTPGET(3). + +Many people have wrongly used this option to replace the entire request with +their own, including multiple headers and POST contents. While that might work +in many cases, it might cause libcurl to send invalid requests and it could +possibly confuse the remote server badly. Use CURLOPT_POST(3) and +CURLOPT_POSTFIELDS(3) to set POST data. Use CURLOPT_HTTPHEADER(3) +to replace or extend the set of headers sent by libcurl. Use +CURLOPT_HTTP_VERSION(3) to change HTTP version. + +## FTP + +Instead of LIST and NLST when performing FTP directory listings. + +## IMAP + +Instead of LIST when issuing IMAP based requests. + +## POP3 + +Instead of LIST and RETR when issuing POP3 based requests. + +For example: + +When you tell libcurl to use a custom request it behaves like a LIST or RETR +command was sent where it expects data to be returned by the server. As such +CURLOPT_NOBODY(3) should be used when specifying commands such as +**DELE** and **NOOP** for example. + +## SMTP + +Instead of a **HELP** or **VRFY** when issuing SMTP based requests. + +For example: + +Normally a multi line response is returned which can be used, in conjunction +with CURLOPT_MAIL_RCPT(3), to specify an EXPN request. If the +CURLOPT_NOBODY(3) option is specified then the request can be used to +issue **NOOP** and **RSET** commands. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP, FTP, IMAP, POP3 and SMTP + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 b/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 deleted file mode 100644 index 1b569e983..000000000 --- a/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DEBUGDATA 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DEBUGDATA \- pointer passed to the debug callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP to whatever you want passed in to your -\fICURLOPT_DEBUGFUNCTION(3)\fP in the last void * argument. This pointer is -not used by libcurl, it is only passed to the callback. -.SH DEFAULT -NULL -.SH PROTOCOLS -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; - CURLcode res; - struct data my_tracedata; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); - - curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &my_tracedata); - - /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - res = curl_easy_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_DEBUGDATA.md b/docs/libcurl/opts/CURLOPT_DEBUGDATA.md new file mode 100644 index 000000000..cac58d99d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DEBUGDATA.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DEBUGDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_DEBUGDATA - pointer passed to the debug callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* to whatever you want passed in to your +CURLOPT_DEBUGFUNCTION(3) in the last void * argument. This pointer is +not used by libcurl, it is only passed to the callback. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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; + CURLcode res; + struct data my_tracedata; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); + + curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &my_tracedata); + + /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3 b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md similarity index 58% rename from docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md index 78c9e76a3..1acf963ca 100644 --- a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md @@ -1,32 +1,24 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DEBUGFUNCTION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DEBUGFUNCTION \- debug callback -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DEBUGFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONN_ID (3) + - CURLINFO_XFER_ID (3) + - CURLOPT_DEBUGDATA (3) + - CURLOPT_VERBOSE (3) + - curl_global_trace (3) +--- + +# NAME + +CURLOPT_DEBUGFUNCTION - debug callback + +# SYNOPSIS + +~~~c #include typedef enum { @@ -48,51 +40,72 @@ int debug_callback(CURL *handle, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGFUNCTION, debug_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. -\fICURLOPT_DEBUGFUNCTION(3)\fP replaces the standard debug function used when -\fICURLOPT_VERBOSE(3)\fP is in effect. This callback receives debug -information, as specified in the \fItype\fP argument. This function must -return 0. The \fIdata\fP pointed to by the char * passed to this function is -not null-terminated, but is exactly of the \fIsize\fP as told by the -\fIsize\fP argument. +CURLOPT_DEBUGFUNCTION(3) replaces the standard debug function used when +CURLOPT_VERBOSE(3) is in effect. This callback receives debug +information, as specified in the *type* argument. This function must +return 0. The *data* pointed to by the char * passed to this function is +not null-terminated, but is exactly of the *size* as told by the +*size* argument. -The \fIclientp\fP argument is the pointer set with \fICURLOPT_DEBUGDATA(3)\fP. +The *clientp* argument is the pointer set with CURLOPT_DEBUGDATA(3). + +Available **curl_infotype** values: + +## CURLINFO_TEXT -Available \fBcurl_infotype\fP values: -.RS -.IP CURLINFO_TEXT The data is informational text. -.IP CURLINFO_HEADER_IN + +## CURLINFO_HEADER_IN + The data is header (or header-like) data received from the peer. -.IP CURLINFO_HEADER_OUT + +## CURLINFO_HEADER_OUT + The data is header (or header-like) data sent to the peer. -.IP CURLINFO_DATA_IN + +## CURLINFO_DATA_IN + The data is the unprocessed protocol data received from the peer. Even if the data is encoded or compressed, it is not not provided decoded nor decompressed to this callback. If you need the data in decoded and decompressed form, use -\fICURLOPT_WRITEFUNCTION(3)\fP. -.IP CURLINFO_DATA_OUT -The data is protocol data sent to the peer. -.IP CURLINFO_SSL_DATA_OUT -The data is SSL/TLS (binary) data sent to the peer. -.IP CURLINFO_SSL_DATA_IN -The data is SSL/TLS (binary) data received from the peer. -.RE +CURLOPT_WRITEFUNCTION(3). -WARNING: This callback may be called with the curl \fIhandle\fP set to an +## CURLINFO_DATA_OUT + +The data is protocol data sent to the peer. + +## CURLINFO_SSL_DATA_OUT + +The data is SSL/TLS (binary) data sent to the peer. + +## CURLINFO_SSL_DATA_IN + +The data is SSL/TLS (binary) data received from the peer. + +WARNING: This callback may be called with the curl *handle* set to an internal handle. (Added in 8.4.0) -If you need to distinguish your curl \fIhandle\fP from internal handles then -set \fICURLOPT_PRIVATE(3)\fP on your handle. -.SH DEFAULT +If you need to distinguish your curl *handle* from internal handles then +set CURLOPT_PRIVATE(3) on your handle. + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c static void dump(const char *text, FILE *stream, unsigned char *ptr, size_t size) @@ -101,7 +114,7 @@ void dump(const char *text, size_t c; unsigned int width = 0x10; - fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\\n", + fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", text, (long)size, (long)size); for(i = 0; i < size; i += width) { @@ -121,7 +134,7 @@ void dump(const char *text, fputc(x, stream); } - fputc('\\n', stream); /* newline */ + fputc('\n', stream); /* newline */ } } @@ -184,7 +197,7 @@ int main(void) res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\\n", + fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ @@ -192,14 +205,12 @@ int main(void) } return 0; } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Always -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK -.SH "SEE ALSO" -.BR curl_global_trace (3), -.BR CURLINFO_CONN_ID (3), -.BR CURLINFO_XFER_ID (3), -.BR CURLOPT_DEBUGDATA (3), -.BR CURLOPT_VERBOSE (3) diff --git a/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3 b/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3 deleted file mode 100644 index ef7b24e96..000000000 --- a/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DEFAULT_PROTOCOL 3 "18 Aug 2015" libcurl libcurl -.SH NAME -CURLOPT_DEFAULT_PROTOCOL \- default protocol to use if the URL is missing a -scheme name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEFAULT_PROTOCOL, - char *protocol); -.fi -.SH DESCRIPTION -This option tells libcurl to use \fIprotocol\fP if the URL is missing a scheme -name. - -Use one of these protocol (scheme) names: - -dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, -pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp - -An unknown or unsupported protocol causes error -\fICURLE_UNSUPPORTED_PROTOCOL\fP when libcurl parses a URL without a -scheme. Parsing happens when \fIcurl_easy_perform(3)\fP or -\fIcurl_multi_perform(3)\fP is called. The protocol set supported by libcurl -vary depending on how it was built. Use \fIcurl_version_info(3)\fP if you need -a list of protocol names supported by the build of libcurl that you are using. - -This option does not change the default proxy protocol (http). - -Without this option libcurl would make a guess based on the host, see -\fICURLOPT_URL(3)\fP for details. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL (make a guess based on the host) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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"); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.45.0 -.SH RETURN VALUE -CURLE_OK if the option is supported. - -CURLE_OUT_OF_MEMORY if there was insufficient heap space. - -CURLE_UNKNOWN_OPTION if the option is not supported. -.SH "SEE ALSO" -.BR CURLINFO_PROTOCOL (3), -.BR CURLINFO_SCHEME (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.md b/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.md new file mode 100644 index 000000000..88468f718 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DEFAULT_PROTOCOL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PROTOCOL (3) + - CURLINFO_SCHEME (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_DEFAULT_PROTOCOL - default protocol to use if the URL is missing a +scheme name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEFAULT_PROTOCOL, + char *protocol); +~~~ + +# DESCRIPTION + +This option tells libcurl to use *protocol* if the URL is missing a scheme +name. + +Use one of these protocol (scheme) names: + +dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, +pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp + +An unknown or unsupported protocol causes error +*CURLE_UNSUPPORTED_PROTOCOL* when libcurl parses a URL without a +scheme. Parsing happens when curl_easy_perform(3) or +curl_multi_perform(3) is called. The protocol set supported by libcurl +vary depending on how it was built. Use curl_version_info(3) if you need +a list of protocol names supported by the build of libcurl that you are using. + +This option does not change the default proxy protocol (http). + +Without this option libcurl would make a guess based on the host, see +CURLOPT_URL(3) for details. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL (make a guess based on the host) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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"); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.45.0 + +# RETURN VALUE + +CURLE_OK if the option is supported. + +CURLE_OUT_OF_MEMORY if there was insufficient heap space. + +CURLE_UNKNOWN_OPTION if the option is not supported. diff --git a/docs/libcurl/opts/CURLOPT_DIRLISTONLY.3 b/docs/libcurl/opts/CURLOPT_DIRLISTONLY.3 deleted file mode 100644 index 62dac240c..000000000 --- a/docs/libcurl/opts/CURLOPT_DIRLISTONLY.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DIRLISTONLY 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DIRLISTONLY \- ask for names only in a directory listing -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long listonly); -.fi -.SH DESCRIPTION -For FTP and SFTP based URLs a parameter set to 1 tells the library to list the -names of files in a directory, rather than performing a full directory listing -that would normally include file sizes, dates etc. - -For POP3 a parameter of 1 tells the library to list the email message or -messages on the POP3 server. This can be used to change the default behavior -of libcurl, when combined with a URL that contains a message ID, to perform a -"scan listing" which can then be used to determine the size of an email. - -Note: For FTP this causes a NLST command to be sent to the FTP server. Beware -that some FTP servers list only files in their response to NLST; they might not -include subdirectories and symbolic links. - -Setting this option to 1 also implies a directory listing even if the URL -does not end with a slash, which otherwise is necessary. - -Do not use this option if you also use \fICURLOPT_WILDCARDMATCH(3)\fP as it -effectively breaks that feature. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -FTP, SFTP and POP3 -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -This option was known as CURLOPT_FTPLISTONLY up to 7.16.4. POP3 is supported -since 7.21.5. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_DIRLISTONLY.md b/docs/libcurl/opts/CURLOPT_DIRLISTONLY.md new file mode 100644 index 000000000..29635622c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DIRLISTONLY.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DIRLISTONLY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_DIRLISTONLY - ask for names only in a directory listing + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long listonly); +~~~ + +# DESCRIPTION + +For FTP and SFTP based URLs a parameter set to 1 tells the library to list the +names of files in a directory, rather than performing a full directory listing +that would normally include file sizes, dates etc. + +For POP3 a parameter of 1 tells the library to list the email message or +messages on the POP3 server. This can be used to change the default behavior +of libcurl, when combined with a URL that contains a message ID, to perform a +"scan listing" which can then be used to determine the size of an email. + +Note: For FTP this causes a NLST command to be sent to the FTP server. Beware +that some FTP servers list only files in their response to NLST; they might +not include subdirectories and symbolic links. + +Setting this option to 1 also implies a directory listing even if the URL +does not end with a slash, which otherwise is necessary. + +Do not use this option if you also use CURLOPT_WILDCARDMATCH(3) as it +effectively breaks that feature. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +FTP, SFTP and POP3 + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +This option was known as CURLOPT_FTPLISTONLY up to 7.16.4. POP3 is supported +since 7.21.5. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 b/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 deleted file mode 100644 index 077fbd8db..000000000 --- a/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DISALLOW_USERNAME_IN_URL 3 "30 May 2018" libcurl libcurl -.SH NAME -CURLOPT_DISALLOW_USERNAME_IN_URL \- disallow specifying username in the URL -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL, - long disallow); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to not allow URLs that include a -username. - -This is the equivalent to the \fICURLU_DISALLOW_USER\fP flag for the -\fIcurl_url_set(3)\fP function. -.SH DEFAULT -0 (disabled) - user names are allowed by default. -.SH PROTOCOLS -Several -.SH EXAMPLE -.nf -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_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. - -\fIcurl_easy_perform(3)\fP returns CURLE_LOGIN_DENIED if this option is -enabled and a URL containing a username is specified. -.SH "SEE ALSO" -.BR curl_url_set (3), -.BR CURLOPT_PROTOCOLS (3), -.BR CURLOPT_URL (3), -.BR libcurl-security (3) diff --git a/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.md b/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.md new file mode 100644 index 000000000..ddaaace89 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DISALLOW_USERNAME_IN_URL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROTOCOLS (3) + - CURLOPT_URL (3) + - curl_url_set (3) + - libcurl-security (3) +--- + +# NAME + +CURLOPT_DISALLOW_USERNAME_IN_URL - disallow specifying username in the URL + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DISALLOW_USERNAME_IN_URL, + long disallow); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to not allow URLs that include a +username. + +This is the equivalent to the *CURLU_DISALLOW_USER* flag for the +curl_url_set(3) function. + +# DEFAULT + +0 (disabled) - user names are allowed by default. + +# PROTOCOLS + +Several + +# EXAMPLE + +~~~c +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_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. + +curl_easy_perform(3) returns CURLE_LOGIN_DENIED if this option is +enabled and a URL containing a username is specified. diff --git a/docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3 b/docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3 rename to docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.md index 2cdb3967a..0199f525a 100644 --- a/docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3 +++ b/docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.md @@ -1,37 +1,31 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_CACHE_TIMEOUT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_CACHE_TIMEOUT \- life-time for DNS cache entries -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_CACHE_TIMEOUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT_MS (3) + - CURLOPT_DNS_SERVERS (3) + - CURLOPT_DNS_USE_GLOBAL_CACHE (3) + - CURLOPT_MAXAGE_CONN (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_DNS_CACHE_TIMEOUT - life-time for DNS cache entries + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_CACHE_TIMEOUT, long age); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long, this sets the timeout in seconds. Name resolve results are kept in memory and used for this number of seconds. Set to zero to completely disable caching, or set to -1 to make the cached entries remain forever. By @@ -44,7 +38,7 @@ period. The name resolve functions of various libc implementations do not re-read name server information unless explicitly told so (for example, by calling -\fIres_init(3)\fP). This may cause libcurl to keep using the older server even +*res_init(3)*). This may cause libcurl to keep using the older server even if DHCP has updated the server info, and this may look like a DNS cache issue to the casual libcurl-app user. @@ -54,12 +48,18 @@ for a small amount of time into the future. Since version 8.1.0, libcurl prunes entries from the DNS cache if it exceeds 30,000 entries no matter which timeout value is used. -.SH DEFAULT + +# DEFAULT + 60 -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -79,14 +79,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Always -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT_MS (3), -.BR CURLOPT_DNS_SERVERS (3), -.BR CURLOPT_DNS_USE_GLOBAL_CACHE (3), -.BR CURLOPT_MAXAGE_CONN (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3 b/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3 deleted file mode 100644 index dfeabb386..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_INTERFACE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_INTERFACE \- interface to speak DNS over -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname); -.fi -.SH DESCRIPTION -Pass a char * as parameter. Set the name of the network interface that the DNS -resolver should bind to. This must be an interface name (not an address). Set -this option to NULL to use the default setting (do not bind to a specific -interface). - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All protocols except file:// - protocols that resolve host names. -.SH EXAMPLE -.nf -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 -Added in 7.33.0. This option also requires that libcurl was built with a -resolver backend that supports this operation. The c-ares backend is the only -such one. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, -or CURLE_NOT_BUILT_IN if support was disabled at compile-time. -.SH "SEE ALSO" -.BR CURLOPT_DNS_LOCAL_IP4 (3), -.BR CURLOPT_DNS_LOCAL_IP6 (3), -.BR CURLOPT_DNS_SERVERS (3), -.BR CURLOPT_INTERFACE (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.md b/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.md new file mode 100644 index 000000000..070bdc5af --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_INTERFACE.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_INTERFACE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_LOCAL_IP4 (3) + - CURLOPT_DNS_LOCAL_IP6 (3) + - CURLOPT_DNS_SERVERS (3) + - CURLOPT_INTERFACE (3) +--- + +# NAME + +CURLOPT_DNS_INTERFACE - interface to speak DNS over + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter. Set the name of the network interface that +the DNS resolver should bind to. This must be an interface name (not an +address). Set this option to NULL to use the default setting (do not bind to a +specific interface). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All protocols except file:// - protocols that resolve host names. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.33.0. This option also requires that libcurl was built with a +resolver backend that supports this operation. The c-ares backend is the only +such one. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, +or CURLE_NOT_BUILT_IN if support was disabled at compile-time. diff --git a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3 b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3 deleted file mode 100644 index 6f8ad2cf8..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_LOCAL_IP4 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_LOCAL_IP4 \- IPv4 address to bind DNS resolves to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address); -.fi -.SH DESCRIPTION -Set the local IPv4 \fIaddress\fP that the resolver should bind to. The -argument should be of type char * and contain a single numerical IPv4 address -as a string. Set this option to NULL to use the default setting (do not bind -to a specific IP address). - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -This option requires that libcurl was built with a resolver backend that -supports this operation. The c-ares backend is the only such one. - -Added in 7.33.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, -CURLE_NOT_BUILT_IN if support was disabled at compile-time, or -CURLE_BAD_FUNCTION_ARGUMENT when given a bad address. -.SH "SEE ALSO" -.BR CURLOPT_DNS_INTERFACE (3), -.BR CURLOPT_DNS_LOCAL_IP6 (3), -.BR CURLOPT_DNS_SERVERS (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.md b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.md new file mode 100644 index 000000000..69af83b6b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_LOCAL_IP4 +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_INTERFACE (3) + - CURLOPT_DNS_LOCAL_IP6 (3) + - CURLOPT_DNS_SERVERS (3) +--- + +# NAME + +CURLOPT_DNS_LOCAL_IP4 - IPv4 address to bind DNS resolves to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address); +~~~ + +# DESCRIPTION + +Set the local IPv4 *address* that the resolver should bind to. The argument +should be of type char * and contain a single numerical IPv4 address as a +string. Set this option to NULL to use the default setting (do not bind to a +specific IP address). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. + +Added in 7.33.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, +CURLE_NOT_BUILT_IN if support was disabled at compile-time, or +CURLE_BAD_FUNCTION_ARGUMENT when given a bad address. diff --git a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3 b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3 deleted file mode 100644 index 78ffbf95b..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_LOCAL_IP6 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_LOCAL_IP6 \- IPv6 address to bind DNS resolves to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP6, char *address); -.fi -.SH DESCRIPTION -Set the local IPv6 \fIaddress\fP that the resolver should bind to. The -argument should be of type char * and contain a single IPv6 address as a -string. Set this option to NULL to use the default setting (do not bind to a -specific IP address). - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -This option requires that libcurl was built with a resolver backend that -supports this operation. The c-ares backend is the only such one. - -Added in 7.33.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, -CURLE_NOT_BUILT_IN if support was disabled at compile-time, or -CURLE_BAD_FUNCTION_ARGUMENT when given a bad address. -.SH "SEE ALSO" -.BR CURLOPT_DNS_INTERFACE (3), -.BR CURLOPT_DNS_LOCAL_IP4 (3), -.BR CURLOPT_DNS_SERVERS (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.md b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.md new file mode 100644 index 000000000..fb04ee899 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_LOCAL_IP6 +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_INTERFACE (3) + - CURLOPT_DNS_LOCAL_IP4 (3) + - CURLOPT_DNS_SERVERS (3) +--- + +# NAME + +CURLOPT_DNS_LOCAL_IP6 - IPv6 address to bind DNS resolves to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP6, char *address); +~~~ + +# DESCRIPTION + +Set the local IPv6 *address* that the resolver should bind to. The argument +should be of type char * and contain a single IPv6 address as a string. Set +this option to NULL to use the default setting (do not bind to a specific IP +address). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. + +Added in 7.33.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, +CURLE_NOT_BUILT_IN if support was disabled at compile-time, or +CURLE_BAD_FUNCTION_ARGUMENT when given a bad address. diff --git a/docs/libcurl/opts/CURLOPT_DNS_SERVERS.3 b/docs/libcurl/opts/CURLOPT_DNS_SERVERS.3 deleted file mode 100644 index c8e160a7d..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_SERVERS.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_SERVERS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_SERVERS \- DNS servers to use -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SERVERS, char *servers); -.fi -.SH DESCRIPTION -Pass a char * that is the list of DNS servers to be used instead of the system -default. The format of the dns servers option is: - -host[:port][,host[:port]]... - -For example: - -192.168.1.100,192.168.1.101,3.4.5.6 - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL - use system default -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -This option requires that libcurl was built with a resolver backend that -supports this operation. The c-ares backend is the only such one. - -Added in 7.24.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, -CURLE_NOT_BUILT_IN if support was disabled at compile-time, -CURLE_BAD_FUNCTION_ARGUMENT when given an invalid server list, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_DNS_LOCAL_IP4 (3), -.BR CURLOPT_DNS_LOCAL_IP6 (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_SERVERS.md b/docs/libcurl/opts/CURLOPT_DNS_SERVERS.md new file mode 100644 index 000000000..998257c79 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_SERVERS.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_SERVERS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_DNS_LOCAL_IP4 (3) + - CURLOPT_DNS_LOCAL_IP6 (3) +--- + +# NAME + +CURLOPT_DNS_SERVERS - DNS servers to use + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SERVERS, char *servers); +~~~ + +# DESCRIPTION + +Pass a char pointer that is the list of DNS servers to be used instead of the +system default. The format of the dns servers option is: + +host[:port][,host[:port]]... + +For example: + +192.168.1.100,192.168.1.101,3.4.5.6 + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL - use system default + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. + +Added in 7.24.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, +CURLE_NOT_BUILT_IN if support was disabled at compile-time, +CURLE_BAD_FUNCTION_ARGUMENT when given an invalid server list, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 b/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 deleted file mode 100644 index cc6934d1d..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_SHUFFLE_ADDRESSES 3 "3 March 2018" libcurl libcurl -.SH NAME -CURLOPT_DNS_SHUFFLE_ADDRESSES \- shuffle IP addresses for hostname -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff); -.fi -.SH DESCRIPTION -Pass a long set to 1 to enable this option. - -When a name is resolved and more than one IP address is returned, this -function shuffles the order of all returned addresses so that they are used in -a random order. This is similar to the ordering behavior of the legacy -gethostbyname function which is no longer used on most platforms. - -Addresses are not reshuffled if name resolution is completed using the DNS -cache. \fICURLOPT_DNS_CACHE_TIMEOUT(3)\fP can be used together with this -option to reduce DNS cache timeout or disable caching entirely if frequent -reshuffling is needed. - -Since the addresses returned are randomly reordered, the order is not in -accordance with RFC 3484 or any other deterministic order that may be -generated by the system's name resolution implementation. This may have -performance impacts and may cause IPv4 to be used before IPv6 or vice versa. -.SH DEFAULT -0 (disabled) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.60.0 -.SH RETURN VALUE -CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. -.SH "SEE ALSO" -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_IPRESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.md b/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.md new file mode 100644 index 000000000..f15abc9c7 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_SHUFFLE_ADDRESSES +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_IPRESOLVE (3) +--- + +# NAME + +CURLOPT_DNS_SHUFFLE_ADDRESSES - shuffle IP addresses for hostname + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff); +~~~ + +# DESCRIPTION + +Pass a long set to 1 to enable this option. + +When a name is resolved and more than one IP address is returned, this +function shuffles the order of all returned addresses so that they are used in +a random order. This is similar to the ordering behavior of the legacy +gethostbyname function which is no longer used on most platforms. + +Addresses are not reshuffled if name resolution is completed using the DNS +cache. CURLOPT_DNS_CACHE_TIMEOUT(3) can be used together with this +option to reduce DNS cache timeout or disable caching entirely if frequent +reshuffling is needed. + +Since the addresses returned are randomly reordered, the order is not in +accordance with RFC 3484 or any other deterministic order that may be +generated by the system's name resolution implementation. This may have +performance impacts and may cause IPv4 to be used before IPv6 or vice versa. + +# DEFAULT + +0 (disabled) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.60.0 + +# RETURN VALUE + +CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. diff --git a/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3 b/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3 deleted file mode 100644 index 184147b49..000000000 --- a/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DNS_USE_GLOBAL_CACHE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_DNS_USE_GLOBAL_CACHE \- global DNS cache -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_USE_GLOBAL_CACHE, - long enable); -.fi -.SH DESCRIPTION -Has no function since 7.62.0. Do not use! - -Pass a long. If the \fIenable\fP value is 1, it tells curl to use a global DNS -cache that survives between easy handle creations and deletions. This is not -thread-safe and this uses a global variable. - -See \fICURLOPT_SHARE(3)\fP and \fIcurl_share_init(3)\fP for the correct way to -share DNS cache between transfers. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_SHARE (3) diff --git a/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.md b/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.md new file mode 100644 index 000000000..dfbc22916 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DNS_USE_GLOBAL_CACHE.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DNS_USE_GLOBAL_CACHE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_SHARE (3) +--- + +# NAME + +CURLOPT_DNS_USE_GLOBAL_CACHE - global DNS cache + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_USE_GLOBAL_CACHE, + long enable); +~~~ + +# DESCRIPTION + +Has no function since 7.62.0. Do not use! + +Pass a long. If the *enable* value is 1, it tells curl to use a global DNS +cache that survives between easy handle creations and deletions. This is not +thread-safe and this uses a global variable. + +See CURLOPT_SHARE(3) and curl_share_init(3) for the correct way to +share DNS cache between transfers. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} + +~~~ + +# AVAILABILITY + +Deprecated since 7.11.1. Function removed in 7.62.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 deleted file mode 100644 index 0bcd87b71..000000000 --- a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DOH_SSL_VERIFYHOST 3 "11 Feb 2021" libcurl libcurl -.SH NAME -CURLOPT_DOH_SSL_VERIFYHOST \- verify the host name in the DoH SSL certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST, - long verify); -.fi -.SH DESCRIPTION -Pass a long set to 2L as asking curl to \fIverify\fP the DoH (DNS-over-HTTPS) -server's certificate name fields against the host name. - -This option is the DoH equivalent of \fICURLOPT_SSL_VERIFYHOST(3)\fP and -only affects requests to the DoH server. - -When \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP is 2, the SSL certificate provided by -the DoH server must indicate that the server name is the same as the server -name to which you meant to connect to, or the connection fails. - -Curl considers the DoH server the intended one when the Common Name field or a -Subject Alternate Name field in the certificate matches the host name in the -DoH URL to which you told Curl to connect. - -When the \fIverify\fP value is set to 1L it is treated the same as 2L. However -for consistency with the other \fIVERIFYHOST\fP options we suggest use 2 and -not 1. - -When the \fIverify\fP value is set to 0L, the connection succeeds regardless of -the names used in the certificate. Use that ability with caution! - -See also \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP to verify the digital signature -of the DoH server certificate. -.SH DEFAULT -2 -.SH PROTOCOLS -DoH -.SH EXAMPLE -.nf -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"); - - /* Disable host name verification of the DoH server */ - curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.76.0 - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DOH_SSL_VERIFYPEER (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.md b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.md new file mode 100644 index 000000000..a168b05a8 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.md @@ -0,0 +1,90 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DOH_SSL_VERIFYHOST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DOH_SSL_VERIFYPEER (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_DOH_SSL_VERIFYHOST - verify the host name in the DoH SSL certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST, + long verify); +~~~ + +# DESCRIPTION + +Pass a long set to 2L as asking curl to *verify* the DoH (DNS-over-HTTPS) +server's certificate name fields against the host name. + +This option is the DoH equivalent of CURLOPT_SSL_VERIFYHOST(3) and +only affects requests to the DoH server. + +When CURLOPT_DOH_SSL_VERIFYHOST(3) is 2, the SSL certificate provided by +the DoH server must indicate that the server name is the same as the server +name to which you meant to connect to, or the connection fails. + +Curl considers the DoH server the intended one when the Common Name field or a +Subject Alternate Name field in the certificate matches the host name in the +DoH URL to which you told Curl to connect. + +When the *verify* value is set to 1L it is treated the same as 2L. However +for consistency with the other *VERIFYHOST* options we suggest use 2 and +not 1. + +When the *verify* value is set to 0L, the connection succeeds regardless of +the names used in the certificate. Use that ability with caution! + +See also CURLOPT_DOH_SSL_VERIFYPEER(3) to verify the digital signature +of the DoH server certificate. + +# DEFAULT + +2 + +# PROTOCOLS + +DoH + +# EXAMPLE + +~~~c +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"); + + /* Disable host name verification of the DoH server */ + curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.76.0 + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 deleted file mode 100644 index d894871d4..000000000 --- a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DOH_SSL_VERIFYPEER 3 "11 Feb 2021" libcurl libcurl -.SH NAME -CURLOPT_DOH_SSL_VERIFYPEER \- verify the DoH SSL certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYPEER, - long verify); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1L to enable or 0L to disable. - -This option tells curl to verify the authenticity of the DoH (DNS-over-HTTPS) -server's certificate. A value of 1 means curl verifies; 0 (zero) means it -does not. - -This option is the DoH equivalent of \fICURLOPT_SSL_VERIFYPEER(3)\fP and -only affects requests to the DoH server. - -When negotiating a TLS or SSL connection, the server sends a certificate -indicating its identity. Curl verifies whether the certificate is authentic, -i.e. that you can trust that the server is who the certificate says it is. -This trust is based on a chain of digital signatures, rooted in certification -authority (CA) certificates you supply. curl uses a default bundle of CA -certificates (the path for that is determined at build time) and you can -specify alternate certificates with the \fICURLOPT_CAINFO(3)\fP option -or the \fICURLOPT_CAPATH(3)\fP option. - -When \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP is enabled, and the verification -fails to prove that the certificate is authentic, the connection fails. When -the option is zero, the peer certificate verification succeeds regardless. - -Authenticating the certificate is not enough to be sure about the server. You -typically also want to ensure that the server is the server you mean to be -talking to. Use \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP for that. The check -that the host name in the certificate is valid for the host name you are -connecting to is done independently of the -\fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP option. - -WARNING: disabling verification of the certificate allows bad guys to -man-in-the-middle the communication without you knowing it. Disabling -verification makes the communication insecure. Just having encryption on a -transfer is not enough as you cannot be sure that you are communicating with -the correct end-point. -.SH DEFAULT -1 -.SH PROTOCOLS -DoH -.SH EXAMPLE -.nf -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"); - - /* Disable certificate verification of the DoH server */ - curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.76.0 - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_DOH_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.md b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.md new file mode 100644 index 000000000..c8935d1c8 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.md @@ -0,0 +1,102 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DOH_SSL_VERIFYPEER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAPATH (3) + - CURLOPT_DOH_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_DOH_SSL_VERIFYPEER - verify the DoH SSL certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYPEER, + long verify); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1L to enable or 0L to disable. + +This option tells curl to verify the authenticity of the DoH (DNS-over-HTTPS) +server's certificate. A value of 1 means curl verifies; 0 (zero) means it +does not. + +This option is the DoH equivalent of CURLOPT_SSL_VERIFYPEER(3) and +only affects requests to the DoH server. + +When negotiating a TLS or SSL connection, the server sends a certificate +indicating its identity. Curl verifies whether the certificate is authentic, +i.e. that you can trust that the server is who the certificate says it is. +This trust is based on a chain of digital signatures, rooted in certification +authority (CA) certificates you supply. curl uses a default bundle of CA +certificates (the path for that is determined at build time) and you can +specify alternate certificates with the CURLOPT_CAINFO(3) option or the +CURLOPT_CAPATH(3) option. + +When CURLOPT_DOH_SSL_VERIFYPEER(3) is enabled, and the verification fails to +prove that the certificate is authentic, the connection fails. When the option +is zero, the peer certificate verification succeeds regardless. + +Authenticating the certificate is not enough to be sure about the server. You +typically also want to ensure that the server is the server you mean to be +talking to. Use CURLOPT_DOH_SSL_VERIFYHOST(3) for that. The check that the +host name in the certificate is valid for the host name you are connecting to +is done independently of the CURLOPT_DOH_SSL_VERIFYPEER(3) option. + +WARNING: disabling verification of the certificate allows bad guys to +man-in-the-middle the communication without you knowing it. Disabling +verification makes the communication insecure. Just having encryption on a +transfer is not enough as you cannot be sure that you are communicating with +the correct end-point. + +# DEFAULT + +1 + +# PROTOCOLS + +DoH + +# EXAMPLE + +~~~c +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"); + + /* Disable certificate verification of the DoH server */ + curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.76.0 + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 deleted file mode 100644 index cde868e36..000000000 --- a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DOH_SSL_VERIFYSTATUS 3 "11 Feb 2021" libcurl libcurl -.SH NAME -CURLOPT_DOH_SSL_VERIFYSTATUS \- verify the DoH SSL certificate's status -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYSTATUS, - long verify); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1 to enable or 0 to disable. - -This option determines whether libcurl verifies the status of the DoH -(DNS-over-HTTPS) server cert using the "Certificate Status Request" TLS -extension (aka. OCSP stapling). - -This option is the DoH equivalent of \fICURLOPT_SSL_VERIFYSTATUS(3)\fP and -only affects requests to the DoH server. - -If this option is enabled and the server does not support the TLS extension, -the verification fails. -.SH DEFAULT -0 -.SH PROTOCOLS -DoH -.SH EXAMPLE -.nf -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"); - - /* Ask for OCSP stapling when verifying the DoH server */ - curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYSTATUS, 1L); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.76.0. This option is currently only supported by the OpenSSL, and -GnuTLS TLS backends. -.SH RETURN VALUE -Returns CURLE_OK if OCSP stapling is supported by the SSL backend, otherwise -returns CURLE_NOT_BUILT_IN. -.SH "SEE ALSO" -.BR CURLOPT_DOH_SSL_VERIFYHOST (3), -.BR CURLOPT_DOH_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYSTATUS (3) diff --git a/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.md b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.md new file mode 100644 index 000000000..19489986b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DOH_SSL_VERIFYSTATUS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DOH_SSL_VERIFYHOST (3) + - CURLOPT_DOH_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYSTATUS (3) +--- + +# NAME + +CURLOPT_DOH_SSL_VERIFYSTATUS - verify the DoH SSL certificate's status + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYSTATUS, + long verify); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1 to enable or 0 to disable. + +This option determines whether libcurl verifies the status of the DoH +(DNS-over-HTTPS) server cert using the "Certificate Status Request" TLS +extension (aka. OCSP stapling). + +This option is the DoH equivalent of CURLOPT_SSL_VERIFYSTATUS(3) and +only affects requests to the DoH server. + +If this option is enabled and the server does not support the TLS extension, +the verification fails. + +# DEFAULT + +0 + +# PROTOCOLS + +DoH + +# EXAMPLE + +~~~c +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"); + + /* Ask for OCSP stapling when verifying the DoH server */ + curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYSTATUS, 1L); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.76.0. This option is currently only supported by the OpenSSL, and +GnuTLS TLS backends. + +# RETURN VALUE + +Returns CURLE_OK if OCSP stapling is supported by the SSL backend, otherwise +returns CURLE_NOT_BUILT_IN. diff --git a/docs/libcurl/opts/CURLOPT_DOH_URL.3 b/docs/libcurl/opts/CURLOPT_DOH_URL.3 deleted file mode 100644 index 35dbed04a..000000000 --- a/docs/libcurl/opts/CURLOPT_DOH_URL.3 +++ /dev/null @@ -1,95 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_DOH_URL 3 "18 Jun 2018" libcurl libcurl -.SH NAME -CURLOPT_DOH_URL \- provide the DNS-over-HTTPS URL -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_URL, char *URL); -.fi -.SH DESCRIPTION -Pass in a pointer to a \fIURL\fP for the DoH server to use for name -resolving. The parameter should be a char * to a null-terminated string which -must be URL-encoded in the following format: "https://host:port/path". It MUST -specify an HTTPS URL. - -libcurl does not validate the syntax or use this variable until the transfer -is issued. Even if you set a crazy value here, \fIcurl_easy_setopt(3)\fP still -returns \fICURLE_OK\fP. - -curl sends POST requests to the given DNS-over-HTTPS URL. - -To find the DoH server itself, which might be specified using a name, libcurl -uses the default name lookup function. You can bootstrap that by providing the -address for the DoH server with \fICURLOPT_RESOLVE(3)\fP. - -Disable DoH use again by setting this option to NULL. -.SH "INHERIT OPTIONS" -DoH lookups use SSL and some SSL settings from your transfer are inherited, -like \fICURLOPT_SSL_CTX_FUNCTION(3)\fP. - -The hostname and peer certificate verification settings are not inherited but -can be controlled separately via \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP and -\fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP. - -A set \fICURLOPT_OPENSOCKETFUNCTION(3)\fP callback is not inherited. -.SH "KNOWN BUGS" -Even when DoH is set to be used with this option, there are still some name -resolves that are performed without it, using the default name resolver -mechanism. This includes name resolves done for \fICURLOPT_INTERFACE(3)\fP, -\fICURLOPT_FTPPORT(3)\fP, a proxy type set to \fBCURLPROXY_SOCKS4\fP or -\fBCURLPROXY_SOCKS5\fP and probably some more. -.SH DEFAULT -NULL - there is no default DoH URL. If this option is not set, libcurl uses -the default name resolver. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.62.0 -.SH RETURN VALUE -Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient -heap space. - -Note that \fIcurl_easy_setopt(3)\fP does immediately parse the given string so -when given a bad DoH URL, libcurl might not detect the problem until it later -tries to resolve a name with it. -.SH "SEE ALSO" -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_RESOLVE (3), -.BR CURLOPT_VERBOSE (3) diff --git a/docs/libcurl/opts/CURLOPT_DOH_URL.md b/docs/libcurl/opts/CURLOPT_DOH_URL.md new file mode 100644 index 000000000..a2e46b4c0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_DOH_URL.md @@ -0,0 +1,96 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_DOH_URL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_RESOLVE (3) + - CURLOPT_VERBOSE (3) +--- + +# NAME + +CURLOPT_DOH_URL - provide the DNS-over-HTTPS URL + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_URL, char *URL); +~~~ + +# DESCRIPTION + +Pass in a pointer to a *URL* for the DoH server to use for name resolving. The +parameter should be a char pointer to a null-terminated string which must be a +valid and correct HTTPS URL. + +libcurl does not validate the syntax or use this variable until the transfer +is issued. Even if you set a crazy value here, curl_easy_setopt(3) still +returns *CURLE_OK*. + +curl sends POST requests to the given DNS-over-HTTPS URL. + +To find the DoH server itself, which might be specified using a name, libcurl +uses the default name lookup function. You can bootstrap that by providing the +address for the DoH server with CURLOPT_RESOLVE(3). + +Disable DoH use again by setting this option to NULL. + +# INHERIT OPTIONS + +DoH lookups use SSL and some SSL settings from your transfer are inherited, +like CURLOPT_SSL_CTX_FUNCTION(3). + +The hostname and peer certificate verification settings are not inherited but +can be controlled separately via CURLOPT_DOH_SSL_VERIFYHOST(3) and +CURLOPT_DOH_SSL_VERIFYPEER(3). + +A set CURLOPT_OPENSOCKETFUNCTION(3) callback is not inherited. + +# KNOWN BUGS + +Even when DoH is set to be used with this option, there are still some name +resolves that are performed without it, using the default name resolver +mechanism. This includes name resolves done for CURLOPT_INTERFACE(3), +CURLOPT_FTPPORT(3), a proxy type set to **CURLPROXY_SOCKS4** or +**CURLPROXY_SOCKS5** and probably some more. + +# DEFAULT + +NULL - there is no default DoH URL. If this option is not set, libcurl uses +the default name resolver. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.62.0 + +# RETURN VALUE + +Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient +heap space. + +Note that curl_easy_setopt(3) does immediately parse the given string so +when given a bad DoH URL, libcurl might not detect the problem until it later +tries to resolve a name with it. diff --git a/docs/libcurl/opts/CURLOPT_EGDSOCKET.3 b/docs/libcurl/opts/CURLOPT_EGDSOCKET.3 deleted file mode 100644 index 099acd8c5..000000000 --- a/docs/libcurl/opts/CURLOPT_EGDSOCKET.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_EGDSOCKET 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_EGDSOCKET \- EGD socket path -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_EGDSOCKET, char *path); -.fi -.SH DESCRIPTION -Deprecated option. It serves no purpose anymore. - -Pass a char * to the null-terminated path name to the Entropy Gathering Daemon -socket. It is used to seed the random engine for TLS. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_EGDSOCKET, "/var/egd.socket"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -If built with TLS enabled. Only the OpenSSL backend uses this, and only with -OpenSSL versions before 1.1.0. - -This option was deprecated in 7.84.0. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_RANDOM_FILE (3) diff --git a/docs/libcurl/opts/CURLOPT_EGDSOCKET.md b/docs/libcurl/opts/CURLOPT_EGDSOCKET.md new file mode 100644 index 000000000..a472f5ea5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_EGDSOCKET.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_EGDSOCKET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_RANDOM_FILE (3) +--- + +# NAME + +CURLOPT_EGDSOCKET - EGD socket path + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_EGDSOCKET, char *path); +~~~ + +# DESCRIPTION + +Deprecated option. It serves no purpose anymore. + +Pass a char pointer to the null-terminated path name to the Entropy Gathering +Daemon socket. It is used to seed the random engine for TLS. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_EGDSOCKET, "/var/egd.socket"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +If built with TLS enabled. Only the OpenSSL backend uses this, and only with +OpenSSL versions before 1.1.0. + +This option was deprecated in 7.84.0. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_ERRORBUFFER.3 b/docs/libcurl/opts/CURLOPT_ERRORBUFFER.3 deleted file mode 100644 index 76180cba8..000000000 --- a/docs/libcurl/opts/CURLOPT_ERRORBUFFER.3 +++ /dev/null @@ -1,103 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ERRORBUFFER 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_ERRORBUFFER \- error buffer for error messages -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ERRORBUFFER, char *buf); -.fi -.SH DESCRIPTION -Pass a char * to a buffer that libcurl may use to store human readable error -messages on failures or problems. This may be more helpful than just the -return code from \fIcurl_easy_perform(3)\fP and related functions. The buffer -must be at least \fBCURL_ERROR_SIZE\fP bytes big. - -You must keep the associated buffer available until libcurl no longer needs -it. Failing to do so might cause odd behavior or even crashes. libcurl might -need it until you call \fIcurl_easy_cleanup(3)\fP or you set the same option -again to use a different pointer. - -Do not rely on the contents of the buffer unless an error code was returned. -Since 7.60.0 libcurl initializes the contents of the error buffer to an empty -string before performing the transfer. For earlier versions if an error code -was returned but there was no error detail then the buffer was untouched. - -Consider \fICURLOPT_VERBOSE(3)\fP and \fICURLOPT_DEBUGFUNCTION(3)\fP to better -debug and trace why errors happen. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -#include /* 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"); - - /* 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; - - /* 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)); - } - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR curl_easy_strerror (3), -.BR curl_multi_strerror (3), -.BR curl_share_strerror (3), -.BR curl_url_strerror (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_VERBOSE (3) diff --git a/docs/libcurl/opts/CURLOPT_ERRORBUFFER.md b/docs/libcurl/opts/CURLOPT_ERRORBUFFER.md new file mode 100644 index 000000000..ed5d361ef --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ERRORBUFFER.md @@ -0,0 +1,101 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ERRORBUFFER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_VERBOSE (3) + - curl_easy_strerror (3) + - curl_multi_strerror (3) + - curl_share_strerror (3) + - curl_url_strerror (3) +--- + +# NAME + +CURLOPT_ERRORBUFFER - error buffer for error messages + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ERRORBUFFER, char *buf); +~~~ + +# DESCRIPTION + +Pass a char pointer to a buffer that libcurl may use to store human readable +error messages on failures or problems. This may be more helpful than just the +return code from curl_easy_perform(3) and related functions. The buffer must +be at least **CURL_ERROR_SIZE** bytes big. + +You must keep the associated buffer available until libcurl no longer needs +it. Failing to do so might cause odd behavior or even crashes. libcurl might +need it until you call curl_easy_cleanup(3) or you set the same option +again to use a different pointer. + +Do not rely on the contents of the buffer unless an error code was returned. +Since 7.60.0 libcurl initializes the contents of the error buffer to an empty +string before performing the transfer. For earlier versions if an error code +was returned but there was no error detail then the buffer was untouched. + +Consider CURLOPT_VERBOSE(3) and CURLOPT_DEBUGFUNCTION(3) to better +debug and trace why errors happen. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +#include /* 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"); + + /* 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; + + /* 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)); + } + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3 deleted file mode 100644 index 987092232..000000000 --- a/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_EXPECT_100_TIMEOUT_MS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_EXPECT_100_TIMEOUT_MS \- timeout for Expect: 100-continue response -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_EXPECT_100_TIMEOUT_MS, - long milliseconds); -.SH DESCRIPTION -Pass a long to tell libcurl the number of \fImilliseconds\fP to wait for a -server response with the HTTP status 100 (Continue), 417 (Expectation Failed) -or similar after sending an HTTP request containing an Expect: 100-continue -header. If this times out before a response is received, the request body is -sent anyway. -.SH DEFAULT -1000 milliseconds -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.36.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPPOST (3), -.BR CURLOPT_POST (3) diff --git a/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.md new file mode 100644 index 000000000..9458cfc63 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_EXPECT_100_TIMEOUT_MS.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_EXPECT_100_TIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPOST (3) + - CURLOPT_POST (3) +--- + +# NAME + +CURLOPT_EXPECT_100_TIMEOUT_MS - timeout for Expect: 100-continue response + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_EXPECT_100_TIMEOUT_MS, + long milliseconds); +~~~ + +# DESCRIPTION + +Pass a long to tell libcurl the number of *milliseconds* to wait for a +server response with the HTTP status 100 (Continue), 417 (Expectation Failed) +or similar after sending an HTTP request containing an Expect: 100-continue +header. If this times out before a response is received, the request body is +sent anyway. + +# DEFAULT + +1000 milliseconds + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.36.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FAILONERROR.3 b/docs/libcurl/opts/CURLOPT_FAILONERROR.3 deleted file mode 100644 index 539517125..000000000 --- a/docs/libcurl/opts/CURLOPT_FAILONERROR.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FAILONERROR 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FAILONERROR \- request failure on HTTP response >= 400 -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FAILONERROR, long fail); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to fail the request if the HTTP -code returned is equal to or larger than 400. The default action would be to -return the page normally, ignoring that code. - -This method is not fail-safe and there are occasions where non-successful -response codes slip through, especially when authentication is involved -(response codes 401 and 407). - -You might get some amounts of headers transferred before this situation is -detected, like when a "100-continue" is received as a response to a POST/PUT -and a 401 or 407 is received immediately afterwards. - -When this option is used and an error is detected, it causes the connection to -get closed and \fICURLE_HTTP_RETURNED_ERROR\fP is returned. -.SH DEFAULT -0, do not fail on error -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -.SH AVAILABILITY -Along with HTTP. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_RESPONSE_CODE (3), -.BR CURLOPT_HTTP200ALIASES (3), -.BR CURLOPT_KEEP_SENDING_ON_ERROR (3) diff --git a/docs/libcurl/opts/CURLOPT_FAILONERROR.md b/docs/libcurl/opts/CURLOPT_FAILONERROR.md new file mode 100644 index 000000000..7ea5cedc6 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FAILONERROR.md @@ -0,0 +1,74 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FAILONERROR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - CURLOPT_HTTP200ALIASES (3) + - CURLOPT_KEEP_SENDING_ON_ERROR (3) +--- + +# NAME + +CURLOPT_FAILONERROR - request failure on HTTP response >= 400 + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FAILONERROR, long fail); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to fail the request if the HTTP +code returned is equal to or larger than 400. The default action would be to +return the page normally, ignoring that code. + +This method is not fail-safe and there are occasions where non-successful +response codes slip through, especially when authentication is involved +(response codes 401 and 407). + +You might get some amounts of headers transferred before this situation is +detected, like when a "100-continue" is received as a response to a POST/PUT +and a 401 or 407 is received immediately afterwards. + +When this option is used and an error is detected, it causes the connection to +get closed and *CURLE_HTTP_RETURNED_ERROR* is returned. + +# DEFAULT + +0, do not fail on error + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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 */ + } + } +} +~~~ + +# AVAILABILITY + +Along with HTTP. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FILETIME.3 b/docs/libcurl/opts/CURLOPT_FILETIME.3 deleted file mode 100644 index 39ce7a25b..000000000 --- a/docs/libcurl/opts/CURLOPT_FILETIME.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FILETIME 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FILETIME \- get the modification time of the remote resource -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime); -.fi -.SH DESCRIPTION -Pass a long. If it is 1, libcurl attempts to get the modification time of the -remote document in this operation. This requires that the remote server sends -the time or replies to a time querying command. The \fIcurl_easy_getinfo(3)\fP -function with the \fICURLINFO_FILETIME(3)\fP argument can be used after a -transfer to extract the received time (if any). -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP(S), FTP(S), SFTP, FILE, SMB(S) -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Always, for SFTP since 7.49.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR curl_easy_getinfo (3), -.BR CURLINFO_FILETIME (3) diff --git a/docs/libcurl/opts/CURLOPT_FILETIME.md b/docs/libcurl/opts/CURLOPT_FILETIME.md new file mode 100644 index 000000000..013449105 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FILETIME.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FILETIME +Section: 3 +Source: libcurl +See-also: + - CURLINFO_FILETIME (3) + - curl_easy_getinfo (3) +--- + +# NAME + +CURLOPT_FILETIME - get the modification time of the remote resource + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime); +~~~ + +# DESCRIPTION + +Pass a long. If it is 1, libcurl attempts to get the modification time of the +remote document in this operation. This requires that the remote server sends +the time or replies to a time querying command. The curl_easy_getinfo(3) +function with the CURLINFO_FILETIME(3) argument can be used after a +transfer to extract the received time (if any). + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP(S), FTP(S), SFTP, FILE, SMB(S) + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always, for SFTP since 7.49.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3 b/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3 deleted file mode 100644 index 89ca2d039..000000000 --- a/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FNMATCH_DATA 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FNMATCH_DATA \- pointer passed to the fnmatch callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_DATA, - void *pointer); -.SH DESCRIPTION -Pass a pointer that is untouched by libcurl and passed as the ptr argument to -the \fICURLOPT_FNMATCH_FUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -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 *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 *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 -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FNMATCH_FUNCTION (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.md b/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.md new file mode 100644 index 000000000..48b60723a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FNMATCH_DATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FNMATCH_FUNCTION (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_FNMATCH_DATA - pointer passed to the fnmatch callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_DATA, + void *pointer); +~~~ + +# DESCRIPTION + +Pass a pointer that is untouched by libcurl and passed as the ptr argument to +the CURLOPT_FNMATCH_FUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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 *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 *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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3 deleted file mode 100644 index 7dc835766..000000000 --- a/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FNMATCH_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FNMATCH_FUNCTION \- wildcard match callback -.SH SYNOPSIS -.nf -#include - -int fnmatch_callback(void *ptr, - const char *pattern, - const char *string); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_FUNCTION, - fnmatch_callback); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -This callback is used for wildcard matching. - -Return \fICURL_FNMATCHFUNC_MATCH\fP if pattern matches the string, -\fICURL_FNMATCHFUNC_NOMATCH\fP if not or \fICURL_FNMATCHFUNC_FAIL\fP if an -error occurred. -.SH DEFAULT -NULL == an internal function for wildcard matching. -.SH PROTOCOLS -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 = 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 *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 -Added in 7.21.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_FNMATCH_DATA (3), -.BR CURLOPT_WILDCARDMATCH (3) diff --git a/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.md b/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.md new file mode 100644 index 000000000..8ed13bfe6 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FNMATCH_FUNCTION.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FNMATCH_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_FNMATCH_DATA (3) + - CURLOPT_WILDCARDMATCH (3) +--- + +# NAME + +CURLOPT_FNMATCH_FUNCTION - wildcard match callback + +# SYNOPSIS + +~~~c +#include + +int fnmatch_callback(void *ptr, + const char *pattern, + const char *string); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_FUNCTION, + fnmatch_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +This callback is used for wildcard matching. + +Return *CURL_FNMATCHFUNC_MATCH* if pattern matches the string, +*CURL_FNMATCHFUNC_NOMATCH* if not or *CURL_FNMATCHFUNC_FAIL* if an +error occurred. + +# DEFAULT + +NULL == an internal function for wildcard matching. + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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 = 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 *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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3 b/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3 deleted file mode 100644 index a78ea3305..000000000 --- a/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FOLLOWLOCATION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FOLLOWLOCATION \- follow HTTP 3xx redirects -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FOLLOWLOCATION, long enable); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to follow any Location: header -redirects that a HTTP server sends in a 30x response. The Location: header can -specify a relative or an absolute URL to follow. - -libcurl issues another request for the new URL and follows subsequent new -Location: redirects all the way until no more such headers are returned or the -maximum limit is reached. \fICURLOPT_MAXREDIRS(3)\fP is used to limit the -number of redirects libcurl follows. - -libcurl restricts what protocols it automatically follow redirects to. The -accepted target protocols are set with \fICURLOPT_REDIR_PROTOCOLS(3)\fP. By -default libcurl allows HTTP, HTTPS, FTP and FTPS on redirects. - -When following a redirect, the specific 30x response code also dictates which -request method libcurl uses in the subsequent request: For 301, 302 and 303 -responses libcurl switches method from POST to GET unless -\fICURLOPT_POSTREDIR(3)\fP instructs libcurl otherwise. All other redirect -response codes make libcurl use the same method again. - -For users who think the existing location following is too naive, too simple -or just lacks features, it is easy to instead implement your own redirect -follow logic with the use of \fIcurl_easy_getinfo(3)\fP's -\fICURLINFO_REDIRECT_URL(3)\fP option instead of using -\fICURLOPT_FOLLOWLOCATION(3)\fP. -.SH NOTE -Since libcurl changes method or not based on the specific HTTP response code, -setting \fICURLOPT_CUSTOMREQUEST(3)\fP while following redirects may change -what libcurl would otherwise do and if not that carefully may even make it -misbehave since \fICURLOPT_CUSTOMREQUEST(3)\fP overrides the method libcurl -would otherwise select internally. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLOPT_POSTREDIR (3), -.BR CURLOPT_PROTOCOLS (3), -.BR CURLOPT_REDIR_PROTOCOLS (3) diff --git a/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.md b/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.md new file mode 100644 index 000000000..814f30996 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.md @@ -0,0 +1,93 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FOLLOWLOCATION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLINFO_REDIRECT_URL (3) + - CURLOPT_POSTREDIR (3) + - CURLOPT_PROTOCOLS (3) + - CURLOPT_REDIR_PROTOCOLS (3) +--- + +# NAME + +CURLOPT_FOLLOWLOCATION - follow HTTP 3xx redirects + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FOLLOWLOCATION, long enable); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to follow any Location: header +redirects that a HTTP server sends in a 30x response. The Location: header can +specify a relative or an absolute URL to follow. + +libcurl issues another request for the new URL and follows subsequent new +Location: redirects all the way until no more such headers are returned or the +maximum limit is reached. CURLOPT_MAXREDIRS(3) is used to limit the +number of redirects libcurl follows. + +libcurl restricts what protocols it automatically follow redirects to. The +accepted target protocols are set with CURLOPT_REDIR_PROTOCOLS(3). By +default libcurl allows HTTP, HTTPS, FTP and FTPS on redirects. + +When following a redirect, the specific 30x response code also dictates which +request method libcurl uses in the subsequent request: For 301, 302 and 303 +responses libcurl switches method from POST to GET unless +CURLOPT_POSTREDIR(3) instructs libcurl otherwise. All other redirect +response codes make libcurl use the same method again. + +For users who think the existing location following is too naive, too simple +or just lacks features, it is easy to instead implement your own redirect +follow logic with the use of curl_easy_getinfo(3)'s +CURLINFO_REDIRECT_URL(3) option instead of using +CURLOPT_FOLLOWLOCATION(3). + +# NOTE + +Since libcurl changes method or not based on the specific HTTP response code, +setting CURLOPT_CUSTOMREQUEST(3) while following redirects may change +what libcurl would otherwise do and if not that carefully may even make it +misbehave since CURLOPT_CUSTOMREQUEST(3) overrides the method libcurl +would otherwise select internally. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FORBID_REUSE.3 b/docs/libcurl/opts/CURLOPT_FORBID_REUSE.3 deleted file mode 100644 index 52d800d67..000000000 --- a/docs/libcurl/opts/CURLOPT_FORBID_REUSE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FORBID_REUSE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FORBID_REUSE \- make connection get closed at once after use -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FORBID_REUSE, long close); -.fi -.SH DESCRIPTION -Pass a long. Set \fIclose\fP to 1 to make libcurl explicitly close the -connection when done with the transfer. Normally, libcurl keeps all -connections alive when done with one transfer in case a succeeding one follows -that can reuse them. This option should be used with caution and only if you -understand what it does as it can seriously impact performance. - -Set to 0 to have libcurl keep the connection open for possible later reuse -(default behavior). -.SH DEFAULT -0 -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -int main(void) -{ - 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); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_FRESH_CONNECT (3), -.BR CURLOPT_MAXCONNECTS (3), -.BR CURLOPT_MAXLIFETIME_CONN (3) diff --git a/docs/libcurl/opts/CURLOPT_FORBID_REUSE.md b/docs/libcurl/opts/CURLOPT_FORBID_REUSE.md new file mode 100644 index 000000000..0e8a20607 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FORBID_REUSE.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FORBID_REUSE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FRESH_CONNECT (3) + - CURLOPT_MAXCONNECTS (3) + - CURLOPT_MAXLIFETIME_CONN (3) +--- + +# NAME + +CURLOPT_FORBID_REUSE - make connection get closed at once after use + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FORBID_REUSE, long close); +~~~ + +# DESCRIPTION + +Pass a long. Set *close* to 1 to make libcurl explicitly close the +connection when done with the transfer. Normally, libcurl keeps all +connections alive when done with one transfer in case a succeeding one follows +that can reuse them. This option should be used with caution and only if you +understand what it does as it can seriously impact performance. + +Set to 0 to have libcurl keep the connection open for possible later reuse +(default behavior). + +# DEFAULT + +0 + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +int main(void) +{ + 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); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3 b/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3 deleted file mode 100644 index 00e4addf9..000000000 --- a/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FRESH_CONNECT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FRESH_CONNECT \- force a new connection to be used -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FRESH_CONNECT, long fresh); -.fi -.SH DESCRIPTION -Pass a long. Set to 1 to make the next transfer use a new (fresh) connection -by force instead of trying to reuse an existing one. This option should be -used with caution and only if you understand what it does as it may impact -performance negatively. - -Related functionality is \fICURLOPT_FORBID_REUSE(3)\fP which makes sure the -connection is closed after use so that it cannot be reused. - -Set \fIfresh\fP to 0 to have libcurl attempt reusing an existing connection -(default behavior). -.SH DEFAULT -0 -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -int main(void) -{ - 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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_FORBID_REUSE (3), -.BR CURLOPT_MAXAGE_CONN (3), -.BR CURLOPT_MAXLIFETIME_CONN (3) diff --git a/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.md b/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.md new file mode 100644 index 000000000..ccb85270d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FRESH_CONNECT.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FRESH_CONNECT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FORBID_REUSE (3) + - CURLOPT_MAXAGE_CONN (3) + - CURLOPT_MAXLIFETIME_CONN (3) +--- + +# NAME + +CURLOPT_FRESH_CONNECT - force a new connection to be used + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FRESH_CONNECT, long fresh); +~~~ + +# DESCRIPTION + +Pass a long. Set to 1 to make the next transfer use a new (fresh) connection +by force instead of trying to reuse an existing one. This option should be +used with caution and only if you understand what it does as it may impact +performance negatively. + +Related functionality is CURLOPT_FORBID_REUSE(3) which makes sure the +connection is closed after use so that it cannot be reused. + +Set *fresh* to 0 to have libcurl attempt reusing an existing connection +(default behavior). + +# DEFAULT + +0 + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +int main(void) +{ + 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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_FTPPORT.3 b/docs/libcurl/opts/CURLOPT_FTPPORT.md similarity index 58% rename from docs/libcurl/opts/CURLOPT_FTPPORT.3 rename to docs/libcurl/opts/CURLOPT_FTPPORT.md index ad7f2be53..93a2bfad4 100644 --- a/docs/libcurl/opts/CURLOPT_FTPPORT.3 +++ b/docs/libcurl/opts/CURLOPT_FTPPORT.md @@ -1,37 +1,28 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTPPORT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTPPORT \- make FTP transfer active -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTPPORT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_USE_EPRT (3) + - CURLOPT_FTP_USE_EPSV (3) +--- + +# NAME + +CURLOPT_FTPPORT - make FTP transfer active + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPPORT, char *spec); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a null-terminated string as parameter. It specifies that the FTP transfer should be made actively and the given string is used to get the IP address to use for the FTP PORT instruction. @@ -52,17 +43,17 @@ specifier can be in brackets. Examples with specified ports: -.nf +~~~c eth0:0 192.168.1.2:32000-33000 curl.se:32123 [::1]:1234-4567 -.fi +~~~ We strongly advise against specifying the address with a name, as it causes libcurl to do a blocking name resolve call to retrieve the IP address. That -name resolve operation does \fBnot\fP use DNS-over-HTTPS even if -\fICURLOPT_DOH_URL(3)\fP is set. +name resolve operation does **not** use DNS-over-HTTPS even if +CURLOPT_DOH_URL(3) is set. Using anything else than "-" for this option should typically only be done if you have special knowledge and confirmation that it works. @@ -72,12 +63,18 @@ this option to NULL. The application does not have to keep the string around after setting this option. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + FTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -90,12 +87,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Port range support was added in 7.19.5 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_FTP_USE_EPRT (3), -.BR CURLOPT_FTP_USE_EPSV (3) diff --git a/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3 b/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3 deleted file mode 100644 index 96b6e9d7f..000000000 --- a/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTPSSLAUTH 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTPSSLAUTH \- order in which to attempt TLS vs SSL -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPSSLAUTH, long order); -.fi -.SH DESCRIPTION -Pass a long using one of the values from below, to alter how libcurl issues -\&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated. This is only -interesting if \fICURLOPT_USE_SSL(3)\fP is also set. - -Possible \fIorder\fP values: -.IP CURLFTPAUTH_DEFAULT -Allow libcurl to decide. -.IP CURLFTPAUTH_SSL -Try "AUTH SSL" first, and only if that fails try "AUTH TLS". -.IP CURLFTPAUTH_TLS -Try "AUTH TLS" first, and only if that fails try "AUTH SSL". -.SH DEFAULT -CURLFTPAUTH_DEFAULT -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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 -Added in 7.12.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_USE_SSL (3), -.BR CURLOPT_FTP_SSL_CCC (3) diff --git a/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.md b/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.md new file mode 100644 index 000000000..922d23795 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTPSSLAUTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_SSL_CCC (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_FTPSSLAUTH - order in which to attempt TLS vs SSL + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPSSLAUTH, long order); +~~~ + +# DESCRIPTION + +Pass a long using one of the values from below, to alter how libcurl issues +&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated. This is only +interesting if CURLOPT_USE_SSL(3) is also set. + +Possible *order* values: + +## CURLFTPAUTH_DEFAULT + +Allow libcurl to decide. + +## CURLFTPAUTH_SSL + +Try "AUTH SSL" first, and only if that fails try "AUTH TLS". + +## CURLFTPAUTH_TLS + +Try "AUTH TLS" first, and only if that fails try "AUTH SSL". + +# DEFAULT + +CURLFTPAUTH_DEFAULT + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.12.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 b/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 deleted file mode 100644 index 0b0513c5c..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_ACCOUNT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_ACCOUNT \- account info for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_ACCOUNT, char *account); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string (or NULL to disable). When an FTP -server asks for "account data" after user name and password has been provided, -this data is sent off using the ACCT command. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.13.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.md b/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.md new file mode 100644 index 000000000..f8941953b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_ACCOUNT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PASSWORD (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_FTP_ACCOUNT - account info for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_ACCOUNT, char *account); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string (or NULL to disable). When an FTP +server asks for "account data" after user name and password has been provided, +this data is sent off using the ACCT command. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.13.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 b/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 deleted file mode 100644 index d89a13ac6..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_ALTERNATIVE_TO_USER 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_ALTERNATIVE_TO_USER \- command to use instead of USER with FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_ALTERNATIVE_TO_USER, - char *cmd); -.SH DESCRIPTION -Pass a char * as parameter, pointing to a string which is used to authenticate -if the usual FTP "USER user" and "PASS password" negotiation fails. This is -currently only known to be required when connecting to Tumbleweed's Secure -Transport FTPS server using client certificates for authentication. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.15.5 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_FTP_ACCOUNT (3), -.BR CURLOPT_FTP_SKIP_PASV_IP (3), -.BR CURLOPT_SERVER_RESPONSE_TIMEOUT (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.md b/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.md new file mode 100644 index 000000000..70f451d84 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_ALTERNATIVE_TO_USER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_ACCOUNT (3) + - CURLOPT_FTP_SKIP_PASV_IP (3) + - CURLOPT_SERVER_RESPONSE_TIMEOUT (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_FTP_ALTERNATIVE_TO_USER - command to use instead of USER with FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_ALTERNATIVE_TO_USER, + char *cmd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, pointing to a string which is used to +authenticate if the usual FTP "USER user" and "PASS password" negotiation +fails. This is currently only known to be required when connecting to +Tumbleweed's Secure Transport FTPS server using client certificates for +authentication. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.5 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 b/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 deleted file mode 100644 index 4d4142967..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_CREATE_MISSING_DIRS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_CREATE_MISSING_DIRS \- create missing directories for FTP and SFTP -.SH SYNOPSIS -.nf -#include - -typedef enum { - CURLFTP_CREATE_DIR_NONE, - CURLFTP_CREATE_DIR, - CURLFTP_CREATE_DIR_RETRY -} curl_ftpcreatedir; - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS, - long create); -.SH DESCRIPTION -Pass a long telling libcurl to \fIcreate\fP the dir. If the value is -\fICURLFTP_CREATE_DIR\fP (1), libcurl may create any remote directory that it -fails to "move" into. - -For FTP requests, that means a CWD command fails. CWD being the command that -changes working directory. - -For SFTP requests, libcurl may create the remote directory if it cannot obtain -a handle to the target-location. The creation fails if a file of the same name -as the directory to create already exists or lack of permissions prevents -creation. - -Setting \fIcreate\fP to \fICURLFTP_CREATE_DIR_RETRY\fP (2), tells libcurl to -retry the CWD command again if the subsequent \fBMKD\fP command fails. This is -especially useful if you are doing many simultaneous connections against the -same server and they all have this option enabled, as then CWD may first fail -but then another connection does \fBMKD\fP before this connection and thus -\fBMKD\fP fails but trying CWD works! -.SH DEFAULT -CURLFTP_CREATE_DIR_NONE (0) -.SH PROTOCOLS -FTP and SFTP -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.7. SFTP support added in 7.16.3. The retry option was added in -7.19.4. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the -create value is not. -.SH "SEE ALSO" -.BR CURLOPT_FTP_FILEMETHOD (3), -.BR CURLOPT_FTP_USE_EPSV (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.md b/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.md new file mode 100644 index 000000000..07b6f68fd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_CREATE_MISSING_DIRS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_FILEMETHOD (3) + - CURLOPT_FTP_USE_EPSV (3) +--- + +# NAME + +CURLOPT_FTP_CREATE_MISSING_DIRS - create missing directories for FTP and SFTP + +# SYNOPSIS + +~~~c +#include + +typedef enum { + CURLFTP_CREATE_DIR_NONE, + CURLFTP_CREATE_DIR, + CURLFTP_CREATE_DIR_RETRY +} curl_ftpcreatedir; + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS, + long create); +~~~ + +# DESCRIPTION + +Pass a long telling libcurl to *create* the dir. If the value is +*CURLFTP_CREATE_DIR* (1), libcurl may create any remote directory that it +fails to "move" into. + +For FTP requests, that means a CWD command fails. CWD being the command that +changes working directory. + +For SFTP requests, libcurl may create the remote directory if it cannot obtain +a handle to the target-location. The creation fails if a file of the same name +as the directory to create already exists or lack of permissions prevents +creation. + +Setting *create* to *CURLFTP_CREATE_DIR_RETRY* (2), tells libcurl to +retry the CWD command again if the subsequent **MKD** command fails. This is +especially useful if you are doing many simultaneous connections against the +same server and they all have this option enabled, as then CWD may first fail +but then another connection does **MKD** before this connection and thus +**MKD** fails but trying CWD works! + +# DEFAULT + +CURLFTP_CREATE_DIR_NONE (0) + +# PROTOCOLS + +FTP and SFTP + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.7. SFTP support added in 7.16.3. The retry option was added in +7.19.4. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the +create value is not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 b/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 deleted file mode 100644 index afd3a00da..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_FILEMETHOD 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_FILEMETHOD \- select directory traversing method for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD, - long method); -.SH DESCRIPTION -Pass a long telling libcurl which \fImethod\fP to use to reach a file on a -FTP(S) server. - -This option exists because some server implementations are not compliant to -what the standards say should work. - -The argument should be one of the following alternatives: -.IP CURLFTPMETHOD_MULTICWD -libcurl does a single CWD operation for each path part in the given URL. For -deep hierarchies this means many commands. This is how RFC 1738 says it should -be done. This is the default but the slowest behavior. -.IP CURLFTPMETHOD_NOCWD -libcurl makes no CWD at all. libcurl does SIZE, RETR, STOR etc and gives a -full path to the server for all these commands. This is the fastest behavior -since it skips having to change directories. -.IP CURLFTPMETHOD_SINGLECWD -libcurl does one CWD with the full target directory and then operates on the -file \&"normally" (like in the multicwd case). This is somewhat more standards -compliant than 'nocwd' but without the full penalty of 'multicwd'. -.SH DEFAULT -CURLFTPMETHOD_MULTICWD -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.15.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DIRLISTONLY (3), -.BR CURLOPT_FTP_SKIP_PASV_IP (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.md b/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.md new file mode 100644 index 000000000..34b55d659 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_FILEMETHOD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DIRLISTONLY (3) + - CURLOPT_FTP_SKIP_PASV_IP (3) +--- + +# NAME + +CURLOPT_FTP_FILEMETHOD - select directory traversing method for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD, + long method); +~~~ + +# DESCRIPTION + +Pass a long telling libcurl which *method* to use to reach a file on a +FTP(S) server. + +This option exists because some server implementations are not compliant to +what the standards say should work. + +The argument should be one of the following alternatives: + +## CURLFTPMETHOD_MULTICWD + +libcurl does a single CWD operation for each path part in the given URL. For +deep hierarchies this means many commands. This is how RFC 1738 says it should +be done. This is the default but the slowest behavior. + +## CURLFTPMETHOD_NOCWD + +libcurl makes no CWD at all. libcurl does SIZE, RETR, STOR etc and gives a +full path to the server for all these commands. This is the fastest behavior +since it skips having to change directories. + +## CURLFTPMETHOD_SINGLECWD + +libcurl does one CWD with the full target directory and then operates on the +file &"normally" (like in the multicwd case). This is somewhat more standards +compliant than 'nocwd' but without the full penalty of 'multicwd'. + +# DEFAULT + +CURLFTPMETHOD_MULTICWD + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 deleted file mode 100644 index 9b6453bdc..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_SKIP_PASV_IP 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_SKIP_PASV_IP \- ignore the IP address in the PASV response -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SKIP_PASV_IP, long skip); -.fi -.SH DESCRIPTION -Pass a long. If \fIskip\fP is set to 1, it instructs libcurl to not use the IP -address the server suggests in its 227-response to libcurl's PASV command when -libcurl connects the data connection. Instead libcurl reuses the same IP -address it already uses for the control connection. It still uses the port -number from the 227-response. - -This option allows libcurl to work around broken server installations or funny -network setups that due to NATs, firewalls or incompetence report the wrong IP -address. Setting this option also reduces the risk for various sorts of client -abuse by malicious servers. - -This option has no effect if PORT, EPRT or EPSV is used instead of PASV. -.SH DEFAULT -1 since 7.74.0, was 0 before then. -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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); - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.14.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FTPPORT (3), -.BR CURLOPT_FTP_USE_EPRT (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.md b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.md new file mode 100644 index 000000000..bea622ac7 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_SKIP_PASV_IP +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTPPORT (3) + - CURLOPT_FTP_USE_EPRT (3) +--- + +# NAME + +CURLOPT_FTP_SKIP_PASV_IP - ignore the IP address in the PASV response + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SKIP_PASV_IP, long skip); +~~~ + +# DESCRIPTION + +Pass a long. If *skip* is set to 1, it instructs libcurl to not use the IP +address the server suggests in its 227-response to libcurl's PASV command when +libcurl connects the data connection. Instead libcurl reuses the same IP +address it already uses for the control connection. It still uses the port +number from the 227-response. + +This option allows libcurl to work around broken server installations or funny +network setups that due to NATs, firewalls or incompetence report the wrong IP +address. Setting this option also reduces the risk for various sorts of client +abuse by malicious servers. + +This option has no effect if PORT, EPRT or EPSV is used instead of PASV. + +# DEFAULT + +1 since 7.74.0, was 0 before then. + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.14.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3 b/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3 deleted file mode 100644 index a8d39881c..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_SSL_CCC 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_SSL_CCC \- switch off SSL again with FTP after auth -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SSL_CCC, - long how); -.fi -.SH DESCRIPTION -If enabled, this option makes libcurl use CCC (Clear Command Channel). It -shuts down the SSL/TLS layer after authenticating. The rest of the control -channel communication remains unencrypted. This allows NAT routers to follow -the FTP transaction. Pass a long using one of the values below -.IP CURLFTPSSL_CCC_NONE -do not attempt to use CCC. -.IP CURLFTPSSL_CCC_PASSIVE -Do not initiate the shutdown, but wait for the server to do it. Do not send a -reply. -.IP CURLFTPSSL_CCC_ACTIVE -Initiate the shutdown and wait for a reply. -.SH DEFAULT -CURLFTPSSL_CCC_NONE -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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 -Added in 7.16.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FTPSSLAUTH (3), -.BR CURLOPT_PROTOCOLS_STR (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md b/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md new file mode 100644 index 000000000..71947c36e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_SSL_CCC +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTPSSLAUTH (3) + - CURLOPT_PROTOCOLS_STR (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_FTP_SSL_CCC - switch off SSL again with FTP after auth + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SSL_CCC, + long how); +~~~ + +# DESCRIPTION + +If enabled, this option makes libcurl use CCC (Clear Command Channel). It +shuts down the SSL/TLS layer after authenticating. The rest of the control +channel communication remains unencrypted. This allows NAT routers to follow +the FTP transaction. Pass a long using one of the values below + +## CURLFTPSSL_CCC_NONE + +do not attempt to use CCC. + +## CURLFTPSSL_CCC_PASSIVE + +Do not initiate the shutdown, but wait for the server to do it. Do not send a +reply. + +## CURLFTPSSL_CCC_ACTIVE + +Initiate the shutdown and wait for a reply. + +# DEFAULT + +CURLFTPSSL_CCC_NONE + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3 b/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3 deleted file mode 100644 index 8731bd6c5..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_USE_EPRT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_USE_EPRT \- use EPRT for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled); -.fi -.SH DESCRIPTION -Pass a long. If the value is 1, it tells curl to use the EPRT command when -doing active FTP downloads (which is enabled by -\fICURLOPT_FTPPORT(3)\fP). Using EPRT means that libcurl first attempts to use -EPRT before using PORT, but if you pass zero to this option, it avoids using -EPRT, only plain PORT. - -The EPRT command is a slightly newer addition to the FTP protocol than PORT -and is the preferred command to use since it enables IPv6 to be used. Very old -FTP servers might not support it, which is why libcurl has a fallback -mechanism. Sometimes that fallback is not enough and then this option might -come handy. - -If the server is an IPv6 host, this option has no effect as EPRT is necessary -then. -.SH DEFAULT -.SH PROTOCOLS -.SH EXAMPLE -.nf -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, "-"); - - /* FTP the way the neanderthals did it */ - curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.5 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_FTP_USE_EPSV (3), -.BR CURLOPT_FTPPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.md b/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.md new file mode 100644 index 000000000..644f51aa9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_USE_EPRT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTPPORT (3) + - CURLOPT_FTP_USE_EPSV (3) +--- + +# NAME + +CURLOPT_FTP_USE_EPRT - use EPRT for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled); +~~~ + +# DESCRIPTION + +Pass a long. If the value is 1, it tells curl to use the EPRT command when +doing active FTP downloads (which is enabled by +CURLOPT_FTPPORT(3)). Using EPRT means that libcurl first attempts to use +EPRT before using PORT, but if you pass zero to this option, it avoids using +EPRT, only plain PORT. + +The EPRT command is a slightly newer addition to the FTP protocol than PORT +and is the preferred command to use since it enables IPv6 to be used. Old FTP +servers might not support it, which is why libcurl has a fallback mechanism. +Sometimes that fallback is not enough and then this option might come handy. + +If the server is an IPv6 host, this option has no effect as EPRT is necessary +then. + +# DEFAULT + +# PROTOCOLS + +# EXAMPLE + +~~~c +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, "-"); + + /* FTP the way the neanderthals did it */ + curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.5 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 b/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 deleted file mode 100644 index af5d4ace9..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_USE_EPSV 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_USE_EPSV \- use EPSV for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPSV, long epsv); -.fi -.SH DESCRIPTION -Pass \fIepsv\fP as a long. If the value is 1, it tells curl to use the EPSV -command when doing passive FTP downloads (which it does by default). Using -EPSV means that libcurl first attempts to use the EPSV command before using -PASV. If you pass zero to this option, it does not use EPSV, only plain PASV. - -The EPSV command is a slightly newer addition to the FTP protocol than PASV -and is the preferred command to use since it enables IPv6 to be used. Very old -FTP servers might not support it, which is why libcurl has a fallback -mechanism. Sometimes that fallback is not enough and then this option might -come handy. - -If the server is an IPv6 host, this option has no effect. -.SH DEFAULT -1 -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with FTP -.SH RETURN VALUE -Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FTP_USE_EPRT (3), -.BR CURLOPT_FTPPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.md b/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.md new file mode 100644 index 000000000..985ca8ba3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_USE_EPSV +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTPPORT (3) + - CURLOPT_FTP_USE_EPRT (3) +--- + +# NAME + +CURLOPT_FTP_USE_EPSV - use EPSV for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPSV, long epsv); +~~~ + +# DESCRIPTION + +Pass *epsv* as a long. If the value is 1, it tells curl to use the EPSV +command when doing passive FTP downloads (which it does by default). Using +EPSV means that libcurl first attempts to use the EPSV command before using +PASV. If you pass zero to this option, it does not use EPSV, only plain PASV. + +The EPSV command is a slightly newer addition to the FTP protocol than PASV +and is the preferred command to use since it enables IPv6 to be used. Old FTP +servers might not support it, which is why libcurl has a fallback mechanism. +Sometimes that fallback is not enough and then this option might come handy. + +If the server is an IPv6 host, this option has no effect. + +# DEFAULT + +1 + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with FTP + +# RETURN VALUE + +Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 b/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 deleted file mode 100644 index c4538bda8..000000000 --- a/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_FTP_USE_PRET 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_FTP_USE_PRET \- use PRET for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_PRET, long enable); -.fi -.SH DESCRIPTION -Pass a long. If the value is 1, it tells curl to send a PRET command before -PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard -command for directory listings as well as up and downloads in PASV mode. Has -no effect when using the active FTP transfers mode. -.SH DEFAULT -0 -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FTP_USE_EPRT (3), -.BR CURLOPT_FTP_USE_EPSV (3) diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.md b/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.md new file mode 100644 index 000000000..f81ca4cf0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_FTP_USE_PRET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_USE_EPRT (3) + - CURLOPT_FTP_USE_EPSV (3) +--- + +# NAME + +CURLOPT_FTP_USE_PRET - use PRET for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_PRET, long enable); +~~~ + +# DESCRIPTION + +Pass a long. If the value is 1, it tells curl to send a PRET command before +PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard +command for directory listings as well as up and downloads in PASV mode. Has +no effect when using the active FTP transfers mode. + +# DEFAULT + +0 + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3 b/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3 deleted file mode 100644 index 2a711b8fa..000000000 --- a/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_GSSAPI_DELEGATION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_GSSAPI_DELEGATION \- allowed GSS-API delegation -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_GSSAPI_DELEGATION, long level); -.fi -.SH DESCRIPTION -Set the long parameter \fIlevel\fP to \fBCURLGSSAPI_DELEGATION_FLAG\fP to -allow unconditional GSSAPI credential delegation. The delegation is disabled -by default since 7.21.7. Set the parameter to -\fBCURLGSSAPI_DELEGATION_POLICY_FLAG\fP to delegate only if the OK-AS-DELEGATE -flag is set in the service ticket in case this feature is supported by the -GSS-API implementation and the definition of \fIGSS_C_DELEG_POLICY_FLAG\fP was -available at compile-time. -.SH DEFAULT -CURLGSSAPI_DELEGATION_NONE -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 - -.SH AVAILABILITY -Added in 7.22.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PROXYAUTH (3) diff --git a/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.md b/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.md new file mode 100644 index 000000000..01c1d5062 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_GSSAPI_DELEGATION.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_GSSAPI_DELEGATION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PROXYAUTH (3) +--- + +# NAME + +CURLOPT_GSSAPI_DELEGATION - allowed GSS-API delegation + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_GSSAPI_DELEGATION, long level); +~~~ + +# DESCRIPTION + +Set the long parameter *level* to **CURLGSSAPI_DELEGATION_FLAG** to allow +unconditional GSSAPI credential delegation. The delegation is disabled by +default since 7.21.7. Set the parameter to +**CURLGSSAPI_DELEGATION_POLICY_FLAG** to delegate only if the OK-AS-DELEGATE +flag is set in the service ticket in case this feature is supported by the +GSS-API implementation and the definition of *GSS_C_DELEG_POLICY_FLAG* was +available at compile-time. + +# DEFAULT + +CURLGSSAPI_DELEGATION_NONE + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.22.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 deleted file mode 100644 index 5e3865f12..000000000 --- a/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS 3 "1 Feb 2018" libcurl libcurl -.SH NAME -CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS \- head start for IPv6 for happy eyeballs -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, - long timeout); -.fi -.SH DESCRIPTION -Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6 -addresses for dual-stack hosts, preferring IPv6 first for \fItimeout\fP -milliseconds. If the IPv6 address cannot be connected to within that time then -a connection attempt is made to the IPv4 address in parallel. The first -connection to be established is the one that is used. - -The range of suggested useful values for \fItimeout\fP is limited. Happy -Eyeballs RFC 6555 says "It is RECOMMENDED that connection attempts be paced -150-250 ms apart to balance human factors against network load." libcurl -currently defaults to 200 ms. Firefox and Chrome currently default to 300 ms. -.SH DEFAULT -CURL_HET_DEFAULT (currently defined as 200L) -.SH PROTOCOLS -All except FILE -.SH EXAMPLE -.nf -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); - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.59.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH SEE ALSO -.BR CURLOPT_CONNECTTIMEOUT_MS "(3), " -.BR CURLOPT_TIMEOUT "(3), " CURLOPT_LOW_SPEED_LIMIT "(3), " diff --git a/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md new file mode 100644 index 000000000..23299c736 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT_MS (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS - head start for IPv6 for happy eyeballs + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, + long timeout); +~~~ + +# DESCRIPTION + +Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6 +addresses for dual-stack hosts, preferring IPv6 first for *timeout* +milliseconds. If the IPv6 address cannot be connected to within that time then +a connection attempt is made to the IPv4 address in parallel. The first +connection to be established is the one that is used. + +The range of suggested useful values for *timeout* is limited. Happy +Eyeballs RFC 6555 says "It is RECOMMENDED that connection attempts be paced +150-250 ms apart to balance human factors against network load." libcurl +currently defaults to 200 ms. Firefox and Chrome currently default to 300 ms. + +# DEFAULT + +CURL_HET_DEFAULT (currently defined as 200L) + +# PROTOCOLS + +All except FILE + +# EXAMPLE + +~~~c +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); + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.59.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 b/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 deleted file mode 100644 index 5c3b079d8..000000000 --- a/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HAPROXYPROTOCOL 3 "5 Feb 2018" libcurl libcurl -.SH NAME -CURLOPT_HAPROXYPROTOCOL \- send HAProxy PROXY protocol v1 header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL, - long haproxy_protocol); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to send an HAProxy PROXY -protocol v1 header at beginning of the connection. The default action is not to -send this header. - -This option is primarily useful when sending test requests to a service that -expects this header. - -Most applications do not need this option. -.SH DEFAULT -0, do not send any HAProxy PROXY protocol header -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Along with HTTP. Added in 7.60.0. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. -.SH SEE ALSO -.BR CURLOPT_PROXY "(3), " diff --git a/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.md b/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.md new file mode 100644 index 000000000..51eb2656c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HAPROXYPROTOCOL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) +--- + +# NAME + +CURLOPT_HAPROXYPROTOCOL - send HAProxy PROXY protocol v1 header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL, + long haproxy_protocol); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to send an HAProxy PROXY +protocol v1 header at beginning of the connection. The default action is not to +send this header. + +This option is primarily useful when sending test requests to a service that +expects this header. + +Most applications do not need this option. + +# DEFAULT + +0, do not send any HAProxy PROXY protocol header + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP. Added in 7.60.0. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3 b/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3 deleted file mode 100644 index a2c9b2ff4..000000000 --- a/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HAPROXY_CLIENT_IP 3 "8 May 2023" libcurl libcurl -.SH NAME -CURLOPT_HAPROXY_CLIENT_IP \- set HAProxy PROXY protocol client IP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP, - char *client_ip); -.fi -.SH DESCRIPTION -When this parameter is set to a valid IPv4 or IPv6 numerical address, the -library sends this address as client address in the HAProxy PROXY protocol v1 -header at beginning of the connection. - -This option is an alternative to \fICURLOPT_HAPROXYPROTOCOL(3)\fP as that one -cannot use a specified address. -.SH DEFAULT -NULL, no HAProxy header is sent -.SH PROTOCOLS -HTTP, HAProxy PROTOCOL -.SH EXAMPLE -.nf -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 -Along with HTTP. Added in 8.2.0. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. -.SH SEE ALSO -.BR CURLOPT_PROXY "(3), " -.BR CURLOPT_HAPROXYPROTOCOL "(3), " diff --git a/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.md b/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.md new file mode 100644 index 000000000..ac0da3a1c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HAPROXY_CLIENT_IP.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HAPROXY_CLIENT_IP +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HAPROXYPROTOCOL (3) + - CURLOPT_PROXY (3) +--- + +# NAME + +CURLOPT_HAPROXY_CLIENT_IP - set HAProxy PROXY protocol client IP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP, + char *client_ip); +~~~ + +# DESCRIPTION + +When this parameter is set to a valid IPv4 or IPv6 numerical address, the +library sends this address as client address in the HAProxy PROXY protocol v1 +header at beginning of the connection. + +This option is an alternative to CURLOPT_HAPROXYPROTOCOL(3) as that one +cannot use a specified address. + +# DEFAULT + +NULL, no HAProxy header is sent + +# PROTOCOLS + +HTTP, HAProxy PROTOCOL + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP. Added in 8.2.0. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HEADER.3 b/docs/libcurl/opts/CURLOPT_HEADER.3 deleted file mode 100644 index 193cdf1a5..000000000 --- a/docs/libcurl/opts/CURLOPT_HEADER.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HEADER 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HEADER \- pass headers to the data stream -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff); -.fi -.SH DESCRIPTION -Pass the long value \fIonoff\fP set to 1 to ask libcurl to include the headers -in the write callback (\fICURLOPT_WRITEFUNCTION(3)\fP). This option is -relevant for protocols that actually have headers or other meta-data (like -HTTP and FTP). - -When asking to get the headers passed to the same callback as the body, it is -not possible to accurately separate them again without detailed knowledge -about the protocol in use. - -Further: the \fICURLOPT_WRITEFUNCTION(3)\fP callback is limited to only ever -get a maximum of \fICURL_MAX_WRITE_SIZE\fP bytes passed to it (16KB), while a -header can be longer and the \fICURLOPT_HEADERFUNCTION(3)\fP supports getting -called with headers up to \fICURL_MAX_HTTP_HEADER\fP bytes big (100KB). - -It is often better to use \fICURLOPT_HEADERFUNCTION(3)\fP to get the header -data separately. - -While named confusingly similar, \fICURLOPT_HTTPHEADER(3)\fP is used to set -custom HTTP headers! -.SH DEFAULT -0 -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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_perform(curl); - } -} -.fi -.SH AVAILABILITY -Provided in all libcurl versions. -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HEADERFUNCTION (3), -.BR CURLOPT_HTTPHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_HEADER.md b/docs/libcurl/opts/CURLOPT_HEADER.md new file mode 100644 index 000000000..d5e272ac5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HEADER.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HEADER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERFUNCTION (3) + - CURLOPT_HTTPHEADER (3) +--- + +# NAME + +CURLOPT_HEADER - pass headers to the data stream + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff); +~~~ + +# DESCRIPTION + +Pass the long value *onoff* set to 1 to ask libcurl to include the headers +in the write callback (CURLOPT_WRITEFUNCTION(3)). This option is +relevant for protocols that actually have headers or other meta-data (like +HTTP and FTP). + +When asking to get the headers passed to the same callback as the body, it is +not possible to accurately separate them again without detailed knowledge +about the protocol in use. + +Further: the CURLOPT_WRITEFUNCTION(3) callback is limited to only ever +get a maximum of *CURL_MAX_WRITE_SIZE* bytes passed to it (16KB), while a +header can be longer and the CURLOPT_HEADERFUNCTION(3) supports getting +called with headers up to *CURL_MAX_HTTP_HEADER* bytes big (100KB). + +It is often better to use CURLOPT_HEADERFUNCTION(3) to get the header +data separately. + +While named confusingly similar, CURLOPT_HTTPHEADER(3) is used to set +custom HTTP headers! + +# DEFAULT + +0 + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Provided in all libcurl versions. + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_HEADERDATA.3 b/docs/libcurl/opts/CURLOPT_HEADERDATA.3 deleted file mode 100644 index 20e696e49..000000000 --- a/docs/libcurl/opts/CURLOPT_HEADERDATA.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HEADERDATA 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HEADERDATA \- pointer to pass to header callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP to be used to write the header part of the received data -to. - -If \fICURLOPT_WRITEFUNCTION(3)\fP or \fICURLOPT_HEADERFUNCTION(3)\fP is used, -\fIpointer\fP is passed in to the respective callback. - -If neither of those options are set, \fIpointer\fP must be a valid FILE * and -it is used by a plain fwrite() to write headers to. - -If you are using libcurl as a win32 DLL, you \fBMUST\fP use a -\fICURLOPT_WRITEFUNCTION(3)\fP or \fICURLOPT_HEADERFUNCTION(3)\fP if you set -this option or you might experience crashes. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct my_info { - int shoesize; - char *secret; -}; - -static size_t header_callback(char *buffer, size_t size, - size_t nitems, void *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; -} - -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); - - /* pass in custom data to the callback */ - curl_easy_setopt(curl, CURLOPT_HEADERDATA, &my); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR curl_easy_header (3), -.BR CURLOPT_HEADERFUNCTION (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HEADERDATA.md b/docs/libcurl/opts/CURLOPT_HEADERDATA.md new file mode 100644 index 000000000..7f056361f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HEADERDATA.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HEADERDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERFUNCTION (3) + - CURLOPT_WRITEFUNCTION (3) + - curl_easy_header (3) +--- + +# NAME + +CURLOPT_HEADERDATA - pointer to pass to header callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* to be used to write the header part of the received data +to. + +If CURLOPT_WRITEFUNCTION(3) or CURLOPT_HEADERFUNCTION(3) is used, +*pointer* is passed in to the respective callback. + +If neither of those options are set, *pointer* must be a valid FILE * and +it is used by a plain fwrite() to write headers to. + +If you are using libcurl as a win32 DLL, you **MUST** use a +CURLOPT_WRITEFUNCTION(3) or CURLOPT_HEADERFUNCTION(3) if you set +this option or you might experience crashes. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct my_info { + int shoesize; + char *secret; +}; + +static size_t header_callback(char *buffer, size_t size, + size_t nitems, void *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; +} + +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); + + /* pass in custom data to the callback */ + curl_easy_setopt(curl, CURLOPT_HEADERDATA, &my); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3 b/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.md similarity index 62% rename from docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_HEADERFUNCTION.md index 03051b193..40530c5a6 100644 --- a/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_HEADERFUNCTION.md @@ -1,32 +1,22 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HEADERFUNCTION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HEADERFUNCTION \- callback that receives header data -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HEADERFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERDATA (3) + - CURLOPT_WRITEFUNCTION (3) + - curl_easy_header (3) +--- + +# NAME + +CURLOPT_HEADERFUNCTION - callback that receives header data + +# SYNOPSIS + +~~~c #include size_t header_callback(char *buffer, @@ -36,35 +26,37 @@ size_t header_callback(char *buffer, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERFUNCTION, header_callback); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. This callback function gets invoked by libcurl as soon as it has received header data. The header callback is called once for each header and only complete header lines are passed on to the callback. Parsing headers is easy -to do using this callback. \fIbuffer\fP points to the delivered data, and the -size of that data is \fInitems\fP; \fIsize\fP is always 1. The provide header +to do using this callback. *buffer* points to the delivered data, and the +size of that data is *nitems*; *size* is always 1. The provide header line is not null-terminated! -The pointer named \fIuserdata\fP is the one you set with the -\fICURLOPT_HEADERDATA(3)\fP option. +The pointer named *userdata* is the one you set with the +CURLOPT_HEADERDATA(3) option. Your callback should return the number of bytes actually taken care of. If that amount differs from the amount passed to your callback function, it signals an error condition to the library. This causes the transfer to get -aborted and the libcurl function used returns \fICURLE_WRITE_ERROR\fP. +aborted and the libcurl function used returns *CURLE_WRITE_ERROR*. You can also abort the transfer by returning CURL_WRITEFUNC_ERROR. (7.87.0) A complete HTTP header that is passed to this function can be up to -\fICURL_MAX_HTTP_HEADER\fP (100K) bytes and includes the final line terminator. +*CURL_MAX_HTTP_HEADER* (100K) bytes and includes the final line terminator. If this option is not set, or if it is set to NULL, but -\fICURLOPT_HEADERDATA(3)\fP is set to anything but NULL, the function used to +CURLOPT_HEADERDATA(3) is set to anything but NULL, the function used to accept response data is used instead. That is the function specified with -\fICURLOPT_WRITEFUNCTION(3)\fP, or if it is not specified or NULL - the +CURLOPT_WRITEFUNCTION(3), or if it is not specified or NULL - the default, stream-writing function. It's important to note that the callback is invoked for the headers of all @@ -89,19 +81,27 @@ For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function gets called with the server responses to the commands that libcurl sends. A more convenient way to get HTTP headers might be to use -\fIcurl_easy_header(3)\fP. -.SH LIMITATIONS +curl_easy_header(3). + +# LIMITATIONS + libcurl does not unfold HTTP "folded headers" (deprecated since RFC 7230). A folded header is a header that continues on a subsequent line and starts with a whitespace. Such folds are passed to the header callback as separate ones, although strictly they are just continuations of the previous lines. -.SH DEFAULT + +# DEFAULT + Nothing. -.SH PROTOCOLS + +# PROTOCOLS + Used for all protocols with headers or meta-data concept: HTTP, FTP, POP3, IMAP, SMTP and more. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c static size_t header_callback(char *buffer, size_t size, size_t nitems, void *userdata) { @@ -121,12 +121,12 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Always -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK -.SH "SEE ALSO" -.BR curl_easy_header (3), -.BR CURLOPT_HEADERDATA (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HEADEROPT.3 b/docs/libcurl/opts/CURLOPT_HEADEROPT.3 deleted file mode 100644 index 000f2035f..000000000 --- a/docs/libcurl/opts/CURLOPT_HEADEROPT.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HEADEROPT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HEADEROPT \- send HTTP headers to both proxy and host or separately -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADEROPT, long bitmask); -.fi -.SH DESCRIPTION -Pass a long that is a bitmask of options of how to deal with headers. The two -mutually exclusive options are: - -\fBCURLHEADER_UNIFIED\fP - the headers specified in -\fICURLOPT_HTTPHEADER(3)\fP are used in requests both to servers and -proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP does not have -any effect. - -\fBCURLHEADER_SEPARATE\fP - makes \fICURLOPT_HTTPHEADER(3)\fP headers only get -sent to a server and not to a proxy. Proxy headers must be set with -\fICURLOPT_PROXYHEADER(3)\fP to get used. Note that if a non-CONNECT request -is sent to a proxy, libcurl sends both server headers and proxy headers. When -doing CONNECT, libcurl sends \fICURLOPT_PROXYHEADER(3)\fP headers only to the -proxy and then \fICURLOPT_HTTPHEADER(3)\fP headers only to the server. -.SH DEFAULT -CURLHEADER_SEPARATE (changed in 7.42.1, used CURLHEADER_UNIFIED before then) -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.37.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_PROXYHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_HEADEROPT.md b/docs/libcurl/opts/CURLOPT_HEADEROPT.md new file mode 100644 index 000000000..bb3bcf41c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HEADEROPT.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HEADEROPT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPHEADER (3) + - CURLOPT_PROXYHEADER (3) +--- + +# NAME + +CURLOPT_HEADEROPT - send HTTP headers to both proxy and host or separately + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADEROPT, long bitmask); +~~~ + +# DESCRIPTION + +Pass a long that is a bitmask of options of how to deal with headers. The two +mutually exclusive options are: + +**CURLHEADER_UNIFIED** - the headers specified in +CURLOPT_HTTPHEADER(3) are used in requests both to servers and +proxies. With this option enabled, CURLOPT_PROXYHEADER(3) does not have +any effect. + +**CURLHEADER_SEPARATE** - makes CURLOPT_HTTPHEADER(3) headers only get +sent to a server and not to a proxy. Proxy headers must be set with +CURLOPT_PROXYHEADER(3) to get used. Note that if a non-CONNECT request +is sent to a proxy, libcurl sends both server headers and proxy headers. When +doing CONNECT, libcurl sends CURLOPT_PROXYHEADER(3) headers only to the +proxy and then CURLOPT_HTTPHEADER(3) headers only to the server. + +# DEFAULT + +CURLHEADER_SEPARATE (changed in 7.42.1, used CURLHEADER_UNIFIED before then) + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.37.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HSTS.3 b/docs/libcurl/opts/CURLOPT_HSTS.3 deleted file mode 100644 index 30d3f3753..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTS.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTS 3 "5 Feb 2019" libcurl libcurl -.SH NAME -CURLOPT_HSTS \- HSTS cache file name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS, char *filename); -.fi -.SH DESCRIPTION -Make the \fIfilename\fP point to a file name to load an existing HSTS cache -from, and to store the cache in when the easy handle is closed. Setting a file -name with this option also enables HSTS for this handle (the equivalent of -setting \fICURLHSTS_ENABLE\fP with \fICURLOPT_HSTS_CTRL(3)\fP). - -If the given file does not exist or contains no HSTS entries at startup, the -HSTS cache simply starts empty. Setting the file name to NULL or "" only -enables HSTS without reading from or writing to any file. - -If this option is set multiple times, libcurl loads cache entries from each -given file but only stores the last used name for later writing. -.SH "FILE FORMAT" -The HSTS cache is saved to and loaded from a text file with one entry per -physical line. Each line in the file has the following format: - -[host] [stamp] - -[host] is the domain name for the entry and the name is dot-prefixed if it is -an entry valid for all subdomains to the name as well or only for the exact -name. - -[stamp] is the time (in UTC) when the entry expires and it uses the format -\&"YYYYMMDD HH:MM:SS". - -Lines starting with "#" are treated as comments and are ignored. There is -currently no length or size limit. -.SH DEFAULT -NULL, no file name -.SH PROTOCOLS -HTTPS and HTTP -.SH EXAMPLE -.nf -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 -Added in 7.74.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ALTSVC (3), -.BR CURLOPT_HSTS_CTRL (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTS.md b/docs/libcurl/opts/CURLOPT_HSTS.md new file mode 100644 index 000000000..5d9720669 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTS.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ALTSVC (3) + - CURLOPT_HSTS_CTRL (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_HSTS - HSTS cache file name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS, char *filename); +~~~ + +# DESCRIPTION + +Make the *filename* point to a file name to load an existing HSTS cache +from, and to store the cache in when the easy handle is closed. Setting a file +name with this option also enables HSTS for this handle (the equivalent of +setting *CURLHSTS_ENABLE* with CURLOPT_HSTS_CTRL(3)). + +If the given file does not exist or contains no HSTS entries at startup, the +HSTS cache simply starts empty. Setting the file name to NULL or "" only +enables HSTS without reading from or writing to any file. + +If this option is set multiple times, libcurl loads cache entries from each +given file but only stores the last used name for later writing. + +# FILE FORMAT + +The HSTS cache is saved to and loaded from a text file with one entry per +physical line. Each line in the file has the following format: + +[host] [stamp] + +[host] is the domain name for the entry and the name is dot-prefixed if it is +an entry valid for all subdomains to the name as well or only for the exact +name. + +[stamp] is the time (in UTC) when the entry expires and it uses the format +&"YYYYMMDD HH:MM:SS". + +Lines starting with "#" are treated as comments and are ignored. There is +currently no length or size limit. + +# DEFAULT + +NULL, no file name + +# PROTOCOLS + +HTTPS and HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_HSTS, "/home/user/.hsts-cache"); + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 b/docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 deleted file mode 100644 index 3097fbda8..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTSREADDATA 3 "14 Sep 2020" libcurl libcurl -.SH NAME -CURLOPT_HSTSREADDATA \- pointer passed to the HSTS read callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADDATA, void *pointer); -.fi -.SH DESCRIPTION -Data \fIpointer\fP to pass to the HSTS read function. If you use the -\fICURLOPT_HSTSREADFUNCTION(3)\fP option, this is the pointer you get as input -in the 3rd argument to the callback. - -This option does not enable HSTS, you need to use \fICURLOPT_HSTS_CTRL(3)\fP to -do that. -.SH DEFAULT -NULL -.SH PROTOCOLS -This feature is only used for HTTP(S) transfer. -.SH EXAMPLE -.nf -struct MyData { - void *custom; -}; - -int main(void) -{ - CURL *curl = curl_easy_init(); - struct MyData this; - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - - /* 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 -Added in 7.74.0 -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HSTS (3), -.BR CURLOPT_HSTSREADFUNCTION (3), -.BR CURLOPT_HSTSWRITEDATA (3), -.BR CURLOPT_HSTSWRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTSREADDATA.md b/docs/libcurl/opts/CURLOPT_HSTSREADDATA.md new file mode 100644 index 000000000..8fbb888d3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTSREADDATA.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTSREADDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HSTS (3) + - CURLOPT_HSTSREADFUNCTION (3) + - CURLOPT_HSTSWRITEDATA (3) + - CURLOPT_HSTSWRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_HSTSREADDATA - pointer passed to the HSTS read callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADDATA, void *pointer); +~~~ + +# DESCRIPTION + +Data *pointer* to pass to the HSTS read function. If you use the +CURLOPT_HSTSREADFUNCTION(3) option, this is the pointer you get as input +in the 3rd argument to the callback. + +This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to +do that. + +# DEFAULT + +NULL + +# PROTOCOLS + +This feature is only used for HTTP(S) transfer. + +# EXAMPLE + +~~~c +struct MyData { + void *custom; +}; + +int main(void) +{ + CURL *curl = curl_easy_init(); + struct MyData this; + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* pass pointer that gets passed in to the + CURLOPT_HSTSREADFUNCTION callback */ + curl_easy_setopt(curl, CURLOPT_HSTSREADDATA, &this); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 b/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 deleted file mode 100644 index 9fcd04645..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTSREADFUNCTION 3 "14 Sep 2020" libcurl libcurl -.SH NAME -CURLOPT_HSTSREADFUNCTION \- read callback for HSTS hosts -.SH SYNOPSIS -.nf -#include - -struct curl_hstsentry { - char *name; - size_t namelen; - unsigned int includeSubDomains:1; - char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */ -}; - -CURLSTScode hstsread(CURL *easy, struct curl_hstsentry *sts, void *clientp); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADFUNCTION, hstsread); -.fi -.SH DESCRIPTION -Pass a pointer to your callback function, as the prototype shows above. - -This callback function gets called by libcurl repeatedly when it populates the -in-memory HSTS cache. - -Set the \fIclientp\fP argument with the \fICURLOPT_HSTSREADDATA(3)\fP option -or it is NULL. - -When this callback is invoked, the \fIsts\fP pointer points to a populated -struct: Copy the host name to \fIname\fP (no longer than \fInamelen\fP -bytes). Make it null-terminated. Set \fIincludeSubDomains\fP to TRUE or -FALSE. Set \fIexpire\fP to a date stamp or a zero length string for *forever* -(wrong date stamp format might cause the name to not get accepted) - -The callback should return \fICURLSTS_OK\fP if it returns a name and is -prepared to be called again (for another host) or \fICURLSTS_DONE\fP if it has -no entry to return. It can also return \fICURLSTS_FAIL\fP to signal -error. Returning \fICURLSTS_FAIL\fP stops the transfer from being performed -and make \fICURLE_ABORTED_BY_CALLBACK\fP get returned. - -This option does not enable HSTS, you need to use \fICURLOPT_HSTS_CTRL(3)\fP to -do that. -.SH DEFAULT -NULL - no callback. -.SH PROTOCOLS -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) -{ - 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, &my_stuff); - - res = curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.74.0 -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HSTS (3), -.BR CURLOPT_HSTS_CTRL (3), -.BR CURLOPT_HSTSREADDATA (3), -.BR CURLOPT_HSTSWRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.md b/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.md new file mode 100644 index 000000000..5e60feb9e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.md @@ -0,0 +1,106 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTSREADFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HSTS (3) + - CURLOPT_HSTSREADDATA (3) + - CURLOPT_HSTSWRITEFUNCTION (3) + - CURLOPT_HSTS_CTRL (3) +--- + +# NAME + +CURLOPT_HSTSREADFUNCTION - read callback for HSTS hosts + +# SYNOPSIS + +~~~c +#include + +struct curl_hstsentry { + char *name; + size_t namelen; + unsigned int includeSubDomains:1; + char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */ +}; + +CURLSTScode hstsread(CURL *easy, struct curl_hstsentry *sts, void *clientp); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSREADFUNCTION, hstsread); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, as the prototype shows above. + +This callback function gets called by libcurl repeatedly when it populates the +in-memory HSTS cache. + +Set the *clientp* argument with the CURLOPT_HSTSREADDATA(3) option +or it is NULL. + +When this callback is invoked, the *sts* pointer points to a populated +struct: Copy the host name to *name* (no longer than *namelen* +bytes). Make it null-terminated. Set *includeSubDomains* to TRUE or +FALSE. Set *expire* to a date stamp or a zero length string for *forever* +(wrong date stamp format might cause the name to not get accepted) + +The callback should return *CURLSTS_OK* if it returns a name and is +prepared to be called again (for another host) or *CURLSTS_DONE* if it has +no entry to return. It can also return *CURLSTS_FAIL* to signal +error. Returning *CURLSTS_FAIL* stops the transfer from being performed +and make *CURLE_ABORTED_BY_CALLBACK* get returned. + +This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to +do that. + +# DEFAULT + +NULL - no callback. + +# PROTOCOLS + +This feature is only used for HTTP(S) transfer. + +# EXAMPLE + +~~~c +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) +{ + 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, &my_stuff); + + res = curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 b/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 deleted file mode 100644 index 04b7d383e..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTSWRITEDATA 3 "14 Sep 2020" libcurl libcurl -.SH NAME -CURLOPT_HSTSWRITEDATA \- pointer passed to the HSTS write callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEDATA, void *pointer); -.fi -.SH DESCRIPTION -Data \fIpointer\fP to pass to the HSTS write function. If you use the -\fICURLOPT_HSTSWRITEFUNCTION(3)\fP option, this is the pointer you get as -input in the fourth argument to the callback. - -This option does not enable HSTS, you need to use \fICURLOPT_HSTS_CTRL(3)\fP to -do that. -.SH DEFAULT -NULL -.SH PROTOCOLS -This feature is only used for HTTP(S) transfer. -.SH EXAMPLE -.nf -struct MyData { - void *custom; -}; - -int main(void) -{ - CURL *curl = curl_easy_init(); - struct MyData this; - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - - /* 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 -Added in 7.74.0 -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HSTS (3), -.BR CURLOPT_HSTSREADDATA (3), -.BR CURLOPT_HSTSREADFUNCTION (3), -.BR CURLOPT_HSTSWRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.md b/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.md new file mode 100644 index 000000000..b4486d7a3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTSWRITEDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HSTS (3) + - CURLOPT_HSTSREADDATA (3) + - CURLOPT_HSTSREADFUNCTION (3) + - CURLOPT_HSTSWRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_HSTSWRITEDATA - pointer passed to the HSTS write callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEDATA, void *pointer); +~~~ + +# DESCRIPTION + +Data *pointer* to pass to the HSTS write function. If you use the +CURLOPT_HSTSWRITEFUNCTION(3) option, this is the pointer you get as +input in the fourth argument to the callback. + +This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to +do that. + +# DEFAULT + +NULL + +# PROTOCOLS + +This feature is only used for HTTP(S) transfer. + +# EXAMPLE + +~~~c +struct MyData { + void *custom; +}; + +int main(void) +{ + CURL *curl = curl_easy_init(); + struct MyData this; + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* pass pointer that gets passed in to the + CURLOPT_HSTSWRITEFUNCTION callback */ + curl_easy_setopt(curl, CURLOPT_HSTSWRITEDATA, &this); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 b/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 deleted file mode 100644 index e5b3a950b..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 +++ /dev/null @@ -1,112 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTSWRITEFUNCTION 3 "14 Sep 2020" libcurl libcurl -.SH NAME -CURLOPT_HSTSWRITEFUNCTION \- write callback for HSTS hosts -.SH SYNOPSIS -.nf -#include - -struct curl_hstsentry { - char *name; - size_t namelen; - unsigned int includeSubDomains:1; - char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */ -}; - -struct curl_index { - size_t index; /* the provided entry's "index" or count */ - size_t total; /* total number of entries to save */ -}; - -CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *sts, - struct curl_index *count, void *clientp); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEFUNCTION, hstswrite); -.fi -.SH DESCRIPTION -Pass a pointer to your callback function, as the prototype shows above. - -This callback function gets called by libcurl repeatedly to allow the -application to store the in-memory HSTS cache when libcurl is about to discard -it. - -Set the \fIclientp\fP argument with the \fICURLOPT_HSTSWRITEDATA(3)\fP option -or it is NULL. -When the callback is invoked, the \fIsts\fP pointer points to a populated -struct: Read the host name to 'name' (it is \fInamelen\fP bytes long and null -terminated. The \fIincludeSubDomains\fP field is non-zero if the entry matches -subdomains. The \fIexpire\fP string is a date stamp null-terminated string -using the syntax YYYYMMDD HH:MM:SS. - -The callback should return \fICURLSTS_OK\fP if it succeeded and is prepared to -be called again (for another host) or \fICURLSTS_DONE\fP if there is nothing -more to do. It can also return \fICURLSTS_FAIL\fP to signal error. - -This option does not enable HSTS, you need to use \fICURLOPT_HSTS_CTRL(3)\fP to -do that. -.SH DEFAULT -NULL - no callback. -.SH PROTOCOLS -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) -{ - 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, &my_stuff); - - res = curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.74.0 -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HSTS (3), -.BR CURLOPT_HSTS_CTRL (3), -.BR CURLOPT_HSTSWRITEDATA (3), -.BR CURLOPT_HSTSWRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.md b/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.md new file mode 100644 index 000000000..229b12e31 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.md @@ -0,0 +1,110 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTSWRITEFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HSTS (3) + - CURLOPT_HSTSWRITEDATA (3) + - CURLOPT_HSTSWRITEFUNCTION (3) + - CURLOPT_HSTS_CTRL (3) +--- + +# NAME + +CURLOPT_HSTSWRITEFUNCTION - write callback for HSTS hosts + +# SYNOPSIS + +~~~c +#include + +struct curl_hstsentry { + char *name; + size_t namelen; + unsigned int includeSubDomains:1; + char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */ +}; + +struct curl_index { + size_t index; /* the provided entry's "index" or count */ + size_t total; /* total number of entries to save */ +}; + +CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *sts, + struct curl_index *count, void *clientp); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTSWRITEFUNCTION, hstswrite); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, as the prototype shows above. + +This callback function gets called by libcurl repeatedly to allow the +application to store the in-memory HSTS cache when libcurl is about to discard +it. + +Set the *clientp* argument with the CURLOPT_HSTSWRITEDATA(3) option +or it is NULL. +When the callback is invoked, the *sts* pointer points to a populated +struct: Read the host name to 'name' (it is *namelen* bytes long and null +terminated. The *includeSubDomains* field is non-zero if the entry matches +subdomains. The *expire* string is a date stamp null-terminated string +using the syntax YYYYMMDD HH:MM:SS. + +The callback should return *CURLSTS_OK* if it succeeded and is prepared to +be called again (for another host) or *CURLSTS_DONE* if there is nothing +more to do. It can also return *CURLSTS_FAIL* to signal error. + +This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to +do that. + +# DEFAULT + +NULL - no callback. + +# PROTOCOLS + +This feature is only used for HTTP(S) transfer. + +# EXAMPLE + +~~~c +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) +{ + 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, &my_stuff); + + res = curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 b/docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 deleted file mode 100644 index 2747ccdd7..000000000 --- a/docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HSTS_CTRL 3 "4 Sep 2020" libcurl libcurl -.SH NAME -CURLOPT_HSTS_CTRL \- control HSTS behavior -.SH SYNOPSIS -.nf -#include - -#define CURLHSTS_ENABLE (1<<0) -#define CURLHSTS_READONLYFILE (1<<1) - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask); -.fi -.SH DESCRIPTION -HSTS (HTTP Strict Transport Security) means that an HTTPS server can instruct -the client to not contact it again over clear-text HTTP for a certain period -into the future. libcurl then automatically redirects HTTP attempts to such -hosts to instead use HTTPS. This is done by libcurl retaining this knowledge -in an in-memory cache. - -Populate the long \fIbitmask\fP with the correct set of features to instruct -libcurl how to handle HSTS for the transfers using this handle. -.SH BITS -.IP "CURLHSTS_ENABLE" -Enable the in-memory HSTS cache for this handle. -.IP "CURLHSTS_READONLYFILE" -Make the HSTS file (if specified) read-only - makes libcurl not save the cache -to the file when closing the handle. -.SH DEFAULT -0. HSTS is disabled by default. -.SH PROTOCOLS -HTTPS and HTTP -.SH EXAMPLE -.nf -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 -Added in 7.74.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ALTSVC (3), -.BR CURLOPT_CONNECT_TO (3), -.BR CURLOPT_HSTS (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_HSTS_CTRL.md b/docs/libcurl/opts/CURLOPT_HSTS_CTRL.md new file mode 100644 index 000000000..d60e58f0f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HSTS_CTRL.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HSTS_CTRL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ALTSVC (3) + - CURLOPT_CONNECT_TO (3) + - CURLOPT_HSTS (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_HSTS_CTRL - control HSTS behavior + +# SYNOPSIS + +~~~c +#include + +#define CURLHSTS_ENABLE (1<<0) +#define CURLHSTS_READONLYFILE (1<<1) + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask); +~~~ + +# DESCRIPTION + +HSTS (HTTP Strict Transport Security) means that an HTTPS server can instruct +the client to not contact it again over clear-text HTTP for a certain period +into the future. libcurl then automatically redirects HTTP attempts to such +hosts to instead use HTTPS. This is done by libcurl retaining this knowledge +in an in-memory cache. + +Populate the long *bitmask* with the correct set of features to instruct +libcurl how to handle HSTS for the transfers using this handle. + +# BITS + +## CURLHSTS_ENABLE + +Enable the in-memory HSTS cache for this handle. + +## CURLHSTS_READONLYFILE + +Make the HSTS file (if specified) read-only - makes libcurl not save the cache +to the file when closing the handle. + +# DEFAULT + +0. HSTS is disabled by default. + +# PROTOCOLS + +HTTPS and HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE); + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.74.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 b/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 deleted file mode 100644 index af8f26bae..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTP09_ALLOWED 3 "17 Dec 2018" libcurl libcurl -.SH NAME -CURLOPT_HTTP09_ALLOWED \- allow HTTP/0.9 response -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP09_ALLOWED, long allowed); -.fi -.SH DESCRIPTION -Pass the long argument \fIallowed\fP set to 1L to allow HTTP/0.9 responses. - -An HTTP/0.9 response is a server response entirely without headers and only a -body. You can connect to lots of random TCP services and still get a response -that curl might consider to be HTTP/0.9! -.SH DEFAULT -curl allowed HTTP/0.9 responses by default before 7.66.0 - -Since 7.66.0, libcurl requires this option set to 1L to allow HTTP/0.9 -responses. -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Option added in 7.64.0, present along with HTTP. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.md b/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.md new file mode 100644 index 000000000..d3594926f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTP09_ALLOWED +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_SSLVERSION (3) +--- + +# NAME + +CURLOPT_HTTP09_ALLOWED - allow HTTP/0.9 response + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP09_ALLOWED, long allowed); +~~~ + +# DESCRIPTION + +Pass the long argument *allowed* set to 1L to allow HTTP/0.9 responses. + +An HTTP/0.9 response is a server response entirely without headers and only a +body. You can connect to lots of random TCP services and still get a response +that curl might consider to be HTTP/0.9! + +# DEFAULT + +curl allowed HTTP/0.9 responses by default before 7.66.0 + +Since 7.66.0, libcurl requires this option set to 1L to allow HTTP/0.9 +responses. + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Option added in 7.64.0, present along with HTTP. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.3 b/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.3 deleted file mode 100644 index 05a0e3ac3..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTP200ALIASES 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTP200ALIASES \- alternative matches for HTTP 200 OK -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP200ALIASES, - struct curl_slist *aliases); -.SH DESCRIPTION -Pass a pointer to a linked list of \fIaliases\fP to be treated as valid HTTP -200 responses. Some servers respond with a custom header response line. For -example, SHOUTcast servers respond with "ICY 200 OK". Also some old Icecast -1.3.x servers respond like that for certain user agent headers or in absence -of such. By including this string in your list of aliases, the response gets -treated as a valid HTTP header line such as "HTTP/1.0 200 OK". - -The linked list should be a fully valid list of struct curl_slist structs, and -be properly filled in. Use \fIcurl_slist_append(3)\fP to create the list and -\fIcurl_slist_free_all(3)\fP to clean up an entire list. - -The alias itself is not parsed for any version strings. The protocol is -assumed to match HTTP 1.0 when an alias match. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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"); - - curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list); - curl_easy_perform(curl); - curl_slist_free_all(list); /* free the list again */ - } -} -.fi -.SH AVAILABILITY -Added in 7.10.3 -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP09_ALLOWED (3), -.BR CURLOPT_HTTP_VERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.md b/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.md new file mode 100644 index 000000000..b48faf603 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTP200ALIASES.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTP200ALIASES +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP09_ALLOWED (3) + - CURLOPT_HTTP_VERSION (3) +--- + +# NAME + +CURLOPT_HTTP200ALIASES - alternative matches for HTTP 200 OK + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP200ALIASES, + struct curl_slist *aliases); +~~~ + +# DESCRIPTION + +Pass a pointer to a linked list of *aliases* to be treated as valid HTTP 200 +responses. Some servers respond with a custom header response line. For +example, SHOUTcast servers respond with "ICY 200 OK". Also some old Icecast +1.3.x servers respond like that for certain user agent headers or in absence +of such. By including this string in your list of aliases, the response gets +treated as a valid HTTP header line such as "HTTP/1.0 200 OK". + +The linked list should be a fully valid list of struct curl_slist structs, and +be properly filled in. Use curl_slist_append(3) to create the list and +curl_slist_free_all(3) to clean up an entire list. + +The alias itself is not parsed for any version strings. The protocol is +assumed to match HTTP 1.0 when an alias match. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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"); + + curl_easy_setopt(curl, CURLOPT_HTTP200ALIASES, list); + curl_easy_perform(curl); + curl_slist_free_all(list); /* free the list again */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.3 + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTPAUTH.3 b/docs/libcurl/opts/CURLOPT_HTTPAUTH.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_HTTPAUTH.3 rename to docs/libcurl/opts/CURLOPT_HTTPAUTH.md index 661f52942..ca92f5eb0 100644 --- a/docs/libcurl/opts/CURLOPT_HTTPAUTH.3 +++ b/docs/libcurl/opts/CURLOPT_HTTPAUTH.md @@ -1,36 +1,29 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTPAUTH 3 "2 Aug 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTPAUTH \- HTTP server authentication methods to try -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTPAUTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PASSWORD (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_HTTPAUTH - HTTP server authentication methods to try + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPAUTH, long bitmask); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) you want it to use speaking to the remote server. @@ -38,76 +31,103 @@ The available bits are listed below. If more than one bit is set, libcurl first queries the host to see which authentication methods it supports and then picks the best one you allow it to use. For some methods, this induces an extra network round-trip. Set the actual name and password with the -\fICURLOPT_USERPWD(3)\fP option or with the \fICURLOPT_USERNAME(3)\fP and the -\fICURLOPT_PASSWORD(3)\fP options. +CURLOPT_USERPWD(3) option or with the CURLOPT_USERNAME(3) and the +CURLOPT_PASSWORD(3) options. -For authentication with a proxy, see \fICURLOPT_PROXYAUTH(3)\fP. +For authentication with a proxy, see CURLOPT_PROXYAUTH(3). + +## CURLAUTH_BASIC -.IP CURLAUTH_BASIC HTTP Basic authentication. This is the default choice, and the only method that is in wide-spread use and supported virtually everywhere. This sends the user name and password over the network in plain text, easily captured by others. -.IP CURLAUTH_DIGEST -HTTP Digest authentication. Digest authentication is defined in RFC 2617 and + +## CURLAUTH_DIGEST + +HTTP Digest authentication. Digest authentication is defined in RFC 2617 and is a more secure way to do authentication over public networks than the regular old-fashioned Basic method. -.IP CURLAUTH_DIGEST_IE -HTTP Digest authentication with an IE flavor. Digest authentication is -defined in RFC 2617 and is a more secure way to do authentication over public -networks than the regular old-fashioned Basic method. The IE flavor is simply -that libcurl uses a special "quirk" that IE is known to have used before -version 7 and that some servers require the client to use. -.IP CURLAUTH_BEARER + +## CURLAUTH_DIGEST_IE + +HTTP Digest authentication with an IE flavor. Digest authentication is defined +in RFC 2617 and is a more secure way to do authentication over public networks +than the regular old-fashioned Basic method. The IE flavor is simply that +libcurl uses a special "quirk" that IE is known to have used before version 7 +and that some servers require the client to use. + +## CURLAUTH_BEARER + HTTP Bearer token authentication, used primarily in OAuth 2.0 protocol. -You can set the Bearer token to use with \fICURLOPT_XOAUTH2_BEARER(3)\fP. -.IP CURLAUTH_NEGOTIATE +You can set the Bearer token to use with CURLOPT_XOAUTH2_BEARER(3). + +## CURLAUTH_NEGOTIATE + HTTP Negotiate (SPNEGO) authentication. Negotiate authentication is defined in RFC 4559 and is the most secure way to perform authentication over HTTP. You need to build libcurl with a suitable GSS-API library or SSPI on Windows for this to work. -.IP CURLAUTH_NTLM + +## CURLAUTH_NTLM + HTTP NTLM authentication. A proprietary protocol invented and used by Microsoft. It uses a challenge-response and hash concept similar to Digest, to prevent the password from being eavesdropped. You need to build libcurl with either OpenSSL or GnuTLS support for this option to work, or build libcurl on Windows with SSPI support. -.IP CURLAUTH_NTLM_WB + +## CURLAUTH_NTLM_WB + NTLM delegating to winbind helper. Authentication is performed by a separate binary application that is executed when needed. The name of the application -is specified at compile time but is typically \fB/usr/bin/ntlm_auth\fP. +is specified at compile time but is typically **/usr/bin/ntlm_auth**. Note that libcurl forks when necessary to run the winbind application and kill -it when complete, calling \fBwaitpid()\fP to await its exit when done. On -POSIX operating systems, killing the process causes a SIGCHLD signal to be -raised (regardless of whether \fICURLOPT_NOSIGNAL(3)\fP is set), which must be -handled intelligently by the application. In particular, the application must -not unconditionally call wait() in its SIGCHLD signal handler to avoid being -subject to a race condition. This behavior is subject to change in future +it when complete, calling **waitpid()** to await its exit when done. On POSIX +operating systems, killing the process causes a SIGCHLD signal to be raised +(regardless of whether CURLOPT_NOSIGNAL(3) is set), which must be handled +intelligently by the application. In particular, the application must not +unconditionally call wait() in its SIGCHLD signal handler to avoid being +subject to a race condition. This behavior is subject to change in future versions of libcurl. -.IP CURLAUTH_ANY + +## CURLAUTH_ANY + This is a convenience macro that sets all bits and thus makes libcurl pick any it finds suitable. libcurl automatically selects the one it finds most secure. -.IP CURLAUTH_ANYSAFE + +## CURLAUTH_ANYSAFE + This is a convenience macro that sets all bits except Basic and thus makes libcurl pick any it finds suitable. libcurl automatically selects the one it finds most secure. -.IP CURLAUTH_ONLY + +## CURLAUTH_ONLY + This is a meta symbol. OR this value together with a single specific auth value to force libcurl to probe for unrestricted auth and if not, only that single auth algorithm is acceptable. -.IP CURLAUTH_AWS_SIGV4 + +## CURLAUTH_AWS_SIGV4 + provides AWS V4 signature authentication on HTTPS header -see \fICURLOPT_AWS_SIGV4(3)\fP. -.SH DEFAULT +see CURLOPT_AWS_SIGV4(3). + +# DEFAULT + CURLAUTH_BASIC -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -120,8 +140,10 @@ int main(void) ret = curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Option Added in 7.10.6. CURLAUTH_DIGEST_IE was added in 7.19.3 @@ -133,11 +155,9 @@ CURLAUTH_NTLM_WB was added in 7.22.0 CURLAUTH_BEARER was added in 7.61.0 CURLAUTH_AWS_SIGV4 was added in 7.74.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication methods. -.SH "SEE ALSO" -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_PROXYAUTH (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTPGET.3 b/docs/libcurl/opts/CURLOPT_HTTPGET.3 deleted file mode 100644 index 9a3af4d7c..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTPGET.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTPGET 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTPGET \- ask for an HTTP GET request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget); -.fi -.SH DESCRIPTION -Pass a long. If \fIuseget\fP is 1, this forces the HTTP request to get back to -using GET. Usable if a POST, HEAD, PUT, etc has been used previously using the -same curl \fIhandle\fP. - -When setting \fICURLOPT_HTTPGET(3)\fP to 1, libcurl automatically sets -\fICURLOPT_NOBODY(3)\fP to 0 and \fICURLOPT_UPLOAD(3)\fP to 0. - -Setting this option to zero has no effect. Applications need to explicitly -select which HTTP request method to use, they cannot deselect a method. To -reset a handle to default method, consider \fIcurl_easy_reset(3)\fP. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_easy_reset (3), -.BR CURLOPT_NOBODY (3), -.BR CURLOPT_POST (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTPGET.md b/docs/libcurl/opts/CURLOPT_HTTPGET.md new file mode 100644 index 000000000..d8b024d8e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTPGET.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTPGET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NOBODY (3) + - CURLOPT_POST (3) + - CURLOPT_UPLOAD (3) + - curl_easy_reset (3) +--- + +# NAME + +CURLOPT_HTTPGET - ask for an HTTP GET request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget); +~~~ + +# DESCRIPTION + +Pass a long. If *useget* is 1, this forces the HTTP request to get back to +using GET. Usable if a POST, HEAD, PUT, etc has been used previously using the +same curl *handle*. + +When setting CURLOPT_HTTPGET(3) to 1, libcurl automatically sets +CURLOPT_NOBODY(3) to 0 and CURLOPT_UPLOAD(3) to 0. + +Setting this option to zero has no effect. Applications need to explicitly +select which HTTP request method to use, they cannot deselect a method. To +reset a handle to default method, consider curl_easy_reset(3). + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 b/docs/libcurl/opts/CURLOPT_HTTPHEADER.md similarity index 62% rename from docs/libcurl/opts/CURLOPT_HTTPHEADER.3 rename to docs/libcurl/opts/CURLOPT_HTTPHEADER.md index a750b9810..0170336ac 100644 --- a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 +++ b/docs/libcurl/opts/CURLOPT_HTTPHEADER.md @@ -1,50 +1,45 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTPHEADER 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTPHEADER \- set of HTTP headers -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTPHEADER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_HEADER (3) + - CURLOPT_HEADEROPT (3) + - CURLOPT_MIMEPOST (3) + - CURLOPT_PROXYHEADER (3) + - curl_mime_init (3) +--- + +# NAME + +CURLOPT_HTTPHEADER - set of HTTP headers + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPHEADER, struct curl_slist *headers); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a linked list of HTTP headers to pass to the server and/or proxy in your HTTP request. The same list can be used for both host and proxy requests! When used within an IMAP or SMTP request to upload a MIME mail, the given header list establishes the document-level MIME headers to prepend to the -uploaded document described by \fICURLOPT_MIMEPOST(3)\fP. This does not affect +uploaded document described by CURLOPT_MIMEPOST(3). This does not affect raw mail uploads. -The linked list should be a fully valid list of \fBstruct curl_slist\fP -structs properly filled in. Use \fIcurl_slist_append(3)\fP to create the list -and \fIcurl_slist_free_all(3)\fP to clean up an entire list. If you add a +The linked list should be a fully valid list of **struct curl_slist** +structs properly filled in. Use curl_slist_append(3) to create the list +and curl_slist_free_all(3) to clean up an entire list. If you add a header that is otherwise generated and used by libcurl internally, your added header is used instead. If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header is @@ -53,7 +48,7 @@ headers and remove internal headers. To add a header with no content (nothing to the right side of the colon), use the form 'name;' (note the ending semicolon). -The headers included in the linked list \fBmust not\fP be CRLF-terminated, +The headers included in the linked list **must not** be CRLF-terminated, because libcurl adds CRLF after each header item itself. Failure to comply with this might result in strange behavior. libcurl passes on the verbatim strings you give it, without any filter or other safe guards. That includes @@ -63,39 +58,51 @@ The first line in an HTTP request (containing the method, usually a GET or POST) is not a header and cannot be replaced using this option. Only the lines following the request-line are headers. Adding this method line in this list of headers only causes your request to send an invalid header. Use -\fICURLOPT_CUSTOMREQUEST(3)\fP to change the method. +CURLOPT_CUSTOMREQUEST(3) to change the method. -When this option is passed to \fIcurl_easy_setopt(3)\fP, libcurl does not copy -the entire list so you \fBmust\fP keep it around until you no longer use this -\fIhandle\fP for a transfer before you call \fIcurl_slist_free_all(3)\fP on +When this option is passed to curl_easy_setopt(3), libcurl does not copy +the entire list so you **must** keep it around until you no longer use this +*handle* for a transfer before you call curl_slist_free_all(3) on the list. Pass a NULL to this option to reset back to no custom headers. The most commonly replaced HTTP headers have "shortcuts" in the options -\fICURLOPT_COOKIE(3)\fP, \fICURLOPT_USERAGENT(3)\fP and -\fICURLOPT_REFERER(3)\fP. We recommend using those. +CURLOPT_COOKIE(3), CURLOPT_USERAGENT(3) and +CURLOPT_REFERER(3). We recommend using those. There is an alternative option that sets or replaces headers only for requests -that are sent with CONNECT to a proxy: \fICURLOPT_PROXYHEADER(3)\fP. Use -\fICURLOPT_HEADEROPT(3)\fP to control the behavior. -.SH SPECIFIC HTTP HEADERS +that are sent with CONNECT to a proxy: CURLOPT_PROXYHEADER(3). Use +CURLOPT_HEADEROPT(3) to control the behavior. + +# SPECIFIC HTTP HEADERS + Setting some specific headers causes libcurl to act differently. -.IP "Host:" + +## Host: + The specified host name is used for cookie matching if the cookie engine is also enabled for this transfer. If the request is done over HTTP/2 or HTTP/3, the custom host name is instead used in the ":authority" header field and Host: is not sent at all over the wire. -.IP "Transfer-Encoding: chunked" + +## Transfer-Encoding: chunked + Tells libcurl the upload is to be done using this chunked encoding instead of providing the Content-Length: field in the request. -.SH SPECIFIC MIME HEADERS + +# SPECIFIC MIME HEADERS + When used to build a MIME e-mail for IMAP or SMTP, the following document-level headers can be set to override libcurl-generated values: -.IP "Mime-Version:" + +## Mime-Version: + Tells the parser at the receiving site how to interpret the MIME framing. It defaults to "1.0" and should normally not be altered. -.IP "Content-Type:" + +## Content-Type: + Indicates the document's global structure type. By default, libcurl sets it to "multipart/mixed", describing a document made of independent parts. When a MIME mail is only composed of alternative representations of the same data @@ -107,35 +114,43 @@ Other specific headers that do not have a libcurl default value but are strongly desired by mail delivery and user agents should also be included. These are "From:", "To:", "Date:" and "Subject:" among others and their presence and value is generally checked by anti-spam utilities. -.SH SECURITY CONCERNS + +# SECURITY CONCERNS + By default, this option makes libcurl send the given headers in all HTTP requests done by this handle. You should therefore use this option with caution if you for example connect to the remote site using a proxy and a CONNECT request, you should to consider if that proxy is supposed to also get the headers. They may be private or otherwise sensitive to leak. -Use \fICURLOPT_HEADEROPT(3)\fP to make the headers only get sent to where you +Use CURLOPT_HEADEROPT(3) to make the headers only get sent to where you intend them to get sent. Custom headers are sent in all requests done by the easy handle, which implies that if you tell libcurl to follow redirects -(\fICURLOPT_FOLLOWLOCATION(3)\fP), the same set of custom headers is sent in +(CURLOPT_FOLLOWLOCATION(3)), the same set of custom headers is sent in the subsequent request. Redirects can of course go to other hosts and thus those servers get all the contents of your custom headers too. Starting in 7.58.0, libcurl specifically prevents "Authorization:" headers from being sent to other hosts than the first used one, unless specifically -permitted with the \fICURLOPT_UNRESTRICTED_AUTH(3)\fP option. +permitted with the CURLOPT_UNRESTRICTED_AUTH(3) option. Starting in 7.64.0, libcurl specifically prevents "Cookie:" headers from being sent to other hosts than the first used one, unless specifically permitted -with the \fICURLOPT_UNRESTRICTED_AUTH(3)\fP option. -.SH DEFAULT +with the CURLOPT_UNRESTRICTED_AUTH(3) option. + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + HTTP, IMAP and SMTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -155,16 +170,12 @@ int main(void) curl_slist_free_all(list); /* free the list */ } } -.fi +~~~ + +# AVAILABILITY -.SH AVAILABILITY As long as HTTP is enabled. Use in MIME mail added in 7.56.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_mime_init (3), -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_HEADER (3), -.BR CURLOPT_HEADEROPT (3), -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_PROXYHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTPPOST.3 b/docs/libcurl/opts/CURLOPT_HTTPPOST.3 deleted file mode 100644 index f86db4ee7..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTPPOST.3 +++ /dev/null @@ -1,101 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTPPOST 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTPPOST \- multipart formpost content -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST, - struct curl_httppost *formpost); -.SH DESCRIPTION -\fBThis option is deprecated.\fP Use \fICURLOPT_MIMEPOST(3)\fP instead. - -Tells libcurl you want a \fBmultipart/formdata\fP HTTP POST to be made and you -instruct what data to pass on to the server in the \fIformpost\fP argument. -Pass a pointer to a linked list of \fIcurl_httppost\fP structs as parameter. -The easiest way to create such a list, is to use \fIcurl_formadd(3)\fP as -documented. The data in this list must remain intact as long as the curl -transfer is alive and is using it. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP. - -When setting \fICURLOPT_HTTPPOST(3)\fP, libcurl automatically sets -\fICURLOPT_NOBODY(3)\fP to 0. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - struct curl_httppost *formpost; - struct curl_httppost *lastptr; - - /* 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 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. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_formadd (3), -.BR curl_formfree (3), -.BR curl_mime_init (3), -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_POST (3), -.BR CURLOPT_POSTFIELDS (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTPPOST.md b/docs/libcurl/opts/CURLOPT_HTTPPOST.md new file mode 100644 index 000000000..6fdfc1707 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTPPOST.md @@ -0,0 +1,100 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTPPOST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MIMEPOST (3) + - CURLOPT_POST (3) + - CURLOPT_POSTFIELDS (3) + - curl_formadd (3) + - curl_formfree (3) + - curl_mime_init (3) +--- + +# NAME + +CURLOPT_HTTPPOST - multipart formpost content + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST, + struct curl_httppost *formpost); +~~~ + +# DESCRIPTION + +**This option is deprecated.** Use CURLOPT_MIMEPOST(3) instead. + +Tells libcurl you want a **multipart/formdata** HTTP POST to be made and you +instruct what data to pass on to the server in the *formpost* argument. +Pass a pointer to a linked list of *curl_httppost* structs as parameter. +The easiest way to create such a list, is to use curl_formadd(3) as +documented. The data in this list must remain intact as long as the curl +transfer is alive and is using it. + +Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. +You can disable this header with CURLOPT_HTTPHEADER(3). + +When setting CURLOPT_HTTPPOST(3), libcurl automatically sets +CURLOPT_NOBODY(3) to 0. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + struct curl_httppost *formpost; + struct curl_httppost *lastptr; + + /* 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 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); +} +~~~ + +# AVAILABILITY + +As long as HTTP is enabled. Deprecated in 7.56.0. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3 b/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3 deleted file mode 100644 index 542eefe6c..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTPPROXYTUNNEL 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTPPROXYTUNNEL \- tunnel through HTTP proxy -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPROXYTUNNEL, long tunnel); -.fi -.SH DESCRIPTION -Set the \fBtunnel\fP parameter to 1L to make libcurl tunnel all operations -through the HTTP proxy (set with \fICURLOPT_PROXY(3)\fP). There is a big -difference between using a proxy and to tunnel through it. - -Tunneling means that an HTTP CONNECT request is sent to the proxy, asking it -to connect to a remote host on a specific port number and then the traffic is -just passed through the proxy. Proxies tend to white-list specific port numbers -it allows CONNECT requests to and often only port 80 and 443 are allowed. - -To suppress proxy CONNECT response headers from user callbacks use -\fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP. - -HTTP proxies can generally only speak HTTP (for obvious reasons), which makes -libcurl convert non-HTTP requests to HTTP when using an HTTP proxy without -this tunnel option set. For example, asking for an FTP URL and specifying an -HTTP proxy makes libcurl send an FTP URL in an HTTP GET request to the -proxy. By instead tunneling through the proxy, you avoid that conversion (that -rarely works through the proxy anyway). -.SH DEFAULT -0 -.SH PROTOCOLS -All network protocols -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYTYPE (3), -.BR CURLOPT_PROXYPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.md b/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.md new file mode 100644 index 000000000..bd67640b4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTPPROXYTUNNEL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYPORT (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_HTTPPROXYTUNNEL - tunnel through HTTP proxy + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPROXYTUNNEL, long tunnel); +~~~ + +# DESCRIPTION + +Set the **tunnel** parameter to 1L to make libcurl tunnel all operations +through the HTTP proxy (set with CURLOPT_PROXY(3)). There is a big +difference between using a proxy and to tunnel through it. + +Tunneling means that an HTTP CONNECT request is sent to the proxy, asking it +to connect to a remote host on a specific port number and then the traffic is +just passed through the proxy. Proxies tend to white-list specific port numbers +it allows CONNECT requests to and often only port 80 and 443 are allowed. + +To suppress proxy CONNECT response headers from user callbacks use +CURLOPT_SUPPRESS_CONNECT_HEADERS(3). + +HTTP proxies can generally only speak HTTP (for obvious reasons), which makes +libcurl convert non-HTTP requests to HTTP when using an HTTP proxy without +this tunnel option set. For example, asking for an FTP URL and specifying an +HTTP proxy makes libcurl send an FTP URL in an HTTP GET request to the +proxy. By instead tunneling through the proxy, you avoid that conversion (that +rarely works through the proxy anyway). + +# DEFAULT + +0 + +# PROTOCOLS + +All network protocols + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.3 b/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.3 deleted file mode 100644 index 7d6dabee3..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTP_CONTENT_DECODING 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTP_CONTENT_DECODING \- HTTP content decoding control -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_CONTENT_DECODING, - long enabled); -.SH DESCRIPTION -Pass a long to tell libcurl how to act on content decoding. If set to zero, -content decoding is disabled. If set to 1 it is enabled. Libcurl has no -default content decoding but requires you to use -\fICURLOPT_ACCEPT_ENCODING(3)\fP for that. -.SH DEFAULT -1 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Added in 7.16.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ACCEPT_ENCODING (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.md b/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.md new file mode 100644 index 000000000..b48c0f9fb --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTP_CONTENT_DECODING.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTP_CONTENT_DECODING +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ACCEPT_ENCODING (3) + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_HTTP_CONTENT_DECODING - HTTP content decoding control + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_CONTENT_DECODING, + long enabled); +~~~ + +# DESCRIPTION + +Pass a long to tell libcurl how to act on content decoding. If set to zero, +content decoding is disabled. If set to 1 it is enabled. Libcurl has no +default content decoding but requires you to use +CURLOPT_ACCEPT_ENCODING(3) for that. + +# DEFAULT + +1 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.3 b/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.3 deleted file mode 100644 index a00fb1a1d..000000000 --- a/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTP_TRANSFER_DECODING 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTP_TRANSFER_DECODING \- HTTP transfer decoding control -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_TRANSFER_DECODING, - long enabled); -.SH DESCRIPTION -Pass a long to tell libcurl how to act on transfer decoding. If set to zero, -transfer decoding is disabled, if set to 1 it is enabled (default). libcurl -does chunked transfer decoding by default unless this option is set to zero. -.SH DEFAULT -1 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Added in 7.16.2 Does not work with the hyper backend (it always has transfer -decoding enabled). -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_CONTENT_DECODING (3), -.BR CURLOPT_ACCEPT_ENCODING (3) diff --git a/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.md b/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.md new file mode 100644 index 000000000..ba83acaae --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_HTTP_TRANSFER_DECODING.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTP_TRANSFER_DECODING +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ACCEPT_ENCODING (3) + - CURLOPT_HTTP_CONTENT_DECODING (3) +--- + +# NAME + +CURLOPT_HTTP_TRANSFER_DECODING - HTTP transfer decoding control + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_TRANSFER_DECODING, + long enabled); +~~~ + +# DESCRIPTION + +Pass a long to tell libcurl how to act on transfer decoding. If set to zero, +transfer decoding is disabled, if set to 1 it is enabled (default). libcurl +does chunked transfer decoding by default unless this option is set to zero. + +# DEFAULT + +1 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.2 Does not work with the hyper backend (it always has transfer +decoding enabled). + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_HTTP_VERSION.3 b/docs/libcurl/opts/CURLOPT_HTTP_VERSION.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_HTTP_VERSION.3 rename to docs/libcurl/opts/CURLOPT_HTTP_VERSION.md index 87b133b88..a41e1a277 100644 --- a/docs/libcurl/opts/CURLOPT_HTTP_VERSION.3 +++ b/docs/libcurl/opts/CURLOPT_HTTP_VERSION.md @@ -1,85 +1,99 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_HTTP_VERSION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_HTTP_VERSION \- HTTP protocol version to use -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_HTTP_VERSION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ALTSVC (3) + - CURLOPT_HTTP09_ALLOWED (3) + - CURLOPT_HTTP200ALIASES (3) + - CURLOPT_SSLVERSION (3) +--- + +# NAME + +CURLOPT_HTTP_VERSION - HTTP protocol version to use + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_VERSION, long version); -.fi -.SH DESCRIPTION -Pass \fIversion\fP a long, set to one of the values described below. They ask +~~~ + +# DESCRIPTION + +Pass *version* a long, set to one of the values described below. They ask libcurl to use the specific HTTP versions. Note that the HTTP version is just a request. libcurl still prioritizes to reuse existing connections so it might then reuse a connection using a HTTP version you have not asked for. -.IP CURL_HTTP_VERSION_NONE +## CURL_HTTP_VERSION_NONE + We do not care about what version the library uses. libcurl uses whatever it thinks fit. -.IP CURL_HTTP_VERSION_1_0 + +## CURL_HTTP_VERSION_1_0 + Enforce HTTP 1.0 requests. -.IP CURL_HTTP_VERSION_1_1 + +## CURL_HTTP_VERSION_1_1 + Enforce HTTP 1.1 requests. -.IP CURL_HTTP_VERSION_2_0 + +## CURL_HTTP_VERSION_2_0 + Attempt HTTP 2 requests. libcurl falls back to HTTP 1.1 if HTTP 2 cannot be negotiated with the server. (Added in 7.33.0) When libcurl uses HTTP/2 over HTTPS, it does not itself insist on TLS 1.2 or higher even though that is required by the specification. A user can add this -version requirement with \fICURLOPT_SSLVERSION(3)\fP. +version requirement with CURLOPT_SSLVERSION(3). -The alias \fICURL_HTTP_VERSION_2\fP was added in 7.43.0 to better reflect the +The alias *CURL_HTTP_VERSION_2* was added in 7.43.0 to better reflect the actual protocol name. -.IP CURL_HTTP_VERSION_2TLS + +## CURL_HTTP_VERSION_2TLS + Attempt HTTP 2 over TLS (HTTPS) only. libcurl falls back to HTTP 1.1 if HTTP 2 cannot be negotiated with the HTTPS server. For clear text HTTP servers, libcurl uses 1.1. (Added in 7.47.0) -.IP CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE + +## CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE + Issue non-TLS HTTP requests using HTTP/2 without HTTP/1.1 Upgrade. It requires prior knowledge that the server supports HTTP/2 straight away. HTTPS requests still do HTTP/2 the standard way with negotiated protocol version in the TLS handshake. (Added in 7.49.0) -.IP CURL_HTTP_VERSION_3 + +## CURL_HTTP_VERSION_3 + (Added in 7.66.0) This option makes libcurl attempt to use HTTP/3 to the host given in the URL, with fallback to earlier HTTP versions if needed. -.IP CURL_HTTP_VERSION_3ONLY + +## CURL_HTTP_VERSION_3ONLY + (Added in 7.88.0) Setting this makes libcurl attempt to use HTTP/3 directly to server given in the URL and does not downgrade to earlier HTTP version if the server does not support HTTP/3. -.SH DEFAULT + +# DEFAULT + Since curl 7.62.0: CURL_HTTP_VERSION_2TLS Before that: CURL_HTTP_VERSION_1_1 -.SH PROTOCOLS + +# PROTOCOLS + HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -94,13 +108,12 @@ int main(void) } } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Along with HTTP -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ALTSVC (3), -.BR CURLOPT_HTTP09_ALLOWED (3), -.BR CURLOPT_HTTP200ALIASES (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 b/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 deleted file mode 100644 index 2512b665f..000000000 --- a/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_IGNORE_CONTENT_LENGTH 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_IGNORE_CONTENT_LENGTH \- ignore content length -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH, - long ignore); -.SH DESCRIPTION -If \fIignore\fP is set to 1L, ignore the Content-Length header in the HTTP -response and ignore asking for or relying on it for FTP transfers. - -This is useful for doing HTTP transfers with ancient web servers which report -incorrect content length for files over 2 gigabytes. If this option is used, -curl cannot accurately report progress, and it instead stops the download when -the server ends the connection. - -It is also useful with FTP when for example the file is growing while the -transfer is in progress which otherwise unconditionally causes libcurl to -report error. - -Only use this option if strictly necessary. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.14.1. Support for FTP added in 7.46.0. This option is not working -for HTTP when libcurl is built to use the hyper backend. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_MAXFILESIZE_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.md b/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.md new file mode 100644 index 000000000..d12b49120 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_IGNORE_CONTENT_LENGTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_MAXFILESIZE_LARGE (3) +--- + +# NAME + +CURLOPT_IGNORE_CONTENT_LENGTH - ignore content length + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH, + long ignore); +~~~ + +# DESCRIPTION + +If *ignore* is set to 1L, ignore the Content-Length header in the HTTP +response and ignore asking for or relying on it for FTP transfers. + +This is useful for doing HTTP transfers with ancient web servers which report +incorrect content length for files over 2 gigabytes. If this option is used, +curl cannot accurately report progress, and it instead stops the download when +the server ends the connection. + +It is also useful with FTP when for example the file is growing while the +transfer is in progress which otherwise unconditionally causes libcurl to +report error. + +Only use this option if strictly necessary. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.14.1. Support for FTP added in 7.46.0. This option is not working +for HTTP when libcurl is built to use the hyper backend. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE.3 b/docs/libcurl/opts/CURLOPT_INFILESIZE.3 deleted file mode 100644 index a26e46302..000000000 --- a/docs/libcurl/opts/CURLOPT_INFILESIZE.3 +++ /dev/null @@ -1,87 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_INFILESIZE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_INFILESIZE \- size of the input file to send off -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE, long filesize); -.fi -.SH DESCRIPTION -When uploading a file to a remote site, \fIfilesize\fP should be used to tell -libcurl what the expected size of the input file is. This value must be passed -as a long. See also \fICURLOPT_INFILESIZE_LARGE(3)\fP for sending files larger -than 2GB. - -For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE(3)\fP is -mandatory. - -To unset this value again, set it to -1. - -Using \fICURLOPT_UPLOAD(3)\fP to a HTTP/1.1 server and this value set to -1, -makes libcurl do a chunked transfer-encoded upload. - -When sending emails using SMTP, this command can be used to specify the -optional SIZE parameter for the MAIL FROM command. - -This option does not limit how much data libcurl actually sends, as that is -controlled entirely by what the read callback returns, but telling one value -and sending a different amount may lead to errors. -.SH DEFAULT -Unset -.SH PROTOCOLS -Many -.SH EXAMPLE -.nf - -#define FILE_SIZE 12345L - -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - long uploadsize = FILE_SIZE; - - curl_easy_setopt(curl, CURLOPT_URL, - "ftp://example.com/destination.tar.gz"); - - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -SMTP support added in 7.23.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_CONTENT_LENGTH_UPLOAD_T (3), -.BR CURLOPT_INFILESIZE_LARGE (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE.md b/docs/libcurl/opts/CURLOPT_INFILESIZE.md new file mode 100644 index 000000000..8098f6d90 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_INFILESIZE.md @@ -0,0 +1,85 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_INFILESIZE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_UPLOAD_T (3) + - CURLOPT_INFILESIZE_LARGE (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_INFILESIZE - size of the input file to send off + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE, long filesize); +~~~ + +# DESCRIPTION + +When uploading a file to a remote site, *filesize* should be used to tell +libcurl what the expected size of the input file is. This value must be passed +as a long. See also CURLOPT_INFILESIZE_LARGE(3) for sending files larger +than 2GB. + +For uploading using SCP, this option or CURLOPT_INFILESIZE_LARGE(3) is +mandatory. + +To unset this value again, set it to -1. + +Using CURLOPT_UPLOAD(3) to a HTTP/1.1 server and this value set to -1, +makes libcurl do a chunked transfer-encoded upload. + +When sending emails using SMTP, this command can be used to specify the +optional SIZE parameter for the MAIL FROM command. + +This option does not limit how much data libcurl actually sends, as that is +controlled entirely by what the read callback returns, but telling one value +and sending a different amount may lead to errors. + +# DEFAULT + +Unset + +# PROTOCOLS + +Many + +# EXAMPLE + +~~~c + +#define FILE_SIZE 12345L + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + long uploadsize = FILE_SIZE; + + curl_easy_setopt(curl, CURLOPT_URL, + "ftp://example.com/destination.tar.gz"); + + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +SMTP support added in 7.23.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 b/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 deleted file mode 100644 index 5cac91089..000000000 --- a/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_INFILESIZE_LARGE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_INFILESIZE_LARGE \- size of the input file to send off -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE_LARGE, - curl_off_t filesize); -.SH DESCRIPTION -When uploading a file to a remote site, \fIfilesize\fP should be used to tell -libcurl what the expected size of the input file is. This value must be passed -as a \fBcurl_off_t\fP. - -For uploading using SCP, this option or \fICURLOPT_INFILESIZE(3)\fP is -mandatory. - -To unset this value again, set it to -1. - -When sending emails using SMTP, this command can be used to specify the -optional SIZE parameter for the MAIL FROM command. - -This option does not limit how much data libcurl actually sends, as that is -controlled entirely by what the read callback returns, but telling one value -and sending a different amount may lead to errors. -.SH DEFAULT -Unset -.SH PROTOCOLS -Many -.SH EXAMPLE -.nf -#define FILE_SIZE 123456 - -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - curl_off_t uploadsize = FILE_SIZE; - - curl_easy_setopt(curl, CURLOPT_URL, - "ftp://example.com/destination.tar.gz"); - - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -SMTP support added in 7.23.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_CONTENT_LENGTH_UPLOAD_T (3), -.BR CURLOPT_INFILESIZE (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.md b/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.md new file mode 100644 index 000000000..5f8a3386f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_INFILESIZE_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CONTENT_LENGTH_UPLOAD_T (3) + - CURLOPT_INFILESIZE (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_INFILESIZE_LARGE - size of the input file to send off + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE_LARGE, + curl_off_t filesize); +~~~ + +# DESCRIPTION + +When uploading a file to a remote site, *filesize* should be used to tell +libcurl what the expected size of the input file is. This value must be passed +as a **curl_off_t**. + +For uploading using SCP, this option or CURLOPT_INFILESIZE(3) is +mandatory. + +To unset this value again, set it to -1. + +When sending emails using SMTP, this command can be used to specify the +optional SIZE parameter for the MAIL FROM command. + +This option does not limit how much data libcurl actually sends, as that is +controlled entirely by what the read callback returns, but telling one value +and sending a different amount may lead to errors. + +# DEFAULT + +Unset + +# PROTOCOLS + +Many + +# EXAMPLE + +~~~c +#define FILE_SIZE 123456 + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + curl_off_t uploadsize = FILE_SIZE; + + curl_easy_setopt(curl, CURLOPT_URL, + "ftp://example.com/destination.tar.gz"); + + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +SMTP support added in 7.23.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_INTERFACE.3 b/docs/libcurl/opts/CURLOPT_INTERFACE.3 deleted file mode 100644 index 676f8ba7c..000000000 --- a/docs/libcurl/opts/CURLOPT_INTERFACE.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_INTERFACE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_INTERFACE \- source interface for outgoing traffic -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERFACE, char *interface); -.fi -.SH DESCRIPTION -Pass a char * as parameter. This sets the \fIinterface\fP name to use as -outgoing network interface. The name can be an interface name, an IP address, -or a host name. - -If the parameter starts with "if!" then it is treated only as an interface -name. If the parameter starts with \&"host!" it is treated as either an IP -address or a hostname. - -If "if!" is specified but the parameter does not match an existing interface, -\fICURLE_INTERFACE_FAILED\fP is returned from the libcurl function used to -perform the transfer. - -libcurl does not support using network interface names for this option on -Windows. - -We strongly advise against specifying the interface with a hostname, as it -causes libcurl to do a blocking name resolve call to retrieve the IP -address. That name resolve operation does \fBnot\fP use DNS-over-HTTPS even if -\fICURLOPT_DOH_URL(3)\fP is set. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, use whatever the TCP stack finds suitable -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -The "if!" and "host!" syntax was added in 7.24.0. -.SH RETURN VALUE -Returns CURLE_OK on success or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SOCKOPTFUNCTION (3), -.BR CURLOPT_TCP_NODELAY (3) diff --git a/docs/libcurl/opts/CURLOPT_INTERFACE.md b/docs/libcurl/opts/CURLOPT_INTERFACE.md new file mode 100644 index 000000000..39d5c241c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_INTERFACE.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_INTERFACE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SOCKOPTFUNCTION (3) + - CURLOPT_TCP_NODELAY (3) +--- + +# NAME + +CURLOPT_INTERFACE - source interface for outgoing traffic + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERFACE, char *interface); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter. This sets the *interface* name to use as +outgoing network interface. The name can be an interface name, an IP address, +or a host name. + +If the parameter starts with "if!" then it is treated only as an interface +name. If the parameter starts with &"host!" it is treated as either an IP +address or a hostname. + +If "if!" is specified but the parameter does not match an existing interface, +*CURLE_INTERFACE_FAILED* is returned from the libcurl function used to +perform the transfer. + +libcurl does not support using network interface names for this option on +Windows. + +We strongly advise against specifying the interface with a hostname, as it +causes libcurl to do a blocking name resolve call to retrieve the IP +address. That name resolve operation does **not** use DNS-over-HTTPS even if +CURLOPT_DOH_URL(3) is set. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, use whatever the TCP stack finds suitable + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +The "if!" and "host!" syntax was added in 7.24.0. + +# RETURN VALUE + +Returns CURLE_OK on success or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.3 b/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.3 deleted file mode 100644 index adc54f694..000000000 --- a/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_INTERLEAVEDATA 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_INTERLEAVEDATA \- pointer passed to RTSP interleave callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEDATA, void *pointer); -.fi -.SH DESCRIPTION -This is the userdata \fIpointer\fP that is passed to -\fICURLOPT_INTERLEAVEFUNCTION(3)\fP when interleaved RTP data is received. If -the interleave function callback is not set, this pointer is not used -anywhere. -.SH DEFAULT -NULL -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -struct local { - void *custom; -}; -static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp) -{ - 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 *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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_INTERLEAVEFUNCTION (3), -.BR CURLOPT_RTSP_REQUEST (3) diff --git a/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.md b/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.md new file mode 100644 index 000000000..64311f83c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_INTERLEAVEDATA.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_INTERLEAVEDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INTERLEAVEFUNCTION (3) + - CURLOPT_RTSP_REQUEST (3) +--- + +# NAME + +CURLOPT_INTERLEAVEDATA - pointer passed to RTSP interleave callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEDATA, void *pointer); +~~~ + +# DESCRIPTION + +This is the userdata *pointer* that is passed to +CURLOPT_INTERLEAVEFUNCTION(3) when interleaved RTP data is received. If +the interleave function callback is not set, this pointer is not used +anywhere. + +# DEFAULT + +NULL + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +struct local { + void *custom; +}; +static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp) +{ + 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 *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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3 b/docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.md similarity index 54% rename from docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.md index b2fa947dd..5f8e999df 100644 --- a/docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.md @@ -1,32 +1,21 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_INTERLEAVEFUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_INTERLEAVEFUNCTION \- callback for RTSP interleaved data -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_INTERLEAVEFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INTERLEAVEDATA (3) + - CURLOPT_RTSP_REQUEST (3) +--- + +# NAME + +CURLOPT_INTERLEAVEFUNCTION - callback for RTSP interleaved data + +# SYNOPSIS + +~~~c #include size_t interleave_callback(void *ptr, size_t size, size_t nmemb, @@ -34,13 +23,16 @@ size_t interleave_callback(void *ptr, size_t size, size_t nmemb, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEFUNCTION, interleave_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. This callback function gets called by libcurl as soon as it has received interleaved RTP data. This function gets called for each $ block and therefore -contains exactly one upper-layer protocol unit (e.g. one RTP packet). Curl +contains exactly one upper-layer protocol unit (e.g. one RTP packet). Curl writes the interleaved header as well as the included data for each call. The first byte is always an ASCII dollar sign. The dollar sign is followed by a one byte channel identifier and then a 2 byte integer length in network byte @@ -51,27 +43,33 @@ Interleaved RTP poses some challenges for the client application. Since the stream data is sharing the RTSP control connection, it is critical to service the RTP in a timely fashion. If the RTP data is not handled quickly, subsequent response processing may become unreasonably delayed and the -connection may close. The application may use \fICURL_RTSPREQ_RECEIVE\fP to +connection may close. The application may use *CURL_RTSPREQ_RECEIVE* to service RTP data when no requests are desired. If the application makes a -request, (e.g. \fICURL_RTSPREQ_PAUSE\fP) then the response handler processes +request, (e.g. *CURL_RTSPREQ_PAUSE*) then the response handler processes any pending RTP data before marking the request as finished. -The \fICURLOPT_INTERLEAVEDATA(3)\fP is passed in the \fIuserdata\fP argument in +The CURLOPT_INTERLEAVEDATA(3) is passed in the *userdata* argument in the callback. Your callback should return the number of bytes actually taken care of. If that amount differs from the amount passed to your callback function, it signals an error condition to the library. This causes the transfer to abort -and the libcurl function used returns \fICURLE_WRITE_ERROR\fP. +and the libcurl function used returns *CURLE_WRITE_ERROR*. You can also abort the transfer by returning CURL_WRITEFUNC_ERROR. (7.87.0) -.SH DEFAULT + +# DEFAULT + NULL, the interleave data is then passed to the regular write function: -\fICURLOPT_WRITEFUNCTION(3)\fP. -.SH PROTOCOLS +CURLOPT_WRITEFUNCTION(3). + +# PROTOCOLS + RTSP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c struct local { void *custom; }; @@ -79,7 +77,7 @@ struct local { static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp) { struct local *l = userp; - printf("our ptr: %p\\n", l->custom); + printf("our ptr: %p\n", l->custom); /* take care of the packet in 'ptr', then return... */ return size * nmemb; } @@ -93,11 +91,12 @@ int main(void) curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.20.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_INTERLEAVEDATA (3), -.BR CURLOPT_RTSP_REQUEST (3) diff --git a/docs/libcurl/opts/CURLOPT_IOCTLDATA.3 b/docs/libcurl/opts/CURLOPT_IOCTLDATA.3 deleted file mode 100644 index 93742c75e..000000000 --- a/docs/libcurl/opts/CURLOPT_IOCTLDATA.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_IOCTLDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_IOCTLDATA \- pointer passed to I/O callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass the \fIpointer\fP that is untouched by libcurl and passed as the 3rd -argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION(3)\fP. -.SH DEFAULT -By default, the value of this parameter is NULL. -.SH PROTOCOLS -Used with HTTP -.SH EXAMPLE -.nf -#include /* 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(io->fd, 0, SEEK_SET); - return CURLIOE_OK; - } - return CURLIOE_UNKNOWNCMD; -} -int main(void) -{ - struct data 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 -Added in 7.12.3. Deprecated since 7.18.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_IOCTLFUNCTION (3), -.BR CURLOPT_SEEKFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_IOCTLDATA.md b/docs/libcurl/opts/CURLOPT_IOCTLDATA.md new file mode 100644 index 000000000..2490fbc7f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_IOCTLDATA.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_IOCTLDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_IOCTLFUNCTION (3) + - CURLOPT_SEEKFUNCTION (3) +--- + +# NAME + +CURLOPT_IOCTLDATA - pointer passed to I/O callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass the *pointer* that is untouched by libcurl and passed as the 3rd +argument in the ioctl callback set with CURLOPT_IOCTLFUNCTION(3). + +# DEFAULT + +By default, the value of this parameter is NULL. + +# PROTOCOLS + +Used with HTTP + +# EXAMPLE + +~~~c +#include /* 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(io->fd, 0, SEEK_SET); + return CURLIOE_OK; + } + return CURLIOE_UNKNOWNCMD; +} +int main(void) +{ + struct data 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.12.3. Deprecated since 7.18.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3 b/docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.md index 981051472..8804ae578 100644 --- a/docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.md @@ -1,32 +1,21 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_IOCTLFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_IOCTLFUNCTION \- callback for I/O operations -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_IOCTLFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_IOCTLDATA (3) + - CURLOPT_SEEKFUNCTION (3) +--- + +# NAME + +CURLOPT_IOCTLFUNCTION - callback for I/O operations + +# SYNOPSIS + +~~~c #include typedef enum { @@ -45,7 +34,10 @@ typedef enum { curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLFUNCTION, ioctl_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. @@ -55,21 +47,27 @@ rewinding the read data stream is the only action it can request. The rewinding of the read data stream may be necessary when doing an HTTP PUT or POST with a multi-pass authentication method. -The callback MUST return \fICURLIOE_UNKNOWNCMD\fP if the input \fIcmd\fP is -not \fICURLIOCMD_RESTARTREAD\fP. +The callback MUST return *CURLIOE_UNKNOWNCMD* if the input *cmd* is +not *CURLIOCMD_RESTARTREAD*. -The \fIclientp\fP argument to the callback is set with the -\fICURLOPT_IOCTLDATA(3)\fP option. +The *clientp* argument to the callback is set with the +CURLOPT_IOCTLDATA(3) option. -This option is deprecated! Do not use it. Use \fICURLOPT_SEEKFUNCTION(3)\fP -instead to provide seeking! If \fICURLOPT_SEEKFUNCTION(3)\fP is set, this +**This option is deprecated**. Do not use it. Use CURLOPT_SEEKFUNCTION(3) +instead to provide seeking! If CURLOPT_SEEKFUNCTION(3) is set, this parameter is ignored when seeking. -.SH DEFAULT + +# DEFAULT + By default, this parameter is set to NULL. Not used. -.SH PROTOCOLS + +# PROTOCOLS + Used with HTTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include /* for lseek */ struct data { @@ -94,11 +92,12 @@ int main(void) curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.12.3. Deprecated since 7.18.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_IOCTLDATA (3), -.BR CURLOPT_SEEKFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_IPRESOLVE.3 b/docs/libcurl/opts/CURLOPT_IPRESOLVE.3 deleted file mode 100644 index 499aed513..000000000 --- a/docs/libcurl/opts/CURLOPT_IPRESOLVE.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_IPRESOLVE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_IPRESOLVE \- IP protocol version to use -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IPRESOLVE, long resolve); -.fi -.SH DESCRIPTION -Allows an application to select what kind of IP addresses to use when -establishing a connection or choosing one from the connection pool. This is -interesting when using host names that resolve to more than one IP family. - -If the URL provided for a transfer contains a numerical IP version as a host -name, this option does not override or prohibit libcurl from using that IP -version. - -Available values for this option are: -.IP CURL_IPRESOLVE_WHATEVER -Default, can use addresses of all IP versions that your system allows. -.IP CURL_IPRESOLVE_V4 -Uses only IPv4 addresses. -.IP CURL_IPRESOLVE_V6 -Uses only IPv6 addresses. -.SH DEFAULT -CURL_IPRESOLVE_WHATEVER -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_RESOLVE (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_IPRESOLVE.md b/docs/libcurl/opts/CURLOPT_IPRESOLVE.md new file mode 100644 index 000000000..7d06405ec --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_IPRESOLVE.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_IPRESOLVE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_RESOLVE (3) + - CURLOPT_SSLVERSION (3) +--- + +# NAME + +CURLOPT_IPRESOLVE - IP protocol version to use + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IPRESOLVE, long resolve); +~~~ + +# DESCRIPTION + +Allows an application to select what kind of IP addresses to use when +establishing a connection or choosing one from the connection pool. This is +interesting when using host names that resolve to more than one IP family. + +If the URL provided for a transfer contains a numerical IP version as a host +name, this option does not override or prohibit libcurl from using that IP +version. + +Available values for this option are: + +## CURL_IPRESOLVE_WHATEVER + +Default, can use addresses of all IP versions that your system allows. + +## CURL_IPRESOLVE_V4 + +Uses only IPv4 addresses. + +## CURL_IPRESOLVE_V6 + +Uses only IPv6 addresses. + +# DEFAULT + +CURL_IPRESOLVE_WHATEVER + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_ISSUERCERT.3 b/docs/libcurl/opts/CURLOPT_ISSUERCERT.3 deleted file mode 100644 index a0c2f5f79..000000000 --- a/docs/libcurl/opts/CURLOPT_ISSUERCERT.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ISSUERCERT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_ISSUERCERT \- issuer SSL certificate filename -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ISSUERCERT, char *file); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a \fIfile\fP holding a CA -certificate in PEM format. If the option is set, an additional check against -the peer certificate is performed to verify the issuer is indeed the one -associated with the certificate provided by the option. This additional check -is useful in multi-level PKI where one needs to enforce that the peer -certificate is from a specific branch of the tree. - -This option makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the check is -not considered as failure. - -A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, -which is returned if the setup of the SSL/TLS session has failed due to a -mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER(3)\fP -has to be set too for the check to fail). (Added in 7.19.0) - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_ISSUERCERT, "/etc/certs/cacert.pem"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -If built TLS enabled -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CRLFILE (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_ISSUERCERT.md b/docs/libcurl/opts/CURLOPT_ISSUERCERT.md new file mode 100644 index 000000000..9b35d5d79 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_ISSUERCERT.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ISSUERCERT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CRLFILE (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_ISSUERCERT - issuer SSL certificate filename + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ISSUERCERT, char *file); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a *file* holding a CA +certificate in PEM format. If the option is set, an additional check against +the peer certificate is performed to verify the issuer is indeed the one +associated with the certificate provided by the option. This additional check +is useful in multi-level PKI where one needs to enforce that the peer +certificate is from a specific branch of the tree. + +This option makes sense only when used in combination with the +CURLOPT_SSL_VERIFYPEER(3) option. Otherwise, the result of the check is +not considered as failure. + +A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, +which is returned if the setup of the SSL/TLS session has failed due to a +mismatch with the issuer of peer certificate (CURLOPT_SSL_VERIFYPEER(3) +has to be set too for the check to fail). (Added in 7.19.0) + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_ISSUERCERT, "/etc/certs/cacert.pem"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +If built TLS enabled + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 b/docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 rename to docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.md index 858987e9b..8f68aedbc 100644 --- a/docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 +++ b/docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.md @@ -1,38 +1,31 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_ISSUERCERT_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_ISSUERCERT_BLOB \- issuer SSL certificate from memory blob -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_ISSUERCERT_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CRLFILE (3) + - CURLOPT_ISSUERCERT (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_ISSUERCERT_BLOB - issuer SSL certificate from memory blob + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ISSUERCERT_BLOB, struct curl_blob *stblob); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a curl_blob structure, which contains information (pointer and size) about a memory block with binary data of a CA certificate in PEM format. If the option is set, an additional check against the peer certificate @@ -42,26 +35,32 @@ multi-level PKI where one needs to enforce that the peer certificate is from a specific branch of the tree. This option should be used in combination with the -\fICURLOPT_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the check is +CURLOPT_SSL_VERIFYPEER(3) option. Otherwise, the result of the check is not considered as failure. A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, which is returned if the setup of the SSL/TLS session has failed due to a -mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER(3)\fP +mismatch with the issuer of peer certificate (CURLOPT_SSL_VERIFYPEER(3) has to be set too for the check to fail). If the blob is initialized with the flags member of struct curl_blob set to CURL_BLOB_COPY, the application does not have to keep the buffer around after setting this. -This option is an alternative to \fICURLOPT_ISSUERCERT(3)\fP which instead +This option is an alternative to CURLOPT_ISSUERCERT(3) which instead expects a file name as input. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS-based protocols -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c extern char *certificateData; extern size_t filesize; @@ -81,14 +80,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.71.0. This option is supported by the OpenSSL backends. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_ISSUERCERT (3), -.BR CURLOPT_CRLFILE (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.3 b/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.3 deleted file mode 100644 index 466436095..000000000 --- a/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_KEEP_SENDING_ON_ERROR 3 "22 Sep 2016" libcurl libcurl -.SH NAME -CURLOPT_KEEP_SENDING_ON_ERROR \- keep sending on early HTTP response >= 300 -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEEP_SENDING_ON_ERROR, - long keep_sending); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells the library to keep sending the request body -if the HTTP code returned is equal to or larger than 300. The default action -would be to stop sending and close the stream or connection. - -This option is suitable for manual NTLM authentication, i.e. if an application -does not use \fICURLOPT_HTTPAUTH(3)\fP, but instead sets "Authorization: NTLM ..." -headers manually using \fICURLOPT_HTTPHEADER(3)\fP. - -Most applications do not need this option. -.SH DEFAULT -0, stop sending on error -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Along with HTTP. Added in 7.51.0. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_RESPONSE_CODE (3), -.BR CURLOPT_FAILONERROR (3), -.BR CURLOPT_HTTPHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.md b/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.md new file mode 100644 index 000000000..090a8fc2d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_KEEP_SENDING_ON_ERROR.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_KEEP_SENDING_ON_ERROR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RESPONSE_CODE (3) + - CURLOPT_FAILONERROR (3) + - CURLOPT_HTTPHEADER (3) +--- + +# NAME + +CURLOPT_KEEP_SENDING_ON_ERROR - keep sending on early HTTP response >= 300 + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEEP_SENDING_ON_ERROR, + long keep_sending); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells the library to keep sending the request body +if the HTTP code returned is equal to or larger than 300. The default action +would be to stop sending and close the stream or connection. + +This option is suitable for manual NTLM authentication, i.e. if an application +does not use CURLOPT_HTTPAUTH(3), but instead sets "Authorization: NTLM ..." +headers manually using CURLOPT_HTTPHEADER(3). + +Most applications do not need this option. + +# DEFAULT + +0, stop sending on error + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP. Added in 7.51.0. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_KEYPASSWD.3 b/docs/libcurl/opts/CURLOPT_KEYPASSWD.3 deleted file mode 100644 index 119f26cd1..000000000 --- a/docs/libcurl/opts/CURLOPT_KEYPASSWD.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_KEYPASSWD 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_KEYPASSWD \- passphrase to private key -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. It is used as the -password required to use the \fICURLOPT_SSLKEY(3)\fP or -\fICURLOPT_SSH_PRIVATE_KEYFILE(3)\fP private key. You never need a pass -phrase to load a certificate but you need one to load your private key. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -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 -This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and -CURLOPT_SSLCERTPASSWD up to 7.9.2. -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_PRIVATE_KEYFILE (3), -.BR CURLOPT_SSLKEY (3) diff --git a/docs/libcurl/opts/CURLOPT_KEYPASSWD.md b/docs/libcurl/opts/CURLOPT_KEYPASSWD.md new file mode 100644 index 000000000..7407f0939 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_KEYPASSWD.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_KEYPASSWD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_PRIVATE_KEYFILE (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_KEYPASSWD - passphrase to private key + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. It is used as the +password required to use the CURLOPT_SSLKEY(3) or +CURLOPT_SSH_PRIVATE_KEYFILE(3) private key. You never need a pass phrase to +load a certificate but you need one to load your private key. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and +CURLOPT_SSLCERTPASSWD up to 7.9.2. + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_KRBLEVEL.3 b/docs/libcurl/opts/CURLOPT_KRBLEVEL.3 deleted file mode 100644 index 7be711e1d..000000000 --- a/docs/libcurl/opts/CURLOPT_KRBLEVEL.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_KRBLEVEL 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_KRBLEVEL \- FTP kerberos security level -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KRBLEVEL, char *level); -.fi -.SH DESCRIPTION -Pass a char * as parameter. Set the kerberos security level for FTP; this also -enables kerberos awareness. This is a string that should match one of the -following: \&'clear', \&'safe', \&'confidential' or \&'private'. If the string -is set but does not match one of these, 'private' is used. Set the string to -NULL to disable kerberos support for FTP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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 -This option was known as CURLOPT_KRB4LEVEL up to 7.16.3 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_KRBLEVEL (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_KRBLEVEL.md b/docs/libcurl/opts/CURLOPT_KRBLEVEL.md new file mode 100644 index 000000000..cb8e27689 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_KRBLEVEL.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_KRBLEVEL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_KRBLEVEL (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_KRBLEVEL - FTP kerberos security level + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KRBLEVEL, char *level); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter. Set the kerberos security level for FTP; +this also enables kerberos awareness. This is a string that should match one +of the following: &'clear', &'safe', &'confidential' or &'private'. If the +string is set but does not match one of these, 'private' is used. Set the +string to NULL to disable kerberos support for FTP. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +This option was known as CURLOPT_KRB4LEVEL up to 7.16.3 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_LOCALPORT.3 b/docs/libcurl/opts/CURLOPT_LOCALPORT.3 deleted file mode 100644 index e5bddf1c1..000000000 --- a/docs/libcurl/opts/CURLOPT_LOCALPORT.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_LOCALPORT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_LOCALPORT \- local port number to use for socket -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOCALPORT, long port); -.fi -.SH DESCRIPTION -Pass a long. This sets the local port number of the socket used for the -connection. This can be used in combination with \fICURLOPT_INTERFACE(3)\fP -and you are recommended to use \fICURLOPT_LOCALPORTRANGE(3)\fP as well when -this option is set. Valid port numbers are 1 - 65535. -.SH DEFAULT -0, disabled - use whatever the system thinks is fine -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.15.2 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLINFO_LOCAL_PORT (3), -.BR CURLOPT_INTERFACE (3), -.BR CURLOPT_LOCALPORTRANGE (3) diff --git a/docs/libcurl/opts/CURLOPT_LOCALPORT.md b/docs/libcurl/opts/CURLOPT_LOCALPORT.md new file mode 100644 index 000000000..25a21c15e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_LOCALPORT.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_LOCALPORT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_LOCAL_PORT (3) + - CURLOPT_INTERFACE (3) + - CURLOPT_LOCALPORTRANGE (3) +--- + +# NAME + +CURLOPT_LOCALPORT - local port number to use for socket + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOCALPORT, long port); +~~~ + +# DESCRIPTION + +Pass a long. This sets the local port number of the socket used for the +connection. This can be used in combination with CURLOPT_INTERFACE(3) +and you are recommended to use CURLOPT_LOCALPORTRANGE(3) as well when +this option is set. Valid port numbers are 1 - 65535. + +# DEFAULT + +0, disabled - use whatever the system thinks is fine + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.2 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.3 b/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.3 deleted file mode 100644 index 71934e323..000000000 --- a/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_LOCALPORTRANGE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_LOCALPORTRANGE \- number of additional local ports to try -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOCALPORTRANGE, - long range); -.fi -.SH DESCRIPTION -Pass a long. The \fIrange\fP argument is the number of attempts libcurl makes -to find a working local port number. It starts with the given -\fICURLOPT_LOCALPORT(3)\fP and adds one to the number for each retry. Setting -this option to 1 or below makes libcurl only do one try for the exact port -number. Port numbers by nature are scarce resources that are busy at times so -setting this value to something too low might cause unnecessary connection -setup failures. -.SH DEFAULT -1 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.15.2 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_INTERFACE (3), -.BR CURLOPT_LOCALPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.md b/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.md new file mode 100644 index 000000000..520020790 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_LOCALPORTRANGE.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_LOCALPORTRANGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INTERFACE (3) + - CURLOPT_LOCALPORT (3) +--- + +# NAME + +CURLOPT_LOCALPORTRANGE - number of additional local ports to try + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOCALPORTRANGE, + long range); +~~~ + +# DESCRIPTION + +Pass a long. The *range* argument is the number of attempts libcurl makes +to find a working local port number. It starts with the given +CURLOPT_LOCALPORT(3) and adds one to the number for each retry. Setting +this option to 1 or below makes libcurl only do one try for the exact port +number. Port numbers by nature are scarce resources that are busy at times so +setting this value to something too low might cause unnecessary connection +setup failures. + +# DEFAULT + +1 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.2 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3 deleted file mode 100644 index 5410bbdce..000000000 --- a/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_LOGIN_OPTIONS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_LOGIN_OPTIONS \- login options -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOGIN_OPTIONS, char *options); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -\fIoptions\fP string to use for the transfer. - -For more information about the login options please see RFC 2384, RFC 5092 and -the IETF draft \fBdraft-earhart-url-smtp-00.txt\fP. - -\fICURLOPT_LOGIN_OPTIONS(3)\fP can be used to set protocol specific login -options, such as the preferred authentication mechanism via "AUTH=NTLM" or -"AUTH=*", and should be used in conjunction with the \fICURLOPT_USERNAME(3)\fP -option. - -Since 8.2.0, IMAP supports the login option "AUTH=+LOGIN". With this option, -curl uses the plain (not SASL) LOGIN IMAP command even if the server -advertises SASL authentication. Care should be taken in using this option, as -it sends your password in plain text. This does not work if the IMAP server -disables the plain LOGIN (e.g. to prevent password snooping). - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -Only IMAP, LDAP, POP3 and SMTP support login options. -.SH EXAMPLE -.nf -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 -Added in 7.34.0. Support for OpenLDAP added in 7.82.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.md b/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.md new file mode 100644 index 000000000..a57b44690 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_LOGIN_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PASSWORD (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_LOGIN_OPTIONS - login options + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOGIN_OPTIONS, char *options); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the +null-terminated *options* string to use for the transfer. + +For more information about the login options please see RFC 2384, RFC 5092 and +the IETF draft **draft-earhart-url-smtp-00.txt**. + +CURLOPT_LOGIN_OPTIONS(3) can be used to set protocol specific login options, +such as the preferred authentication mechanism via "AUTH=NTLM" or "AUTH=*", +and should be used in conjunction with the CURLOPT_USERNAME(3) option. + +Since 8.2.0, IMAP supports the login option "AUTH=+LOGIN". With this option, +curl uses the plain (not SASL) LOGIN IMAP command even if the server +advertises SASL authentication. Care should be taken in using this option, as +it sends your password in plain text. This does not work if the IMAP server +disables the plain LOGIN (e.g. to prevent password snooping). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +Only IMAP, LDAP, POP3 and SMTP support login options. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.34.0. Support for OpenLDAP added in 7.82.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 b/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 deleted file mode 100644 index d491e655b..000000000 --- a/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_LOW_SPEED_LIMIT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_LOW_SPEED_LIMIT \- low speed limit in bytes per second -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_LIMIT, - long speedlimit); -.fi -.SH DESCRIPTION -Pass a long as parameter. It contains the average transfer speed in bytes per -second that the transfer should be below during -\fICURLOPT_LOW_SPEED_TIME(3)\fP seconds for libcurl to consider it to be too -slow and abort. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_LOW_SPEED_TIME (3), -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_MAX_SEND_SPEED_LARGE (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.md b/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.md new file mode 100644 index 000000000..99df9faed --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_LOW_SPEED_LIMIT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_TIME (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) + - CURLOPT_MAX_SEND_SPEED_LARGE (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_LOW_SPEED_LIMIT - low speed limit in bytes per second + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_LIMIT, + long speedlimit); +~~~ + +# DESCRIPTION + +Pass a long as parameter. It contains the average transfer speed in bytes per +second that the transfer should be below during +CURLOPT_LOW_SPEED_TIME(3) seconds for libcurl to consider it to be too +slow and abort. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 b/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 deleted file mode 100644 index 507ac4528..000000000 --- a/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_LOW_SPEED_TIME 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_LOW_SPEED_TIME \- low speed limit time period -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_TIME, - long speedtime); -.fi -.SH DESCRIPTION -Pass a long as parameter. It contains the time in number seconds that the -transfer speed should be below the \fICURLOPT_LOW_SPEED_LIMIT(3)\fP for the -library to consider it too slow and abort. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.md b/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.md new file mode 100644 index 000000000..a3a9ef1ff --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_LOW_SPEED_TIME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_LOW_SPEED_TIME - low speed limit time period + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_TIME, + long speedtime); +~~~ + +# DESCRIPTION + +Pass a long as parameter. It contains the time in number seconds that the +transfer speed should be below the CURLOPT_LOW_SPEED_LIMIT(3) for the +library to consider it too slow and abort. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_MAIL_AUTH.3 b/docs/libcurl/opts/CURLOPT_MAIL_AUTH.3 deleted file mode 100644 index 340d801d8..000000000 --- a/docs/libcurl/opts/CURLOPT_MAIL_AUTH.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAIL_AUTH 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAIL_AUTH \- SMTP authentication address -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_AUTH, char *auth); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. This is used to -specify the authentication address (identity) of a submitted message that is -being relayed to another server. - -This optional parameter allows co-operating agents in a trusted environment to -communicate the authentication of individual messages and should only be used -by the application program, using libcurl, if the application is itself a mail -server acting in such an environment. If the application is operating as such -and the AUTH address is not known or is invalid, then an empty string should -be used for this parameter. - -Unlike \fICURLOPT_MAIL_FROM(3)\fP and \fICURLOPT_MAIL_RCPT(3)\fP, the address -should not be specified within a pair of angled brackets (<>). However, if an -empty string is used then a pair of brackets are sent by libcurl as required -by RFC 2554. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -SMTP -.SH EXAMPLE -.nf -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, ""); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.25.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_FROM (3), -.BR CURLOPT_MAIL_RCPT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAIL_AUTH.md b/docs/libcurl/opts/CURLOPT_MAIL_AUTH.md new file mode 100644 index 000000000..a5dbc7d79 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAIL_AUTH.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAIL_AUTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_FROM (3) + - CURLOPT_MAIL_RCPT (3) +--- + +# NAME + +CURLOPT_MAIL_AUTH - SMTP authentication address + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_AUTH, char *auth); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. This is used to +specify the authentication address (identity) of a submitted message that is +being relayed to another server. + +This optional parameter allows co-operating agents in a trusted environment to +communicate the authentication of individual messages and should only be used +by the application program, using libcurl, if the application is itself a mail +server acting in such an environment. If the application is operating as such +and the AUTH address is not known or is invalid, then an empty string should +be used for this parameter. + +Unlike CURLOPT_MAIL_FROM(3) and CURLOPT_MAIL_RCPT(3), the address +should not be specified within a pair of angled brackets (<>). However, if an +empty string is used then a pair of brackets are sent by libcurl as required +by RFC 2554. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +SMTP + +# EXAMPLE + +~~~c +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, ""); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.25.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_MAIL_FROM.3 b/docs/libcurl/opts/CURLOPT_MAIL_FROM.3 deleted file mode 100644 index b76455c61..000000000 --- a/docs/libcurl/opts/CURLOPT_MAIL_FROM.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAIL_FROM 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAIL_FROM \- SMTP sender address -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. This should be used -to specify the sender's email address when sending SMTP mail with libcurl. - -An originator email address should be specified with angled brackets (<>) -around it, which if not specified are added automatically. - -If this parameter is not specified then an empty address is sent to the SMTP -server which might cause the email to be rejected. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -SMTP -.SH EXAMPLE -.nf -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, "president@example.com"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_AUTH (3), -.BR CURLOPT_MAIL_RCPT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAIL_FROM.md b/docs/libcurl/opts/CURLOPT_MAIL_FROM.md new file mode 100644 index 000000000..c4984b056 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAIL_FROM.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAIL_FROM +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_AUTH (3) + - CURLOPT_MAIL_RCPT (3) +--- + +# NAME + +CURLOPT_MAIL_FROM - SMTP sender address + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. This should be used +to specify the sender's email address when sending SMTP mail with libcurl. + +An originator email address should be specified with angled brackets (<>) +around it, which if not specified are added automatically. + +If this parameter is not specified then an empty address is sent to the SMTP +server which might cause the email to be rejected. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +SMTP + +# EXAMPLE + +~~~c +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, "president@example.com"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_MAIL_RCPT.3 b/docs/libcurl/opts/CURLOPT_MAIL_RCPT.3 deleted file mode 100644 index 5a47e3d9a..000000000 --- a/docs/libcurl/opts/CURLOPT_MAIL_RCPT.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAIL_RCPT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAIL_RCPT \- list of SMTP mail recipients -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT, - struct curl_slist *rcpts); -.SH DESCRIPTION -Pass a pointer to a linked list of recipients to pass to the server in your -SMTP mail request. The linked list should be a fully valid list of -\fBstruct curl_slist\fP structs properly filled in. Use -\fIcurl_slist_append(3)\fP to create the list and \fIcurl_slist_free_all(3)\fP -to clean up an entire list. - -When performing a mail transfer, each recipient should be specified within a -pair of angled brackets (<>), however, should you not use an angled bracket as -the first character libcurl assumes you provided a single email address and -encloses that address within brackets for you. - -When performing an address verification (\fBVRFY\fP command), each recipient -should be specified as the user name or user name and domain (as per Section -3.5 of RFC 5321). - -When performing a mailing list expand (\fBEXPN\fP command), each recipient -should be specified using the mailing list name, such as "Friends" or -"London-Office". -.SH DEFAULT -NULL -.SH PROTOCOLS -SMTP -.SH EXAMPLE -.nf -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, "person@example.com"); - 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 -Added in 7.20.0. The \fBVRFY\fP and \fBEXPN\fP logic was added in 7.34.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_AUTH (3), -.BR CURLOPT_MAIL_FROM (3) diff --git a/docs/libcurl/opts/CURLOPT_MAIL_RCPT.md b/docs/libcurl/opts/CURLOPT_MAIL_RCPT.md new file mode 100644 index 000000000..ce57074f0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAIL_RCPT.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAIL_RCPT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_AUTH (3) + - CURLOPT_MAIL_FROM (3) +--- + +# NAME + +CURLOPT_MAIL_RCPT - list of SMTP mail recipients + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT, + struct curl_slist *rcpts); +~~~ + +# DESCRIPTION + +Pass a pointer to a linked list of recipients to pass to the server in your +SMTP mail request. The linked list should be a fully valid list of +**struct curl_slist** structs properly filled in. Use +curl_slist_append(3) to create the list and curl_slist_free_all(3) +to clean up an entire list. + +When performing a mail transfer, each recipient should be specified within a +pair of angled brackets (<>), however, should you not use an angled bracket as +the first character libcurl assumes you provided a single email address and +encloses that address within brackets for you. + +When performing an address verification (**VRFY** command), each recipient +should be specified as the user name or user name and domain (as per Section +3.5 of RFC 5321). + +When performing a mailing list expand (**EXPN** command), each recipient +should be specified using the mailing list name, such as "Friends" or +"London-Office". + +# DEFAULT + +NULL + +# PROTOCOLS + +SMTP + +# EXAMPLE + +~~~c +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, "person@example.com"); + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0. The **VRFY** and **EXPN** logic was added in 7.34.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.3 b/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.3 deleted file mode 100644 index bef151485..000000000 --- a/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAIL_RCPT_ALLOWFAILS 3 "16 Jan 2020" libcurl libcurl -.SH NAME -CURLOPT_MAIL_RCPT_ALLOWFAILS \- allow RCPT TO command to fail for some recipients -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLOWFAILS, - long allow); -.SH DESCRIPTION -If \fIallow\fP is set to 1L, allow RCPT TO command to fail for some recipients. - -When sending data to multiple recipients, by default curl aborts the SMTP -conversation if either one of the recipients causes the RCPT TO command to -return an error. - -The default behavior can be changed by setting \fIallow\fP to 1L which makes -libcurl ignore errors for individual recipients and proceed with the remaining -accepted recipients. - -If all recipients trigger RCPT TO failures and this flag is specified, curl -aborts the SMTP conversation and returns the error received from to the last -RCPT TO command. -.SH DEFAULT -0 -.SH PROTOCOLS -SMTP -.SH EXAMPLE -.nf -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, "person@example.com"); - list = curl_slist_append(list, "invalidemailaddress"); - - curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/"); - curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L); - - res = curl_easy_perform(curl); - curl_slist_free_all(list); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -This option was called CURLOPT_MAIL_RCPT_ALLLOWFAILS before 8.2.0 - -Added in 7.69.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_FROM (3), -.BR CURLOPT_MAIL_RCPT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.md b/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.md new file mode 100644 index 000000000..cf595e26b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLOWFAILS.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAIL_RCPT_ALLOWFAILS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_FROM (3) + - CURLOPT_MAIL_RCPT (3) +--- + +# NAME + +CURLOPT_MAIL_RCPT_ALLOWFAILS - allow RCPT TO command to fail for some recipients + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT_ALLOWFAILS, + long allow); +~~~ + +# DESCRIPTION + +If *allow* is set to 1L, allow RCPT TO command to fail for some recipients. + +When sending data to multiple recipients, by default curl aborts the SMTP +conversation if either one of the recipients causes the RCPT TO command to +return an error. + +The default behavior can be changed by setting *allow* to 1L which makes +libcurl ignore errors for individual recipients and proceed with the remaining +accepted recipients. + +If all recipients trigger RCPT TO failures and this flag is specified, curl +aborts the SMTP conversation and returns the error received from to the last +RCPT TO command. + +# DEFAULT + +0 + +# PROTOCOLS + +SMTP + +# EXAMPLE + +~~~c +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, "person@example.com"); + list = curl_slist_append(list, "invalidemailaddress"); + + curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/"); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT_ALLOWFAILS, 1L); + + res = curl_easy_perform(curl); + curl_slist_free_all(list); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +This option was called CURLOPT_MAIL_RCPT_ALLLOWFAILS before 8.2.0 + +Added in 7.69.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 b/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 deleted file mode 100644 index 652792857..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXAGE_CONN 3 "18 Apr 2019" libcurl libcurl -.SH NAME -CURLOPT_MAXAGE_CONN \- max idle time allowed for reusing a connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXAGE_CONN, long age); -.fi -.SH DESCRIPTION -Pass a long as parameter containing \fIage\fP - the maximum time in seconds -allowed for an existing connection to have been idle to be considered for -reuse for this request. - -The "connection cache" holds previously used connections. When a new request -is to be done, libcurl considers any connection that matches for reuse. The -\fICURLOPT_MAXAGE_CONN(3)\fP limit prevents libcurl from trying too old -connections for reuse, since old connections have a higher risk of not working -and thus trying them is a performance loss and sometimes service loss due to -the difficulties to figure out the situation. If a connection is found in the -cache that is older than this set \fIage\fP, it is closed instead. -.SH DEFAULT -Default maximum age is set to 118 seconds. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.65.0 -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_FORBID_REUSE (3), -.BR CURLOPT_FRESH_CONNECT (3), -.BR CURLOPT_MAXLIFETIME_CONN (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.md b/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.md new file mode 100644 index 000000000..3d0a9cb2a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXAGE_CONN +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FORBID_REUSE (3) + - CURLOPT_FRESH_CONNECT (3) + - CURLOPT_MAXLIFETIME_CONN (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_MAXAGE_CONN - max idle time allowed for reusing a connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXAGE_CONN, long age); +~~~ + +# DESCRIPTION + +Pass a long as parameter containing *age* - the maximum time in seconds +allowed for an existing connection to have been idle to be considered for +reuse for this request. + +The "connection cache" holds previously used connections. When a new request +is to be done, libcurl considers any connection that matches for reuse. The +CURLOPT_MAXAGE_CONN(3) limit prevents libcurl from trying too old +connections for reuse, since old connections have a higher risk of not working +and thus trying them is a performance loss and sometimes service loss due to +the difficulties to figure out the situation. If a connection is found in the +cache that is older than this set *age*, it is closed instead. + +# DEFAULT + +Default maximum age is set to 118 seconds. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.65.0 + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_MAXCONNECTS.3 b/docs/libcurl/opts/CURLOPT_MAXCONNECTS.3 deleted file mode 100644 index bb1c40398..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXCONNECTS.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXCONNECTS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAXCONNECTS \- maximum connection cache size -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXCONNECTS, long amount); -.fi -.SH DESCRIPTION -Pass a long. The set \fIamount\fP is the maximum number of simultaneously open -persistent connections that libcurl may cache in the pool associated with this -handle. The default is 5, and there is not much point in changing this value -unless you are perfectly aware of how this works. This concerns connections -using any of the protocols that support persistent connections. - -When reaching the maximum limit, curl closes the oldest one in the cache to -prevent increasing the number of open connections. - -If you already have performed transfers with this curl handle, setting a -smaller \fICURLOPT_MAXCONNECTS(3)\fP than before may cause open connections to -get closed unnecessarily. - -If you add this easy handle to a multi handle, this setting is not -acknowledged, and you must instead use \fIcurl_multi_setopt(3)\fP and the -\fICURLMOPT_MAXCONNECTS(3)\fP option. -.SH DEFAULT -5 -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3), -.BR CURLMOPT_MAX_TOTAL_CONNECTIONS (3), -.BR CURLMOPT_MAXCONNECTS (3), -.BR CURLOPT_MAXREDIRS (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXCONNECTS.md b/docs/libcurl/opts/CURLOPT_MAXCONNECTS.md new file mode 100644 index 000000000..807df4da1 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXCONNECTS.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXCONNECTS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAXCONNECTS (3) + - CURLMOPT_MAX_HOST_CONNECTIONS (3) + - CURLMOPT_MAX_TOTAL_CONNECTIONS (3) + - CURLOPT_MAXREDIRS (3) +--- + +# NAME + +CURLOPT_MAXCONNECTS - maximum connection cache size + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXCONNECTS, long amount); +~~~ + +# DESCRIPTION + +Pass a long. The set *amount* is the maximum number of simultaneously open +persistent connections that libcurl may cache in the pool associated with this +handle. The default is 5, and there is not much point in changing this value +unless you are perfectly aware of how this works. This concerns connections +using any of the protocols that support persistent connections. + +When reaching the maximum limit, curl closes the oldest one in the cache to +prevent increasing the number of open connections. + +If you already have performed transfers with this curl handle, setting a +smaller CURLOPT_MAXCONNECTS(3) than before may cause open connections to +get closed unnecessarily. + +If you add this easy handle to a multi handle, this setting is not +acknowledged, and you must instead use curl_multi_setopt(3) and the +CURLMOPT_MAXCONNECTS(3) option. + +# DEFAULT + +5 + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE.3 b/docs/libcurl/opts/CURLOPT_MAXFILESIZE.3 deleted file mode 100644 index ed970b29e..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXFILESIZE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXFILESIZE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAXFILESIZE \- maximum file size allowed to download -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE, long size); -.fi -.SH DESCRIPTION -Pass a long as parameter. This specifies the maximum accepted \fIsize\fP (in -bytes) of a file to download. If the file requested is found larger than this -value, the transfer is aborted and \fICURLE_FILESIZE_EXCEEDED\fP is returned. - -The file size is not always known prior to the download start, and for such -transfers this option has no effect - even if the file transfer eventually -ends up being larger than this given limit. - -If you want a limit above 2GB, use \fICURLOPT_MAXFILESIZE_LARGE(3)\fP. - -Since 8.4.0, this option also stops ongoing transfers if they reach this -threshold. -.SH DEFAULT -None -.SH PROTOCOLS -FTP, HTTP and MQTT -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_MAXFILESIZE_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md b/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md new file mode 100644 index 000000000..a90c94b7d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXFILESIZE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAXFILESIZE_LARGE (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) +--- + +# NAME + +CURLOPT_MAXFILESIZE - maximum file size allowed to download + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE, long size); +~~~ + +# DESCRIPTION + +Pass a long as parameter. This specifies the maximum accepted *size* (in +bytes) of a file to download. If the file requested is found larger than this +value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is returned. + +The file size is not always known prior to the download start, and for such +transfers this option has no effect - even if the file transfer eventually +ends up being larger than this given limit. + +If you want a limit above 2GB, use CURLOPT_MAXFILESIZE_LARGE(3). + +Since 8.4.0, this option also stops ongoing transfers if they reach this +threshold. + +# DEFAULT + +None + +# PROTOCOLS + +FTP, HTTP and MQTT + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3 b/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3 deleted file mode 100644 index 209701c4e..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXFILESIZE_LARGE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAXFILESIZE_LARGE \- maximum file size allowed to download -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE, - curl_off_t size); -.SH DESCRIPTION -Pass a curl_off_t as parameter. This specifies the maximum accepted \fIsize\fP -(in bytes) of a file to download. If the file requested is found larger than -this value, the transfer is aborted and \fICURLE_FILESIZE_EXCEEDED\fP is -returned. - -The file size is not always known prior to the download start, and for such -transfers this option has no effect - even if the file transfer eventually -ends up being larger than this given limit. - -Since 8.4.0, this option also stops ongoing transfers if they reach this -threshold. -.SH DEFAULT -None -.SH PROTOCOLS -FTP, HTTP and MQTT -.SH EXAMPLE -.nf -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 -Added in 7.11.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_MAXFILESIZE (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md b/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md new file mode 100644 index 000000000..041282f41 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXFILESIZE_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAXFILESIZE (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) +--- + +# NAME + +CURLOPT_MAXFILESIZE_LARGE - maximum file size allowed to download + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE, + curl_off_t size); +~~~ + +# DESCRIPTION + +Pass a curl_off_t as parameter. This specifies the maximum accepted *size* +(in bytes) of a file to download. If the file requested is found larger than +this value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is +returned. + +The file size is not always known prior to the download start, and for such +transfers this option has no effect - even if the file transfer eventually +ends up being larger than this given limit. + +Since 8.4.0, this option also stops ongoing transfers if they reach this +threshold. + +# DEFAULT + +None + +# PROTOCOLS + +FTP, HTTP and MQTT + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.11.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.3 b/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.3 deleted file mode 100644 index c3ec8aab9..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXLIFETIME_CONN 3 "10 Nov 2021" libcurl libcurl -.SH NAME -CURLOPT_MAXLIFETIME_CONN \- max lifetime (since creation) allowed for reusing a connection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXLIFETIME_CONN, - long maxlifetime); -.fi -.SH DESCRIPTION -Pass a long as parameter containing \fImaxlifetime\fP - the maximum time in -seconds, since the creation of the connection, that you allow an existing -connection to have to be considered for reuse for this request. - -libcurl features a connection cache that holds previously used connections. -When a new request is to be done, libcurl considers any connection that -matches for reuse. The \fICURLOPT_MAXLIFETIME_CONN(3)\fP limit prevents -libcurl from trying too old connections for reuse. This can be used for -client-side load balancing. If a connection is found in the cache that is -older than this set \fImaxlifetime\fP, it is instead marked for closure. - -If set to 0, this behavior is disabled: all connections are eligible for reuse. -.SH DEFAULT -Default \fImaxlifetime\fP is 0 seconds (i.e., disabled). -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.80.0 -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_FORBID_REUSE (3), -.BR CURLOPT_FRESH_CONNECT (3), -.BR CURLOPT_MAXAGE_CONN (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.md b/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.md new file mode 100644 index 000000000..f731ad999 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXLIFETIME_CONN.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXLIFETIME_CONN +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FORBID_REUSE (3) + - CURLOPT_FRESH_CONNECT (3) + - CURLOPT_MAXAGE_CONN (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_MAXLIFETIME_CONN - max lifetime (since creation) allowed for reusing a connection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXLIFETIME_CONN, + long maxlifetime); +~~~ + +# DESCRIPTION + +Pass a long as parameter containing *maxlifetime* - the maximum time in +seconds, since the creation of the connection, that you allow an existing +connection to have to be considered for reuse for this request. + +libcurl features a connection cache that holds previously used connections. +When a new request is to be done, libcurl considers any connection that +matches for reuse. The CURLOPT_MAXLIFETIME_CONN(3) limit prevents +libcurl from trying too old connections for reuse. This can be used for +client-side load balancing. If a connection is found in the cache that is +older than this set *maxlifetime*, it is instead marked for closure. + +If set to 0, this behavior is disabled: all connections are eligible for reuse. + +# DEFAULT + +Default *maxlifetime* is 0 seconds (i.e., disabled). + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.80.0 + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 b/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 deleted file mode 100644 index 763425a07..000000000 --- a/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAXREDIRS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAXREDIRS \- maximum number of redirects allowed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXREDIRS, long amount); -.fi -.SH DESCRIPTION -Pass a long. The set number is the redirection limit \fIamount\fP. If that -many redirections have been followed, the next redirect triggers the error -(\fICURLE_TOO_MANY_REDIRECTS\fP). This option only makes sense if the -\fICURLOPT_FOLLOWLOCATION(3)\fP is used at the same time. - -Setting the limit to 0 makes libcurl refuse any redirect. - -Set it to -1 for an infinite number of redirects. This allows your application -to get stuck in never-ending redirect loops. -.SH DEFAULT -30 (since 8.3.0), it was previously unlimited. -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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); - - /* allow three redirects */ - curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLOPT_FOLLOWLOCATION (3) diff --git a/docs/libcurl/opts/CURLOPT_MAXREDIRS.md b/docs/libcurl/opts/CURLOPT_MAXREDIRS.md new file mode 100644 index 000000000..5ace67e42 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAXREDIRS.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAXREDIRS +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLINFO_REDIRECT_URL (3) + - CURLOPT_FOLLOWLOCATION (3) +--- + +# NAME + +CURLOPT_MAXREDIRS - maximum number of redirects allowed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXREDIRS, long amount); +~~~ + +# DESCRIPTION + +Pass a long. The set number is the redirection limit *amount*. If that +many redirections have been followed, the next redirect triggers the error +(*CURLE_TOO_MANY_REDIRECTS*). This option only makes sense if the +CURLOPT_FOLLOWLOCATION(3) is used at the same time. + +Setting the limit to 0 makes libcurl refuse any redirect. + +Set it to -1 for an infinite number of redirects. This allows your application +to get stuck in never-ending redirect loops. + +# DEFAULT + +30 (since 8.3.0), it was previously unlimited. + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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); + + /* allow three redirects */ + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.3 b/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.3 deleted file mode 100644 index 9f0a5ac92..000000000 --- a/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAX_RECV_SPEED_LARGE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAX_RECV_SPEED_LARGE \- rate limit data download speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_RECV_SPEED_LARGE, - curl_off_t maxspeed); -.SH DESCRIPTION -Pass a curl_off_t as parameter. If a download exceeds this \fImaxspeed\fP -(counted in bytes per second) the transfer pauses to keep the average speed -less than or equal to the parameter value. Defaults to unlimited speed. - -This is not an exact science. libcurl attempts to keep the average speed below -the given threshold over a period time. - -If you set \fImaxspeed\fP to a value lower than \fICURLOPT_BUFFERSIZE(3)\fP, -libcurl might download faster than the set limit initially. - -This option does not affect transfer speeds done with FILE:// URLs. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -All but file:// -.SH EXAMPLE -.nf -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 -Added in 7.15.5 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_MAX_SEND_SPEED_LARGE (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.md b/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.md new file mode 100644 index 000000000..646f301e4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAX_RECV_SPEED_LARGE.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAX_RECV_SPEED_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_MAX_SEND_SPEED_LARGE (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_MAX_RECV_SPEED_LARGE - rate limit data download speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_RECV_SPEED_LARGE, + curl_off_t maxspeed); +~~~ + +# DESCRIPTION + +Pass a curl_off_t as parameter. If a download exceeds this *maxspeed* +(counted in bytes per second) the transfer pauses to keep the average speed +less than or equal to the parameter value. Defaults to unlimited speed. + +This is not an exact science. libcurl attempts to keep the average speed below +the given threshold over a period time. + +If you set *maxspeed* to a value lower than CURLOPT_BUFFERSIZE(3), +libcurl might download faster than the set limit initially. + +This option does not affect transfer speeds done with FILE:// URLs. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +All but file:// + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.5 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.3 b/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.3 deleted file mode 100644 index 364baed31..000000000 --- a/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MAX_SEND_SPEED_LARGE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_MAX_SEND_SPEED_LARGE \- rate limit data upload speed -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_SEND_SPEED_LARGE, - curl_off_t maxspeed); -.SH DESCRIPTION -Pass a curl_off_t as parameter with the \fImaxspeed\fP. If an upload exceeds -this speed (counted in bytes per second) the transfer pauses to keep the -average speed less than or equal to the parameter value. Defaults to unlimited -speed. - -This is not an exact science. libcurl attempts to keep the average speed below -the given threshold over a period time. - -If you set \fImaxspeed\fP to a value lower than -\fICURLOPT_UPLOAD_BUFFERSIZE(3)\fP, libcurl might "shoot over" the limit on -its first send and still send off a full buffer. - -This option does not affect transfer speeds done with FILE:// URLs. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -All except file:// -.SH EXAMPLE -.nf -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 -Added in 7.15.5 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.md b/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.md new file mode 100644 index 000000000..8b709ccb7 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MAX_SEND_SPEED_LARGE.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MAX_SEND_SPEED_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) +--- + +# NAME + +CURLOPT_MAX_SEND_SPEED_LARGE - rate limit data upload speed + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_SEND_SPEED_LARGE, + curl_off_t maxspeed); +~~~ + +# DESCRIPTION + +Pass a curl_off_t as parameter with the *maxspeed*. If an upload exceeds +this speed (counted in bytes per second) the transfer pauses to keep the +average speed less than or equal to the parameter value. Defaults to unlimited +speed. + +This is not an exact science. libcurl attempts to keep the average speed below +the given threshold over a period time. + +If you set *maxspeed* to a value lower than +CURLOPT_UPLOAD_BUFFERSIZE(3), libcurl might "shoot over" the limit on +its first send and still send off a full buffer. + +This option does not affect transfer speeds done with FILE:// URLs. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +All except file:// + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.15.5 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_MIMEPOST.3 b/docs/libcurl/opts/CURLOPT_MIMEPOST.3 deleted file mode 100644 index 02a5a0a7f..000000000 --- a/docs/libcurl/opts/CURLOPT_MIMEPOST.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MIMEPOST 3 "22 Aug 2017" libcurl libcurl -.SH NAME -CURLOPT_MIMEPOST \- send data from mime structure -.SH SYNOPSIS -.nf -#include - -curl_mime *mime; - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIMEPOST, mime); -.SH DESCRIPTION -Pass a mime handle previously obtained from \fIcurl_mime_init(3)\fP. - -This setting is supported by the HTTP protocol to post forms and by the -SMTP and IMAP protocols to provide the email data to send/upload. - -This option is the preferred way of posting an HTTP form, replacing and -extending the \fICURLOPT_HTTPPOST(3)\fP option. - -When setting \fICURLOPT_MIMEPOST(3)\fP to NULL, libcurl resets the request -type for HTTP to the default to disable the POST. Typically that would mean it -is reset to GET. Instead you should set a desired request method explicitly. -.SH PROTOCOLS -HTTP, SMTP, IMAP. -.SH EXAMPLE -.nf -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(curl, CURLOPT_MIMEPOST, multipart); - - curl_easy_perform(curl); /* post away! */ - curl_mime_free(multipart); /* free the post data */ - } - } -} -.fi -.SH AVAILABILITY -Added in 7.56.0 -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR curl_mime_init (3), -.BR CURLOPT_HTTPPOST (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_PUT (3) diff --git a/docs/libcurl/opts/CURLOPT_MIMEPOST.md b/docs/libcurl/opts/CURLOPT_MIMEPOST.md new file mode 100644 index 000000000..588b7e803 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MIMEPOST.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MIMEPOST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPOST (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_PUT (3) + - curl_mime_init (3) +--- + +# NAME + +CURLOPT_MIMEPOST - send data from mime structure + +# SYNOPSIS + +~~~c +#include + +curl_mime *mime; + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIMEPOST, mime); +~~~ + +# DESCRIPTION + +Pass a mime handle previously obtained from curl_mime_init(3). + +This setting is supported by the HTTP protocol to post forms and by the +SMTP and IMAP protocols to provide the email data to send/upload. + +This option is the preferred way of posting an HTTP form, replacing and +extending the CURLOPT_HTTPPOST(3) option. + +When setting CURLOPT_MIMEPOST(3) to NULL, libcurl resets the request +type for HTTP to the default to disable the POST. Typically that would mean it +is reset to GET. Instead you should set a desired request method explicitly. + +# PROTOCOLS + +HTTP, SMTP, IMAP. + +# EXAMPLE + +~~~c +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(curl, CURLOPT_MIMEPOST, multipart); + + curl_easy_perform(curl); /* post away! */ + curl_mime_free(multipart); /* free the post data */ + } + } +} +~~~ + +# AVAILABILITY + +Added in 7.56.0 + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.3 deleted file mode 100644 index 3f7282351..000000000 --- a/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_MIME_OPTIONS 3 "2 Oct 2021" libcurl libcurl -.SH NAME -CURLOPT_MIME_OPTIONS \- set MIME option flags -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIME_OPTIONS, long options); -.fi -.SH DESCRIPTION -Pass a long that holds a bitmask of CURLMIMEOPT_* defines. Each bit is a -Boolean flag used while encoding a MIME tree or multipart form data. - -Available bits are: -.IP CURLMIMEOPT_FORMESCAPE -Tells libcurl to escape multipart form field and file names using the -backslash-escaping algorithm rather than percent-encoding (HTTP only). - -Backslash-escaping consists in preceding backslashes and double quotes with -a backslash. Percent encoding maps all occurrences of double quote, -carriage return and line feed to %22, %0D and %0A respectively. - -Before version 7.81.0, percent-encoding was never applied. - -HTTP browsers used to do backslash-escaping in the past but have over time -transitioned to use percent-encoding. This option allows one to address -server-side applications that have not yet have been converted. - -As an example, consider field or file name \fIstrange\\name"kind\fP. -When the containing multipart form is sent, this is normally transmitted as -\fIstrange\\name%22kind\fP. When this option is set, it is sent as -\fIstrange\\\\name\\"kind\fP. -.SH DEFAULT -0, meaning disabled. -.SH PROTOCOLS -HTTP, IMAP, SMTP -.SH EXAMPLE -.nf -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); - - 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); - - /* Perform the request */ - curl_easy_perform(curl); - } - } - - curl_easy_cleanup(curl); - curl_mime_free(form); - } -} -.fi -.SH AVAILABILITY -Option added in 7.81.0. -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_HTTPPOST (3), -.BR CURLOPT_MIMEPOST (3) diff --git a/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.md b/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.md new file mode 100644 index 000000000..6ba9abb5f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_MIME_OPTIONS.md @@ -0,0 +1,97 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_MIME_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPOST (3) + - CURLOPT_MIMEPOST (3) +--- + +# NAME + +CURLOPT_MIME_OPTIONS - set MIME option flags + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIME_OPTIONS, long options); +~~~ + +# DESCRIPTION + +Pass a long that holds a bitmask of CURLMIMEOPT_* defines. Each bit is a +Boolean flag used while encoding a MIME tree or multipart form data. + +Available bits are: + +## CURLMIMEOPT_FORMESCAPE + +Tells libcurl to escape multipart form field and file names using the +backslash-escaping algorithm rather than percent-encoding (HTTP only). + +Backslash-escaping consists in preceding backslashes and double quotes with +a backslash. Percent encoding maps all occurrences of double quote, +carriage return and line feed to %22, %0D and %0A respectively. + +Before version 7.81.0, percent-encoding was never applied. + +HTTP browsers used to do backslash-escaping in the past but have over time +transitioned to use percent-encoding. This option allows one to address +server-side applications that have not yet have been converted. + +As an example, consider field or file name *strangename"kind*. +When the containing multipart form is sent, this is normally transmitted as +*strangename%22kind*. When this option is set, it is sent as +*strangename"kind*. + +# DEFAULT + +0, meaning disabled. + +# PROTOCOLS + +HTTP, IMAP, SMTP + +# EXAMPLE + +~~~c +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); + + 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); + + /* Perform the request */ + curl_easy_perform(curl); + } + } + + curl_easy_cleanup(curl); + curl_mime_free(form); + } +} +~~~ + +# AVAILABILITY + +Option added in 7.81.0. + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_NETRC.3 b/docs/libcurl/opts/CURLOPT_NETRC.3 deleted file mode 100644 index 3f04fccf7..000000000 --- a/docs/libcurl/opts/CURLOPT_NETRC.3 +++ /dev/null @@ -1,126 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NETRC 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NETRC \- enable use of .netrc -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC, long level); -.fi -.SH DESCRIPTION -This parameter controls the preference \fIlevel\fP of libcurl between using -user names and passwords from your \fI~/.netrc\fP file, relative to user names -and passwords in the URL supplied with \fICURLOPT_URL(3)\fP. - -On Windows, libcurl uses the file as \fI%HOME%/_netrc\fP. If \fI%HOME%\fP is -not set on Windows, libcurl falls back to \fI%USERPROFILE%\fP. - -You can also tell libcurl a different file name to use with -\fICURLOPT_NETRC_FILE(3)\fP. - -libcurl uses a user name (and supplied or prompted password) supplied with -\fICURLOPT_USERPWD(3)\fP or \fICURLOPT_USERNAME(3)\fP in preference to any of -the options controlled by this parameter. - -Only machine name, user name and password are taken into account (init macros -and similar things are not supported). - -libcurl does not verify that the file has the correct properties set (as the -standard Unix ftp client does). It should only be readable by user. - -\fIlevel\fP is a long that should be set to one of the values described below. -.IP "CURL_NETRC_IGNORED (0)" -libcurl ignores the \fI.netrc\fP file. This is the default. -.IP "CURL_NETRC_OPTIONAL (1)" -The use of the \fI.netrc\fP file is optional, and information in the URL is to -be preferred. The file is scanned for the host and user name (to find the -password only) or for the host only, to find the first user name and password -after that \fImachine\fP, which ever information is not specified. -.IP "CURL_NETRC_REQUIRED (2)" -The use of the \fI.netrc\fP file is required, and any credential information -present in the URL is ignored. The file is scanned for the host and user name -(to find the password only) or for the host only, to find the first user name -and password after that \fImachine\fP, which ever information is not -specified. -.SH FILE FORMAT -The \fB.netrc\fP file format is simple: you specify lines with a machine name -and follow the login and password that are associated with that machine. - -Each field is provided as a sequence of letters that ends with a space or -newline. Starting in 7.84.0, libcurl also supports quoted strings. They start -and end with double quotes and support the escaped special letters \\\", \\n, -\\r, and \\t. Quoted strings are the only way a space character can be used in -a user name or password. - -.IP "machine " -Provides credentials for a host called \fBname\fP. libcurl searches the .netrc -file for a machine token that matches the host name specified in the URL. Once -a match is made, the subsequent tokens are processed, stopping when the end of -file is reached or another "machine" is encountered. -.IP default -This is the same as "machine" name except that default matches any name. There -can be only one default token, and it must be after all machine tokens. To -provide a default anonymous login for hosts that are not otherwise matched, -add a line similar to this in the end: - - default login anonymous password user@domain -.IP "login " -The user name string for the remote machine. -.IP "password " -Supply a password. If this token is present, curl supplies the specified -string if the remote server requires a password as part of the login process. -Note that if this token is present in the .netrc file you really should make -sure the file is not readable by anyone besides the user. -.IP "macdef " -Define a macro. This feature is not supported by libcurl. In order for the -rest of the .netrc to still work fine, libcurl properly skips every definition -done with "macdef" that it finds. -.SH DEFAULT -CURL_NETRC_IGNORED -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_USERPWD (3), -.BR CURLOPT_USERNAME (3), -.BR CURLOPT_NETRC_FILE (3) diff --git a/docs/libcurl/opts/CURLOPT_NETRC.md b/docs/libcurl/opts/CURLOPT_NETRC.md new file mode 100644 index 000000000..4ec831335 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NETRC.md @@ -0,0 +1,141 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NETRC +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NETRC_FILE (3) + - CURLOPT_USERNAME (3) + - CURLOPT_USERPWD (3) +--- + +# NAME + +CURLOPT_NETRC - enable use of .netrc + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC, long level); +~~~ + +# DESCRIPTION + +This parameter controls the preference *level* of libcurl between using +user names and passwords from your *~/.netrc* file, relative to user names +and passwords in the URL supplied with CURLOPT_URL(3). + +On Windows, libcurl uses the file as *%HOME%/_netrc*. If *%HOME%* is +not set on Windows, libcurl falls back to *%USERPROFILE%*. + +You can also tell libcurl a different file name to use with +CURLOPT_NETRC_FILE(3). + +libcurl uses a user name (and supplied or prompted password) supplied with +CURLOPT_USERPWD(3) or CURLOPT_USERNAME(3) in preference to any of +the options controlled by this parameter. + +Only machine name, user name and password are taken into account (init macros +and similar things are not supported). + +libcurl does not verify that the file has the correct properties set (as the +standard Unix ftp client does). It should only be readable by user. + +*level* is a long that should be set to one of the values described below. + +## CURL_NETRC_IGNORED (0) + +libcurl ignores the *.netrc* file. This is the default. + +## CURL_NETRC_OPTIONAL (1) + +The use of the *.netrc* file is optional, and information in the URL is to +be preferred. The file is scanned for the host and user name (to find the +password only) or for the host only, to find the first user name and password +after that *machine*, which ever information is not specified. + +## CURL_NETRC_REQUIRED (2) + +The use of the *.netrc* file is required, and any credential information +present in the URL is ignored. The file is scanned for the host and user name +(to find the password only) or for the host only, to find the first user name +and password after that *machine*, which ever information is not +specified. + +# FILE FORMAT + +The **.netrc** file format is simple: you specify lines with a machine name +and follow the login and password that are associated with that machine. + +Each field is provided as a sequence of letters that ends with a space or +newline. Starting in 7.84.0, libcurl also supports quoted strings. They start +and end with double quotes and support the escaped special letters ", n, +r, and t. Quoted strings are the only way a space character can be used in +a user name or password. + +## machine + +Provides credentials for a host called **name**. libcurl searches the .netrc +file for a machine token that matches the host name specified in the URL. Once +a match is made, the subsequent tokens are processed, stopping when the end of +file is reached or another "machine" is encountered. + +## default + +This is the same as "machine" name except that default matches any name. There +can be only one default token, and it must be after all machine tokens. To +provide a default anonymous login for hosts that are not otherwise matched, +add a line similar to this in the end: + + default login anonymous password user@domain + +## login + +The user name string for the remote machine. + +## password + +Supply a password. If this token is present, curl supplies the specified +string if the remote server requires a password as part of the login process. +Note that if this token is present in the .netrc file you really should make +sure the file is not readable by anyone besides the user. + +## macdef + +Define a macro. This feature is not supported by libcurl. In order for the +rest of the .netrc to still work fine, libcurl properly skips every definition +done with "macdef" that it finds. + +# DEFAULT + +CURL_NETRC_IGNORED + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_NETRC_FILE.3 b/docs/libcurl/opts/CURLOPT_NETRC_FILE.3 deleted file mode 100644 index ff0bb5050..000000000 --- a/docs/libcurl/opts/CURLOPT_NETRC_FILE.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NETRC_FILE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NETRC_FILE \- file name to read .netrc info from -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file); -.fi -.SH DESCRIPTION -Pass a char * as parameter, pointing to a null-terminated string containing -the full path name to the \fIfile\fP you want libcurl to use as .netrc -file. If this option is omitted, and \fICURLOPT_NETRC(3)\fP is set, libcurl -checks for a .netrc file in the current user's home directory. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.10.9 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_NETRC (3), -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_NETRC_FILE.md b/docs/libcurl/opts/CURLOPT_NETRC_FILE.md new file mode 100644 index 000000000..95a3e877d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NETRC_FILE.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NETRC_FILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NETRC (3) + - CURLOPT_PASSWORD (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_NETRC_FILE - file name to read .netrc info from + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, pointing to a null-terminated string +containing the full path name to the *file* you want libcurl to use as .netrc +file. If this option is omitted, and CURLOPT_NETRC(3) is set, libcurl checks +for a .netrc file in the current user's home directory. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.9 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.3 b/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.3 deleted file mode 100644 index 97282225a..000000000 --- a/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NEW_DIRECTORY_PERMS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NEW_DIRECTORY_PERMS \- permissions for remotely created directories -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS, - long mode); -.SH DESCRIPTION -Pass a long as a parameter, containing the value of the permissions that is -set on newly created directories on the remote server. The default value is -\fI0755\fP, but any valid value can be used. The only protocols that can use -this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP. -.SH DEFAULT -0755 -.SH PROTOCOLS -SFTP, SCP and FILE -.SH EXAMPLE -.nf -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 -Added in 7.16.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FTP_CREATE_MISSING_DIRS (3), -.BR CURLOPT_NEW_FILE_PERMS (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.md b/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.md new file mode 100644 index 000000000..bb302d42b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NEW_DIRECTORY_PERMS.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NEW_DIRECTORY_PERMS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FTP_CREATE_MISSING_DIRS (3) + - CURLOPT_NEW_FILE_PERMS (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_NEW_DIRECTORY_PERMS - permissions for remotely created directories + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS, + long mode); +~~~ + +# DESCRIPTION + +Pass a long as a parameter, containing the value of the permissions that is +set on newly created directories on the remote server. The default value is +*0755*, but any valid value can be used. The only protocols that can use +this are *sftp://*, *scp://*, and *file://*. + +# DEFAULT + +0755 + +# PROTOCOLS + +SFTP, SCP and FILE + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.3 b/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.3 deleted file mode 100644 index b81041d16..000000000 --- a/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NEW_FILE_PERMS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NEW_FILE_PERMS \- permissions for remotely created files -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS, - long mode); -.SH DESCRIPTION -Pass a long as a parameter, containing the value of the permissions that are -set on newly created files on the remote server. The default value is -\fI0644\fP, but any valid value can be used. The only protocols that can use -this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP. -.SH DEFAULT -0644 -.SH PROTOCOLS -SFTP, SCP and FILE -.SH EXAMPLE -.nf -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 -Added in 7.16.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_NEW_DIRECTORY_PERMS (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.md b/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.md new file mode 100644 index 000000000..dd12c0bbd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NEW_FILE_PERMS.md @@ -0,0 +1,60 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NEW_FILE_PERMS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NEW_DIRECTORY_PERMS (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_NEW_FILE_PERMS - permissions for remotely created files + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS, + long mode); +~~~ + +# DESCRIPTION + +Pass a long as a parameter, containing the value of the permissions that are +set on newly created files on the remote server. The default value is *0644*. +The only protocols that can use this are *sftp://*, *scp://*, and *file://*. + +# DEFAULT + +0644 + +# PROTOCOLS + +SFTP, SCP and FILE + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_NOBODY.3 b/docs/libcurl/opts/CURLOPT_NOBODY.3 deleted file mode 100644 index a21a825a3..000000000 --- a/docs/libcurl/opts/CURLOPT_NOBODY.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NOBODY 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NOBODY \- do the download request without getting the body -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt); -.fi -.SH DESCRIPTION -A long parameter set to 1 tells libcurl to not include the body-part in the -output when doing what would otherwise be a download. For HTTP(S), this makes -libcurl do a HEAD request. For most other protocols it means just not asking -to transfer the body data. - -For HTTP operations when \fICURLOPT_NOBODY(3)\fP has been set, disabling this -option (with 0) makes it a GET again - only if the method is still set to be -HEAD. The proper way to get back to a GET request is to set -\fICURLOPT_HTTPGET(3)\fP and for other methods, use the POST or UPLOAD -options. - -Enabling \fICURLOPT_NOBODY(3)\fP means asking for a download without a body. - -If you do a transfer with HTTP that involves a method other than HEAD, you get -a body (unless the resource and server sends a zero byte body for the specific -URL you request). -.SH DEFAULT -0, the body is transferred -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_HTTPGET (3), -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_REQUEST_TARGET (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_NOBODY.md b/docs/libcurl/opts/CURLOPT_NOBODY.md new file mode 100644 index 000000000..9d63154c9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NOBODY.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NOBODY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPGET (3) + - CURLOPT_MIMEPOST (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_REQUEST_TARGET (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_NOBODY - do the download request without getting the body + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt); +~~~ + +# DESCRIPTION + +A long parameter set to 1 tells libcurl to not include the body-part in the +output when doing what would otherwise be a download. For HTTP(S), this makes +libcurl do a HEAD request. For most other protocols it means just not asking +to transfer the body data. + +For HTTP operations when CURLOPT_NOBODY(3) has been set, disabling this +option (with 0) makes it a GET again - only if the method is still set to be +HEAD. The proper way to get back to a GET request is to set +CURLOPT_HTTPGET(3) and for other methods, use the POST or UPLOAD +options. + +Enabling CURLOPT_NOBODY(3) means asking for a download without a body. + +If you do a transfer with HTTP that involves a method other than HEAD, you get +a body (unless the resource and server sends a zero byte body for the specific +URL you request). + +# DEFAULT + +0, the body is transferred + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_NOPROGRESS.3 b/docs/libcurl/opts/CURLOPT_NOPROGRESS.3 deleted file mode 100644 index fd4e07f32..000000000 --- a/docs/libcurl/opts/CURLOPT_NOPROGRESS.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NOPROGRESS 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NOPROGRESS \- switch off the progress meter -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROGRESS, long onoff); -.fi -.SH DESCRIPTION -If \fIonoff\fP is to 1, it tells the library to shut off the progress meter -completely for requests done with this \fIhandle\fP. It also prevents the -\fICURLOPT_XFERINFOFUNCTION(3)\fP or \fICURLOPT_PROGRESSFUNCTION(3)\fP from -getting called. -.SH DEFAULT -1, meaning it normally runs without a progress meter. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_PROGRESSFUNCTION (3), -.BR CURLOPT_VERBOSE (3), -.BR CURLOPT_XFERINFOFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_NOPROGRESS.md b/docs/libcurl/opts/CURLOPT_NOPROGRESS.md new file mode 100644 index 000000000..e2845a96f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NOPROGRESS.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NOPROGRESS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_PROGRESSFUNCTION (3) + - CURLOPT_VERBOSE (3) + - CURLOPT_XFERINFOFUNCTION (3) +--- + +# NAME + +CURLOPT_NOPROGRESS - switch off the progress meter + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROGRESS, long onoff); +~~~ + +# DESCRIPTION + +If *onoff* is to 1, it tells the library to shut off the progress meter +completely for requests done with this *handle*. It also prevents the +CURLOPT_XFERINFOFUNCTION(3) or CURLOPT_PROGRESSFUNCTION(3) from +getting called. + +# DEFAULT + +1, meaning it normally runs without a progress meter. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_NOPROXY.3 b/docs/libcurl/opts/CURLOPT_NOPROXY.3 deleted file mode 100644 index 1a5b07570..000000000 --- a/docs/libcurl/opts/CURLOPT_NOPROXY.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NOPROXY 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NOPROXY \- disable proxy use for specific hosts -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROXY, char *noproxy); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string. The string consists of a comma -separated list of host names that do not require a proxy to get reached, even -if one is specified. The only wildcard available is a single * character, -which matches all hosts, and effectively disables the proxy. Each name in this -list is matched as either a domain which contains the hostname, or the -hostname itself. For example, "ample.com" would match ample.com, ample.com:80, -and www.ample.com, but not www.example.com or ample.com.org. - -Setting the \fInoproxy\fP string to "" (an empty string) explicitly enables -the proxy for all host names, even if there is an environment variable set for -it. - -Enter IPv6 numerical addresses in the list of host names without enclosing -brackets: - - "example.com,::1,localhost" - -Since 7.86.0, IP addresses specified to this option can be provided using CIDR -notation: an appended slash and number specifies the number of "network bits" -out of the address to use in the comparison. For example "192.168.0.0/16" -would match all addresses starting with "192.168". - -The application does not have to keep the string around after setting this -option. -.SH "Environment variables" -If there is an environment variable called \fBno_proxy\fP (or \fBNO_PROXY\fP), -it is used if the \fICURLOPT_NOPROXY(3)\fP option is not set. It works exactly -the same way. -.SH DEFAULT -NULL -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Added in 7.19.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYAUTH (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_NOPROXY.md b/docs/libcurl/opts/CURLOPT_NOPROXY.md new file mode 100644 index 000000000..91292e22e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NOPROXY.md @@ -0,0 +1,91 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NOPROXY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_NOPROXY - disable proxy use for specific hosts + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROXY, char *noproxy); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string. The string consists of a comma +separated list of host names that do not require a proxy to get reached, even +if one is specified. The only wildcard available is a single * character, +which matches all hosts, and effectively disables the proxy. Each name in this +list is matched as either a domain which contains the hostname, or the +hostname itself. For example, "ample.com" would match ample.com, ample.com:80, +and www.ample.com, but not www.example.com or ample.com.org. + +Setting the *noproxy* string to "" (an empty string) explicitly enables +the proxy for all host names, even if there is an environment variable set for +it. + +Enter IPv6 numerical addresses in the list of host names without enclosing +brackets: + + "example.com,::1,localhost" + +Since 7.86.0, IP addresses specified to this option can be provided using CIDR +notation: an appended slash and number specifies the number of "network bits" +out of the address to use in the comparison. For example "192.168.0.0/16" +would match all addresses starting with "192.168". + +The application does not have to keep the string around after setting this +option. + +# Environment variables + +If there is an environment variable called **no_proxy** (or **NO_PROXY**), +it is used if the CURLOPT_NOPROXY(3) option is not set. It works exactly +the same way. + +# DEFAULT + +NULL + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_NOSIGNAL.3 b/docs/libcurl/opts/CURLOPT_NOSIGNAL.3 deleted file mode 100644 index 290f44e42..000000000 --- a/docs/libcurl/opts/CURLOPT_NOSIGNAL.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_NOSIGNAL 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_NOSIGNAL \- skip all signal handling -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOSIGNAL, long onoff); -.fi -.SH DESCRIPTION -If \fIonoff\fP is 1, libcurl uses no functions that install signal handlers or -any functions that cause signals to be sent to the process. This option is -here to allow multi-threaded unix applications to still set/use all timeout -options etc, without risking getting signals. - -If this option is set and libcurl has been built with the standard name -resolver, timeouts cannot occur while the name resolve takes place. Consider -building libcurl with the c-ares or threaded resolver backends to enable -asynchronous DNS lookups, to enable timeouts for name resolves without the use -of signals. - -Setting \fICURLOPT_NOSIGNAL(3)\fP to 1 makes libcurl NOT ask the system to -ignore SIGPIPE signals, which otherwise are sent by the system when trying to -send data to a socket which is closed in the other end. libcurl makes an -effort to never cause such SIGPIPE signals to trigger, but some operating -systems have no way to avoid them and even on those that have there are some -corner cases when they may still happen, contrary to our desire. In addition, -using \fICURLAUTH_NTLM_WB\fP authentication could cause a SIGCHLD signal to be -raised. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.10 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH SEE ALSO -.BR CURLOPT_TIMEOUT "(3), " diff --git a/docs/libcurl/opts/CURLOPT_NOSIGNAL.md b/docs/libcurl/opts/CURLOPT_NOSIGNAL.md new file mode 100644 index 000000000..50ae65cca --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_NOSIGNAL.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_NOSIGNAL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_NOSIGNAL - skip all signal handling + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOSIGNAL, long onoff); +~~~ + +# DESCRIPTION + +If *onoff* is 1, libcurl uses no functions that install signal handlers or +any functions that cause signals to be sent to the process. This option is +here to allow multi-threaded unix applications to still set/use all timeout +options etc, without risking getting signals. + +If this option is set and libcurl has been built with the standard name +resolver, timeouts cannot occur while the name resolve takes place. Consider +building libcurl with the c-ares or threaded resolver backends to enable +asynchronous DNS lookups, to enable timeouts for name resolves without the use +of signals. + +Setting CURLOPT_NOSIGNAL(3) to 1 makes libcurl NOT ask the system to +ignore SIGPIPE signals, which otherwise are sent by the system when trying to +send data to a socket which is closed in the other end. libcurl makes an +effort to never cause such SIGPIPE signals to trigger, but some operating +systems have no way to avoid them and even on those that have there are some +corner cases when they may still happen, contrary to our desire. In addition, +using *CURLAUTH_NTLM_WB* authentication could cause a SIGCHLD signal to be +raised. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3 b/docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3 rename to docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.md index e4c227a89..f3e7ef855 100644 --- a/docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3 +++ b/docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.md @@ -1,46 +1,44 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_OPENSOCKETDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_OPENSOCKETDATA \- pointer passed to open socket callback -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_OPENSOCKETDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CLOSESOCKETFUNCTION (3) + - CURLOPT_OPENSOCKETFUNCTION (3) + - CURLOPT_SOCKOPTFUNCTION (3) +--- + +# NAME + +CURLOPT_OPENSOCKETDATA - pointer passed to open socket callback + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_OPENSOCKETDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the first +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the first argument in the open socket callback set with -\fICURLOPT_OPENSOCKETFUNCTION(3)\fP. -.SH DEFAULT +CURLOPT_OPENSOCKETFUNCTION(3). + +# DEFAULT + The default value of this parameter is NULL. -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* make libcurl use the already established socket 'sockfd' */ static curl_socket_t opensocket(void *clientp, @@ -83,12 +81,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.17.1 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CLOSESOCKETFUNCTION (3), -.BR CURLOPT_OPENSOCKETFUNCTION (3), -.BR CURLOPT_SOCKOPTFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3 b/docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.md index 9d1a9fd4c..125ccff68 100644 --- a/docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.md @@ -1,32 +1,22 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_OPENSOCKETFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_OPENSOCKETFUNCTION \- callback for opening socket -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_OPENSOCKETFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CLOSESOCKETFUNCTION (3) + - CURLOPT_OPENSOCKETFUNCTION (3) + - CURLOPT_SOCKOPTFUNCTION (3) +--- + +# NAME + +CURLOPT_OPENSOCKETFUNCTION - callback for opening socket + +# SYNOPSIS + +~~~c #include typedef enum { @@ -46,41 +36,50 @@ curl_socket_t opensocket_callback(void *clientp, struct curl_sockaddr *address); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_OPENSOCKETFUNCTION, opensocket_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. -This callback function gets called by libcurl instead of the \fIsocket(2)\fP -call. The callback's \fIpurpose\fP argument identifies the exact purpose for -this particular socket. \fICURLSOCKTYPE_IPCXN\fP is for IP based connections +This callback function gets called by libcurl instead of the *socket(2)* +call. The callback's *purpose* argument identifies the exact purpose for +this particular socket. *CURLSOCKTYPE_IPCXN* is for IP based connections and is the only purpose currently used in libcurl. Future versions of libcurl may support more purposes. -The \fIclientp\fP pointer contains whatever user-defined value set using the -\fICURLOPT_OPENSOCKETDATA(3)\fP function. +The *clientp* pointer contains whatever user-defined value set using the +CURLOPT_OPENSOCKETDATA(3) function. -The callback gets the resolved peer address as the \fIaddress\fP argument and +The callback gets the resolved peer address as the *address* argument and is allowed to modify the address or refuse to connect completely. The callback -function should return the newly created socket or \fICURL_SOCKET_BAD\fP in +function should return the newly created socket or *CURL_SOCKET_BAD* in case no connection could be established or another error was detected. Any -additional \fIsetsockopt(2)\fP calls can of course be done on the socket at -the user's discretion. A \fICURL_SOCKET_BAD\fP return value from the callback +additional *setsockopt(2)* calls can of course be done on the socket at +the user's discretion. A *CURL_SOCKET_BAD* return value from the callback function signals an unrecoverable error to libcurl and it returns -\fICURLE_COULDNT_CONNECT\fP from the function that triggered this callback. +*CURLE_COULDNT_CONNECT* from the function that triggered this callback. This return code can be used for IP address block listing. If you want to pass in a socket with an already established connection, pass the socket back with this callback and then use -\fICURLOPT_SOCKOPTFUNCTION(3)\fP to signal that it already is connected. -.SH DEFAULT +CURLOPT_SOCKOPTFUNCTION(3) to signal that it already is connected. + +# DEFAULT + The default behavior is the equivalent of this: -.nf +~~~c return socket(addr->family, addr->socktype, addr->protocol); -.fi -.SH PROTOCOLS +~~~ + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* make libcurl use the already established socket 'sockfd' */ static curl_socket_t opensocket(void *clientp, @@ -122,12 +121,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.17.1. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CLOSESOCKETFUNCTION (3), -.BR CURLOPT_OPENSOCKETFUNCTION (3), -.BR CURLOPT_SOCKOPTFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_PASSWORD.3 b/docs/libcurl/opts/CURLOPT_PASSWORD.3 deleted file mode 100644 index 73d8627c0..000000000 --- a/docs/libcurl/opts/CURLOPT_PASSWORD.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PASSWORD 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PASSWORD \- password to use in authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PASSWORD, char *pwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -password to use for the transfer. - -The \fICURLOPT_PASSWORD(3)\fP option should be used in conjunction with the -\fICURLOPT_USERNAME(3)\fP option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PROXYAUTH (3), -.BR CURLOPT_USERNAME (3), -.BR CURLOPT_USERPWD (3) diff --git a/docs/libcurl/opts/CURLOPT_PASSWORD.md b/docs/libcurl/opts/CURLOPT_PASSWORD.md new file mode 100644 index 000000000..9849802d1 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PASSWORD.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PASSWORD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_USERNAME (3) + - CURLOPT_USERPWD (3) +--- + +# NAME + +CURLOPT_PASSWORD - password to use in authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PASSWORD, char *pwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the +null-terminated password to use for the transfer. + +The CURLOPT_PASSWORD(3) option should be used in conjunction with the +CURLOPT_USERNAME(3) option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PATH_AS_IS.3 b/docs/libcurl/opts/CURLOPT_PATH_AS_IS.3 deleted file mode 100644 index 702d97919..000000000 --- a/docs/libcurl/opts/CURLOPT_PATH_AS_IS.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PATH_AS_IS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PATH_AS_IS \- do not handle dot dot sequences -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long leaveit); -.fi -.SH DESCRIPTION -Set the long \fIleaveit\fP to 1, to explicitly tell libcurl to not alter the -given path before passing it on to the server. - -This instructs libcurl to NOT squash sequences of "/../" or "/./" that may -exist in the URL's path part and that is supposed to be removed according to -RFC 3986 section 5.2.4. - -Some server implementations are known to (erroneously) require the dot dot -sequences to remain in the path and some clients want to pass these on in -order to try out server implementations. - -By default libcurl normalizes such sequences before using the path. - -The corresponding flag for the \fIcurl_url_set(3)\fP function is called -\fBCURLU_PATH_AS_IS\fP. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.42.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_url_set (3), -.BR CURLOPT_STDERR (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_PATH_AS_IS.md b/docs/libcurl/opts/CURLOPT_PATH_AS_IS.md new file mode 100644 index 000000000..499469172 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PATH_AS_IS.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PATH_AS_IS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_STDERR (3) + - CURLOPT_URL (3) + - curl_url_set (3) +--- + +# NAME + +CURLOPT_PATH_AS_IS - do not handle dot dot sequences + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PATH_AS_IS, long leaveit); +~~~ + +# DESCRIPTION + +Set the long *leaveit* to 1, to explicitly tell libcurl to not alter the +given path before passing it on to the server. + +This instructs libcurl to NOT squash sequences of "/../" or "/./" that may +exist in the URL's path part and that is supposed to be removed according to +RFC 3986 section 5.2.4. + +Some server implementations are known to (erroneously) require the dot dot +sequences to remain in the path and some clients want to pass these on in +order to try out server implementations. + +By default libcurl normalizes such sequences before using the path. + +The corresponding flag for the curl_url_set(3) function is called +**CURLU_PATH_AS_IS**. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.42.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3 b/docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3 rename to docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.md index 9a72fa85f..af3ed12ba 100644 --- a/docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3 +++ b/docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY.md @@ -1,61 +1,60 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PINNEDPUBLICKEY 3 "27 Aug 2014" libcurl libcurl -.SH NAME -CURLOPT_PINNEDPUBLICKEY \- pinned public key -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PINNEDPUBLICKEY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAPATH (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PINNEDPUBLICKEY - pinned public key + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PINNEDPUBLICKEY, char *pinnedpubkey); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a null-terminated string as parameter. The string can be the -file name of your pinned public key. The file format expected is "PEM" or "DER". -The string can also be any number of base64 encoded sha256 hashes preceded by -"sha256//" and separated by ";" +file name of your pinned public key. The file format expected is "PEM" or +"DER". The string can also be any number of base64 encoded sha256 hashes +preceded by "sha256//" and separated by ";" When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, curl aborts the connection before sending or receiving any data. -This option is independent of option \fICURLOPT_SSL_VERIFYPEER(3)\fP. If you -turn off that option then the peer is still verified by public key. +This option is independent of option CURLOPT_SSL_VERIFYPEER(3). If you turn +off that option then the peer is still verified by public key. -On mismatch, \fICURLE_SSL_PINNEDPUBKEYNOTMATCH\fP is returned. +On mismatch, *CURLE_SSL_PINNEDPUBKEYNOTMATCH* is returned. The application does not have to keep the string around after setting this option. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -73,11 +72,13 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH PUBLIC KEY EXTRACTION +~~~ + +# PUBLIC KEY EXTRACTION + If you do not have the server's public key file you can extract it from the server's certificate. -.nf +~~~ # retrieve the server's certificate if you do not already have it # # be sure to examine the certificate to see if it is what you expected @@ -88,53 +89,55 @@ server's certificate. # - If you do not have sed, then just copy the certificate into a file: # Lines from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----. # -openssl s_client -servername www.example.com -connect www.example.com:443 < /dev/null | sed -n "/-----BEGIN/,/-----END/p" > www.example.com.pem +openssl s_client -servername www.example.com -connect www.example.com:443 \ + < /dev/null | sed -n "/-----BEGIN/,/-----END/p" > www.example.com.pem # extract public key in pem format from certificate openssl x509 -in www.example.com.pem -pubkey -noout > www.example.com.pubkey.pem # convert public key from pem to der -openssl asn1parse -noout -inform pem -in www.example.com.pubkey.pem -out www.example.com.pubkey.der +openssl asn1parse -noout -inform pem -in www.example.com.pubkey.pem \ + -out www.example.com.pubkey.der # sha256 hash and base64 encode der to string for use openssl dgst -sha256 -binary www.example.com.pubkey.der | openssl base64 -.fi +~~~ + The public key in PEM format contains a header, base64 data and a footer: -.nf +~~~ -----BEGIN PUBLIC KEY----- [BASE 64 DATA] -----END PUBLIC KEY----- -.fi -.SH AVAILABILITY -PEM/DER support: +~~~ - 7.39.0: OpenSSL, GnuTLS +# AVAILABILITY - 7.43.0: wolfSSL +## PEM/DER support - 7.47.0: mbedTLS +7.39.0: OpenSSL, GnuTLS - 7.54.1: Secure Transport on macOS 10.7+/iOS 10+ +7.43.0: wolfSSL - 7.58.1: Schannel +7.47.0: mbedTLS -sha256 support: +7.54.1: Secure Transport on macOS 10.7+/iOS 10+ - 7.44.0: OpenSSL, GnuTLS and wolfSSL +7.58.1: Schannel - 7.47.0: mbedTLS +## sha256 support - 7.54.1: Secure Transport on macOS 10.7+/iOS 10+ +7.44.0: OpenSSL, GnuTLS and wolfSSL - 7.58.1: Schannel +7.47.0: mbedTLS + +7.54.1: Secure Transport on macOS 10.7+/iOS 10+ + +7.58.1: Schannel Other SSL backends not supported. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PIPEWAIT.3 b/docs/libcurl/opts/CURLOPT_PIPEWAIT.3 deleted file mode 100644 index 645f788f9..000000000 --- a/docs/libcurl/opts/CURLOPT_PIPEWAIT.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PIPEWAIT 3 "12 May 2015" libcurl libcurl -.SH NAME -CURLOPT_PIPEWAIT \- wait for multiplexing -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PIPEWAIT, long wait); -.fi -.SH DESCRIPTION -Set \fIwait\fP to 1L to tell libcurl to prefer to wait for a connection to -confirm or deny that it can do multiplexing before continuing. - -When about to perform a new transfer that allows multiplexing, libcurl checks -for existing connections to use. If no such connection exists it immediately -continues and creates a fresh new connection to use. - -By setting this option to 1 - and having \fICURLMOPT_PIPELINING(3)\fP enabled -for the multi handle this transfer is associated with - libcurl instead waits -for the connection to reveal if it is possible to multiplex on before it -continues. This enables libcurl to much better keep the number of connections -to a minimum when using multiplexing protocols. - -With this option set, libcurl prefers to wait and reuse an existing connection -for multiplexing rather than the opposite: prefer to open a new connection -rather than waiting. - -The waiting time is as long as it takes for the connection to get up and for -libcurl to get the necessary response back that informs it about its protocol -and support level. -.SH DEFAULT -0 (off) -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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 */ - } -} -.fi -.SH AVAILABILITY -Added in 7.43.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_MAX_HOST_CONNECTIONS (3), -.BR CURLMOPT_PIPELINING (3), -.BR CURLOPT_FORBID_REUSE (3), -.BR CURLOPT_FRESH_CONNECT (3) diff --git a/docs/libcurl/opts/CURLOPT_PIPEWAIT.md b/docs/libcurl/opts/CURLOPT_PIPEWAIT.md new file mode 100644 index 000000000..1be844dd0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PIPEWAIT.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PIPEWAIT +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_MAX_HOST_CONNECTIONS (3) + - CURLMOPT_PIPELINING (3) + - CURLOPT_FORBID_REUSE (3) + - CURLOPT_FRESH_CONNECT (3) +--- + +# NAME + +CURLOPT_PIPEWAIT - wait for multiplexing + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PIPEWAIT, long wait); +~~~ + +# DESCRIPTION + +Set *wait* to 1L to tell libcurl to prefer to wait for a connection to +confirm or deny that it can do multiplexing before continuing. + +When about to perform a new transfer that allows multiplexing, libcurl checks +for existing connections to use. If no such connection exists it immediately +continues and creates a fresh new connection to use. + +By setting this option to 1 - and having CURLMOPT_PIPELINING(3) enabled +for the multi handle this transfer is associated with - libcurl instead waits +for the connection to reveal if it is possible to multiplex on before it +continues. This enables libcurl to much better keep the number of connections +to a minimum when using multiplexing protocols. + +With this option set, libcurl prefers to wait and reuse an existing connection +for multiplexing rather than the opposite: prefer to open a new connection +rather than waiting. + +The waiting time is as long as it takes for the connection to get up and for +libcurl to get the necessary response back that informs it about its protocol +and support level. + +# DEFAULT + +0 (off) + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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 */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.43.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PORT.3 b/docs/libcurl/opts/CURLOPT_PORT.3 deleted file mode 100644 index 4b6667ba8..000000000 --- a/docs/libcurl/opts/CURLOPT_PORT.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PORT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PORT \- remote port number to connect to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number); -.fi -.SH DESCRIPTION -We discourage using this option since its scope is not obvious and hard to -predict. Set the preferred port number in the URL instead. - -This option sets \fInumber\fP to be the remote port number to connect to, -instead of the one specified in the URL or the default port for the used -protocol. - -Usually, you just let the URL decide which port to use but this allows the -application to override that. - -While this option accepts a 'long', a port number is an unsigned 16 bit number -and therefore using a port number lower than zero or over 65535 causes a -\fBCURLE_BAD_FUNCTION_ARGUMENT\fP error. -.SH DEFAULT -By default this is 0 which makes it not used. This also makes port number zero -impossible to set with this API. -.SH PROTOCOLS -Used for all protocols that speak to a port number. -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLINFO_PRIMARY_PORT (3), -.BR CURLOPT_STDERR (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_PORT.md b/docs/libcurl/opts/CURLOPT_PORT.md new file mode 100644 index 000000000..42dc80133 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PORT.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PORT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PRIMARY_PORT (3) + - CURLOPT_STDERR (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_PORT - remote port number to connect to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number); +~~~ + +# DESCRIPTION + +We discourage using this option since its scope is not obvious and hard to +predict. Set the preferred port number in the URL instead. + +This option sets *number* to be the remote port number to connect to, +instead of the one specified in the URL or the default port for the used +protocol. + +Usually, you just let the URL decide which port to use but this allows the +application to override that. + +While this option accepts a 'long', a port number is an unsigned 16 bit number +and therefore using a port number lower than zero or over 65535 causes a +**CURLE_BAD_FUNCTION_ARGUMENT** error. + +# DEFAULT + +By default this is 0 which makes it not used. This also makes port number zero +impossible to set with this API. + +# PROTOCOLS + +Used for all protocols that speak to a port number. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_POST.3 b/docs/libcurl/opts/CURLOPT_POST.3 deleted file mode 100644 index 182b59cb8..000000000 --- a/docs/libcurl/opts/CURLOPT_POST.3 +++ /dev/null @@ -1,104 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POST 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POST \- make an HTTP POST -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POST, long post); -.fi -.SH DESCRIPTION -A parameter set to 1 tells libcurl to do a regular HTTP post. This also makes -libcurl use a "Content-Type: application/x-www-form-urlencoded" header. This -is the most commonly used POST method. - -Use one of \fICURLOPT_POSTFIELDS(3)\fP or \fICURLOPT_COPYPOSTFIELDS(3)\fP -options to specify what data to post and \fICURLOPT_POSTFIELDSIZE(3)\fP or -\fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP to set the data size. - -Optionally, you can provide data to POST using the -\fICURLOPT_READFUNCTION(3)\fP and \fICURLOPT_READDATA(3)\fP options but then -you must make sure to not set \fICURLOPT_POSTFIELDS(3)\fP to anything but -NULL. When providing data with a callback, you must transmit it using chunked -transfer-encoding or you must set the size of the data with the -\fICURLOPT_POSTFIELDSIZE(3)\fP or \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP -options. To enable chunked encoding, you simply pass in the appropriate -Transfer-Encoding header, see the post-callback.c example. - -You can override the default POST Content-Type: header by setting your own -with \fICURLOPT_HTTPHEADER(3)\fP. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP as usual. - -If you use POST to an HTTP 1.1 server, you can send data without knowing the -size before starting the POST if you use chunked encoding. You enable this by -adding a header like "Transfer-Encoding: chunked" with -\fICURLOPT_HTTPHEADER(3)\fP. With HTTP 1.0 or without chunked transfer, you -must specify the size in the request. (Since 7.66.0, libcurl automatically -uses chunked encoding for POSTs if the size is unknown.) - -When setting \fICURLOPT_POST(3)\fP to 1, libcurl automatically sets -\fICURLOPT_NOBODY(3)\fP and \fICURLOPT_HTTPGET(3)\fP to 0. - -If you issue a POST request and then want to make a HEAD or GET using the same -reused handle, you must explicitly set the new request type using -\fICURLOPT_NOBODY(3)\fP or \fICURLOPT_HTTPGET(3)\fP or similar. - -When setting \fICURLOPT_POST(3)\fP to 0, libcurl resets the request type to -the default to disable the POST. Typically that would mean it's reset to GET. -Instead you should set a new request type explicitly as described above. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 */ - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPPOST (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_PUT (3) diff --git a/docs/libcurl/opts/CURLOPT_POST.md b/docs/libcurl/opts/CURLOPT_POST.md new file mode 100644 index 000000000..fd3c0b2c9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POST.md @@ -0,0 +1,102 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPOST (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_PUT (3) +--- + +# NAME + +CURLOPT_POST - make an HTTP POST + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POST, long post); +~~~ + +# DESCRIPTION + +A parameter set to 1 tells libcurl to do a regular HTTP post. This also makes +libcurl use a "Content-Type: application/x-www-form-urlencoded" header. This +is the most commonly used POST method. + +Use one of CURLOPT_POSTFIELDS(3) or CURLOPT_COPYPOSTFIELDS(3) +options to specify what data to post and CURLOPT_POSTFIELDSIZE(3) or +CURLOPT_POSTFIELDSIZE_LARGE(3) to set the data size. + +Optionally, you can provide data to POST using the +CURLOPT_READFUNCTION(3) and CURLOPT_READDATA(3) options but then +you must make sure to not set CURLOPT_POSTFIELDS(3) to anything but +NULL. When providing data with a callback, you must transmit it using chunked +transfer-encoding or you must set the size of the data with the +CURLOPT_POSTFIELDSIZE(3) or CURLOPT_POSTFIELDSIZE_LARGE(3) +options. To enable chunked encoding, you simply pass in the appropriate +Transfer-Encoding header, see the post-callback.c example. + +You can override the default POST Content-Type: header by setting your own +with CURLOPT_HTTPHEADER(3). + +Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. +You can disable this header with CURLOPT_HTTPHEADER(3) as usual. + +If you use POST to an HTTP 1.1 server, you can send data without knowing the +size before starting the POST if you use chunked encoding. You enable this by +adding a header like "Transfer-Encoding: chunked" with +CURLOPT_HTTPHEADER(3). With HTTP 1.0 or without chunked transfer, you +must specify the size in the request. (Since 7.66.0, libcurl automatically +uses chunked encoding for POSTs if the size is unknown.) + +When setting CURLOPT_POST(3) to 1, libcurl automatically sets +CURLOPT_NOBODY(3) and CURLOPT_HTTPGET(3) to 0. + +If you issue a POST request and then want to make a HEAD or GET using the same +reused handle, you must explicitly set the new request type using +CURLOPT_NOBODY(3) or CURLOPT_HTTPGET(3) or similar. + +When setting CURLOPT_POST(3) to 0, libcurl resets the request type to +the default to disable the POST. Typically that would mean it's reset to GET. +Instead you should set a new request type explicitly as described above. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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 */ + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 b/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 deleted file mode 100644 index 6efdb9531..000000000 --- a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 +++ /dev/null @@ -1,126 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POSTFIELDS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POSTFIELDS \- data to POST to server -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDS, char *postdata); -.fi -.SH DESCRIPTION -Pass a char * as parameter, pointing to the data buffer to use in an HTTP POST -operation. The data must be formatted and encoded the way you want the server -to receive it. libcurl does not convert or encode it in any way. For example, -the web server may assume that this data is URL encoded. - -The data pointed to is NOT copied by the library: as a consequence, it must be -preserved by the calling application until the associated transfer finishes. -This behavior can be changed (so libcurl does copy the data) by instead using -the \fICURLOPT_COPYPOSTFIELDS(3)\fP option. - -This POST is a normal \fBapplication/x-www-form-urlencoded\fP kind (and -libcurl sets that Content-Type by default when this option is used), which is -commonly used by HTML forms. Change Content-Type with -\fICURLOPT_HTTPHEADER(3)\fP. - -You can use \fIcurl_easy_escape(3)\fP to URL encode your data, if -necessary. It returns a pointer to an encoded string that can be passed as -\fIpostdata\fP. - -Using \fICURLOPT_POSTFIELDS(3)\fP implies setting \fICURLOPT_POST(3)\fP to 1. - -If \fICURLOPT_POSTFIELDS(3)\fP is explicitly set to NULL then libcurl gets the -POST data from the read callback. If you want to send a zero-byte POST set -\fICURLOPT_POSTFIELDS(3)\fP to an empty string, or set \fICURLOPT_POST(3)\fP -to 1 and \fICURLOPT_POSTFIELDSIZE(3)\fP to 0. - -libcurl assumes this option points to a null-terminated string unless you also -set \fICURLOPT_POSTFIELDSIZE(3)\fP to specify the length of the provided data, -which then is strictly required if you want to send off null bytes included in -the data. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header, -and libcurl adds that header automatically if the POST is either known to be -larger than 1MB or if the expected size is unknown. You can disable this -header with \fICURLOPT_HTTPHEADER(3)\fP as usual. - -To make \fBmultipart/formdata\fP posts, check out the -\fICURLOPT_MIMEPOST(3)\fP option combined with \fIcurl_mime_init(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -/* send an application/x-www-form-urlencoded POST */ -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"); - - /* 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); - - curl_easy_perform(curl); - } - - /* 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(curl, CURLOPT_HTTPHEADER, slist1); - - 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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_COPYPOSTFIELDS (3), -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_POSTFIELDSIZE (3), -.BR CURLOPT_READFUNCTION (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDS.md b/docs/libcurl/opts/CURLOPT_POSTFIELDS.md new file mode 100644 index 000000000..409e4100a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POSTFIELDS.md @@ -0,0 +1,124 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POSTFIELDS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COPYPOSTFIELDS (3) + - CURLOPT_MIMEPOST (3) + - CURLOPT_POSTFIELDSIZE (3) + - CURLOPT_READFUNCTION (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_POSTFIELDS - data to POST to server + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDS, char *postdata); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, pointing to the data buffer to use in an +HTTP POST operation. The data must be formatted and encoded the way you want +the server to receive it. libcurl does not convert or encode it in any +way. For example, the web server may assume that this data is URL encoded. + +The data pointed to is NOT copied by the library: as a consequence, it must be +preserved by the calling application until the associated transfer finishes. +This behavior can be changed (so libcurl does copy the data) by instead using +the CURLOPT_COPYPOSTFIELDS(3) option. + +This POST is a normal **application/x-www-form-urlencoded** kind (and +libcurl sets that Content-Type by default when this option is used), which is +commonly used by HTML forms. Change Content-Type with +CURLOPT_HTTPHEADER(3). + +You can use curl_easy_escape(3) to URL encode your data, if +necessary. It returns a pointer to an encoded string that can be passed as +*postdata*. + +Using CURLOPT_POSTFIELDS(3) implies setting CURLOPT_POST(3) to 1. + +If CURLOPT_POSTFIELDS(3) is explicitly set to NULL then libcurl gets the +POST data from the read callback. If you want to send a zero-byte POST set +CURLOPT_POSTFIELDS(3) to an empty string, or set CURLOPT_POST(3) +to 1 and CURLOPT_POSTFIELDSIZE(3) to 0. + +libcurl assumes this option points to a null-terminated string unless you also +set CURLOPT_POSTFIELDSIZE(3) to specify the length of the provided data, +which then is strictly required if you want to send off null bytes included in +the data. + +Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header, +and libcurl adds that header automatically if the POST is either known to be +larger than 1MB or if the expected size is unknown. You can disable this +header with CURLOPT_HTTPHEADER(3) as usual. + +To make **multipart/formdata** posts, check out the +CURLOPT_MIMEPOST(3) option combined with curl_mime_init(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +/* send an application/x-www-form-urlencoded POST */ +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"); + + /* 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); + + curl_easy_perform(curl); + } + + /* 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(curl, CURLOPT_HTTPHEADER, slist1); + + 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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3 b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3 deleted file mode 100644 index 75ec05291..000000000 --- a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POSTFIELDSIZE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POSTFIELDSIZE \- size of POST data pointed to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE, long size); -.fi -.SH DESCRIPTION -If you want to post static data to the server without having libcurl do a -strlen() to measure the data size, this option must be used. When this option -is used you can post fully binary data, which otherwise is likely to fail. If -this size is set to -1, libcurl uses strlen() to get the size or relies on the -\fICURLOPT_READFUNCTION(3)\fP (if used) to signal the end of data. - -If you post more than 2GB, use \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP. -.SH DEFAULT --1 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -#include /* for strlen */ - -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"); - - /* size of the POST data */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data)); - - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_POSTFIELDSIZE_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.md b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.md new file mode 100644 index 000000000..d086809cb --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POSTFIELDSIZE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_POSTFIELDS (3) + - CURLOPT_POSTFIELDSIZE_LARGE (3) +--- + +# NAME + +CURLOPT_POSTFIELDSIZE - size of POST data pointed to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE, long size); +~~~ + +# DESCRIPTION + +If you want to post static data to the server without having libcurl do a +strlen() to measure the data size, this option must be used. When this option +is used you can post fully binary data, which otherwise is likely to fail. If +this size is set to -1, libcurl uses strlen() to get the size or relies on the +CURLOPT_READFUNCTION(3) (if used) to signal the end of data. + +If you post more than 2GB, use CURLOPT_POSTFIELDSIZE_LARGE(3). + +# DEFAULT + +-1 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +#include /* for strlen */ + +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"); + + /* size of the POST data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data)); + + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.3 b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.3 deleted file mode 100644 index c09feea9a..000000000 --- a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POSTFIELDSIZE_LARGE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POSTFIELDSIZE_LARGE \- size of POST data pointed to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE_LARGE, - curl_off_t size); -.SH DESCRIPTION -If you want to post static data to the server without having libcurl do a -strlen() to measure the data size, this option must be used. When this option -is used you can post fully binary data, which otherwise is likely to fail. If -this size is set to -1, libcurl uses strlen() to get the size or relies on the -\fICURLOPT_READFUNCTION(3)\fP (if used) to signal the end of data. -.SH DEFAULT --1 -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -extern char *large_chunk; /* pointer to somewhere */ - -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - const char *data = large_chunk; - curl_off_t length_of_data; /* set somehow */ - - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* size of the POST data */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data); - - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_COPYPOSTFIELDS (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_POSTFIELDSIZE (3) diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.md b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.md new file mode 100644 index 000000000..36fc0ff95 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POSTFIELDSIZE_LARGE.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POSTFIELDSIZE_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COPYPOSTFIELDS (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_POSTFIELDSIZE (3) +--- + +# NAME + +CURLOPT_POSTFIELDSIZE_LARGE - size of POST data pointed to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE_LARGE, + curl_off_t size); +~~~ + +# DESCRIPTION + +If you want to post static data to the server without having libcurl do a +strlen() to measure the data size, this option must be used. When this option +is used you can post fully binary data, which otherwise is likely to fail. If +this size is set to -1, libcurl uses strlen() to get the size or relies on the +CURLOPT_READFUNCTION(3) (if used) to signal the end of data. + +# DEFAULT + +-1 + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +extern char *large_chunk; /* pointer to somewhere */ + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + const char *data = large_chunk; + curl_off_t length_of_data; /* set somehow */ + + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* size of the POST data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data); + + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_POSTQUOTE.3 b/docs/libcurl/opts/CURLOPT_POSTQUOTE.3 deleted file mode 100644 index 33c46c7a5..000000000 --- a/docs/libcurl/opts/CURLOPT_POSTQUOTE.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POSTQUOTE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POSTQUOTE \- (S)FTP commands to run after the transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE, - struct curl_slist *cmds); -.fi -.SH DESCRIPTION -Pass a pointer to a linked list of FTP or SFTP commands to pass to the server -after your FTP transfer request. The commands are only issues if no error -occur. The linked list should be a fully valid list of struct curl_slist -structs properly filled in as described for \fICURLOPT_QUOTE(3)\fP. - -Disable this operation again by setting a NULL to this option. -.SH DEFAULT -NULL -.SH PROTOCOLS -SFTP and FTP -.SH EXAMPLE -.nf -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 = 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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -If support for the protocols are built-in. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PREQUOTE (3), -.BR CURLOPT_QUOTE (3) diff --git a/docs/libcurl/opts/CURLOPT_POSTQUOTE.md b/docs/libcurl/opts/CURLOPT_POSTQUOTE.md new file mode 100644 index 000000000..300a1f2c5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POSTQUOTE.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POSTQUOTE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PREQUOTE (3) + - CURLOPT_QUOTE (3) +--- + +# NAME + +CURLOPT_POSTQUOTE - (S)FTP commands to run after the transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE, + struct curl_slist *cmds); +~~~ + +# DESCRIPTION + +Pass a pointer to a linked list of FTP or SFTP commands to pass to the server +after your FTP transfer request. The commands are only issues if no error +occur. The linked list should be a fully valid list of struct curl_slist +structs properly filled in as described for CURLOPT_QUOTE(3). + +Disable this operation again by setting a NULL to this option. + +# DEFAULT + +NULL + +# PROTOCOLS + +SFTP and FTP + +# EXAMPLE + +~~~c +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 = 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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +If support for the protocols are built-in. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 b/docs/libcurl/opts/CURLOPT_POSTREDIR.3 deleted file mode 100644 index da7d826d7..000000000 --- a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_POSTREDIR 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_POSTREDIR \- how to act on an HTTP POST redirect -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTREDIR, - long bitmask); -.SH DESCRIPTION -Pass a bitmask to control how libcurl acts on redirects after POSTs that get a -301, 302 or 303 response back. A parameter with bit 0 set (value -\fBCURL_REDIR_POST_301\fP) tells the library to respect RFC 7231 (section -6.4.2 to 6.4.4) and not convert POST requests into GET requests when following -a 301 redirection. Setting bit 1 (value \fBCURL_REDIR_POST_302\fP) makes -libcurl maintain the request method after a 302 redirect whilst setting bit 2 -(value \fBCURL_REDIR_POST_303\fP) makes libcurl maintain the request method -after a 303 redirect. The value \fBCURL_REDIR_POST_ALL\fP is a convenience -define that sets all three bits. - -The non-RFC behavior is ubiquitous in web browsers, so the library does the -conversion by default to maintain consistency. However, a server may require a -POST to remain a POST after such a redirection. This option is meaningful only -when setting \fICURLOPT_FOLLOWLOCATION(3)\fP. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP(S) -.SH EXAMPLE -.nf -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"); - - /* 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.17.1. This option was known as CURLOPT_POST301 up to 7.19.0 as it -only supported the 301 then. CURL_REDIR_POST_303 was added in 7.26.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_EFFECTIVE_METHOD (3), -.BR CURLINFO_REDIRECT_COUNT (3), -.BR CURLOPT_FOLLOWLOCATION (3), -.BR CURLOPT_MAXREDIRS (3), -.BR CURLOPT_POSTFIELDS (3) diff --git a/docs/libcurl/opts/CURLOPT_POSTREDIR.md b/docs/libcurl/opts/CURLOPT_POSTREDIR.md new file mode 100644 index 000000000..0ca04a98c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_POSTREDIR.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_POSTREDIR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_EFFECTIVE_METHOD (3) + - CURLINFO_REDIRECT_COUNT (3) + - CURLOPT_FOLLOWLOCATION (3) + - CURLOPT_MAXREDIRS (3) + - CURLOPT_POSTFIELDS (3) +--- + +# NAME + +CURLOPT_POSTREDIR - how to act on an HTTP POST redirect + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTREDIR, + long bitmask); +~~~ + +# DESCRIPTION + +Pass a bitmask to control how libcurl acts on redirects after POSTs that get a +301, 302 or 303 response back. A parameter with bit 0 set (value +**CURL_REDIR_POST_301**) tells the library to respect RFC 7231 (section +6.4.2 to 6.4.4) and not convert POST requests into GET requests when following +a 301 redirection. Setting bit 1 (value **CURL_REDIR_POST_302**) makes +libcurl maintain the request method after a 302 redirect whilst setting bit 2 +(value **CURL_REDIR_POST_303**) makes libcurl maintain the request method +after a 303 redirect. The value **CURL_REDIR_POST_ALL** is a convenience +define that sets all three bits. + +The non-RFC behavior is ubiquitous in web browsers, so the library does the +conversion by default to maintain consistency. However, a server may require a +POST to remain a POST after such a redirection. This option is meaningful only +when setting CURLOPT_FOLLOWLOCATION(3). + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP(S) + +# EXAMPLE + +~~~c +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"); + + /* 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.17.1. This option was known as CURLOPT_POST301 up to 7.19.0 as it +only supported the 301 then. CURL_REDIR_POST_303 was added in 7.26.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PREQUOTE.3 b/docs/libcurl/opts/CURLOPT_PREQUOTE.3 deleted file mode 100644 index fd5ba0467..000000000 --- a/docs/libcurl/opts/CURLOPT_PREQUOTE.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PREQUOTE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PREQUOTE \- commands to run before an FTP transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREQUOTE, - struct curl_slist *cmds); -.fi -.SH DESCRIPTION -Pass a pointer to a linked list of FTP commands to pass to the server after -the transfer type is set. The linked list should be a fully valid list of -struct curl_slist structs properly filled in as described for -\fICURLOPT_QUOTE(3)\fP. Disable this operation again by setting a NULL to this -option. - -These commands are not performed when a directory listing is performed, only -for file transfers. - -While \fICURLOPT_QUOTE(3)\fP and \fICURLOPT_POSTQUOTE(3)\fP work for SFTP, -this option does not. -.SH DEFAULT -NULL -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -int main(void) -{ - struct curl_slist *cmdlist = NULL; - cmdlist = curl_slist_append(cmdlist, "SYST"); - - 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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Along with the protocol support -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_POSTQUOTE (3), -.BR CURLOPT_QUOTE (3) diff --git a/docs/libcurl/opts/CURLOPT_PREQUOTE.md b/docs/libcurl/opts/CURLOPT_PREQUOTE.md new file mode 100644 index 000000000..e5192039d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PREQUOTE.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PREQUOTE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_POSTQUOTE (3) + - CURLOPT_QUOTE (3) +--- + +# NAME + +CURLOPT_PREQUOTE - commands to run before an FTP transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREQUOTE, + struct curl_slist *cmds); +~~~ + +# DESCRIPTION + +Pass a pointer to a linked list of FTP commands to pass to the server after +the transfer type is set. The linked list should be a fully valid list of +struct curl_slist structs properly filled in as described for +CURLOPT_QUOTE(3). Disable this operation again by setting a NULL to this +option. + +These commands are not performed when a directory listing is performed, only +for file transfers. + +While CURLOPT_QUOTE(3) and CURLOPT_POSTQUOTE(3) work for SFTP, +this option does not. + +# DEFAULT + +NULL + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +int main(void) +{ + struct curl_slist *cmdlist = NULL; + cmdlist = curl_slist_append(cmdlist, "SYST"); + + 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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Along with the protocol support + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PREREQDATA.3 b/docs/libcurl/opts/CURLOPT_PREREQDATA.3 deleted file mode 100644 index 2d9c4e12c..000000000 --- a/docs/libcurl/opts/CURLOPT_PREREQDATA.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Max Dymond, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PREREQDATA 3 "2 Aug 2021" libcurl libcurl -.SH NAME -CURLOPT_PREREQDATA \- pointer passed to the pre-request callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the first -argument in the pre-request callback set with \fICURLOPT_PREREQFUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -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:%d\\n", conn_primary_ip, conn_primary_port); - return CURL_PREREQFUNC_OK; -} - -int main(void) -{ - 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 -Added in 7.80.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_PRIMARY_IP (3), -.BR CURLINFO_PRIMARY_PORT (3), -.BR CURLOPT_PREREQFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_PREREQDATA.md b/docs/libcurl/opts/CURLOPT_PREREQDATA.md new file mode 100644 index 000000000..14ba8e302 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PREREQDATA.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PREREQDATA +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PRIMARY_IP (3) + - CURLINFO_PRIMARY_PORT (3) + - CURLOPT_PREREQFUNCTION (3) +--- + +# NAME + +CURLOPT_PREREQDATA - pointer passed to the pre-request callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the first +argument in the pre-request callback set with CURLOPT_PREREQFUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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:%d\n", conn_primary_ip, conn_primary_port); + return CURL_PREREQFUNC_OK; +} + +int main(void) +{ + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.80.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3 b/docs/libcurl/opts/CURLOPT_PREREQFUNCTION.md similarity index 56% rename from docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_PREREQFUNCTION.md index a2e3dd38f..c81408494 100644 --- a/docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_PREREQFUNCTION.md @@ -1,33 +1,23 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Max Dymond, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PREREQFUNCTION 3 "2 Aug 2021" libcurl libcurl -.SH NAME -CURLOPT_PREREQFUNCTION \- user callback called when a connection has been +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PREREQFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PRIMARY_IP (3) + - CURLINFO_PRIMARY_PORT (3) + - CURLOPT_PREREQDATA (3) +--- + +# NAME + +CURLOPT_PREREQFUNCTION - user callback called when a connection has been established, but before a request has been made. -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include /* These are the return codes for the pre-request callback. */ @@ -41,7 +31,10 @@ int prereq_callback(void *clientp, int conn_local_port); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREREQFUNCTION, prereq_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. @@ -52,35 +45,51 @@ callback is called once a connection has been established to the server, but before a GET/HEAD/POST/etc request has been sent. This function may be called multiple times if redirections are enabled and are -being followed (see \fICURLOPT_FOLLOWLOCATION(3)\fP). +being followed (see CURLOPT_FOLLOWLOCATION(3)). -The callback function must return \fICURL_PREREQFUNC_OK\fP on success, or -\fICURL_PREREQFUNC_ABORT\fP to cause the transfer to fail. +The callback function must return *CURL_PREREQFUNC_OK* on success, or +*CURL_PREREQFUNC_ABORT* to cause the transfer to fail. This function is passed the following arguments: -.IP conn_primary_ip + +## conn_primary_ip + A null-terminated pointer to a C string containing the primary IP of the remote server established with this connection. For FTP, this is the IP for the control connection. IPv6 addresses are represented without surrounding brackets. -.IP conn_local_ip + +## conn_local_ip + A null-terminated pointer to a C string containing the originating IP for this connection. IPv6 addresses are represented without surrounding brackets. -.IP conn_primary_port + +## conn_primary_port + The primary port number on the remote server established with this connection. For FTP, this is the port for the control connection. This can be a TCP or a UDP port number depending on the protocol. -.IP conn_local_port + +## conn_local_port + The originating port number for this connection. This can be a TCP or a UDP port number depending on the protocol. -.IP clientp -The pointer you set with \fICURLOPT_PREREQDATA(3)\fP. -.SH DEFAULT + +## clientp + +The pointer you set with CURLOPT_PREREQDATA(3). + +# DEFAULT + By default, this is NULL and unused. -.SH PROTOCOLS + +# PROTOCOLS + ALL -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c struct priv { void *custom; }; @@ -91,7 +100,7 @@ static int prereq_callback(void *clientp, int conn_primary_port, int conn_local_port) { - printf("Connection made to %s:%d\\n", conn_primary_ip, conn_primary_port); + printf("Connection made to %s:%d\n", conn_primary_ip, conn_primary_port); return CURL_PREREQFUNC_OK; } @@ -105,12 +114,12 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.80.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_PRIMARY_IP (3), -.BR CURLINFO_PRIMARY_PORT (3), -.BR CURLOPT_PREREQDATA (3) diff --git a/docs/libcurl/opts/CURLOPT_PRE_PROXY.3 b/docs/libcurl/opts/CURLOPT_PRE_PROXY.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_PRE_PROXY.3 rename to docs/libcurl/opts/CURLOPT_PRE_PROXY.md index 044d60c0c..78a4af032 100644 --- a/docs/libcurl/opts/CURLOPT_PRE_PROXY.3 +++ b/docs/libcurl/opts/CURLOPT_PRE_PROXY.md @@ -1,55 +1,46 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PRE_PROXY 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PRE_PROXY \- pre-proxy host to use -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PRE_PROXY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_PROXY (3) +--- + +# NAME + +CURLOPT_PRE_PROXY - pre-proxy host to use + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRE_PROXY, char *preproxy); -.fi -.SH DESCRIPTION -Set the \fIpreproxy\fP to use for the upcoming request. The parameter +~~~ + +# DESCRIPTION + +Set the *preproxy* to use for the upcoming request. The parameter should be a char * to a null-terminated string holding the host name or dotted numerical IP address. A numerical IPv6 address must be written within [brackets]. To specify port number in this string, append :[port] to the end of the host name. The proxy's port number may optionally be specified with the separate -option \fICURLOPT_PROXYPORT(3)\fP. If not specified, libcurl defaults to using +option CURLOPT_PROXYPORT(3). If not specified, libcurl defaults to using port 1080 for proxies. A pre proxy is a SOCKS proxy that curl connects to before it connects to the -HTTP(S) proxy specified in the \fICURLOPT_PROXY(3)\fP option. The pre proxy +HTTP(S) proxy specified in the CURLOPT_PROXY(3) option. The pre proxy can only be a SOCKS proxy. The pre proxy string should be prefixed with [scheme]:// to specify which kind of socks is used. Use socks4://, socks4a://, socks5:// or socks5h:// (the last one to enable socks5 and asking the proxy to do the resolving, also known as -\fICURLPROXY_SOCKS5_HOSTNAME\fP type) to request the specific SOCKS version to +*CURLPROXY_SOCKS5_HOSTNAME* type) to request the specific SOCKS version to be used. Otherwise SOCKS4 is used as default. Setting the pre proxy string to "" (an empty string) explicitly disables the @@ -57,15 +48,21 @@ use of a pre proxy. The application does not have to keep the string around after setting this option. -.SH DEFAULT + +# DEFAULT + Default is NULL, meaning no pre proxy is used. When you set a host name to use, do not assume that there is any particular single port number used widely for proxies. Specify it! -.SH PROTOCOLS + +# PROTOCOLS + All except file://. Note that some protocols do not work well over proxy. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -76,12 +73,13 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.52.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_HTTPPROXYTUNNEL (3) diff --git a/docs/libcurl/opts/CURLOPT_PRIVATE.3 b/docs/libcurl/opts/CURLOPT_PRIVATE.3 deleted file mode 100644 index 273ba1df6..000000000 --- a/docs/libcurl/opts/CURLOPT_PRIVATE.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PRIVATE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PRIVATE \- store a private pointer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer); -.fi -.SH DESCRIPTION -Pass a void * as parameter, pointing to data that should be associated with -this curl handle. The pointer can subsequently be retrieved using -\fIcurl_easy_getinfo(3)\fP with the \fICURLINFO_PRIVATE(3)\fP option. libcurl -itself never does anything with this data. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct private { - void *custom; -}; - -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"); - - /* store a pointer to our private struct */ - curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets); - - curl_easy_perform(curl); - - /* we can extract the private pointer again too */ - curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.3 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_PRIVATE (3), -.BR CURLOPT_STDERR (3), -.BR CURLOPT_VERBOSE (3) diff --git a/docs/libcurl/opts/CURLOPT_PRIVATE.md b/docs/libcurl/opts/CURLOPT_PRIVATE.md new file mode 100644 index 000000000..571a681b9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PRIVATE.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PRIVATE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PRIVATE (3) + - CURLOPT_STDERR (3) + - CURLOPT_VERBOSE (3) +--- + +# NAME + +CURLOPT_PRIVATE - store a private pointer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer); +~~~ + +# DESCRIPTION + +Pass a void * as parameter, pointing to data that should be associated with +this curl handle. The pointer can subsequently be retrieved using +curl_easy_getinfo(3) with the CURLINFO_PRIVATE(3) option. libcurl itself +never does anything with this data. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct private { + void *custom; +}; + +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"); + + /* store a pointer to our private struct */ + curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets); + + curl_easy_perform(curl); + + /* we can extract the private pointer again too */ + curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.3 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 deleted file mode 100644 index 8d1fef100..000000000 --- a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROGRESSDATA 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROGRESSDATA \- pointer passed to the progress callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the first -argument in the progress callback set with \fICURLOPT_PROGRESSFUNCTION(3)\fP. -.SH DEFAULT -The default value of this parameter is NULL. -.SH PROTOCOLS -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 = clientp; - printf("private: %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_PROGRESSDATA, &data); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PROGRESSFUNCTION (3), -.BR CURLOPT_XFERINFOFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.md b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.md new file mode 100644 index 000000000..276bee827 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROGRESSDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROGRESSFUNCTION (3) + - CURLOPT_XFERINFOFUNCTION (3) +--- + +# NAME + +CURLOPT_PROGRESSDATA - pointer passed to the progress callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the first +argument in the progress callback set with CURLOPT_PROGRESSFUNCTION(3). + +# DEFAULT + +The default value of this parameter is NULL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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) +{ + CURL *curl = curl_easy_init(); + if(curl) { + struct progress data; + + /* pass struct to callback */ + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.3 b/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md index 5682900d5..19d84c889 100644 --- a/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md @@ -1,32 +1,22 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROGRESSFUNCTION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROGRESSFUNCTION \- progress meter callback -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROGRESSFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NOPROGRESS (3) + - CURLOPT_VERBOSE (3) + - CURLOPT_XFERINFOFUNCTION (3) +--- + +# NAME + +CURLOPT_PROGRESSFUNCTION - progress meter callback + +# SYNOPSIS + +~~~c #include int progress_callback(void *clientp, @@ -37,27 +27,29 @@ int progress_callback(void *clientp, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSFUNCTION, progress_callback); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. This option is deprecated and we encourage users to use the -newer \fICURLOPT_XFERINFOFUNCTION(3)\fP instead, if you can. +newer CURLOPT_XFERINFOFUNCTION(3) instead, if you can. This function gets called by libcurl instead of its internal equivalent with a frequent interval. While data is being transferred it is invoked frequently, and during slow periods like when nothing is being transferred it can slow down to about one call per second. -\fIclientp\fP is the pointer set with \fICURLOPT_PROGRESSDATA(3)\fP, it is not +*clientp* is the pointer set with CURLOPT_PROGRESSDATA(3), it is not used by libcurl but is only passed along from the application to the callback. The callback gets told how much data libcurl is about to transfer and has -transferred, in number of bytes. \fIdltotal\fP is the total number of bytes -libcurl expects to download in this transfer. \fIdlnow\fP is the number of -bytes downloaded so far. \fIultotal\fP is the total number of bytes libcurl -expects to upload in this transfer. \fIulnow\fP is the number of bytes +transferred, in number of bytes. *dltotal* is the total number of bytes +libcurl expects to download in this transfer. *dlnow* is the number of +bytes downloaded so far. *ultotal* is the total number of bytes libcurl +expects to upload in this transfer. *ulnow* is the number of bytes uploaded so far. Unknown/unused argument values passed to the callback are be set to zero (like @@ -69,21 +61,27 @@ If your callback function returns CURL_PROGRESSFUNC_CONTINUE it causes libcurl to continue executing the default progress function. Returning any other non-zero value from this callback makes libcurl abort the -transfer and return \fICURLE_ABORTED_BY_CALLBACK\fP. +transfer and return *CURLE_ABORTED_BY_CALLBACK*. If you transfer data with the multi interface, this function is not called during periods of idleness unless you call the appropriate libcurl function that performs transfers. -\fICURLOPT_NOPROGRESS(3)\fP must be set to 0 to make this function actually +CURLOPT_NOPROGRESS(3) must be set to 0 to make this function actually get called. -.SH DEFAULT + +# DEFAULT + By default, libcurl has an internal progress meter. That is rarely wanted by users. -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c struct progress { char *private; size_t size; @@ -96,7 +94,7 @@ static size_t progress_callback(void *clientp, double ulnow) { struct progress *memory = clientp; - printf("private: %p\\n", memory->private); + printf("private: %p\n", memory->private); /* use the values */ @@ -116,12 +114,12 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Deprecated since 7.32.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_VERBOSE (3), -.BR CURLOPT_NOPROGRESS (3), -.BR CURLOPT_XFERINFOFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_PROTOCOLS.3 b/docs/libcurl/opts/CURLOPT_PROTOCOLS.3 deleted file mode 100644 index 29538d660..000000000 --- a/docs/libcurl/opts/CURLOPT_PROTOCOLS.3 +++ /dev/null @@ -1,106 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROTOCOLS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROTOCOLS \- allowed protocols -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask); -.fi -.SH DESCRIPTION -This option is deprecated. We strongly recommend using -\fICURLOPT_PROTOCOLS_STR(3)\fP instead because this option cannot control all -available protocols! - -Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask -limits what protocols libcurl may use in the transfer. This allows you to have -a libcurl built to support a wide range of protocols but still limit specific -transfers to only be allowed to use a subset of them. By default libcurl -accepts all protocols it supports (\fICURLPROTO_ALL\fP). See also -\fICURLOPT_REDIR_PROTOCOLS(3)\fP. - -These are the available protocol defines: -.nf -CURLPROTO_DICT -CURLPROTO_FILE -CURLPROTO_FTP -CURLPROTO_FTPS -CURLPROTO_GOPHER -CURLPROTO_HTTP -CURLPROTO_HTTPS -CURLPROTO_IMAP -CURLPROTO_IMAPS -CURLPROTO_LDAP -CURLPROTO_LDAPS -CURLPROTO_POP3 -CURLPROTO_POP3S -CURLPROTO_RTMP -CURLPROTO_RTMPE -CURLPROTO_RTMPS -CURLPROTO_RTMPT -CURLPROTO_RTMPTE -CURLPROTO_RTMPTS -CURLPROTO_RTSP -CURLPROTO_SCP -CURLPROTO_SFTP -CURLPROTO_SMB -CURLPROTO_SMBS -CURLPROTO_SMTP -CURLPROTO_SMTPS -CURLPROTO_TELNET -CURLPROTO_TFTP -.fi -.SH DEFAULT -All protocols built-in. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.4. Deprecated since 7.85.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DEFAULT_PROTOCOL (3), -.BR CURLOPT_REDIR_PROTOCOLS (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_PROTOCOLS.md b/docs/libcurl/opts/CURLOPT_PROTOCOLS.md new file mode 100644 index 000000000..a4d1a5a7c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROTOCOLS.md @@ -0,0 +1,104 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROTOCOLS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEFAULT_PROTOCOL (3) + - CURLOPT_REDIR_PROTOCOLS (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_PROTOCOLS - allowed protocols + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS, long bitmask); +~~~ + +# DESCRIPTION + +This option is deprecated. We strongly recommend using +CURLOPT_PROTOCOLS_STR(3) instead because this option cannot control all +available protocols! + +Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask +limits what protocols libcurl may use in the transfer. This allows you to have +a libcurl built to support a wide range of protocols but still limit specific +transfers to only be allowed to use a subset of them. By default libcurl +accepts all protocols it supports (*CURLPROTO_ALL*). See also +CURLOPT_REDIR_PROTOCOLS(3). + +These are the available protocol defines: +~~~c +CURLPROTO_DICT +CURLPROTO_FILE +CURLPROTO_FTP +CURLPROTO_FTPS +CURLPROTO_GOPHER +CURLPROTO_HTTP +CURLPROTO_HTTPS +CURLPROTO_IMAP +CURLPROTO_IMAPS +CURLPROTO_LDAP +CURLPROTO_LDAPS +CURLPROTO_POP3 +CURLPROTO_POP3S +CURLPROTO_RTMP +CURLPROTO_RTMPE +CURLPROTO_RTMPS +CURLPROTO_RTMPT +CURLPROTO_RTMPTE +CURLPROTO_RTMPTS +CURLPROTO_RTSP +CURLPROTO_SCP +CURLPROTO_SFTP +CURLPROTO_SMB +CURLPROTO_SMBS +CURLPROTO_SMTP +CURLPROTO_SMTPS +CURLPROTO_TELNET +CURLPROTO_TFTP +~~~ + +# DEFAULT + +All protocols built-in. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4. Deprecated since 7.85.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.3 b/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.3 deleted file mode 100644 index 8af32244d..000000000 --- a/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROTOCOLS_STR 3 "11 Jun 2022" libcurl libcurl -.SH NAME -CURLOPT_PROTOCOLS_STR \- allowed protocols -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec); -.fi -.SH DESCRIPTION -Pass a pointer to a string that holds a comma-separated list of case -insensitive protocol names (URL schemes) to allow in the transfer. This -option allows applications to use libcurl built to support a wide range of -protocols but still limit specific transfers to only be allowed to use a -subset of them. By default, libcurl accepts all protocols it was built with -support for. See also \fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP. - -If trying to set a non-existing protocol or if no matching protocol at all is -set, it returns error. - -These are the available protocols: - -DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, -MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP, -SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS - -You can set "ALL" as a short-cut to enable all protocols. Note that by setting -all, you may enable protocols that were not supported the day you write this -but are introduced in a future libcurl version. - -\fIcurl_version_info(3)\fP can be used to get a list of all supported -protocols in the current libcurl. \fICURLINFO_SCHEME(3)\fP is the recommended -way to figure out the protocol used in a previous transfer. -.SH DEFAULT -All protocols built-in -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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"); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.85.0 -.SH RETURN VALUE -Returns CURLE_UNKNOWN_OPTION if the option is not implemented, -CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled, -CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK. -.SH "SEE ALSO" -.BR curl_version_info (3), -.BR CURLINFO_SCHEME (3), -.BR CURLOPT_DEFAULT_PROTOCOL (3), -.BR CURLOPT_REDIR_PROTOCOLS_STR (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.md b/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.md new file mode 100644 index 000000000..9da056d23 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROTOCOLS_STR.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROTOCOLS_STR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SCHEME (3) + - CURLOPT_DEFAULT_PROTOCOL (3) + - CURLOPT_REDIR_PROTOCOLS_STR (3) + - CURLOPT_URL (3) + - curl_version_info (3) +--- + +# NAME + +CURLOPT_PROTOCOLS_STR - allowed protocols + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec); +~~~ + +# DESCRIPTION + +Pass a pointer to a string that holds a comma-separated list of case +insensitive protocol names (URL schemes) to allow in the transfer. This +option allows applications to use libcurl built to support a wide range of +protocols but still limit specific transfers to only be allowed to use a +subset of them. By default, libcurl accepts all protocols it was built with +support for. See also CURLOPT_REDIR_PROTOCOLS_STR(3). + +If trying to set a non-existing protocol or if no matching protocol at all is +set, it returns error. + +These are the available protocols: + +DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, +MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP, +SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS + +You can set "ALL" as a short-cut to enable all protocols. Note that by setting +all, you may enable protocols that were not supported the day you write this +but are introduced in a future libcurl version. + +curl_version_info(3) can be used to get a list of all supported +protocols in the current libcurl. CURLINFO_SCHEME(3) is the recommended +way to figure out the protocol used in a previous transfer. + +# DEFAULT + +All protocols built-in + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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"); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.85.0 + +# RETURN VALUE + +Returns CURLE_UNKNOWN_OPTION if the option is not implemented, +CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled, +CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_PROXY.3 b/docs/libcurl/opts/CURLOPT_PROXY.3 deleted file mode 100644 index a3a36152a..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY.3 +++ /dev/null @@ -1,137 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXY \- proxy to use -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY, char *proxy); -.fi -.SH DESCRIPTION -Set the \fIproxy\fP to use for transfers with this easy handle. The parameter -should be a char * to a null-terminated string holding the host name or dotted -numerical IP address. A numerical IPv6 address must be written within -[brackets]. - -To specify port number in this string, append :[port] to the end of the host -name. The proxy's port number may optionally (but discouraged) be specified -with the separate option \fICURLOPT_PROXYPORT(3)\fP. If not specified, libcurl -defaults to using port 1080 for proxies. - -The proxy string may be prefixed with [scheme]:// to specify which kind of -proxy is used. - -.RS -.IP http:// -HTTP Proxy. Default when no scheme or proxy type is specified. -.IP https:// -HTTPS Proxy. (Added in 7.52.0 for OpenSSL and GnuTLS Since 7.87.0, it -also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport and -wolfSSL.) - -This uses HTTP/1 by default. Setting \fICURLOPT_PROXYTYPE(3)\fP to -\fBCURLPROXY_HTTPS2\fP allows libcurl to negotiate using HTTP/2 with proxy. -.IP socks4:// -SOCKS4 Proxy. -.IP socks4a:// -SOCKS4a Proxy. Proxy resolves URL hostname. -.IP socks5:// -SOCKS5 Proxy. -.IP socks5h:// -SOCKS5 Proxy. Proxy resolves URL hostname. -.RE - -Without a scheme prefix, \fICURLOPT_PROXYTYPE(3)\fP can be used to specify -which kind of proxy the string identifies. - -When you tell the library to use an HTTP proxy, libcurl transparently converts -operations to HTTP even if you specify an FTP URL etc. This may have an impact -on what other features of the library you can use, such as -\fICURLOPT_QUOTE(3)\fP and similar FTP specifics that do not work unless you -tunnel through the HTTP proxy. Such tunneling is activated with -\fICURLOPT_HTTPPROXYTUNNEL(3)\fP. - -Setting the proxy string to "" (an empty string) explicitly disables the use -of a proxy, even if there is an environment variable set for it. - -A proxy host string can also include protocol scheme (http://) and embedded -user + password. - -Unix domain sockets are supported for socks proxies since 7.84.0. Set -localhost for the host part. e.g. socks5h://localhost/path/to/socket.sock - -The application does not have to keep the string around after setting this -option. - -When a proxy is used, the active FTP mode as set with \fICUROPT_FTPPORT(3)\fP, -cannot be used. -.SH "Environment variables" -libcurl respects the proxy environment variables named \fBhttp_proxy\fP, -\fBftp_proxy\fP, \fBsftp_proxy\fP etc. If set, libcurl uses the specified -proxy for that URL scheme. So for a "FTP://" URL, the \fBftp_proxy\fP is -considered. \fBall_proxy\fP is used if no protocol specific proxy was set. - -If \fBno_proxy\fP (or \fBNO_PROXY\fP) is set, it is the exact equivalent of -setting the \fICURLOPT_NOPROXY(3)\fP option. - -The \fICURLOPT_PROXY(3)\fP and \fICURLOPT_NOPROXY(3)\fP options override -environment variables. -.SH DEFAULT -Default is NULL, meaning no proxy is used. - -When you set a host name to use, do not assume that there is any particular -single port number used widely for proxies. Specify it! -.SH PROTOCOLS -All except file://. Note that some protocols do not work well over proxy. -.SH EXAMPLE -.nf -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 -Since 7.14.1 the proxy environment variable names can include the protocol -scheme. - -Since 7.21.7 the proxy string supports the socks protocols as "schemes". - -Since 7.50.2, unsupported schemes in proxy strings cause libcurl to return -error. -.SH RETURN VALUE -Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_HTTPPROXYTUNNEL (3), -.BR CURLOPT_PRE_PROXY (3), -.BR CURLOPT_PROXYPORT (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY.md b/docs/libcurl/opts/CURLOPT_PROXY.md new file mode 100644 index 000000000..6bdda4ab5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY.md @@ -0,0 +1,146 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_PRE_PROXY (3) + - CURLOPT_PROXYPORT (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_PROXY - proxy to use + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY, char *proxy); +~~~ + +# DESCRIPTION + +Set the *proxy* to use for transfers with this easy handle. The parameter +should be a char * to a null-terminated string holding the host name or dotted +numerical IP address. A numerical IPv6 address must be written within +[brackets]. + +To specify port number in this string, append :[port] to the end of the host +name. The proxy's port number may optionally (but discouraged) be specified +with the separate option CURLOPT_PROXYPORT(3). If not specified, libcurl +defaults to using port 1080 for proxies. + +The proxy string may be prefixed with [scheme]:// to specify which kind of +proxy is used. + +## http:// + +HTTP Proxy. Default when no scheme or proxy type is specified. + +## https:// + +HTTPS Proxy. (Added in 7.52.0 for OpenSSL and GnuTLS Since 7.87.0, it +also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport and +wolfSSL.) + +This uses HTTP/1 by default. Setting CURLOPT_PROXYTYPE(3) to +**CURLPROXY_HTTPS2** allows libcurl to negotiate using HTTP/2 with proxy. + +## socks4:// + +SOCKS4 Proxy. + +## socks4a:// + +SOCKS4a Proxy. Proxy resolves URL hostname. + +## socks5:// + +SOCKS5 Proxy. + +## socks5h:// + +SOCKS5 Proxy. Proxy resolves URL hostname. + +Without a scheme prefix, CURLOPT_PROXYTYPE(3) can be used to specify +which kind of proxy the string identifies. + +When you tell the library to use an HTTP proxy, libcurl transparently converts +operations to HTTP even if you specify an FTP URL etc. This may have an impact +on what other features of the library you can use, such as +CURLOPT_QUOTE(3) and similar FTP specifics that do not work unless you +tunnel through the HTTP proxy. Such tunneling is activated with +CURLOPT_HTTPPROXYTUNNEL(3). + +Setting the proxy string to "" (an empty string) explicitly disables the use +of a proxy, even if there is an environment variable set for it. + +A proxy host string can also include protocol scheme (http://) and embedded +user + password. + +Unix domain sockets are supported for socks proxies since 7.84.0. Set +localhost for the host part. e.g. socks5h://localhost/path/to/socket.sock + +The application does not have to keep the string around after setting this +option. + +When a proxy is used, the active FTP mode as set with *CUROPT_FTPPORT(3)*, +cannot be used. + +# Environment variables + +libcurl respects the proxy environment variables named **http_proxy**, +**ftp_proxy**, **sftp_proxy** etc. If set, libcurl uses the specified +proxy for that URL scheme. So for a "FTP://" URL, the **ftp_proxy** is +considered. **all_proxy** is used if no protocol specific proxy was set. + +If **no_proxy** (or **NO_PROXY**) is set, it is the exact equivalent of +setting the CURLOPT_NOPROXY(3) option. + +The CURLOPT_PROXY(3) and CURLOPT_NOPROXY(3) options override +environment variables. + +# DEFAULT + +Default is NULL, meaning no proxy is used. + +When you set a host name to use, do not assume that there is any particular +single port number used widely for proxies. Specify it! + +# PROTOCOLS + +All except file://. Note that some protocols do not work well over proxy. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Since 7.14.1 the proxy environment variable names can include the protocol +scheme. + +Since 7.21.7 the proxy string supports the socks protocols as "schemes". + +Since 7.50.2, unsupported schemes in proxy strings cause libcurl to return +error. + +# RETURN VALUE + +Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXYAUTH.3 b/docs/libcurl/opts/CURLOPT_PROXYAUTH.3 deleted file mode 100644 index db48dd1fb..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYAUTH.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYAUTH 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYAUTH \- HTTP proxy authentication methods -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask); -.fi -.SH DESCRIPTION -Pass a long as parameter, which is set to a bitmask, to tell libcurl which -HTTP authentication method(s) you want it to use for your proxy -authentication. If more than one bit is set, libcurl first queries the site to -see what authentication methods it supports and then it picks the best one you -allow it to use. For some methods, this induces an extra network round-trip. -Set the actual name and password with the \fICURLOPT_PROXYUSERPWD(3)\fP -option. - -The bitmask can be constructed by the bits listed and described in the -\fICURLOPT_HTTPAUTH(3)\fP man page. -.SH DEFAULT -CURLAUTH_BASIC -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Added in 7.10.7 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication -methods. -.SH "SEE ALSO" -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYPORT (3), -.BR CURLOPT_PROXYTYPE (3), -.BR CURLOPT_PROXYUSERPWD (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYAUTH.md b/docs/libcurl/opts/CURLOPT_PROXYAUTH.md new file mode 100644 index 000000000..8e6dc093b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYAUTH.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYAUTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PROXY (3) + - CURLOPT_PROXYPORT (3) + - CURLOPT_PROXYTYPE (3) + - CURLOPT_PROXYUSERPWD (3) +--- + +# NAME + +CURLOPT_PROXYAUTH - HTTP proxy authentication methods + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask); +~~~ + +# DESCRIPTION + +Pass a long as parameter, which is set to a bitmask, to tell libcurl which +HTTP authentication method(s) you want it to use for your proxy +authentication. If more than one bit is set, libcurl first queries the site to +see what authentication methods it supports and then it picks the best one you +allow it to use. For some methods, this induces an extra network round-trip. +Set the actual name and password with the CURLOPT_PROXYUSERPWD(3) +option. + +The bitmask can be constructed by the bits listed and described in the +CURLOPT_HTTPAUTH(3) man page. + +# DEFAULT + +CURLAUTH_BASIC + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.7 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication +methods. diff --git a/docs/libcurl/opts/CURLOPT_PROXYHEADER.3 b/docs/libcurl/opts/CURLOPT_PROXYHEADER.3 deleted file mode 100644 index 1bc17e9e8..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYHEADER.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYHEADER 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYHEADER \- set of HTTP headers to pass to proxy -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER, - struct curl_slist *headers); -.SH DESCRIPTION -Pass a pointer to a linked list of HTTP headers to pass in your HTTP request -sent to a proxy. The rules for this list is identical to the -\fICURLOPT_HTTPHEADER(3)\fP option's. - -The headers set with this option is only ever used in requests sent to a proxy -- when there is also a request sent to a host. - -The first line in a request (containing the method, usually a GET or POST) is -NOT a header and cannot be replaced using this option. Only the lines -following the request-line are headers. Adding this method line in this list -of headers causes your request to send an invalid header. - -Pass a NULL to this to reset back to no custom headers. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - - 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"); - - list = curl_slist_append(NULL, "Shoesize: 10"); - list = curl_slist_append(list, "Accept:"); - - curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list); - - curl_easy_perform(curl); - - curl_slist_free_all(list); /* free the list again */ - } -} -.fi -.SH AVAILABILITY -Added in 7.37.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HEADEROPT (3), -.BR CURLOPT_HTTPHEADER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYHEADER.md b/docs/libcurl/opts/CURLOPT_PROXYHEADER.md new file mode 100644 index 000000000..e44afdd18 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYHEADER.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYHEADER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADEROPT (3) + - CURLOPT_HTTPHEADER (3) +--- + +# NAME + +CURLOPT_PROXYHEADER - set of HTTP headers to pass to proxy + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYHEADER, + struct curl_slist *headers); +~~~ + +# DESCRIPTION + +Pass a pointer to a linked list of HTTP headers to pass in your HTTP request +sent to a proxy. The rules for this list is identical to the +CURLOPT_HTTPHEADER(3) option's. + +The headers set with this option is only ever used in requests sent to a proxy +- when there is also a request sent to a host. + +The first line in a request (containing the method, usually a GET or POST) is +NOT a header and cannot be replaced using this option. Only the lines +following the request-line are headers. Adding this method line in this list +of headers causes your request to send an invalid header. + +Pass a NULL to this to reset back to no custom headers. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + + 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"); + + list = curl_slist_append(NULL, "Shoesize: 10"); + list = curl_slist_append(list, "Accept:"); + + curl_easy_setopt(curl, CURLOPT_PROXYHEADER, list); + + curl_easy_perform(curl); + + curl_slist_free_all(list); /* free the list again */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.37.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3 b/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3 deleted file mode 100644 index 921caf329..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYPASSWORD 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYPASSWORD \- password to use with proxy authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPASSWORD, char *pwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -password to use for authentication with the proxy. - -The \fICURLOPT_PROXYPASSWORD(3)\fP option should be used in conjunction with -the \fICURLOPT_PROXYUSERNAME(3)\fP option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Added in 7.19.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_PROXYAUTH (3), -.BR CURLOPT_PROXYUSERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.md b/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.md new file mode 100644 index 000000000..22520ea11 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYPASSWORD.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYPASSWORD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PASSWORD (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_PROXYUSERNAME (3) +--- + +# NAME + +CURLOPT_PROXYPASSWORD - password to use with proxy authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPASSWORD, char *pwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the null-terminated +password to use for authentication with the proxy. + +The CURLOPT_PROXYPASSWORD(3) option should be used in conjunction with +the CURLOPT_PROXYUSERNAME(3) option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXYPORT.3 b/docs/libcurl/opts/CURLOPT_PROXYPORT.3 deleted file mode 100644 index 04a20a7bb..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYPORT.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYPORT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYPORT \- port number the proxy listens on -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port); -.fi -.SH DESCRIPTION -We discourage use of this option. - -Pass a long with this option to set the proxy port to connect to unless it is -specified in the proxy string \fICURLOPT_PROXY(3)\fP or uses 443 for https -proxies and 1080 for all others as default. - -While this accepts a 'long', the port number is 16 bit so it cannot be larger -than 65535. -.SH DEFAULT -0, not specified which makes it use the default port -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLINFO_PRIMARY_PORT (3), -.BR CURLOPT_PORT (3), -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYPORT.md b/docs/libcurl/opts/CURLOPT_PROXYPORT.md new file mode 100644 index 000000000..0cda8bb8f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYPORT.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYPORT +Section: 3 +Source: libcurl +See-also: + - CURLINFO_PRIMARY_PORT (3) + - CURLOPT_PORT (3) + - CURLOPT_PROXY (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_PROXYPORT - port number the proxy listens on + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port); +~~~ + +# DESCRIPTION + +We discourage use of this option. + +Pass a long with this option to set the proxy port to connect to unless it is +specified in the proxy string CURLOPT_PROXY(3) or uses 443 for https +proxies and 1080 for all others as default. + +While this accepts a 'long', the port number is 16 bit so it cannot be larger +than 65535. + +# DEFAULT + +0, not specified which makes it use the default port + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_PROXYTYPE.3 b/docs/libcurl/opts/CURLOPT_PROXYTYPE.3 deleted file mode 100644 index 91f3b5a9a..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYTYPE.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYTYPE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYTYPE \- proxy protocol type -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYTYPE, long type); -.fi -.SH DESCRIPTION -Pass one of the values below to set the type of the proxy. - -.RS -.IP CURLPROXY_HTTP -HTTP Proxy. Default. -.IP CURLPROXY_HTTPS -HTTPS Proxy using HTTP/1. (Added in 7.52.0 for OpenSSL and GnuTLS. Since -7.87.0, it also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport -and wolfSSL.) -.IP CURLPROXY_HTTPS2 -HTTPS Proxy and attempt to speak HTTP/2 over it. (Added in 8.1.0) -.IP CURLPROXY_HTTP_1_0 -HTTP 1.0 Proxy. This is similar to CURLPROXY_HTTP except it uses HTTP/1.0 for -any CONNECT tunneling. It does not change the HTTP version of the actual HTTP -requests, controlled by \fICURLOPT_HTTP_VERSION(3)\fP. -.IP CURLPROXY_SOCKS4 -SOCKS4 Proxy. -.IP CURLPROXY_SOCKS4A -SOCKS4a Proxy. Proxy resolves URL hostname. -.IP CURLPROXY_SOCKS5 -SOCKS5 Proxy. -.IP CURLPROXY_SOCKS5_HOSTNAME -SOCKS5 Proxy. Proxy resolves URL hostname. -.RE - -Often it is more convenient to specify the proxy type with the scheme part of -the \fICURLOPT_PROXY(3)\fP string. -.SH DEFAULT -CURLPROXY_HTTP -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYTYPE.md b/docs/libcurl/opts/CURLOPT_PROXYTYPE.md new file mode 100644 index 000000000..4f06fe550 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYTYPE.md @@ -0,0 +1,99 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYTYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYPORT (3) +--- + +# NAME + +CURLOPT_PROXYTYPE - proxy protocol type + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYTYPE, long type); +~~~ + +# DESCRIPTION + +Pass one of the values below to set the type of the proxy. + +## CURLPROXY_HTTP + +HTTP Proxy. Default. + +## CURLPROXY_HTTPS + +HTTPS Proxy using HTTP/1. (Added in 7.52.0 for OpenSSL and GnuTLS. Since +7.87.0, it also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport +and wolfSSL.) + +## CURLPROXY_HTTPS2 + +HTTPS Proxy and attempt to speak HTTP/2 over it. (Added in 8.1.0) + +## CURLPROXY_HTTP_1_0 + +HTTP 1.0 Proxy. This is similar to CURLPROXY_HTTP except it uses HTTP/1.0 for +any CONNECT tunneling. It does not change the HTTP version of the actual HTTP +requests, controlled by CURLOPT_HTTP_VERSION(3). + +## CURLPROXY_SOCKS4 + +SOCKS4 Proxy. + +## CURLPROXY_SOCKS4A + +SOCKS4a Proxy. Proxy resolves URL hostname. + +## CURLPROXY_SOCKS5 + +SOCKS5 Proxy. + +## CURLPROXY_SOCKS5_HOSTNAME + +SOCKS5 Proxy. Proxy resolves URL hostname. + +Often it is more convenient to specify the proxy type with the scheme part of +the CURLOPT_PROXY(3) string. + +# DEFAULT + +CURLPROXY_HTTP + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3 b/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3 deleted file mode 100644 index 7a0e54ee2..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYUSERNAME 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYUSERNAME \- user name to use for proxy authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERNAME, - char *username); -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -user name to use for the transfer. - -\fICURLOPT_PROXYUSERNAME(3)\fP sets the user name to be used in protocol -authentication with the proxy. - -To specify the proxy password use the \fICURLOPT_PROXYPASSWORD(3)\fP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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 -Added in 7.19.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXYPASSWORD (3), -.BR CURLOPT_USERNAME (3), -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PROXYAUTH (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.md b/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.md new file mode 100644 index 000000000..f0d1dfc4d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYUSERNAME.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYUSERNAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_PROXYPASSWORD (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_PROXYUSERNAME - user name to use for proxy authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERNAME, + char *username); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the +null-terminated user name to use for the transfer. + +CURLOPT_PROXYUSERNAME(3) sets the user name to be used in protocol +authentication with the proxy. + +To specify the proxy password use the CURLOPT_PROXYPASSWORD(3). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3 b/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3 deleted file mode 100644 index e6bdcf956..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXYUSERPWD 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXYUSERPWD \- user name and password to use for proxy authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERPWD, char *userpwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be [user name]:[password] to use for -the connection to the HTTP proxy. Both the name and the password are URL -decoded before used, so to include for example a colon in the user name you -should encode it as %3A. (This is different to how \fICURLOPT_USERPWD(3)\fP is -used - beware.) - -Use \fICURLOPT_PROXYAUTH(3)\fP to specify the authentication method. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -This is NULL by default. -.SH PROTOCOLS -Used with all protocols that can use a proxy -.SH EXAMPLE -.nf -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 -Always -.SH RETURN VALUE -Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYPASSWORD (3), -.BR CURLOPT_PROXYTYPE (3), -.BR CURLOPT_PROXYUSERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.md b/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.md new file mode 100644 index 000000000..196d587e2 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXYUSERPWD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYPASSWORD (3) + - CURLOPT_PROXYTYPE (3) + - CURLOPT_PROXYUSERNAME (3) +--- + +# NAME + +CURLOPT_PROXYUSERPWD - user name and password to use for proxy authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERPWD, char *userpwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be [user name]:[password] to +use for the connection to the HTTP proxy. Both the name and the password are +URL decoded before used, so to include for example a colon in the user name +you should encode it as %3A. (This is different to how CURLOPT_USERPWD(3) is +used - beware.) + +Use CURLOPT_PROXYAUTH(3) to specify the authentication method. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +This is NULL by default. + +# PROTOCOLS + +Used with all protocols that can use a proxy + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3 b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3 deleted file mode 100644 index 4b64353e6..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3 +++ /dev/null @@ -1,95 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_CAINFO 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_CAINFO \- path to proxy Certificate Authority (CA) bundle -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO, char *path); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a char * to a null-terminated string naming a file holding one or more -certificates to verify the HTTPS proxy with. - -If \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP is zero and you avoid verifying the -server's certificate, \fICURLOPT_PROXY_CAINFO(3)\fP need not even indicate an -accessible file. - -This option is by default set to the system path where libcurl's CA -certificate bundle is assumed to be stored, as established at build time. - -(iOS and macOS only) If curl is built against Secure Transport, then this -option is supported for backward compatibility with other SSL engines, but it -should not be set. If the option is not set, then curl uses the certificates -in the system and user Keychain to verify the peer, which is the preferred -method of verifying the peer's certificate chain. - -The application does not have to keep the string around after setting this -option. - -The default value for this can be figured out with \fICURLINFO_CAINFO(3)\fP. -.SH DEFAULT -Built-in system specific -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf -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 -Added in 7.52.0 - -For TLS backends that do not support certificate files, the -\fICURLOPT_PROXY_CAINFO(3)\fP option is ignored. Refer to -https://curl.se/docs/ssl-compared.html -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAINFO_BLOB (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_PROXY_CAINFO_BLOB (3), -.BR CURLOPT_PROXY_CAPATH (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.md b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.md new file mode 100644 index 000000000..473083f35 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.md @@ -0,0 +1,93 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_CAINFO +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAINFO_BLOB (3) + - CURLOPT_CAPATH (3) + - CURLOPT_PROXY_CAINFO_BLOB (3) + - CURLOPT_PROXY_CAPATH (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_CAINFO - path to proxy Certificate Authority (CA) bundle + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO, char *path); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a char pointer to a null-terminated string naming a file holding one or +more certificates to verify the HTTPS proxy with. + +If CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and you avoid verifying the +server's certificate, CURLOPT_PROXY_CAINFO(3) need not even indicate an +accessible file. + +This option is by default set to the system path where libcurl's CA +certificate bundle is assumed to be stored, as established at build time. + +(iOS and macOS only) If curl is built against Secure Transport, then this +option is supported for backward compatibility with other SSL engines, but it +should not be set. If the option is not set, then curl uses the certificates +in the system and user Keychain to verify the peer, which is the preferred +method of verifying the peer's certificate chain. + +The application does not have to keep the string around after setting this +option. + +The default value for this can be figured out with CURLINFO_CAINFO(3). + +# DEFAULT + +Built-in system specific + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +For TLS backends that do not support certificate files, the +CURLOPT_PROXY_CAINFO(3) option is ignored. Refer to +https://curl.se/docs/ssl-compared.html + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 deleted file mode 100644 index 80c03f354..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_CAINFO_BLOB 3 "31 March 2021" libcurl libcurl -.SH NAME -CURLOPT_PROXY_CAINFO_BLOB \- proxy Certificate Authority (CA) bundle in PEM format -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO_BLOB, - struct curl_blob *stblob); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a pointer to a curl_blob structure, which contains information (pointer -and size) about a memory block with binary data of PEM encoded content holding -one or more certificates to verify the HTTPS proxy with. - -If the blob is initialized with the flags member of struct curl_blob set to -CURL_BLOB_COPY, the application does not have to keep the buffer around after -setting this. - -If \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP is zero and you avoid verifying the -server's certificate, \fICURLOPT_PROXY_CAINFO_BLOB(3)\fP is not needed. - -This option overrides \fICURLOPT_PROXY_CAINFO(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf -#include /* 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 -Added in 7.77.0. - -This option is supported by the rustls (since 7.82.0), OpenSSL, Secure -Transport and Schannel backends. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_CAINFO_BLOB (3), -.BR CURLOPT_CAPATH (3), -.BR CURLOPT_PROXY_CAINFO (3), -.BR CURLOPT_PROXY_CAPATH (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.md b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.md new file mode 100644 index 000000000..bbf30cba3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.md @@ -0,0 +1,92 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_CAINFO_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_CAINFO_BLOB (3) + - CURLOPT_CAPATH (3) + - CURLOPT_PROXY_CAINFO (3) + - CURLOPT_PROXY_CAPATH (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_CAINFO_BLOB - proxy Certificate Authority (CA) bundle in PEM format + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO_BLOB, + struct curl_blob *stblob); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a pointer to a curl_blob structure, which contains information (pointer +and size) about a memory block with binary data of PEM encoded content holding +one or more certificates to verify the HTTPS proxy with. + +If the blob is initialized with the flags member of struct curl_blob set to +CURL_BLOB_COPY, the application does not have to keep the buffer around after +setting this. + +If CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and you avoid verifying the +server's certificate, CURLOPT_PROXY_CAINFO_BLOB(3) is not needed. + +This option overrides CURLOPT_PROXY_CAINFO(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c +#include /* 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.77.0. + +This option is supported by the rustls (since 7.82.0), OpenSSL, Secure +Transport and Schannel backends. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3 b/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3 deleted file mode 100644 index fd55b0918..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_CAPATH 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_CAPATH \- directory holding HTTPS proxy CA certificates -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAPATH, char *capath); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a directory holding multiple -CA certificates to verify the HTTPS proxy with. If libcurl is built against -OpenSSL, the certificate directory must be prepared using the OpenSSL -\fBc_rehash\fP utility. This makes sense only when -\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP is enabled (which it is by default). - -The application does not have to keep the string around after setting this -option. - -The default value for this can be figured out with \fICURLINFO_CAPATH(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -Everything used over an HTTPS proxy -.SH EXAMPLE -.nf -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 -Added in 7.52.0 - -This option is supported by the OpenSSL, GnuTLS, and mbedTLS (since 7.56.0) -backends. -.SH RETURN VALUE -CURLE_OK if supported; or an error such as: - -CURLE_NOT_BUILT_IN - Not supported by the SSL backend - -CURLE_UNKNOWN_OPTION - -CURLE_OUT_OF_MEMORY -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_PROXY_CAINFO (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.md b/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.md new file mode 100644 index 000000000..2253c9f26 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_CAPATH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_PROXY_CAINFO (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_PROXY_CAPATH - directory holding HTTPS proxy CA certificates + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAPATH, char *capath); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a directory holding +multiple CA certificates to verify the HTTPS proxy with. If libcurl is built +against OpenSSL, the certificate directory must be prepared using the OpenSSL +**c_rehash** utility. This makes sense only when +CURLOPT_PROXY_SSL_VERIFYPEER(3) is enabled (which it is by default). + +The application does not have to keep the string around after setting this +option. + +The default value for this can be figured out with CURLINFO_CAPATH(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +Everything used over an HTTPS proxy + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +This option is supported by the OpenSSL, GnuTLS, and mbedTLS (since 7.56.0) +backends. + +# RETURN VALUE + +CURLE_OK if supported; or an error such as: + +CURLE_NOT_BUILT_IN - Not supported by the SSL backend + +CURLE_UNKNOWN_OPTION + +CURLE_OUT_OF_MEMORY diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3 b/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3 deleted file mode 100644 index 80891666a..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_CRLFILE 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_CRLFILE \- HTTPS proxy Certificate Revocation List file -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CRLFILE, char *file); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a char * to a null-terminated string naming a \fIfile\fP with the -concatenation of CRL (in PEM format) to use in the certificate validation that -occurs during the SSL exchange. - -When curl is built to use GnuTLS, there is no way to influence the use of CRL -passed to help in the verification process. When libcurl is built with OpenSSL -support, X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both set, -requiring CRL check against all the elements of the certificate chain if a CRL -file is passed. - -This option makes sense only when used in combination with the -\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP option. - -A specific error code (\fICURLE_SSL_CRL_BADFILE\fP) is defined with the -option. It is returned when the SSL exchange fails because the CRL file cannot -be loaded. A failure in certificate verification due to a revocation -information found in the CRL does not trigger this specific error. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -Used with HTTPS proxy. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.md b/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.md new file mode 100644 index 000000000..d12c29800 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_CRLFILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_CRLFILE - HTTPS proxy Certificate Revocation List file + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CRLFILE, char *file); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a char pointer to a null-terminated string naming a *file* with the +concatenation of CRL (in PEM format) to use in the certificate validation that +occurs during the SSL exchange. + +When curl is built to use GnuTLS, there is no way to influence the use of CRL +passed to help in the verification process. When libcurl is built with OpenSSL +support, X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both set, +requiring CRL check against all the elements of the certificate chain if a CRL +file is passed. + +This option makes sense only when used in combination with the +CURLOPT_PROXY_SSL_VERIFYPEER(3) option. + +A specific error code (*CURLE_SSL_CRL_BADFILE*) is defined with the option. It +is returned when the SSL exchange fails because the CRL file cannot be loaded. +A failure in certificate verification due to a revocation information found in +the CRL does not trigger this specific error. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +Used with HTTPS proxy. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:80"); + curl_easy_setopt(curl, CURLOPT_PROXY_CRLFILE, "/etc/certs/crl.pem"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 b/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 deleted file mode 100644 index 5ddbc712c..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_ISSUERCERT 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_PROXY_ISSUERCERT \- proxy issuer SSL certificate filename -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_ISSUERCERT, char *file); -.fi -.SH DESCRIPTION -Pass a char * to a null-terminated string naming a \fIfile\fP holding a CA -certificate in PEM format. If the option is set, an additional check against -the peer certificate is performed to verify the issuer of the the HTTPS proxy -is indeed the one associated with the certificate provided by the option. -This additional check is useful in multi-level PKI where one needs to enforce -that the peer certificate is from a specific branch of the tree. - -This option makes sense only when used in combination with the -\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the -check is not considered as failure. - -A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, -which is returned if the setup of the SSL/TLS session has failed due to a -mismatch with the issuer of peer certificate -(\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP has to be set too for the check to -fail). - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - /* 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 -Added in 7.71.0. This option is supported by the OpenSSL backends. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_ISSUERCERT (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.md b/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.md new file mode 100644 index 000000000..3b289d2d4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_ISSUERCERT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ISSUERCERT (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_ISSUERCERT - proxy issuer SSL certificate filename + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_ISSUERCERT, char *file); +~~~ + +# DESCRIPTION + +Pass a char pointer to a null-terminated string naming a *file* holding a CA +certificate in PEM format. If the option is set, an additional check against +the peer certificate is performed to verify the issuer of the HTTPS proxy is +indeed the one associated with the certificate provided by the option. This +additional check is useful in multi-level PKI where one needs to enforce that +the peer certificate is from a specific branch of the tree. + +This option makes sense only when used in combination with the +CURLOPT_PROXY_SSL_VERIFYPEER(3) option. Otherwise, the result of the +check is not considered as failure. + +A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, +which is returned if the setup of the SSL/TLS session has failed due to a +mismatch with the issuer of peer certificate +(CURLOPT_PROXY_SSL_VERIFYPEER(3) has to be set too for the check to +fail). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.71.0. This option is supported by the OpenSSL backends. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 b/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 rename to docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.md index 4f94d2eb0..41a2a1896 100644 --- a/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 +++ b/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.md @@ -1,68 +1,67 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_ISSUERCERT_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_PROXY_ISSUERCERT_BLOB \- proxy issuer SSL certificate from memory blob -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_ISSUERCERT_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ISSUERCERT_BLOB (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_ISSUERCERT_BLOB - proxy issuer SSL certificate from memory blob + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_ISSUERCERT_BLOB, struct curl_blob *blob); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a curl_blob struct, which contains information (pointer and size) about a memory block with binary data of a CA certificate in PEM format. If the option is set, an additional check against the peer certificate -is performed to verify the issuer of the the HTTPS proxy is indeed the one +is performed to verify the issuer of the HTTPS proxy is indeed the one associated with the certificate provided by the option. This additional check is useful in multi-level PKI where one needs to enforce that the peer certificate is from a specific branch of the tree. This option should be used in combination with the -\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the +CURLOPT_PROXY_SSL_VERIFYPEER(3) option. Otherwise, the result of the check is not considered as failure. A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, which is returned if the setup of the SSL/TLS session has failed due to a mismatch with the issuer of peer certificate -(\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP has to be set too for the check to -fail). +(CURLOPT_PROXY_SSL_VERIFYPEER(3) has to be set too for the check to fail). If the blob is initialized with the flags member of struct curl_blob set to CURL_BLOB_COPY, the application does not have to keep the buffer around after setting this. -This option is an alternative to \fICURLOPT_PROXY_ISSUERCERT(3)\fP which +This option is an alternative to CURLOPT_PROXY_ISSUERCERT(3) which instead expects a file name as input. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS-based protocols -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c extern char *certificateData; /* point to the data */ size_t filesize; /* size of the data */ @@ -84,15 +83,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.71.0. This option is supported by the OpenSSL backends. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_ISSUERCERT_BLOB (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3 b/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3 deleted file mode 100644 index 8d0ba91a0..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_KEYPASSWD 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_KEYPASSWD \- passphrase for the proxy private key -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_KEYPASSWD, char *pwd); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a pointer to a null-terminated string as parameter. It is used as the -password required to use the \fICURLOPT_PROXY_SSLKEY(3)\fP private key. You -never need a pass phrase to load a certificate but you need one to load your -private key. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf -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 -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_KEYPASSWD (3), -.BR CURLOPT_PROXY_SSLKEY (3), -.BR CURLOPT_SSH_PRIVATE_KEYFILE (3), -.BR CURLOPT_SSLKEY (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.md b/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.md new file mode 100644 index 000000000..b29d95f07 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_KEYPASSWD.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_KEYPASSWD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_KEYPASSWD (3) + - CURLOPT_PROXY_SSLKEY (3) + - CURLOPT_SSH_PRIVATE_KEYFILE (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_PROXY_KEYPASSWD - passphrase for the proxy private key + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_KEYPASSWD, char *pwd); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a pointer to a null-terminated string as parameter. It is used as the +password required to use the CURLOPT_PROXY_SSLKEY(3) private key. You +never need a pass phrase to load a certificate but you need one to load your +private key. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3 b/docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.md similarity index 54% rename from docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3 rename to docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.md index 631d42f80..37110bba6 100644 --- a/docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3 +++ b/docs/libcurl/opts/CURLOPT_PROXY_PINNEDPUBLICKEY.md @@ -1,57 +1,58 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_PINNEDPUBLICKEY 3 "24 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_PINNEDPUBLICKEY \- pinned public key for https proxy -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_PINNEDPUBLICKEY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PINNEDPUBLICKEY (3) + - CURLOPT_PROXY_CAINFO (3) + - CURLOPT_PROXY_CAPATH (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_PINNEDPUBLICKEY - pinned public key for https proxy + +# SYNOPSIS + +~~~c #include -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_PINNEDPUBLICKEY, char *pinnedpubkey); -.fi -.SH DESCRIPTION +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_PINNEDPUBLICKEY, + char *pinnedpubkey); +~~~ + +# DESCRIPTION + Pass a pointer to a null-terminated string as parameter. The string can be the -file name of your pinned public key. The file format expected is "PEM" or "DER". -The string can also be any number of base64 encoded sha256 hashes preceded by -"sha256//" and separated by ";" +file name of your pinned public key. The file format expected is "PEM" or +"DER". The string can also be any number of base64 encoded sha256 hashes +preceded by "sha256//" and separated by ";" When negotiating a TLS or SSL connection, the https proxy sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, libcurl aborts the connection before sending or receiving any data. -On mismatch, \fICURLE_SSL_PINNEDPUBKEYNOTMATCH\fP is returned. +On mismatch, *CURLE_SSL_PINNEDPUBKEYNOTMATCH* is returned. The application does not have to keep the string around after setting this option. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -67,11 +68,13 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH PUBLIC KEY EXTRACTION +~~~ + +# PUBLIC KEY EXTRACTION + If you do not have the https proxy server's public key file you can extract it from the https proxy server's certificate. -.nf +~~~c # retrieve the server's certificate if you do not already have it # # be sure to examine the certificate to see if it is what you expected @@ -82,40 +85,40 @@ from the https proxy server's certificate. # - If you do not have sed, then just copy the certificate into a file: # Lines from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----. # -openssl s_client -servername www.example.com -connect www.example.com:443 < /dev/null | sed -n "/-----BEGIN/,/-----END/p" > www.example.com.pem +openssl s_client -servername www.example.com -connect www.example.com:443 \ + < /dev/null | sed -n "/-----BEGIN/,/-----END/p" > www.example.com.pem # extract public key in pem format from certificate openssl x509 -in www.example.com.pem -pubkey -noout > www.example.com.pubkey.pem # convert public key from pem to der -openssl asn1parse -noout -inform pem -in www.example.com.pubkey.pem -out www.example.com.pubkey.der +openssl asn1parse -noout -inform pem -in www.example.com.pubkey.pem \ + -out www.example.com.pubkey.der # sha256 hash and base64 encode der to string for use openssl dgst -sha256 -binary www.example.com.pubkey.der | openssl base64 -.fi +~~~ The public key in PEM format contains a header, base64 data and a footer: -.nf +~~~c -----BEGIN PUBLIC KEY----- [BASE 64 DATA] -----END PUBLIC KEY----- -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + PEM/DER support: - 7.52.0: GnuTLS, OpenSSL, mbedTLS, wolfSSL + 7.52.0: GnuTLS, OpenSSL, mbedTLS, wolfSSL sha256 support: - 7.52.0: GnuTLS, OpenSSL, mbedTLS, wolfSSL + 7.52.0: GnuTLS, OpenSSL, mbedTLS, wolfSSL Other SSL backends not supported. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PINNEDPUBLICKEY (3), -.BR CURLOPT_PROXY_CAINFO (3), -.BR CURLOPT_PROXY_CAPATH (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3 b/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3 deleted file mode 100644 index 712836f60..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SERVICE_NAME 3 "17 Jun 2015" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SERVICE_NAME \- proxy authentication service name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SERVICE_NAME, - char *name); -.fi -.SH DESCRIPTION -Pass a char * as parameter to a string holding the \fIname\fP of the -service. The default service name is \fB"HTTP"\fP for HTTP based proxies and -\fB"rcmd"\fP for SOCKS5. This option allows you to change it. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -See above -.SH PROTOCOLS -All network protocols -.SH EXAMPLE -.nf -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 -Added in 7.43.0 for HTTP proxies, 7.49.0 for SOCKS5 proxies. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYTYPE (3), -.BR CURLOPT_SERVICE_NAME (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.md b/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.md new file mode 100644 index 000000000..73e5cb72a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SERVICE_NAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYTYPE (3) + - CURLOPT_SERVICE_NAME (3) +--- + +# NAME + +CURLOPT_PROXY_SERVICE_NAME - proxy authentication service name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SERVICE_NAME, + char *name); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter to a string holding the *name* of the +service. The default service name is **"HTTP"** for HTTP based proxies and +**"rcmd"** for SOCKS5. This option allows you to change it. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +See above + +# PROTOCOLS + +All network protocols + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.43.0 for HTTP proxies, 7.49.0 for SOCKS5 proxies. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3 deleted file mode 100644 index 54e6f545b..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLCERT 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLCERT \- HTTPS proxy client certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERT, char *cert); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a pointer to a null-terminated string as parameter. The string should be -the file name of your client certificate used to connect to the HTTPS proxy. -The default format is "P12" on Secure Transport and "PEM" on other engines, -and can be changed with \fICURLOPT_PROXY_SSLCERTTYPE(3)\fP. - -With Secure Transport, this can also be the nickname of the certificate you -wish to authenticate with as it is named in the security database. If you want -to use a file from the current directory, please precede it with "./" prefix, -in order to avoid confusion with a nickname. - -When using a client certificate, you most likely also need to provide a -private key with \fICURLOPT_PROXY_SSLKEY(3)\fP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLCERTTYPE (3), -.BR CURLOPT_PROXY_SSLKEY (3), -.BR CURLOPT_SSLCERT (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.md new file mode 100644 index 000000000..0a1539f8b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLCERT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLCERTTYPE (3) + - CURLOPT_PROXY_SSLKEY (3) + - CURLOPT_SSLCERT (3) +--- + +# NAME + +CURLOPT_PROXY_SSLCERT - HTTPS proxy client certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERT, char *cert); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a pointer to a null-terminated string as parameter. The string should be +the file name of your client certificate used to connect to the HTTPS proxy. +The default format is "P12" on Secure Transport and "PEM" on other engines, +and can be changed with CURLOPT_PROXY_SSLCERTTYPE(3). + +With Secure Transport, this can also be the nickname of the certificate you +wish to authenticate with as it is named in the security database. If you want +to use a file from the current directory, please precede it with "./" prefix, +in order to avoid confusion with a nickname. + +When using a client certificate, you most likely also need to provide a +private key with CURLOPT_PROXY_SSLKEY(3). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3 deleted file mode 100644 index 380595c7e..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLCERTTYPE 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLCERTTYPE \- type of the proxy client SSL certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERTTYPE, char *type); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the format of your client certificate used when connecting to an HTTPS proxy. - -Supported formats are "PEM" and "DER", except with Secure Transport or -Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or -later, or OS X 10.7 or later) and Schannel support "P12" for PKCS#12-encoded -files. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -"PEM" -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLCERT (3), -.BR CURLOPT_PROXY_SSLKEY (3), -.BR CURLOPT_SSLCERTTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.md new file mode 100644 index 000000000..ce6c50887 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLCERTTYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLCERT (3) + - CURLOPT_PROXY_SSLKEY (3) + - CURLOPT_SSLCERTTYPE (3) +--- + +# NAME + +CURLOPT_PROXY_SSLCERTTYPE - type of the proxy client SSL certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERTTYPE, char *type); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the format of your client certificate used when connecting to an HTTPS proxy. + +Supported formats are "PEM" and "DER", except with Secure Transport or +Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or +later, or OS X 10.7 or later) and Schannel support "P12" for PKCS#12-encoded +files. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +"PEM" + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 deleted file mode 100644 index a033193d1..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 +++ /dev/null @@ -1,87 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLCERT_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLCERT_BLOB \- SSL proxy client certificate from memory blob -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERT_BLOB, - struct curl_blob *blob); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_blob structure, which contains information (pointer -and size) about a memory block with binary data of the certificate used to -connect to the HTTPS proxy. The format must be "P12" on Secure Transport or -Schannel. The format must be "P12" or "PEM" on OpenSSL. The string "P12" or -"PEM" must be specified with \fICURLOPT_PROXY_SSLCERTTYPE(3)\fP. - -If the blob is initialized with the flags member of struct curl_blob set to -CURL_BLOB_COPY, the application does not have to keep the buffer around after -setting this. - -This option is an alternative to \fICURLOPT_PROXY_SSLCERT(3)\fP which instead -expects a file name as input. -.SH DEFAULT -NULL -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf - -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 -Added in 7.71.0. This option is supported by the OpenSSL, Secure Transport and -Schannel backends. -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLCERT (3), -.BR CURLOPT_PROXY_SSLCERTTYPE (3), -.BR CURLOPT_PROXY_SSLKEY (3), -.BR CURLOPT_SSLCERT_BLOB (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.md new file mode 100644 index 000000000..d0b1407c3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.md @@ -0,0 +1,85 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLCERT_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLCERT (3) + - CURLOPT_PROXY_SSLCERTTYPE (3) + - CURLOPT_PROXY_SSLKEY (3) + - CURLOPT_SSLCERT_BLOB (3) +--- + +# NAME + +CURLOPT_PROXY_SSLCERT_BLOB - SSL proxy client certificate from memory blob + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLCERT_BLOB, + struct curl_blob *blob); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_blob structure, which contains information (pointer +and size) about a memory block with binary data of the certificate used to +connect to the HTTPS proxy. The format must be "P12" on Secure Transport or +Schannel. The format must be "P12" or "PEM" on OpenSSL. The string "P12" or +"PEM" must be specified with CURLOPT_PROXY_SSLCERTTYPE(3). + +If the blob is initialized with the flags member of struct curl_blob set to +CURL_BLOB_COPY, the application does not have to keep the buffer around after +setting this. + +This option is an alternative to CURLOPT_PROXY_SSLCERT(3) which instead +expects a file name as input. + +# DEFAULT + +NULL + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c + +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.71.0. This option is supported by the OpenSSL, Secure Transport and +Schannel backends. + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3 deleted file mode 100644 index ce79f44a6..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLKEY 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLKEY \- private key file for HTTPS proxy client cert -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY, char *keyfile); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the file name of your private key used for connecting to the HTTPS proxy. The -default format is "PEM" and can be changed with -\fICURLOPT_PROXY_SSLKEYTYPE(3)\fP. - -(Windows, iOS and Mac OS X) This option is ignored by Secure Transport and -Schannel SSL backends because they expect the private key to be already -present in the key chain or PKCS#12 file containing the certificate. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLCERT (3), -.BR CURLOPT_PROXY_SSLKEYTYPE (3), -.BR CURLOPT_SSLCERT (3), -.BR CURLOPT_SSLKEY (3), -.BR CURLOPT_SSLKEYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.md new file mode 100644 index 000000000..593859806 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLKEY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLCERT (3) + - CURLOPT_PROXY_SSLKEYTYPE (3) + - CURLOPT_SSLCERT (3) + - CURLOPT_SSLKEY (3) + - CURLOPT_SSLKEYTYPE (3) +--- + +# NAME + +CURLOPT_PROXY_SSLKEY - private key file for HTTPS proxy client cert + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY, char *keyfile); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the file name of your private key used for connecting to the HTTPS proxy. The +default format is "PEM" and can be changed with +CURLOPT_PROXY_SSLKEYTYPE(3). + +(Windows, iOS and Mac OS X) This option is ignored by Secure Transport and +Schannel SSL backends because they expect the private key to be already +present in the key chain or PKCS#12 file containing the certificate. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3 deleted file mode 100644 index dfa6ce6d4..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLKEYTYPE 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLKEYTYPE \- type of the proxy private key file -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEYTYPE, char *type); -.fi -.SH DESCRIPTION -This option is for connecting to an HTTPS proxy, not an HTTPS server. - -Pass a pointer to a null-terminated string as parameter. The string should be -the format of your private key. Supported formats are "PEM", "DER" and "ENG". - -The application does not have to keep the string around after setting this -option. -.SH PROTOCOLS -Used with HTTPS proxy -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLCERT (3), -.BR CURLOPT_PROXY_SSLKEY (3), -.BR CURLOPT_SSLKEYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.md new file mode 100644 index 000000000..97960f437 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLKEYTYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLCERT (3) + - CURLOPT_PROXY_SSLKEY (3) + - CURLOPT_SSLKEYTYPE (3) +--- + +# NAME + +CURLOPT_PROXY_SSLKEYTYPE - type of the proxy private key file + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEYTYPE, char *type); +~~~ + +# DESCRIPTION + +This option is for connecting to an HTTPS proxy, not an HTTPS server. + +Pass a pointer to a null-terminated string as parameter. The string should be +the format of your private key. Supported formats are "PEM", "DER" and "ENG". + +The application does not have to keep the string around after setting this +option. + +# PROTOCOLS + +Used with HTTPS proxy + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 rename to docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.md index 034e1fe0e..48bb2e88a 100644 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.md @@ -1,52 +1,50 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLKEY_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLKEY_BLOB \- private key for proxy cert from memory blob -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLKEY_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLKEY (3) + - CURLOPT_SSLKEYTYPE (3) + - CURLOPT_SSLKEY_BLOB (3) +--- + +# NAME + +CURLOPT_PROXY_SSLKEY_BLOB - private key for proxy cert from memory blob + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY_BLOB, struct curl_blob *blob); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a curl_blob structure that contains information (pointer and size) about the private key for connecting to the HTTPS proxy. Compatible with OpenSSL. The format (like "PEM") must be specified with -\fICURLOPT_PROXY_SSLKEYTYPE(3)\fP. +CURLOPT_PROXY_SSLKEYTYPE(3). If the blob is initialized with the flags member of struct curl_blob set to CURL_BLOB_COPY, the application does not have to keep the buffer around after setting this. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c extern char *certificateData; /* point to data */ extern size_t filesize; /* size of data */ @@ -76,13 +74,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.71.0. This option is supported by the OpenSSL backends. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLKEY (3), -.BR CURLOPT_SSLKEY_BLOB (3), -.BR CURLOPT_SSLKEYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.3 deleted file mode 100644 index 3c3fe0289..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.3 +++ /dev/null @@ -1,110 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSLVERSION 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSLVERSION \- preferred HTTPS proxy TLS version -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLVERSION, - long version); -.fi -.SH DESCRIPTION -Pass a long as parameter to control which version of SSL/TLS to attempt to use -when connecting to an HTTPS proxy. - -Use one of the available defines for this purpose. The available options are: -.RS -.IP CURL_SSLVERSION_DEFAULT -The default action. This attempts to figure out the remote SSL protocol -version. -.IP CURL_SSLVERSION_TLSv1 -TLSv1.x -.IP CURL_SSLVERSION_TLSv1_0 -TLSv1.0 -.IP CURL_SSLVERSION_TLSv1_1 -TLSv1.1 -.IP CURL_SSLVERSION_TLSv1_2 -TLSv1.2 -.IP CURL_SSLVERSION_TLSv1_3 -TLSv1.3 -.RE -The maximum TLS version can be set by using \fIone\fP of the -CURL_SSLVERSION_MAX_ macros below. It is also possible to OR \fIone\fP of the -CURL_SSLVERSION_ macros with \fIone\fP of the CURL_SSLVERSION_MAX_ macros. -The MAX macros are not supported for WolfSSL. -.RS -.IP CURL_SSLVERSION_MAX_DEFAULT -The flag defines the maximum supported TLS version as TLSv1.2, or the default -value from the SSL library. -(Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_0 -The flag defines maximum supported TLS version as TLSv1.0. -(Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_1 -The flag defines maximum supported TLS version as TLSv1.1. -(Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_2 -The flag defines maximum supported TLS version as TLSv1.2. -(Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_3 -The flag defines maximum supported TLS version as TLSv1.3. -(Added in 7.54.0) -.RE - -In versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were -documented to allow \fIonly\fP the specified TLS version, but behavior was -inconsistent depending on the TLS library. - -.SH DEFAULT -CURL_SSLVERSION_DEFAULT -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_IPRESOLVE (3), -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.md b/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.md new file mode 100644 index 000000000..6f159e87d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSLVERSION.md @@ -0,0 +1,125 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSLVERSION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_IPRESOLVE (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_PROXY_SSLVERSION - preferred HTTPS proxy TLS version + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLVERSION, + long version); +~~~ + +# DESCRIPTION + +Pass a long as parameter to control which version of SSL/TLS to attempt to use +when connecting to an HTTPS proxy. + +Use one of the available defines for this purpose. The available options are: + +## CURL_SSLVERSION_DEFAULT + +The default action. This attempts to figure out the remote SSL protocol +version. + +## CURL_SSLVERSION_TLSv1 + +TLSv1.x + +## CURL_SSLVERSION_TLSv1_0 + +TLSv1.0 + +## CURL_SSLVERSION_TLSv1_1 + +TLSv1.1 + +## CURL_SSLVERSION_TLSv1_2 + +TLSv1.2 + +## CURL_SSLVERSION_TLSv1_3 + +TLSv1.3 +The maximum TLS version can be set by using *one* of the +CURL_SSLVERSION_MAX_ macros below. It is also possible to OR *one* of the +CURL_SSLVERSION_ macros with *one* of the CURL_SSLVERSION_MAX_ macros. +The MAX macros are not supported for WolfSSL. + +## CURL_SSLVERSION_MAX_DEFAULT + +The flag defines the maximum supported TLS version as TLSv1.2, or the default +value from the SSL library. +(Added in 7.54.0) + +## CURL_SSLVERSION_MAX_TLSv1_0 + +The flag defines maximum supported TLS version as TLSv1.0. +(Added in 7.54.0) + +## CURL_SSLVERSION_MAX_TLSv1_1 + +The flag defines maximum supported TLS version as TLSv1.1. +(Added in 7.54.0) + +## CURL_SSLVERSION_MAX_TLSv1_2 + +The flag defines maximum supported TLS version as TLSv1.2. +(Added in 7.54.0) + +## CURL_SSLVERSION_MAX_TLSv1_3 + +The flag defines maximum supported TLS version as TLSv1.3. +(Added in 7.54.0) + +In versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were +documented to allow *only* the specified TLS version, but behavior was +inconsistent depending on the TLS library. + +# DEFAULT + +CURL_SSLVERSION_DEFAULT + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3 deleted file mode 100644 index 5677c655a..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSL_CIPHER_LIST 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSL_CIPHER_LIST \- ciphers to use for HTTPS proxy -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_CIPHER_LIST, - char *list); -.fi -.SH DESCRIPTION -Pass a char *, pointing to a null-terminated string holding the list of -ciphers to use for the connection to the HTTPS proxy. The list must be -syntactically correct, it consists of one or more cipher strings separated by -colons. Commas or spaces are also acceptable separators but colons are -normally used, \&!, \&- and \&+ can be used as operators. - -For OpenSSL and GnuTLS valid examples of cipher lists include \fBRC4-SHA\fP, -\fBSHA1+DES\fP, \fBTLSv1\fP and \fBDEFAULT\fP. The default list is normally -set when you compile OpenSSL. - -For WolfSSL, valid examples of cipher lists include \fBECDHE-RSA-RC4-SHA\fP, -\fBAES256-SHA:AES256-SHA256\fP, etc. - -For BearSSL, valid examples of cipher lists include -\fBECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256\fP, or when using IANA names -\fBTLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\fP, -etc. -With BearSSL you do not add/remove ciphers. If one uses this option then all -known ciphers are disabled and only those passed in are enabled. - -Find more details about cipher lists on this URL: - - https://curl.se/docs/ssl-ciphers.html - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, use internal default -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost"); - curl_easy_setopt(curl, CURLOPT_PROXY_SSL_CIPHER_LIST, "TLSv1"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0, in 7.83.0 for BearSSL - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_PROXY_TLS13_CIPHERS (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_TLS13_CIPHERS (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.md b/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.md new file mode 100644 index 000000000..d7626c376 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSL_CIPHER_LIST.md @@ -0,0 +1,91 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSL_CIPHER_LIST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_PROXY_TLS13_CIPHERS (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CIPHER_LIST (3) + - CURLOPT_TLS13_CIPHERS (3) +--- + +# NAME + +CURLOPT_PROXY_SSL_CIPHER_LIST - ciphers to use for HTTPS proxy + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_CIPHER_LIST, + char *list); +~~~ + +# DESCRIPTION + +Pass a char pointer, pointing to a null-terminated string holding the list of +ciphers to use for the connection to the HTTPS proxy. The list must be +syntactically correct, it consists of one or more cipher strings separated by +colons. Commas or spaces are also acceptable separators but colons are +normally used, &!, &- and &+ can be used as operators. + +For OpenSSL and GnuTLS valid examples of cipher lists include **RC4-SHA**, +**SHA1+DES**, **TLSv1** and **DEFAULT**. The default list is normally +set when you compile OpenSSL. + +For WolfSSL, valid examples of cipher lists include **ECDHE-RSA-RC4-SHA**, +**AES256-SHA:AES256-SHA256**, etc. + +For BearSSL, valid examples of cipher lists include +**ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256**, or when using IANA names +**TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256**, +etc. +With BearSSL you do not add/remove ciphers. If one uses this option then all +known ciphers are disabled and only those passed in are enabled. + +Find more details about cipher lists on this URL: + + https://curl.se/docs/ssl-ciphers.html + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, use internal default + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost"); + curl_easy_setopt(curl, CURLOPT_PROXY_SSL_CIPHER_LIST, "TLSv1"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0, in 7.83.0 for BearSSL + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.md similarity index 60% rename from docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3 rename to docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.md index b64285afc..30d6935a1 100644 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3 +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.md @@ -1,66 +1,69 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSL_OPTIONS 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSL_OPTIONS \- HTTPS proxy SSL behavior options -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSL_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_PROXY_SSL_CIPHER_LIST (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CIPHER_LIST (3) +--- + +# NAME + +CURLOPT_PROXY_SSL_OPTIONS - HTTPS proxy SSL behavior options + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_OPTIONS, long bitmask); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long with a bitmask to tell libcurl about specific SSL behaviors. Available bits: -.IP CURLSSLOPT_ALLOW_BEAST + +## CURLSSLOPT_ALLOW_BEAST + Tells libcurl to not attempt to use any workarounds for a security flaw in the -SSL3 and TLS1.0 protocols. If this option is not used or this bit is set to 0, +SSL3 and TLS1.0 protocols. If this option is not used or this bit is set to 0, the SSL layer libcurl uses may use a work-around for this flaw although it might cause interoperability problems with some (older) SSL implementations. WARNING: avoiding this work-around lessens the security, and by setting this -option to 1 you ask for exactly that. This option is only supported for -Secure Transport and OpenSSL. -.IP CURLSSLOPT_NO_REVOKE +option to 1 you ask for exactly that. This option is only supported for Secure +Transport and OpenSSL. + +## CURLSSLOPT_NO_REVOKE + Tells libcurl to disable certificate revocation checks for those SSL backends where such behavior is present. This option is only supported for Schannel (the native Windows SSL library), with an exception in the case of Windows' Untrusted Publishers block list which it seems cannot be bypassed. (Added in 7.44.0) -.IP CURLSSLOPT_NO_PARTIALCHAIN + +## CURLSSLOPT_NO_PARTIALCHAIN + Tells libcurl to not accept "partial" certificate chains, which it otherwise does by default. This option is only supported for OpenSSL and fails the certificate verification if the chain ends with an intermediate certificate and not with a root cert. (Added in 7.68.0) -.IP CURLSSLOPT_REVOKE_BEST_EFFORT + +## CURLSSLOPT_REVOKE_BEST_EFFORT + Tells libcurl to ignore certificate revocation checks in case of missing or offline distribution points for those SSL backends where such behavior is present. This option is only supported for Schannel (the native Windows SSL -library). If combined with \fICURLSSLOPT_NO_REVOKE\fP, the latter takes +library). If combined with *CURLSSLOPT_NO_REVOKE*, the latter takes precedence. (Added in 7.70.0) -.IP CURLSSLOPT_NATIVE_CA + +## CURLSSLOPT_NATIVE_CA + Tell libcurl to use the operating system's native CA store for certificate verification. If you set this option and also set a CA certificate file or directory then during verification those certificates are searched in addition @@ -69,7 +72,9 @@ to the native CA store. Works with wolfSSL on Windows, Linux (Debian, Ubuntu, Gentoo, Fedora, RHEL), macOS, Android and iOS (added in 8.3.0), with GnuTLS (added in 8.5.0) or on Windows when built to use OpenSSL (Added in 7.71.0). -.IP CURLSSLOPT_AUTO_CLIENT_CERT + +## CURLSSLOPT_AUTO_CLIENT_CERT + Tell libcurl to automatically locate and use a client certificate for authentication, when requested by the server. This option is only supported for Schannel (the native Windows SSL library). Prior to 7.77.0 this was the @@ -77,12 +82,18 @@ default behavior in libcurl with Schannel. Since the server can request any certificate that supports client authentication in the OS certificate store it could be a privacy violation and unexpected. (Added in 7.77.0) -.SH DEFAULT + +# DEFAULT + 0 -.SH PROTOCOLS + +# PROTOCOLS + All TLS-based protocols -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -97,13 +108,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.52.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_CIPHER_LIST (3), -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.3 deleted file mode 100644 index 42a96b6c2..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSL_VERIFYHOST 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSL_VERIFYHOST \- verify the proxy certificate's name against host -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYHOST, - long verify); -.fi -.SH DESCRIPTION -Pass a long set to 2L as asking curl to \fIverify\fP in the HTTPS proxy's -certificate name fields against the proxy name. - -This option determines whether libcurl verifies that the proxy cert contains -the correct name for the name it is known as. - -When \fICURLOPT_PROXY_SSL_VERIFYHOST(3)\fP is 2, the proxy certificate must -indicate that the server is the proxy to which you meant to connect to, or the -connection fails. - -Curl considers the proxy the intended one when the Common Name field or a -Subject Alternate Name field in the certificate matches the host name in the -proxy string which you told curl to use. - -If \fIverify\fP value is set to 1: - -In 7.28.0 and earlier: treated as a debug option of some sorts, not supported -anymore due to frequently leading to programmer mistakes. - -From 7.28.1 to 7.65.3: setting it to 1 made \fIcurl_easy_setopt(3)\fP return -an error and leaving the flag untouched. - -From 7.66.0: treats 1 and 2 the same. - -When the \fIverify\fP value is 0L, the connection succeeds regardless of the -names used in the certificate. Use that ability with caution! - -See also \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP to verify the digital signature -of the proxy certificate. -.SH DEFAULT -2 -.SH PROTOCOLS -All protocols when used over an HTTPS proxy. -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0. - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not. - -If 1 is set as argument, \fICURLE_BAD_FUNCTION_ARGUMENT\fP is returned. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_PROXY_CAINFO (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.md b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.md new file mode 100644 index 000000000..ff52383a1 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYHOST.md @@ -0,0 +1,94 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSL_VERIFYHOST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_PROXY_CAINFO (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_SSL_VERIFYHOST - verify the proxy certificate's name against host + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYHOST, + long verify); +~~~ + +# DESCRIPTION + +Pass a long set to 2L as asking curl to *verify* in the HTTPS proxy's +certificate name fields against the proxy name. + +This option determines whether libcurl verifies that the proxy cert contains +the correct name for the name it is known as. + +When CURLOPT_PROXY_SSL_VERIFYHOST(3) is 2, the proxy certificate must +indicate that the server is the proxy to which you meant to connect to, or the +connection fails. + +Curl considers the proxy the intended one when the Common Name field or a +Subject Alternate Name field in the certificate matches the host name in the +proxy string which you told curl to use. + +If *verify* value is set to 1: + +In 7.28.0 and earlier: treated as a debug option of some sorts, not supported +anymore due to frequently leading to programmer mistakes. + +From 7.28.1 to 7.65.3: setting it to 1 made curl_easy_setopt(3) return +an error and leaving the flag untouched. + +From 7.66.0: treats 1 and 2 the same. + +When the *verify* value is 0L, the connection succeeds regardless of the +names used in the certificate. Use that ability with caution! + +See also CURLOPT_PROXY_SSL_VERIFYPEER(3) to verify the digital signature +of the proxy certificate. + +# DEFAULT + +2 + +# PROTOCOLS + +All protocols when used over an HTTPS proxy. + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0. + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not. + +If 1 is set as argument, *CURLE_BAD_FUNCTION_ARGUMENT* is returned. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.3 b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.3 deleted file mode 100644 index 866f07c9f..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_SSL_VERIFYPEER 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_SSL_VERIFYPEER \- verify the proxy's SSL certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYPEER, - long verify); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1L to enable or 0L to disable. - -This option tells curl to verify the authenticity of the HTTPS proxy's -certificate. A value of 1 means curl verifies; 0 (zero) means it does not. - -This is the proxy version of \fICURLOPT_SSL_VERIFYPEER(3)\fP that is used for -ordinary HTTPS servers. - -When negotiating a TLS or SSL connection, the server sends a certificate -indicating its identity. Curl verifies whether the certificate is authentic, -i.e. that you can trust that the server is who the certificate says it is. -This trust is based on a chain of digital signatures, rooted in certification -authority (CA) certificates you supply. curl uses a default bundle of CA -certificates (the path for that is determined at build time) and you can -specify alternate certificates with the \fICURLOPT_PROXY_CAINFO(3)\fP option -or the \fICURLOPT_PROXY_CAPATH(3)\fP option. - -When \fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP is enabled, and the verification -fails to prove that the certificate is authentic, the connection fails. When -the option is zero, the peer certificate verification succeeds regardless. - -Authenticating the certificate is not enough to be sure about the server. You -typically also want to ensure that the server is the server you mean to be -talking to. Use \fICURLOPT_PROXY_SSL_VERIFYHOST(3)\fP for that. The check -that the host name in the certificate is valid for the host name you are -connecting to is done independently of the -\fICURLOPT_PROXY_SSL_VERIFYPEER(3)\fP option. - -WARNING: disabling verification of the certificate allows bad guys to -man-in-the-middle the communication without you knowing it. Disabling -verification makes the communication insecure. Just having encryption on a -transfer is not enough as you cannot be sure that you are communicating with -the correct end-point. -.SH DEFAULT -1 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.52.0 - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3), -.BR CURLOPT_SSL_VERIFYHOST (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.md b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.md new file mode 100644 index 000000000..e4504068a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_SSL_VERIFYPEER.md @@ -0,0 +1,94 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_SSL_VERIFYPEER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_PROXY_SSL_VERIFYPEER - verify the proxy's SSL certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYPEER, + long verify); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1L to enable or 0L to disable. + +This option tells curl to verify the authenticity of the HTTPS proxy's +certificate. A value of 1 means curl verifies; 0 (zero) means it does not. + +This is the proxy version of CURLOPT_SSL_VERIFYPEER(3) that is used for +ordinary HTTPS servers. + +When negotiating a TLS or SSL connection, the server sends a certificate +indicating its identity. Curl verifies whether the certificate is authentic, +i.e. that you can trust that the server is who the certificate says it is. +This trust is based on a chain of digital signatures, rooted in certification +authority (CA) certificates you supply. curl uses a default bundle of CA +certificates (the path for that is determined at build time) and you can +specify alternate certificates with the CURLOPT_PROXY_CAINFO(3) option or +the CURLOPT_PROXY_CAPATH(3) option. + +When CURLOPT_PROXY_SSL_VERIFYPEER(3) is enabled, and the verification +fails to prove that the certificate is authentic, the connection fails. When +the option is zero, the peer certificate verification succeeds regardless. + +Authenticating the certificate is not enough to be sure about the server. You +typically also want to ensure that the server is the server you mean to be +talking to. Use CURLOPT_PROXY_SSL_VERIFYHOST(3) for that. The check that the +host name in the certificate is valid for the host name you are connecting to +is done independently of the CURLOPT_PROXY_SSL_VERIFYPEER(3) option. + +WARNING: disabling verification of the certificate allows bad guys to +man-in-the-middle the communication without you knowing it. Disabling +verification makes the communication insecure. Just having encryption on a +transfer is not enough as you cannot be sure that you are communicating with +the correct end-point. + +# DEFAULT + +1 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3 b/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3 deleted file mode 100644 index fd187add8..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_TLS13_CIPHERS 3 "25 May 2018" libcurl libcurl -.SH NAME -CURLOPT_PROXY_TLS13_CIPHERS \- ciphers suites for proxy TLS 1.3 -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLS13_CIPHERS, - char *list); -.fi -.SH DESCRIPTION -Pass a char *, pointing to a null-terminated string holding the list of cipher -suites to use for the TLS 1.3 connection to a proxy. The list must be -syntactically correct, it consists of one or more cipher suite strings -separated by colons. - -Find more details about cipher lists on this URL: - - https://curl.se/docs/ssl-ciphers.html - -This option is currently used only when curl is built to use OpenSSL 1.1.1 or -later. If you are using a different SSL backend you can try setting TLS 1.3 -cipher suites by using the \fICURLOPT_PROXY_SSL_CIPHER_LIST(3)\fP option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, use internal default -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY_TLS13_CIPHERS, - "TLS_CHACHA20_POLY1305_SHA256"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0. -Available when built with OpenSSL >= 1.1.1. -.SH RETURN VALUE -Returns CURLE_OK if supported, CURLE_NOT_BUILT_IN otherwise. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_CIPHER_LIST (3), -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_TLS13_CIPHERS (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.md b/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.md new file mode 100644 index 000000000..f3c5448f0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_TLS13_CIPHERS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_PROXY_SSL_CIPHER_LIST (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CIPHER_LIST (3) + - CURLOPT_TLS13_CIPHERS (3) +--- + +# NAME + +CURLOPT_PROXY_TLS13_CIPHERS - ciphers suites for proxy TLS 1.3 + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLS13_CIPHERS, + char *list); +~~~ + +# DESCRIPTION + +Pass a char pointer, pointing to a null-terminated string holding the list of +cipher suites to use for the TLS 1.3 connection to a proxy. The list must be +syntactically correct, it consists of one or more cipher suite strings +separated by colons. + +Find more details about cipher lists on this URL: + + https://curl.se/docs/ssl-ciphers.html + +This option is currently used only when curl is built to use OpenSSL 1.1.1 or +later. If you are using a different SSL backend you can try setting TLS 1.3 +cipher suites by using the CURLOPT_PROXY_SSL_CIPHER_LIST(3) option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, use internal default + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY_TLS13_CIPHERS, + "TLS_CHACHA20_POLY1305_SHA256"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0. +Available when built with OpenSSL >= 1.1.1. + +# RETURN VALUE + +Returns CURLE_OK if supported, CURLE_NOT_BUILT_IN otherwise. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3 b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3 deleted file mode 100644 index 327b92a81..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_TLSAUTH_PASSWORD 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_TLSAUTH_PASSWORD \- password to use for proxy TLS authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_PASSWORD, - char *pwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should point to the null-terminated password -to use for the TLS authentication method specified with the -\fICURLOPT_PROXY_TLSAUTH_TYPE(3)\fP option. Requires that the -\fICURLOPT_PROXY_TLSAUTH_USERNAME(3)\fP option also be set. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0, with the OpenSSL and GnuTLS backends only -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_TLSAUTH_TYPE (3), -.BR CURLOPT_PROXY_TLSAUTH_USERNAME (3), -.BR CURLOPT_TLSAUTH_TYPE (3), -.BR CURLOPT_TLSAUTH_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.md b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.md new file mode 100644 index 000000000..778d1b79c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_TLSAUTH_PASSWORD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_TLSAUTH_TYPE (3) + - CURLOPT_PROXY_TLSAUTH_USERNAME (3) + - CURLOPT_TLSAUTH_TYPE (3) + - CURLOPT_TLSAUTH_USERNAME (3) +--- + +# NAME + +CURLOPT_PROXY_TLSAUTH_PASSWORD - password to use for proxy TLS authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_PASSWORD, + char *pwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should point to the null-terminated +password to use for the TLS authentication method specified with the +CURLOPT_PROXY_TLSAUTH_TYPE(3) option. Requires that the +CURLOPT_PROXY_TLSAUTH_USERNAME(3) option also be set. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0, with the OpenSSL and GnuTLS backends only + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3 b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3 deleted file mode 100644 index c4fe02c85..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_TLSAUTH_TYPE 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_TLSAUTH_TYPE \- HTTPS proxy TLS authentication methods -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_TYPE, - char *type); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the method of the TLS authentication used for the HTTPS connection. Supported -method is "SRP". - -.IP SRP -TLS-SRP authentication. Secure Remote Password authentication for TLS is -defined in RFC 5054 and provides mutual authentication if both sides have a -shared secret. To use TLS-SRP, you must also set the -\fICURLOPT_PROXY_TLSAUTH_USERNAME(3)\fP and -\fICURLOPT_PROXY_TLSAUTH_PASSWORD(3)\fP options. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0 - -You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this -to work. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_TLSAUTH_PASSWORD (3), -.BR CURLOPT_PROXY_TLSAUTH_USERNAME (3), -.BR CURLOPT_TLSAUTH_PASSWORD (3), -.BR CURLOPT_TLSAUTH_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.md b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.md new file mode 100644 index 000000000..d4389188b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_TLSAUTH_TYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_TLSAUTH_PASSWORD (3) + - CURLOPT_PROXY_TLSAUTH_USERNAME (3) + - CURLOPT_TLSAUTH_PASSWORD (3) + - CURLOPT_TLSAUTH_USERNAME (3) +--- + +# NAME + +CURLOPT_PROXY_TLSAUTH_TYPE - HTTPS proxy TLS authentication methods + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_TYPE, + char *type); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the method of the TLS authentication used for the HTTPS connection. Supported +method is "SRP". + +## SRP + +TLS-SRP authentication. Secure Remote Password authentication for TLS is +defined in RFC 5054 and provides mutual authentication if both sides have a +shared secret. To use TLS-SRP, you must also set the +CURLOPT_PROXY_TLSAUTH_USERNAME(3) and +CURLOPT_PROXY_TLSAUTH_PASSWORD(3) options. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0 + +You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this +to work. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3 b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3 deleted file mode 100644 index e8362fa2f..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_TLSAUTH_USERNAME 3 "16 Nov 2016" libcurl libcurl -.SH NAME -CURLOPT_PROXY_TLSAUTH_USERNAME \- user name to use for proxy TLS authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_USERNAME, - char *user); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should point to the null-terminated username -to use for the HTTPS proxy TLS authentication method specified with the -\fICURLOPT_PROXY_TLSAUTH_TYPE(3)\fP option. Requires that the -\fICURLOPT_PROXY_TLSAUTH_PASSWORD(3)\fP option also be set. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "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 -Added in 7.52.0, with the OpenSSL and GnuTLS backends only. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_TLSAUTH_PASSWORD (3), -.BR CURLOPT_PROXY_TLSAUTH_TYPE (3), -.BR CURLOPT_TLSAUTH_PASSWORD (3), -.BR CURLOPT_TLSAUTH_TYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.md b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.md new file mode 100644 index 000000000..612ff4f92 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_TLSAUTH_USERNAME.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_TLSAUTH_USERNAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_TLSAUTH_PASSWORD (3) + - CURLOPT_PROXY_TLSAUTH_TYPE (3) + - CURLOPT_TLSAUTH_PASSWORD (3) + - CURLOPT_TLSAUTH_TYPE (3) +--- + +# NAME + +CURLOPT_PROXY_TLSAUTH_USERNAME - user name to use for proxy TLS authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_USERNAME, + char *user); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should point to the null-terminated +username to use for the HTTPS proxy TLS authentication method specified with +the CURLOPT_PROXY_TLSAUTH_TYPE(3) option. Requires that the +CURLOPT_PROXY_TLSAUTH_PASSWORD(3) option also be set. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.52.0, with the OpenSSL and GnuTLS backends only. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.3 b/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.3 deleted file mode 100644 index f948613a8..000000000 --- a/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PROXY_TRANSFER_MODE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PROXY_TRANSFER_MODE \- append FTP transfer mode to URL for proxy -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TRANSFER_MODE, - long enabled); -.fi -.SH DESCRIPTION -Pass a long. If the value is set to 1 (one), it tells libcurl to set the -transfer mode (binary or ASCII) for FTP transfers done via an HTTP proxy, by -appending ;type=a or ;type=i to the URL. Without this setting, or it being set -to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT(3)\fP has no effect when -doing FTP via a proxy. Beware that not all proxies support this feature. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -FTP over proxy -.SH EXAMPLE -.nf -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 -Added in 7.18.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the -enabled value is not supported. -.SH "SEE ALSO" -.BR CURLOPT_CRLF (3), -.BR CURLOPT_TRANSFERTEXT (3), -.BR CURLOPT_HTTPPROXYTUNNEL (3), -.BR CURLOPT_PROXY (3) diff --git a/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.md b/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.md new file mode 100644 index 000000000..c0fed8b21 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PROXY_TRANSFER_MODE.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PROXY_TRANSFER_MODE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CRLF (3) + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_PROXY (3) + - CURLOPT_TRANSFERTEXT (3) +--- + +# NAME + +CURLOPT_PROXY_TRANSFER_MODE - append FTP transfer mode to URL for proxy + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TRANSFER_MODE, + long enabled); +~~~ + +# DESCRIPTION + +Pass a long. If the value is set to 1 (one), it tells libcurl to set the +transfer mode (binary or ASCII) for FTP transfers done via an HTTP proxy, by +appending ;type=a or ;type=i to the URL. Without this setting, or it being set +to 0 (zero, the default), CURLOPT_TRANSFERTEXT(3) has no effect when +doing FTP via a proxy. Beware that not all proxies support this feature. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +FTP over proxy + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.18.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the +enabled value is not supported. diff --git a/docs/libcurl/opts/CURLOPT_PUT.3 b/docs/libcurl/opts/CURLOPT_PUT.3 deleted file mode 100644 index fb4e4c9be..000000000 --- a/docs/libcurl/opts/CURLOPT_PUT.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_PUT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_PUT \- make an HTTP PUT request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PUT, long put); -.fi -.SH DESCRIPTION -A parameter set to 1 tells the library to use HTTP PUT to transfer data. The -data should be set with \fICURLOPT_READDATA(3)\fP and -\fICURLOPT_INFILESIZE(3)\fP. - -This option is \fBdeprecated\fP since version 7.12.1. Use -\fICURLOPT_UPLOAD(3)\fP! -.SH DEFAULT -0, disabled -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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); - - 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"); - - /* 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); - - /* Now run off and do what you have been told! */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Deprecated since 7.12.1. Do not use. -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPGET (3), -.BR CURLOPT_MIMEPOST (3), -.BR CURLOPT_POSTFIELDS (3), -.BR CURLOPT_UPLOAD (3) diff --git a/docs/libcurl/opts/CURLOPT_PUT.md b/docs/libcurl/opts/CURLOPT_PUT.md new file mode 100644 index 000000000..117eaedd7 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_PUT.md @@ -0,0 +1,89 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_PUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPGET (3) + - CURLOPT_MIMEPOST (3) + - CURLOPT_POSTFIELDS (3) + - CURLOPT_UPLOAD (3) +--- + +# NAME + +CURLOPT_PUT - make an HTTP PUT request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PUT, long put); +~~~ + +# DESCRIPTION + +A parameter set to 1 tells the library to use HTTP PUT to transfer data. The +data should be set with CURLOPT_READDATA(3) and +CURLOPT_INFILESIZE(3). + +This option is **deprecated** since version 7.12.1. Use CURLOPT_UPLOAD(3). + +# DEFAULT + +0, disabled + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + + 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"); + + /* 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); + + /* Now run off and do what you have been told */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Deprecated since 7.12.1. Do not use. + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_QUICK_EXIT.3 b/docs/libcurl/opts/CURLOPT_QUICK_EXIT.3 deleted file mode 100644 index f34e771ac..000000000 --- a/docs/libcurl/opts/CURLOPT_QUICK_EXIT.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_QUICK_EXIT 3 "30 Sep 2022" libcurl libcurl -.SH NAME -CURLOPT_QUICK_EXIT \- allow to exit quickly -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUICK_EXIT, - long value); -.SH DESCRIPTION -Pass a long as a parameter, 1L meaning that when recovering from a timeout, -libcurl should skip lengthy cleanups that are intended to avoid all kinds of -leaks (threads etc.), as the caller program is about to call exit() anyway. -This allows for a swift termination after a DNS timeout for example, by -canceling and/or forgetting about a resolver thread, at the expense of a -possible (though short-lived) leak of associated resources. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.87.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FAILONERROR (3), -.BR CURLOPT_RESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_QUICK_EXIT.md b/docs/libcurl/opts/CURLOPT_QUICK_EXIT.md new file mode 100644 index 000000000..4159c02fb --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_QUICK_EXIT.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_QUICK_EXIT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_FAILONERROR (3) + - CURLOPT_RESOLVE (3) +--- + +# NAME + +CURLOPT_QUICK_EXIT - allow to exit quickly + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUICK_EXIT, + long value); +~~~ + +# DESCRIPTION + +Pass a long as a parameter, 1L meaning that when recovering from a timeout, +libcurl should skip lengthy cleanups that are intended to avoid all kinds of +leaks (threads etc.), as the caller program is about to call exit() anyway. +This allows for a swift termination after a DNS timeout for example, by +canceling and/or forgetting about a resolver thread, at the expense of a +possible (though short-lived) leak of associated resources. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.87.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_QUOTE.3 b/docs/libcurl/opts/CURLOPT_QUOTE.md similarity index 56% rename from docs/libcurl/opts/CURLOPT_QUOTE.3 rename to docs/libcurl/opts/CURLOPT_QUOTE.md index 29e0154cd..f57b45eec 100644 --- a/docs/libcurl/opts/CURLOPT_QUOTE.3 +++ b/docs/libcurl/opts/CURLOPT_QUOTE.md @@ -1,44 +1,37 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_QUOTE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_QUOTE \- (S)FTP commands to run before transfer -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_QUOTE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_DIRLISTONLY (3) + - CURLOPT_POSTQUOTE (3) + - CURLOPT_PREQUOTE (3) +--- + +# NAME + +CURLOPT_QUOTE - (S)FTP commands to run before transfer + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE, struct curl_slist *cmds); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a linked list of FTP or SFTP commands to pass to the server prior to your request. This is done before any other commands are issued (even before the CWD command for FTP). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in with text strings. Use -\fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear -the entire list afterwards with \fIcurl_slist_free_all(3)\fP. +curl_slist_append(3) to append strings (commands) to the list, and clear +the entire list afterwards with curl_slist_free_all(3). Disable this operation again by setting a NULL to this option. @@ -53,55 +46,91 @@ libcurl does not inspect, parse or "understand" the commands passed to the server using this option. If you change connection state, working directory or similar using quote commands, libcurl does not know about it. -The valid SFTP commands are: -.RS -.IP "atime date file" +The path arguments for FTP or SFTP can use single or double quotes to +distinguish a space from being the parameter separator or being a part of the +path. e.g. rename with sftp using a quote command like this: + + "rename 'test/_upload.txt' 'test/Hello World.txt'" + +# SFTP commands + +## atime date file + The atime command sets the last access time of the file named by the file operand. The can be all sorts of date strings, see the -\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0) -.IP "chgrp group file" +curl_getdate(3) man page for date expression details. (Added in 7.73.0) + +## chgrp group file + The chgrp command sets the group ID of the file named by the file operand to the group ID specified by the group operand. The group operand is a decimal integer group ID. -.IP "chmod mode file" + +## chmod mode file + The chmod command modifies the file mode bits of the specified file. The mode operand is an octal integer mode number. -.IP "chown user file" + +## chown user file + The chown command sets the owner of the file named by the file operand to the user ID specified by the user operand. The user operand is a decimal integer user ID. -.IP "ln source_file target_file" -The \fBln\fP and \fBsymlink\fP commands create a symbolic link at the + +## ln source_file target_file + +The **ln** and **symlink** commands create a symbolic link at the target_file location pointing to the source_file location. -.IP "mkdir directory_name" + +## mkdir directory_name + The mkdir command creates the directory named by the directory_name operand. -.IP "mtime date file" + +## mtime date file + The mtime command sets the last modification time of the file named by the file operand. The can be all sorts of date strings, see the -\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0) -.IP "pwd" -The \fBpwd\fP command returns the absolute path of the current working +curl_getdate(3) man page for date expression details. (Added in 7.73.0) + +## pwd + +The **pwd** command returns the absolute path of the current working directory. -.IP "rename source target" + +## rename source target + The rename command renames the file or directory named by the source operand to the destination path named by the target operand. -.IP "rm file" + +## rm file + The rm command removes the file specified by the file operand. -.IP "rmdir directory" + +## rmdir directory + The rmdir command removes the directory entry specified by the directory operand, provided it is empty. -.IP "statvfs file" + +## statvfs file + The statvfs command returns statistics on the file system in which specified file resides. (Added in 7.49.0) -.IP "symlink source_file target_file" + +## symlink source_file target_file + See ln. -.RE -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + SFTP and FTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { struct curl_slist *cmdlist = NULL; @@ -121,13 +150,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_DIRLISTONLY (3), -.BR CURLOPT_POSTQUOTE (3), -.BR CURLOPT_PREQUOTE (3) diff --git a/docs/libcurl/opts/CURLOPT_RANDOM_FILE.3 b/docs/libcurl/opts/CURLOPT_RANDOM_FILE.3 deleted file mode 100644 index b226d15a0..000000000 --- a/docs/libcurl/opts/CURLOPT_RANDOM_FILE.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RANDOM_FILE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RANDOM_FILE \- file to read random data from -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANDOM_FILE, char *path); -.fi -.SH DESCRIPTION -Deprecated option. It serves no purpose anymore. - -Pass a char * to a null-terminated file name. The file might be used to read -from to seed the random engine for SSL and more. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, not used -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, "junk.txt"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -If built with TLS enabled. Only the OpenSSL backend uses this, and only with -OpenSSL versions before 1.1.0. - -This option was deprecated in 7.84.0. -.SH RETURN VALUE -Returns CURLE_OK on success or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_EGDSOCKET (3) diff --git a/docs/libcurl/opts/CURLOPT_RANDOM_FILE.md b/docs/libcurl/opts/CURLOPT_RANDOM_FILE.md new file mode 100644 index 000000000..5331a68c9 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RANDOM_FILE.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RANDOM_FILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_EGDSOCKET (3) +--- + +# NAME + +CURLOPT_RANDOM_FILE - file to read random data from + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANDOM_FILE, char *path); +~~~ + +# DESCRIPTION + +Deprecated option. It serves no purpose anymore. + +Pass a char pointer to a null-terminated file name. The file might be used to +read from to seed the random engine for SSL and more. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, not used + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, "junk.txt"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +If built with TLS enabled. Only the OpenSSL backend uses this, and only with +OpenSSL versions before 1.1.0. + +This option was deprecated in 7.84.0. + +# RETURN VALUE + +Returns CURLE_OK on success or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_RANGE.3 b/docs/libcurl/opts/CURLOPT_RANGE.3 deleted file mode 100644 index 90ad66696..000000000 --- a/docs/libcurl/opts/CURLOPT_RANGE.3 +++ /dev/null @@ -1,86 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RANGE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RANGE \- byte range to request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANGE, char *range); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should contain the specified range you want -to retrieve. It should be in the format "X-Y", where either X or Y may be left -out and X and Y are byte indexes. - -HTTP transfers also support several intervals, separated with commas as in -\fI"X-Y,N-M"\fP. Using this kind of multiple intervals causes the HTTP server -to send the response document in pieces (using standard MIME separation -techniques). Unfortunately, the HTTP standard (RFC 7233 section 3.1) allows -servers to ignore range requests so even when you set \fICURLOPT_RANGE(3)\fP -for a request, you may end up getting the full response sent back. - -For RTSP, the formatting of a range should follow RFC 2326 Section 12.29. For -RTSP, byte ranges are \fBnot\fP permitted. Instead, ranges should be given in -\fBnpt\fP, \fButc\fP, or \fBsmpte\fP formats. - -For HTTP PUT uploads this option should not be used, since it may conflict with -other options. - -Pass a NULL to this option to disable the use of ranges. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP, FTP, FILE, RTSP and SFTP. -.SH EXAMPLE -.nf -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"); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -FILE since 7.18.0, RTSP since 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK on success or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3), -.BR CURLOPT_MAXFILESIZE_LARGE (3), -.BR CURLOPT_RESUME_FROM (3) diff --git a/docs/libcurl/opts/CURLOPT_RANGE.md b/docs/libcurl/opts/CURLOPT_RANGE.md new file mode 100644 index 000000000..3f765bc61 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RANGE.md @@ -0,0 +1,84 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RANGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_MAXFILESIZE_LARGE (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) + - CURLOPT_RESUME_FROM (3) +--- + +# NAME + +CURLOPT_RANGE - byte range to request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RANGE, char *range); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should contain the specified range you +want to retrieve. It should be in the format "X-Y", where either X or Y may be +left out and X and Y are byte indexes. + +HTTP transfers also support several intervals, separated with commas as in +*"X-Y,N-M"*. Using this kind of multiple intervals causes the HTTP server +to send the response document in pieces (using standard MIME separation +techniques). Unfortunately, the HTTP standard (RFC 7233 section 3.1) allows +servers to ignore range requests so even when you set CURLOPT_RANGE(3) +for a request, you may end up getting the full response sent back. + +For RTSP, the formatting of a range should follow RFC 2326 Section 12.29. For +RTSP, byte ranges are **not** permitted. Instead, ranges should be given in +**npt**, **utc**, or **smpte** formats. + +For HTTP PUT uploads this option should not be used, since it may conflict with +other options. + +Pass a NULL to this option to disable the use of ranges. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP, FTP, FILE, RTSP and SFTP. + +# EXAMPLE + +~~~c +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"); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +FILE since 7.18.0, RTSP since 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK on success or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_READDATA.3 b/docs/libcurl/opts/CURLOPT_READDATA.3 deleted file mode 100644 index db0dcfc60..000000000 --- a/docs/libcurl/opts/CURLOPT_READDATA.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_READDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_READDATA \- pointer passed to the read callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READDATA, void *pointer); -.fi -.SH DESCRIPTION -Data \fIpointer\fP to pass to the file read function. If you use the -\fICURLOPT_READFUNCTION(3)\fP option, this is the pointer you get as input in -the fourth argument to the callback. - -If you do not specify a read callback but instead rely on the default internal -read function, this data must be a valid readable FILE * (cast to 'void *'). - -If you are using libcurl as a DLL on Windows, you must use the -\fICURLOPT_READFUNCTION(3)\fP callback if you set this option, otherwise you -might experience crashes. -.SH DEFAULT -By default, this is a FILE * to stdin. -.SH PROTOCOLS -This is used for all protocols when sending data. -.SH EXAMPLE -.nf -struct MyData { - void *custom; -}; - -int main(void) -{ - CURL *curl = curl_easy_init(); - struct MyData this; - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* 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 -This option was once known by the older name CURLOPT_INFILE, the name -\fICURLOPT_READDATA(3)\fP was introduced in 7.9.7. -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_HEADERDATA (3), -.BR CURLOPT_READFUNCTION (3), -.BR CURLOPT_WRITEDATA (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_READDATA.md b/docs/libcurl/opts/CURLOPT_READDATA.md new file mode 100644 index 000000000..d7aa4ff9a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_READDATA.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_READDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERDATA (3) + - CURLOPT_READFUNCTION (3) + - CURLOPT_WRITEDATA (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_READDATA - pointer passed to the read callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READDATA, void *pointer); +~~~ + +# DESCRIPTION + +Data *pointer* to pass to the file read function. If you use the +CURLOPT_READFUNCTION(3) option, this is the pointer you get as input in +the fourth argument to the callback. + +If you do not specify a read callback but instead rely on the default internal +read function, this data must be a valid readable FILE * (cast to 'void *'). + +If you are using libcurl as a DLL on Windows, you must use the +CURLOPT_READFUNCTION(3) callback if you set this option, otherwise you +might experience crashes. + +# DEFAULT + +By default, this is a FILE * to stdin. + +# PROTOCOLS + +This is used for all protocols when sending data. + +# EXAMPLE + +~~~c +struct MyData { + void *custom; +}; + +int main(void) +{ + CURL *curl = curl_easy_init(); + struct MyData this; + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* pass pointer that gets passed in to the + CURLOPT_READFUNCTION callback */ + curl_easy_setopt(curl, CURLOPT_READDATA, &this); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +This option was once known by the older name CURLOPT_INFILE, the name +CURLOPT_READDATA(3) was introduced in 7.9.7. + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_READFUNCTION.3 b/docs/libcurl/opts/CURLOPT_READFUNCTION.3 deleted file mode 100644 index de689fbdc..000000000 --- a/docs/libcurl/opts/CURLOPT_READFUNCTION.3 +++ /dev/null @@ -1,125 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_READFUNCTION 3 "25 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_READFUNCTION \- read callback for data uploads -.SH SYNOPSIS -.nf -#include - -size_t read_callback(char *buffer, size_t size, size_t nitems, void *userdata); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READFUNCTION, read_callback); -.fi -.SH DESCRIPTION -Pass a pointer to your callback function, as the prototype shows above. - -This callback function gets called by libcurl as soon as it needs to read data -in order to send it to the peer - like if you ask it to upload or post data to -the server. The data area pointed at by the pointer \fIbuffer\fP should be -filled up with at most \fIsize\fP multiplied with \fInitems\fP number of bytes -by your function. \fIsize\fP is always 1. - -Set the \fIuserdata\fP argument with the \fICURLOPT_READDATA(3)\fP option. - -Your function must return the actual number of bytes that it stored in the -data area pointed at by the pointer \fIbuffer\fP. Returning 0 signals -end-of-file to the library and causes it to stop the current transfer. - -If you stop the current transfer by returning 0 "pre-maturely" (i.e before the -server expected it, like when you have said you would upload N bytes and you -upload less than N bytes), you may experience that the server "hangs" waiting -for the rest of the data that is not sent. - -The read callback may return \fICURL_READFUNC_ABORT\fP to stop the current -operation immediately, resulting in a \fICURLE_ABORTED_BY_CALLBACK\fP error -code from the transfer. - -The callback can return \fICURL_READFUNC_PAUSE\fP to cause reading from this -connection to pause. See \fIcurl_easy_pause(3)\fP for further details. - -\fBBugs\fP: when doing TFTP uploads, you must return the exact amount of data -that the callback wants, or it is considered the final packet by the server -end and the transfer ends there. - -If you set this callback pointer to NULL, or do not set it at all, the default -internal read function is used. It is doing an fread() on the FILE * userdata -set with \fICURLOPT_READDATA(3)\fP. - -You can set the total size of the data you are sending by using -\fICURLOPT_INFILESIZE_LARGE(3)\fP or \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP, -depending on the type of transfer. For some transfer types it may be required -and it allows for better error checking. -.SH DEFAULT -The default internal read callback is fread(). -.SH PROTOCOLS -This is used for all protocols when doing uploads. -.SH EXAMPLE -.nf -size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userdata) -{ - FILE *readhere = (FILE *)userdata; - curl_off_t nread; - - /* copy as much data as possible into the 'ptr' buffer, but no more than - 'size' * 'nmemb' bytes! */ - size_t retcode = fread(ptr, size, nmemb, readhere); - - nread = (curl_off_t)retcode; - - fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T - " bytes from file\\n", nread); - return retcode; -} - -int main(int argc, char **argv) -{ - FILE *file = fopen(argv[1], "rb"); - CURLcode result; - - 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); - - result = curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -CURL_READFUNC_PAUSE return code was added in 7.18.0 and CURL_READFUNC_ABORT -was added in 7.12.1. -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_POST (3), -.BR CURLOPT_READDATA (3), -.BR CURLOPT_SEEKFUNCTION (3), -.BR CURLOPT_UPLOAD (3), -.BR CURLOPT_UPLOAD_BUFFERSIZE (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_READFUNCTION.md b/docs/libcurl/opts/CURLOPT_READFUNCTION.md new file mode 100644 index 000000000..978440d13 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_READFUNCTION.md @@ -0,0 +1,123 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_READFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_POST (3) + - CURLOPT_READDATA (3) + - CURLOPT_SEEKFUNCTION (3) + - CURLOPT_UPLOAD (3) + - CURLOPT_UPLOAD_BUFFERSIZE (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_READFUNCTION - read callback for data uploads + +# SYNOPSIS + +~~~c +#include + +size_t read_callback(char *buffer, size_t size, size_t nitems, void *userdata); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READFUNCTION, read_callback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, as the prototype shows above. + +This callback function gets called by libcurl as soon as it needs to read data +in order to send it to the peer - like if you ask it to upload or post data to +the server. The data area pointed at by the pointer *buffer* should be +filled up with at most *size* multiplied with *nitems* number of bytes +by your function. *size* is always 1. + +Set the *userdata* argument with the CURLOPT_READDATA(3) option. + +Your function must return the actual number of bytes that it stored in the +data area pointed at by the pointer *buffer*. Returning 0 signals +end-of-file to the library and causes it to stop the current transfer. + +If you stop the current transfer by returning 0 "pre-maturely" (i.e before the +server expected it, like when you have said you would upload N bytes and you +upload less than N bytes), you may experience that the server "hangs" waiting +for the rest of the data that is not sent. + +The read callback may return *CURL_READFUNC_ABORT* to stop the current +operation immediately, resulting in a *CURLE_ABORTED_BY_CALLBACK* error +code from the transfer. + +The callback can return *CURL_READFUNC_PAUSE* to cause reading from this +connection to pause. See curl_easy_pause(3) for further details. + +**Bugs**: when doing TFTP uploads, you must return the exact amount of data +that the callback wants, or it is considered the final packet by the server +end and the transfer ends there. + +If you set this callback pointer to NULL, or do not set it at all, the default +internal read function is used. It is doing an fread() on the FILE * userdata +set with CURLOPT_READDATA(3). + +You can set the total size of the data you are sending by using +CURLOPT_INFILESIZE_LARGE(3) or CURLOPT_POSTFIELDSIZE_LARGE(3), +depending on the type of transfer. For some transfer types it may be required +and it allows for better error checking. + +# DEFAULT + +The default internal read callback is fread(). + +# PROTOCOLS + +This is used for all protocols when doing uploads. + +# EXAMPLE + +~~~c +size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userdata) +{ + FILE *readhere = (FILE *)userdata; + curl_off_t nread; + + /* copy as much data as possible into the 'ptr' buffer, but no more than + 'size' * 'nmemb' bytes! */ + size_t retcode = fread(ptr, size, nmemb, readhere); + + nread = (curl_off_t)retcode; + + fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T + " bytes from file\n", nread); + return retcode; +} + +int main(int argc, char **argv) +{ + FILE *file = fopen(argv[1], "rb"); + CURLcode result; + + 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); + + result = curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +CURL_READFUNC_PAUSE return code was added in 7.18.0 and CURL_READFUNC_ABORT +was added in 7.12.1. + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3 b/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3 deleted file mode 100644 index c45583d79..000000000 --- a/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3 +++ /dev/null @@ -1,117 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_REDIR_PROTOCOLS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_REDIR_PROTOCOLS \- protocols allowed to redirect to -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS, long bitmask); -.fi -.SH DESCRIPTION -This option is deprecated. We strongly recommend using -\fICURLOPT_REDIR_PROTOCOLS_STR(3)\fP instead because this option cannot -control all available protocols! - -Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask -limits what protocols libcurl may use in a transfer that it follows to in a -redirect when \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This allows you to -limit specific transfers to only be allowed to use a subset of protocols in -redirections. - -Protocols denied by \fICURLOPT_PROTOCOLS(3)\fP are not overridden by this -option. - -By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirect (7.65.2). -\fICURLPROTO_ALL\fP enables all protocols on redirect, including those -otherwise disabled for security. - -These are the available protocol defines: -.nf -CURLPROTO_DICT -CURLPROTO_FILE -CURLPROTO_FTP -CURLPROTO_FTPS -CURLPROTO_GOPHER -CURLPROTO_HTTP -CURLPROTO_HTTPS -CURLPROTO_IMAP -CURLPROTO_IMAPS -CURLPROTO_LDAP -CURLPROTO_LDAPS -CURLPROTO_POP3 -CURLPROTO_POP3S -CURLPROTO_RTMP -CURLPROTO_RTMPE -CURLPROTO_RTMPS -CURLPROTO_RTMPT -CURLPROTO_RTMPTE -CURLPROTO_RTMPTS -CURLPROTO_RTSP -CURLPROTO_SCP -CURLPROTO_SFTP -CURLPROTO_SMB -CURLPROTO_SMBS -CURLPROTO_SMTP -CURLPROTO_SMTPS -CURLPROTO_TELNET -CURLPROTO_TFTP -.fi -.SH DEFAULT -HTTP, HTTPS, FTP and FTPS (Added in 7.65.2). - -Older versions defaulted to all protocols except FILE, SCP and since 7.40.0 -SMB and SMBS. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.4, before then it would follow all protocols. Deprecated -since 7.85.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_SCHEME (3), -.BR CURLOPT_DEFAULT_PROTOCOL (3), -.BR CURLOPT_PROTOCOLS (3), -.BR CURLOPT_REDIR_PROTOCOLS_STR (3) diff --git a/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.md b/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.md new file mode 100644 index 000000000..4d06d4658 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS.md @@ -0,0 +1,115 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_REDIR_PROTOCOLS +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SCHEME (3) + - CURLOPT_DEFAULT_PROTOCOL (3) + - CURLOPT_PROTOCOLS (3) + - CURLOPT_REDIR_PROTOCOLS_STR (3) +--- + +# NAME + +CURLOPT_REDIR_PROTOCOLS - protocols allowed to redirect to + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS, long bitmask); +~~~ + +# DESCRIPTION + +This option is deprecated. We strongly recommend using +CURLOPT_REDIR_PROTOCOLS_STR(3) instead because this option cannot +control all available protocols! + +Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask +limits what protocols libcurl may use in a transfer that it follows to in a +redirect when CURLOPT_FOLLOWLOCATION(3) is enabled. This allows you to +limit specific transfers to only be allowed to use a subset of protocols in +redirections. + +Protocols denied by CURLOPT_PROTOCOLS(3) are not overridden by this +option. + +By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirect (7.65.2). +*CURLPROTO_ALL* enables all protocols on redirect, including those +otherwise disabled for security. + +These are the available protocol defines: +~~~c +CURLPROTO_DICT +CURLPROTO_FILE +CURLPROTO_FTP +CURLPROTO_FTPS +CURLPROTO_GOPHER +CURLPROTO_HTTP +CURLPROTO_HTTPS +CURLPROTO_IMAP +CURLPROTO_IMAPS +CURLPROTO_LDAP +CURLPROTO_LDAPS +CURLPROTO_POP3 +CURLPROTO_POP3S +CURLPROTO_RTMP +CURLPROTO_RTMPE +CURLPROTO_RTMPS +CURLPROTO_RTMPT +CURLPROTO_RTMPTE +CURLPROTO_RTMPTS +CURLPROTO_RTSP +CURLPROTO_SCP +CURLPROTO_SFTP +CURLPROTO_SMB +CURLPROTO_SMBS +CURLPROTO_SMTP +CURLPROTO_SMTPS +CURLPROTO_TELNET +CURLPROTO_TFTP +~~~ + +# DEFAULT + +HTTP, HTTPS, FTP and FTPS (Added in 7.65.2). + +Older versions defaulted to all protocols except FILE, SCP and since 7.40.0 +SMB and SMBS. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4, before then it would follow all protocols. Deprecated +since 7.85.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.3 b/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.3 rename to docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.md index db243ad1d..9201a4b41 100644 --- a/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.3 +++ b/docs/libcurl/opts/CURLOPT_REDIR_PROTOCOLS_STR.md @@ -1,46 +1,40 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_REDIR_PROTOCOLS_STR 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_REDIR_PROTOCOLS_STR \- protocols allowed to redirect to -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_REDIR_PROTOCOLS_STR +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SCHEME (3) + - CURLOPT_DEFAULT_PROTOCOL (3) + - CURLOPT_PROTOCOLS (3) + - CURLOPT_PROTOCOLS_STR (3) + - CURLOPT_REDIR_PROTOCOLS (3) +--- + +# NAME + +CURLOPT_REDIR_PROTOCOLS_STR - protocols allowed to redirect to + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS_STR, char *spec); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a string that holds a comma-separated list of case insensitive protocol names (URL schemes). That list limits what protocols libcurl may use in a transfer that it follows to in a redirect when -\fICURLOPT_FOLLOWLOCATION(3)\fP is enabled. This option allows applications to +CURLOPT_FOLLOWLOCATION(3) is enabled. This option allows applications to limit specific transfers to only be allowed to use a subset of protocols in redirections. -Protocols denied by \fICURLOPT_PROTOCOLS_STR(3)\fP are not overridden by this +Protocols denied by CURLOPT_PROTOCOLS_STR(3) are not overridden by this option. By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirects (since @@ -58,15 +52,21 @@ but are introduced in a future libcurl version. If trying to set a non-existing protocol or if no matching protocol at all is set, it returns error. -.SH DEFAULT + +# DEFAULT + HTTP, HTTPS, FTP and FTPS (Added in 7.65.2). Older versions defaulted to all protocols except FILE, SCP and since 7.40.0 SMB and SMBS. -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(int argc, char **argv) { CURL *curl = curl_easy_init(); @@ -81,16 +81,14 @@ int main(int argc, char **argv) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.85.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_UNKNOWN_OPTION if the option is not implemented, CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled, CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_PROTOCOLS_STR (3), -.BR CURLINFO_SCHEME (3), -.BR CURLOPT_DEFAULT_PROTOCOL (3), -.BR CURLOPT_PROTOCOLS (3), -.BR CURLOPT_REDIR_PROTOCOLS (3) diff --git a/docs/libcurl/opts/CURLOPT_REFERER.3 b/docs/libcurl/opts/CURLOPT_REFERER.3 deleted file mode 100644 index 38d931b9f..000000000 --- a/docs/libcurl/opts/CURLOPT_REFERER.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_REFERER 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_REFERER \- the HTTP referer header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REFERER, char *where); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. It is used to set the -Referer: header field in the HTTP request sent to the remote server. You can -set any custom header with \fICURLOPT_HTTPHEADER(3)\fP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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.org/me.html"); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -If built with HTTP support -.SH RETURN VALUE -Returns CURLE_OK if HTTP support is enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLINFO_REFERER (3), -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_USERAGENT (3) diff --git a/docs/libcurl/opts/CURLOPT_REFERER.md b/docs/libcurl/opts/CURLOPT_REFERER.md new file mode 100644 index 000000000..6af19cb01 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_REFERER.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_REFERER +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_URL (3) + - CURLINFO_REFERER (3) + - CURLOPT_HTTPHEADER (3) + - CURLOPT_USERAGENT (3) +--- + +# NAME + +CURLOPT_REFERER - the HTTP referer header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REFERER, char *where); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. It is used to set the +Referer: header field in the HTTP request sent to the remote server. You can +set any custom header with CURLOPT_HTTPHEADER(3). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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.org/me.html"); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +If built with HTTP support + +# RETURN VALUE + +Returns CURLE_OK if HTTP support is enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.3 b/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.3 deleted file mode 100644 index f7a21feda..000000000 --- a/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_REQUEST_TARGET 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_REQUEST_TARGET \- alternative target for this request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REQUEST_TARGET, string); -.fi -.SH DESCRIPTION -Pass a char * to string which libcurl uses in the upcoming request instead of -the path as extracted from the URL. - -libcurl passes on the verbatim string in its request without any filter or -other safe guards. That includes white space and control characters. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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, "*"); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_HTTPGET (3), -.BR CURLOPT_PATH_AS_IS (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.md b/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.md new file mode 100644 index 000000000..cfc15d7b4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_REQUEST_TARGET.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_REQUEST_TARGET +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_HTTPGET (3) + - CURLOPT_PATH_AS_IS (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_REQUEST_TARGET - alternative target for this request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REQUEST_TARGET, string); +~~~ + +# DESCRIPTION + +Pass a char pointer to string which libcurl uses in the upcoming request +instead of the path as extracted from the URL. + +libcurl passes on the verbatim string in its request without any filter or +other safe guards. That includes white space and control characters. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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, "*"); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_RESOLVE.3 b/docs/libcurl/opts/CURLOPT_RESOLVE.md similarity index 59% rename from docs/libcurl/opts/CURLOPT_RESOLVE.3 rename to docs/libcurl/opts/CURLOPT_RESOLVE.md index b0aa0e778..8ae8f0556 100644 --- a/docs/libcurl/opts/CURLOPT_RESOLVE.3 +++ b/docs/libcurl/opts/CURLOPT_RESOLVE.md @@ -1,48 +1,41 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RESOLVE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RESOLVE \- provide custom host name to IP address resolves -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RESOLVE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECT_TO (3) + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_IPRESOLVE (3) +--- + +# NAME + +CURLOPT_RESOLVE - provide custom host name to IP address resolves + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVE, struct curl_slist *hosts); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a linked list of strings with host name resolve information to use for requests with this handle. The linked list should be a fully valid -list of \fBstruct curl_slist\fP structs properly filled in. Use -\fIcurl_slist_append(3)\fP to create the list and \fIcurl_slist_free_all(3)\fP +list of **struct curl_slist** structs properly filled in. Use +curl_slist_append(3) to create the list and curl_slist_free_all(3) to clean up an entire list. Each resolve rule to add should be written using the format -.nf +~~~c [+]HOST:PORT:ADDRESS[,ADDRESS] -.fi +~~~ HOST is the name libcurl wants to resolve, PORT is the port number of the service where libcurl wants to connect to the HOST and ADDRESS is one or more @@ -62,23 +55,29 @@ If the DNS cache already has an entry for the given host+port pair, the new entry overrides the former one. An ADDRESS provided by this option is only used if not restricted by the -setting of \fICURLOPT_IPRESOLVE(3)\fP to a different IP version. +setting of CURLOPT_IPRESOLVE(3) to a different IP version. To remove names from the DNS cache again, to stop providing these fake resolves, include a string in the linked list that uses the format -.nf +~~~c -HOST:PORT -.fi +~~~ The entry to remove must be prefixed with a dash, and the host name and port number must exactly match what was added previously. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl; @@ -98,8 +97,10 @@ int main(void) curl_slist_free_all(host); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.21.3. Removal support added in 7.42.0. Support for providing the ADDRESS within [brackets] was added in 7.57.0. @@ -108,9 +109,7 @@ Support for providing multiple IP addresses per entry was added in 7.59.0. Support for adding non-permanent entries by using the "+" prefix was added in 7.75.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CONNECT_TO (3), -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_IPRESOLVE (3) diff --git a/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3 b/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3 deleted file mode 100644 index 84bc081a6..000000000 --- a/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RESOLVER_START_DATA 3 "14 Feb 2018" libcurl libcurl -.SH NAME -CURLOPT_RESOLVER_START_DATA \- pointer passed to the resolver start callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVER_START_DATA, - void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP is be untouched by libcurl and passed as the third -argument in the resolver start callback set with -\fICURLOPT_RESOLVER_START_FUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -static int resolver_start_cb(void *resolver_state, void *reserved, - void *userdata) -{ - (void)reserved; - printf("Received resolver_state=%p userdata=%p\\n", - resolver_state, userdata); - return 0; -} - -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 -Added in 7.59.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PREREQFUNCTION (3), -.BR CURLOPT_RESOLVER_START_FUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.md b/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.md new file mode 100644 index 000000000..f34cf8bd6 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RESOLVER_START_DATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PREREQFUNCTION (3) + - CURLOPT_RESOLVER_START_FUNCTION (3) +--- + +# NAME + +CURLOPT_RESOLVER_START_DATA - pointer passed to the resolver start callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVER_START_DATA, + void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* is be untouched by libcurl and passed as the third +argument in the resolver start callback set with +CURLOPT_RESOLVER_START_FUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +static int resolver_start_cb(void *resolver_state, void *reserved, + void *userdata) +{ + (void)reserved; + printf("Received resolver_state=%p userdata=%p\n", + resolver_state, userdata); + return 0; +} + +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.59.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 deleted file mode 100644 index bd2c1189f..000000000 --- a/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RESOLVER_START_FUNCTION 3 "14 Feb 2018" libcurl libcurl -.SH NAME -CURLOPT_RESOLVER_START_FUNCTION \- callback called before a new name resolve is started -.SH SYNOPSIS -.nf -#include - -int resolver_start_cb(void *resolver_state, void *reserved, void *userdata); - -CURLcode curl_easy_setopt(CURL *handle, - CURLOPT_RESOLVER_START_FUNCTION, - resolver_start_cb); -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. - -This callback function gets called by libcurl every time before a new resolve -request is started. - -\fIresolver_state\fP points to a backend-specific resolver state. Currently -only the ares resolver backend has a resolver state. It can be used to set up -any desired option on the ares channel before it's used, for example setting up -socket callback options. - -\fIreserved\fP is reserved. - -\fIuserdata\fP is the user pointer set with the -\fICURLOPT_RESOLVER_START_DATA(3)\fP option. - -The callback must return 0 on success. Returning a non-zero value causes the -resolve to fail. -.SH DEFAULT -NULL (No callback) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -static int start_cb(void *resolver_state, void *reserved, - void *userdata) -{ - (void)reserved; - printf("Received resolver_state=%p userdata=%p\\n", - resolver_state, userdata); - return 0; -} - -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 -Added in 7.59.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PREREQFUNCTION (3), -.BR CURLOPT_RESOLVER_START_DATA (3) diff --git a/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.md b/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.md new file mode 100644 index 000000000..3b5d500cd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RESOLVER_START_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PREREQFUNCTION (3) + - CURLOPT_RESOLVER_START_DATA (3) +--- + +# NAME + +CURLOPT_RESOLVER_START_FUNCTION - callback called before a new name resolve is started + +# SYNOPSIS + +~~~c +#include + +int resolver_start_cb(void *resolver_state, void *reserved, void *userdata); + +CURLcode curl_easy_setopt(CURL *handle, + CURLOPT_RESOLVER_START_FUNCTION, + resolver_start_cb); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. + +This callback function gets called by libcurl every time before a new resolve +request is started. + +*resolver_state* points to a backend-specific resolver state. Currently +only the ares resolver backend has a resolver state. It can be used to set up +any desired option on the ares channel before it's used, for example setting up +socket callback options. + +*reserved* is reserved. + +*userdata* is the user pointer set with the +CURLOPT_RESOLVER_START_DATA(3) option. + +The callback must return 0 on success. Returning a non-zero value causes the +resolve to fail. + +# DEFAULT + +NULL (No callback) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +static int start_cb(void *resolver_state, void *reserved, + void *userdata) +{ + (void)reserved; + printf("Received resolver_state=%p userdata=%p\n", + resolver_state, userdata); + return 0; +} + +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.59.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_RESUME_FROM.3 b/docs/libcurl/opts/CURLOPT_RESUME_FROM.3 deleted file mode 100644 index 30c7fea9e..000000000 --- a/docs/libcurl/opts/CURLOPT_RESUME_FROM.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RESUME_FROM 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RESUME_FROM \- offset to resume transfer from -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from); -.fi -.SH DESCRIPTION -Pass a long as parameter. It contains the offset in number of bytes that you -want the transfer to start from. Set this option to 0 to make the transfer -start from the beginning (effectively disabling resume). For FTP, set this -option to -1 to make the transfer start from the end of the target file -(useful to continue an interrupted upload). - -When doing uploads with FTP, the resume position is where in the local/source -file libcurl should try to resume the upload from and it then appends the -source file to the remote target file. - -If you need to resume a transfer beyond the 2GB limit, use -\fICURLOPT_RESUME_FROM_LARGE(3)\fP instead. -.SH DEFAULT -0, not used -.SH PROTOCOLS -HTTP, FTP, SFTP, FILE -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - long size_of_file; - - curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com"); - - /* resume upload at byte index 200 */ - curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L); - - /* ask for upload */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - /* 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 -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_RESUME_FROM_LARGE (3), -.BR CURLOPT_RANGE (3), -.BR CURLOPT_INFILESIZE (3) diff --git a/docs/libcurl/opts/CURLOPT_RESUME_FROM.md b/docs/libcurl/opts/CURLOPT_RESUME_FROM.md new file mode 100644 index 000000000..c8de1ee6b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RESUME_FROM.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RESUME_FROM +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INFILESIZE (3) + - CURLOPT_RANGE (3) + - CURLOPT_RESUME_FROM_LARGE (3) +--- + +# NAME + +CURLOPT_RESUME_FROM - offset to resume transfer from + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from); +~~~ + +# DESCRIPTION + +Pass a long as parameter. It contains the offset in number of bytes that you +want the transfer to start from. Set this option to 0 to make the transfer +start from the beginning (effectively disabling resume). For FTP, set this +option to -1 to make the transfer start from the end of the target file +(useful to continue an interrupted upload). + +When doing uploads with FTP, the resume position is where in the local/source +file libcurl should try to resume the upload from and it then appends the +source file to the remote target file. + +If you need to resume a transfer beyond the 2GB limit, use +CURLOPT_RESUME_FROM_LARGE(3) instead. + +# DEFAULT + +0, not used + +# PROTOCOLS + +HTTP, FTP, SFTP, FILE + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + long size_of_file; + + curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com"); + + /* resume upload at byte index 200 */ + curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L); + + /* ask for upload */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* set total data amount to expect */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3 b/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3 deleted file mode 100644 index e5d91bb89..000000000 --- a/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RESUME_FROM_LARGE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RESUME_FROM_LARGE \- offset to resume transfer from -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM_LARGE, - curl_off_t from); -.SH DESCRIPTION -Pass a curl_off_t as parameter. It contains the offset in number of bytes that -you want the transfer to start from. Set this option to 0 to make the transfer -start from the beginning (effectively disabling resume). For FTP, set this -option to -1 to make the transfer start from the end of the target file -(useful to continue an interrupted upload). - -When doing uploads with FTP, the resume position is where in the local/source -file libcurl should try to resume the upload from and it appends the source -file to the remote target file. -.SH DEFAULT -0, not used -.SH PROTOCOLS -HTTP, FTP, SFTP, FILE -.SH EXAMPLE -.nf -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"); - - /* 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); - - /* set total data amount to expect */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_size); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.11.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_INFILESIZE_LARGE (3), -.BR CURLOPT_RANGE (3), -.BR CURLOPT_RESUME_FROM (3) diff --git a/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.md b/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.md new file mode 100644 index 000000000..950a4f496 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RESUME_FROM_LARGE.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RESUME_FROM_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INFILESIZE_LARGE (3) + - CURLOPT_RANGE (3) + - CURLOPT_RESUME_FROM (3) +--- + +# NAME + +CURLOPT_RESUME_FROM_LARGE - offset to resume transfer from + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM_LARGE, + curl_off_t from); +~~~ + +# DESCRIPTION + +Pass a curl_off_t as parameter. It contains the offset in number of bytes that +you want the transfer to start from. Set this option to 0 to make the transfer +start from the beginning (effectively disabling resume). For FTP, set this +option to -1 to make the transfer start from the end of the target file +(useful to continue an interrupted upload). + +When doing uploads with FTP, the resume position is where in the local/source +file libcurl should try to resume the upload from and it appends the source +file to the remote target file. + +# DEFAULT + +0, not used + +# PROTOCOLS + +HTTP, FTP, SFTP, FILE + +# EXAMPLE + +~~~c +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"); + + /* 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); + + /* set total data amount to expect */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_size); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.11.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3 b/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3 deleted file mode 100644 index 4faf8020a..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_CLIENT_CSEQ 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_CLIENT_CSEQ \- RTSP client CSEQ number -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_CLIENT_CSEQ, long cseq); -.fi -.SH DESCRIPTION -Pass a long to set the CSEQ number to issue for the next RTSP request. Useful -if the application is resuming a previously broken connection. The CSEQ -increments from this new number henceforth. -.SH DEFAULT -0 -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_RTSP_CLIENT_CSEQ (3), -.BR CURLINFO_RTSP_SERVER_CSEQ (3), -.BR CURLOPT_RTSP_REQUEST (3), -.BR CURLOPT_RTSP_SERVER_CSEQ (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.md b/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.md new file mode 100644 index 000000000..6c83663dc --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_CLIENT_CSEQ +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_CLIENT_CSEQ (3) + - CURLINFO_RTSP_SERVER_CSEQ (3) + - CURLOPT_RTSP_REQUEST (3) + - CURLOPT_RTSP_SERVER_CSEQ (3) +--- + +# NAME + +CURLOPT_RTSP_CLIENT_CSEQ - RTSP client CSEQ number + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_CLIENT_CSEQ, long cseq); +~~~ + +# DESCRIPTION + +Pass a long to set the CSEQ number to issue for the next RTSP request. Useful +if the application is resuming a previously broken connection. The CSEQ +increments from this new number henceforth. + +# DEFAULT + +0 + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3 b/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3 deleted file mode 100644 index d62cf1d18..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3 +++ /dev/null @@ -1,122 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_REQUEST 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_REQUEST \- RTSP request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_REQUEST, long request); -.fi -.SH DESCRIPTION -Tell libcurl what kind of RTSP request to make. Pass one of the following RTSP -enum values as a long in the \fIrequest\fP argument. Unless noted otherwise, -commands require the Session ID to be initialized. -.IP CURL_RTSPREQ_OPTIONS -Used to retrieve the available methods of the server. The application is -responsible for parsing and obeying the response. The session ID is not needed -for this method. -.IP CURL_RTSPREQ_DESCRIBE -Used to get the low level description of a stream. The application should note -what formats it understands in the \fI'Accept:'\fP header. Unless set -manually, libcurl automatically adds in \fI'Accept: application/sdp'\fP. -Time-condition headers are added to Describe requests if the -\fICURLOPT_TIMECONDITION(3)\fP option is used. \fB(The session ID is not -needed for this method)\fP -.IP CURL_RTSPREQ_ANNOUNCE -When sent by a client, this method changes the description of the session. For -example, if a client is using the server to record a meeting, the client can -use Announce to inform the server of all the meta-information about the -session. ANNOUNCE acts like an HTTP PUT or POST just like -\fICURL_RTSPREQ_SET_PARAMETER\fP -.IP CURL_RTSPREQ_SETUP -Setup is used to initialize the transport layer for the session. The -application must set the desired Transport options for a session by using the -\fICURLOPT_RTSP_TRANSPORT(3)\fP option prior to calling setup. If no session -ID is currently set with \fICURLOPT_RTSP_SESSION_ID(3)\fP, libcurl extracts -and uses the session ID in the response to this request. The session ID is not -needed for this method. -.IP CURL_RTSPREQ_PLAY -Send a Play command to the server. Use the \fICURLOPT_RANGE(3)\fP option to -modify the playback time (e.g. \fInpt=10-15\fP). -.IP CURL_RTSPREQ_PAUSE -Send a Pause command to the server. Use the \fICURLOPT_RANGE(3)\fP option with -a single value to indicate when the stream should be -halted. (e.g. \fInpt=25\fP) -.IP CURL_RTSPREQ_TEARDOWN -This command terminates an RTSP session. Simply closing a connection does not -terminate the RTSP session since it is valid to control an RTSP session over -different connections. -.IP CURL_RTSPREQ_GET_PARAMETER -Retrieve a parameter from the server. By default, libcurl adds a -\fIContent-Type: text/parameters\fP header on all non-empty requests unless a -custom one is set. GET_PARAMETER acts just like an HTTP PUT or POST (see -\fICURL_RTSPREQ_SET_PARAMETER\fP). Applications wishing to send a heartbeat -message (e.g. in the presence of a server-specified timeout) should send use -an empty GET_PARAMETER request. -.IP CURL_RTSPREQ_SET_PARAMETER -Set a parameter on the server. By default, libcurl uses a -\fIContent-Type: text/parameters\fP header unless a custom one is set. -The interaction with SET_PARAMETER is much like an HTTP PUT or POST. An -application may either use \fICURLOPT_UPLOAD(3)\fP with -\fICURLOPT_READDATA(3)\fP like a HTTP PUT, or it may use -\fICURLOPT_POSTFIELDS(3)\fP like an HTTP POST. No chunked transfers are -allowed, so the application must set the \fICURLOPT_INFILESIZE(3)\fP in the -former and \fICURLOPT_POSTFIELDSIZE(3)\fP in the latter. Also, there is no use -of multi-part POSTs within RTSP. -.IP CURL_RTSPREQ_RECORD -Used to tell the server to record a session. Use the \fICURLOPT_RANGE(3)\fP -option to modify the record time. -.IP CURL_RTSPREQ_RECEIVE -This is a special request because it does not send any data to the server. The -application may call this function in order to receive interleaved RTP -data. It returns after processing one read buffer of data in order to give the -application a chance to run. -.SH DEFAULT -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_RTSP_SESSION_ID (3), -.BR CURLOPT_RTSP_STREAM_URI (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.md b/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.md new file mode 100644 index 000000000..925a31782 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.md @@ -0,0 +1,140 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_REQUEST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_RTSP_SESSION_ID (3) + - CURLOPT_RTSP_STREAM_URI (3) +--- + +# NAME + +CURLOPT_RTSP_REQUEST - RTSP request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_REQUEST, long request); +~~~ + +# DESCRIPTION + +Tell libcurl what kind of RTSP request to make. Pass one of the following RTSP +enum values as a long in the *request* argument. Unless noted otherwise, +commands require the Session ID to be initialized. + +## CURL_RTSPREQ_OPTIONS + +Used to retrieve the available methods of the server. The application is +responsible for parsing and obeying the response. The session ID is not needed +for this method. + +## CURL_RTSPREQ_DESCRIBE + +Used to get the low level description of a stream. The application should note +what formats it understands in the *'Accept:'* header. Unless set manually, +libcurl automatically adds in *'Accept: application/sdp'*. Time-condition +headers are added to Describe requests if the CURLOPT_TIMECONDITION(3) +option is used. (The session ID is not needed for this method) + +## CURL_RTSPREQ_ANNOUNCE + +When sent by a client, this method changes the description of the session. For +example, if a client is using the server to record a meeting, the client can +use Announce to inform the server of all the meta-information about the +session. ANNOUNCE acts like an HTTP PUT or POST just like +*CURL_RTSPREQ_SET_PARAMETER* + +## CURL_RTSPREQ_SETUP + +Setup is used to initialize the transport layer for the session. The +application must set the desired Transport options for a session by using the +CURLOPT_RTSP_TRANSPORT(3) option prior to calling setup. If no session +ID is currently set with CURLOPT_RTSP_SESSION_ID(3), libcurl extracts +and uses the session ID in the response to this request. The session ID is not +needed for this method. + +## CURL_RTSPREQ_PLAY + +Send a Play command to the server. Use the CURLOPT_RANGE(3) option to +modify the playback time (e.g. *npt=10-15*). + +## CURL_RTSPREQ_PAUSE + +Send a Pause command to the server. Use the CURLOPT_RANGE(3) option with +a single value to indicate when the stream should be +halted. (e.g. *npt=25*) + +## CURL_RTSPREQ_TEARDOWN + +This command terminates an RTSP session. Simply closing a connection does not +terminate the RTSP session since it is valid to control an RTSP session over +different connections. + +## CURL_RTSPREQ_GET_PARAMETER + +Retrieve a parameter from the server. By default, libcurl adds a +*Content-Type: text/parameters* header on all non-empty requests unless a +custom one is set. GET_PARAMETER acts just like an HTTP PUT or POST (see +*CURL_RTSPREQ_SET_PARAMETER*). Applications wishing to send a heartbeat +message (e.g. in the presence of a server-specified timeout) should send use +an empty GET_PARAMETER request. + +## CURL_RTSPREQ_SET_PARAMETER + +Set a parameter on the server. By default, libcurl uses a +*Content-Type: text/parameters* header unless a custom one is set. +The interaction with SET_PARAMETER is much like an HTTP PUT or POST. An +application may either use CURLOPT_UPLOAD(3) with +CURLOPT_READDATA(3) like a HTTP PUT, or it may use +CURLOPT_POSTFIELDS(3) like an HTTP POST. No chunked transfers are +allowed, so the application must set the CURLOPT_INFILESIZE(3) in the +former and CURLOPT_POSTFIELDSIZE(3) in the latter. Also, there is no use +of multi-part POSTs within RTSP. + +## CURL_RTSPREQ_RECORD + +Used to tell the server to record a session. Use the CURLOPT_RANGE(3) +option to modify the record time. + +## CURL_RTSPREQ_RECEIVE + +This is a special request because it does not send any data to the server. The +application may call this function in order to receive interleaved RTP +data. It returns after processing one read buffer of data in order to give the +application a chance to run. + +# DEFAULT + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3 b/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3 deleted file mode 100644 index 5c75bd149..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_SERVER_CSEQ 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_SERVER_CSEQ \- RTSP server CSEQ number -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_SERVER_CSEQ, long cseq); -.fi -.SH DESCRIPTION -Pass a long to set the CSEQ number to expect for the next RTSP Server->Client -request. \fBNOTE\fP: this feature (listening for Server requests) is -unimplemented. -.SH DEFAULT -0 -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLINFO_RTSP_SERVER_CSEQ (3), -.BR CURLOPT_RTSP_CLIENT_CSEQ (3), -.BR CURLOPT_RTSP_STREAM_URI (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.md b/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.md new file mode 100644 index 000000000..521084388 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_SERVER_CSEQ +Section: 3 +Source: libcurl +See-also: + - CURLINFO_RTSP_SERVER_CSEQ (3) + - CURLOPT_RTSP_CLIENT_CSEQ (3) + - CURLOPT_RTSP_STREAM_URI (3) +--- + +# NAME + +CURLOPT_RTSP_SERVER_CSEQ - RTSP server CSEQ number + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_SERVER_CSEQ, long cseq); +~~~ + +# DESCRIPTION + +Pass a long to set the CSEQ number to expect for the next RTSP Server->Client +request. **NOTE**: this feature (listening for Server requests) is +unimplemented. + +# DEFAULT + +0 + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.3 b/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.3 deleted file mode 100644 index acb8e3611..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_SESSION_ID 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_SESSION_ID \- RTSP session ID -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_SESSION_ID, char *id); -.fi -.SH DESCRIPTION -Pass a char * as a parameter to set the value of the current RTSP Session ID -for the handle. Useful for resuming an in-progress session. Once this value is -set to any non-NULL value, libcurl returns \fICURLE_RTSP_SESSION_ERROR\fP if -ID received from the server does not match. If unset (or set to NULL), libcurl -automatically sets the ID the first time the server sets it in a response. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_RTSP_REQUEST (3), -.BR CURLOPT_RTSP_STREAM_URI (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.md b/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.md new file mode 100644 index 000000000..8af7f7c59 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_SESSION_ID.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_SESSION_ID +Section: 3 +Source: libcurl +See-also: + - CURLOPT_RTSP_REQUEST (3) + - CURLOPT_RTSP_STREAM_URI (3) +--- + +# NAME + +CURLOPT_RTSP_SESSION_ID - RTSP session ID + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_SESSION_ID, char *id); +~~~ + +# DESCRIPTION + +Pass a char pointer as a parameter to set the value of the current RTSP +Session ID for the handle. Useful for resuming an in-progress session. Once +this value is set to any non-NULL value, libcurl returns +*CURLE_RTSP_SESSION_ERROR* if ID received from the server does not match. If +unset (or set to NULL), libcurl automatically sets the ID the first time the +server sets it in a response. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.3 b/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.3 deleted file mode 100644 index d2c7a49da..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_STREAM_URI 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_STREAM_URI \- RTSP stream URI -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_STREAM_URI, char *URI); -.fi -.SH DESCRIPTION -Set the stream \fIURI\fP to operate on by passing a char * . For example, a -single session may be controlling \fIrtsp://foo/twister/audio\fP and -\fIrtsp://foo/twister/video\fP and the application can switch to the -appropriate stream using this option. If unset, libcurl defaults to operating -on generic server options by passing '*' in the place of the RTSP Stream -URI. This option is distinct from \fICURLOPT_URL(3)\fP. When working with -RTSP, the \fICURLOPT_RTSP_STREAM_URI(3)\fP indicates what URL to send to the -server in the request header while the \fICURLOPT_URL(3)\fP indicates where to -make the connection to. (e.g. the \fICURLOPT_URL(3)\fP for the above examples -might be set to \fIrtsp://foo/twister\fP - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -\&'*' -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_RTSP_REQUEST (3), -.BR CURLOPT_RTSP_TRANSPORT (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.md b/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.md new file mode 100644 index 000000000..c1d50ad13 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_STREAM_URI.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_STREAM_URI +Section: 3 +Source: libcurl +See-also: + - CURLOPT_RTSP_REQUEST (3) + - CURLOPT_RTSP_TRANSPORT (3) +--- + +# NAME + +CURLOPT_RTSP_STREAM_URI - RTSP stream URI + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_STREAM_URI, char *URI); +~~~ + +# DESCRIPTION + +Set the stream *URI* to operate on by passing a char * . For example, a single +session may be controlling *rtsp://foo/twister/audio* and +*rtsp://foo/twister/video* and the application can switch to the appropriate +stream using this option. If unset, libcurl defaults to operating on generic +server options by passing '*' in the place of the RTSP Stream URI. This option +is distinct from CURLOPT_URL(3). When working with RTSP, the +CURLOPT_RTSP_STREAM_URI(3) indicates what URL to send to the server in the +request header while the CURLOPT_URL(3) indicates where to make the +connection to. (e.g. the CURLOPT_URL(3) for the above examples might be set +to *rtsp://foo/twister* + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +&'*' + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.3 b/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.3 deleted file mode 100644 index 9017f9154..000000000 --- a/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_RTSP_TRANSPORT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_RTSP_TRANSPORT \- RTSP Transport: header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_TRANSPORT, - char *transport); -.SH DESCRIPTION -Pass a char * to tell libcurl what to pass for the Transport: header for this -RTSP session. This is mainly a convenience method to avoid needing to set a -custom Transport: header for every SETUP request. The application must set a -Transport: header before issuing a SETUP request. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -RTSP -.SH EXAMPLE -.nf -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 -Added in 7.20.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_RTSP_REQUEST (3), -.BR CURLOPT_RTSP_SESSION_ID (3) diff --git a/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.md b/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.md new file mode 100644 index 000000000..b8083967d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_RTSP_TRANSPORT.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_RTSP_TRANSPORT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_RTSP_REQUEST (3) + - CURLOPT_RTSP_SESSION_ID (3) +--- + +# NAME + +CURLOPT_RTSP_TRANSPORT - RTSP Transport: header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_TRANSPORT, + char *transport); +~~~ + +# DESCRIPTION + +Pass a char pointer to tell libcurl what to pass for the Transport: header for +this RTSP session. This is mainly a convenience method to avoid needing to set +a custom Transport: header for every SETUP request. The application must set a +Transport: header before issuing a SETUP request. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +RTSP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.20.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 b/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 deleted file mode 100644 index c06a665e2..000000000 --- a/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SASL_AUTHZID 3 "11 Sep 2019" libcurl libcurl -.SH NAME -CURLOPT_SASL_AUTHZID \- authorization identity (identity to act as) -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_AUTHZID, char *authzid); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -authorization identity (\fIauthzid\fP) for the transfer. Only applicable to -the PLAIN SASL authentication mechanism where it is optional. - -When not specified only the authentication identity (\fIauthcid\fP) as -specified by the username is sent to the server, along with the password. The -server derives a \fIauthzid\fP from the \fIauthcid\fP when not provided, which -it then uses internally. - -When the \fIauthzid\fP is specified, the use of which is server dependent, it -can be used to access another user's inbox, that the user has been granted -access to, or a shared mailbox for example. -.SH DEFAULT -blank -.SH PROTOCOLS -IMAP, LDAP, POP3 and SMTP -.SH EXAMPLE -.nf -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 -Added in 7.66.0. Support for OpenLDAP added in 7.82.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_USERNAME (3), -.BR CURLOPT_USERPWD (3) diff --git a/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.md b/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.md new file mode 100644 index 000000000..5ff67c6ab --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SASL_AUTHZID +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PASSWORD (3) + - CURLOPT_USERNAME (3) + - CURLOPT_USERPWD (3) +--- + +# NAME + +CURLOPT_SASL_AUTHZID - authorization identity (identity to act as) + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_AUTHZID, char *authzid); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the +null-terminated authorization identity (*authzid*) for the transfer. Only +applicable to the PLAIN SASL authentication mechanism where it is optional. + +When not specified only the authentication identity (*authcid*) as +specified by the username is sent to the server, along with the password. The +server derives a *authzid* from the *authcid* when not provided, which +it then uses internally. + +When the *authzid* is specified, the use of which is server dependent, it +can be used to access another user's inbox, that the user has been granted +access to, or a shared mailbox for example. + +# DEFAULT + +blank + +# PROTOCOLS + +IMAP, LDAP, POP3 and SMTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.66.0. Support for OpenLDAP added in 7.82.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SASL_IR.3 b/docs/libcurl/opts/CURLOPT_SASL_IR.3 deleted file mode 100644 index 50ec074a0..000000000 --- a/docs/libcurl/opts/CURLOPT_SASL_IR.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SASL_IR 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SASL_IR \- send initial response in first packet -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_IR, long enable); -.fi -.SH DESCRIPTION -Pass a long. If the value is 1, curl sends the initial response to the server -in the first authentication packet in order to reduce the number of ping pong -requests. Only applicable to the following supporting SASL authentication -mechanisms: - -* Login -* Plain -* GSSAPI -* NTLM -* OAuth 2.0 - -Note: Whilst IMAP supports this option there is no need to explicitly set it, -as libcurl can determine the feature itself when the server supports the -SASL-IR CAPABILITY. -.SH DEFAULT -0 -.SH PROTOCOLS -IMAP, POP3 and SMTP -.SH EXAMPLE -.nf -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 -Added in 7.31.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_AUTH (3), -.BR CURLOPT_MAIL_FROM (3), -.BR CURLOPT_SASL_AUTHZID (3) diff --git a/docs/libcurl/opts/CURLOPT_SASL_IR.md b/docs/libcurl/opts/CURLOPT_SASL_IR.md new file mode 100644 index 000000000..204734d01 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SASL_IR.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SASL_IR +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_AUTH (3) + - CURLOPT_MAIL_FROM (3) + - CURLOPT_SASL_AUTHZID (3) +--- + +# NAME + +CURLOPT_SASL_IR - send initial response in first packet + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_IR, long enable); +~~~ + +# DESCRIPTION + +Pass a long. If the value is 1, curl sends the initial response to the server +in the first authentication packet in order to reduce the number of ping pong +requests. Only applicable to the following supporting SASL authentication +mechanisms: + +* Login +* Plain +* GSSAPI +* NTLM +* OAuth 2.0 + +Note: Whilst IMAP supports this option there is no need to explicitly set it, +as libcurl can determine the feature itself when the server supports the +SASL-IR CAPABILITY. + +# DEFAULT + +0 + +# PROTOCOLS + +IMAP, POP3 and SMTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.31.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SEEKDATA.3 b/docs/libcurl/opts/CURLOPT_SEEKDATA.3 deleted file mode 100644 index eed02af19..000000000 --- a/docs/libcurl/opts/CURLOPT_SEEKDATA.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SEEKDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SEEKDATA \- pointer passed to the seek callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer); -.fi -.SH DESCRIPTION -Data \fIpointer\fP to pass to the seek callback function. If you use the -\fICURLOPT_SEEKFUNCTION(3)\fP option, this is the pointer you get as input. -.SH DEFAULT -If you do not set this, NULL is passed to the callback. -.SH PROTOCOLS -HTTP, FTP, SFTP -.SH EXAMPLE -.nf -#include /* 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(d->our_fd, offset, origin); - return CURL_SEEKFUNC_OK; -} - -int main(void) -{ - struct data 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 -Added in 7.18.0 -.SH RETURN VALUE -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_IOCTLFUNCTION (3), -.BR CURLOPT_SEEKFUNCTION (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_SEEKDATA.md b/docs/libcurl/opts/CURLOPT_SEEKDATA.md new file mode 100644 index 000000000..9392c2366 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SEEKDATA.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SEEKDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_IOCTLFUNCTION (3) + - CURLOPT_SEEKFUNCTION (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_SEEKDATA - pointer passed to the seek callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer); +~~~ + +# DESCRIPTION + +Data *pointer* to pass to the seek callback function. If you use the +CURLOPT_SEEKFUNCTION(3) option, this is the pointer you get as input. + +# DEFAULT + +If you do not set this, NULL is passed to the callback. + +# PROTOCOLS + +HTTP, FTP, SFTP + +# EXAMPLE + +~~~c +#include /* 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(d->our_fd, offset, origin); + return CURL_SEEKFUNC_OK; +} + +int main(void) +{ + struct data 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.18.0 + +# RETURN VALUE + diff --git a/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 b/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_SEEKFUNCTION.md index 649eb2ae2..102bdcfc7 100644 --- a/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.md @@ -1,32 +1,23 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SEEKFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SEEKFUNCTION \- user callback for seeking in input stream -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SEEKFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_IOCTLFUNCTION (3) + - CURLOPT_SEEKDATA (3) + - CURLOPT_STDERR (3) +--- + +# NAME + +CURLOPT_SEEKFUNCTION - user callback for seeking in input stream + +# SYNOPSIS + +~~~c #include /* These are the return codes for the seek callbacks */ @@ -38,7 +29,10 @@ CURLOPT_SEEKFUNCTION \- user callback for seeking in input stream int seek_callback(void *clientp, curl_off_t offset, int origin); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. @@ -50,26 +44,32 @@ been sent to the server and needs to be sent again. This may happen when doing an HTTP PUT or POST with a multi-pass authentication method, or when an existing HTTP connection is reused too late and the server closes the connection. The function shall work like fseek(3) or lseek(3) and it gets -SEEK_SET, SEEK_CUR or SEEK_END as argument for \fIorigin\fP, although libcurl +SEEK_SET, SEEK_CUR or SEEK_END as argument for *origin*, although libcurl currently only passes SEEK_SET. -\fIclientp\fP is the pointer you set with \fICURLOPT_SEEKDATA(3)\fP. +*clientp* is the pointer you set with CURLOPT_SEEKDATA(3). -The callback function must return \fICURL_SEEKFUNC_OK\fP on success, -\fICURL_SEEKFUNC_FAIL\fP to cause the upload operation to fail or -\fICURL_SEEKFUNC_CANTSEEK\fP to indicate that while the seek failed, libcurl +The callback function must return *CURL_SEEKFUNC_OK* on success, +*CURL_SEEKFUNC_FAIL* to cause the upload operation to fail or +*CURL_SEEKFUNC_CANTSEEK* to indicate that while the seek failed, libcurl is free to work around the problem if possible. The latter can sometimes be done by instead reading from the input or similar. If you forward the input arguments directly to fseek(3) or lseek(3), note that -the data type for \fIoffset\fP is not the same as defined for curl_off_t on +the data type for *offset* is not the same as defined for curl_off_t on many systems! -.SH DEFAULT + +# DEFAULT + By default, this is NULL and unused. -.SH PROTOCOLS + +# PROTOCOLS + HTTP, FTP, SFTP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include /* for lseek */ struct data { @@ -91,13 +91,12 @@ int main(void) curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.18.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_IOCTLFUNCTION (3), -.BR CURLOPT_SEEKDATA (3), -.BR CURLOPT_STDERR (3) diff --git a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.3 b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.3 deleted file mode 100644 index 72b2a6264..000000000 --- a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SERVER_RESPONSE_TIMEOUT 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SERVER_RESPONSE_TIMEOUT \- time allowed to wait for server response -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT, - long timeout); -.fi -.SH DESCRIPTION -Pass a long. Causes libcurl to set a \fItimeout\fP period (in seconds) on the -amount of time that the server is allowed to take in order to send a response -message for a command before the session is considered dead. While libcurl is -waiting for a response, this value overrides \fICURLOPT_TIMEOUT(3)\fP. It is -recommended that if used in conjunction with \fICURLOPT_TIMEOUT(3)\fP, you set -\fICURLOPT_SERVER_RESPONSE_TIMEOUT(3)\fP to a value smaller than -\fICURLOPT_TIMEOUT(3)\fP. - -This option was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT. -.SH DEFAULT -None -.SH PROTOCOLS -FTP, IMAP, POP3, SMTP, and SSH -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Added in 7.10.8. Used under this name since 7.20.0 - -Support for SSH is predicated on a new enough (1.11.0) version of libssh2 -being available when compiling libcurl. -.SH RETURN VALUE -Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns -CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when -converted to milliseconds is too large. -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.md b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.md new file mode 100644 index 000000000..5385d521e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SERVER_RESPONSE_TIMEOUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_SERVER_RESPONSE_TIMEOUT - time allowed to wait for server response + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT, + long timeout); +~~~ + +# DESCRIPTION + +Pass a long. Causes libcurl to set a *timeout* period (in seconds) on the +amount of time that the server is allowed to take in order to send a response +message for a command before the session is considered dead. While libcurl is +waiting for a response, this value overrides CURLOPT_TIMEOUT(3). It is +recommended that if used in conjunction with CURLOPT_TIMEOUT(3), you set +CURLOPT_SERVER_RESPONSE_TIMEOUT(3) to a value smaller than +CURLOPT_TIMEOUT(3). + +This option was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT. + +# DEFAULT + +None + +# PROTOCOLS + +FTP, IMAP, POP3, SMTP, and SSH + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.10.8. Used under this name since 7.20.0 + +Support for SSH is predicated on a new enough (1.11.0) version of libssh2 +being available when compiling libcurl. + +# RETURN VALUE + +Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns +CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when +converted to milliseconds is too large. diff --git a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.3 deleted file mode 100644 index 08239b749..000000000 --- a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SERVER_RESPONSE_TIMEOUT_MS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SERVER_RESPONSE_TIMEOUT_MS \- time allowed to wait for server response -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, - long timeout); -.fi -.SH DESCRIPTION -Pass a long. Causes libcurl to set a \fItimeout\fP period (in milliseconds) -on the amount of time that the server is allowed to take in order to send a -response message for a command before the session is considered dead. While -libcurl is waiting for a response, this value overrides -\fICURLOPT_TIMEOUT(3)\fP. It is recommended that if used in conjunction with -\fICURLOPT_TIMEOUT(3)\fP, you set \fICURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3)\fP -to a value smaller than \fICURLOPT_TIMEOUT(3)\fP. - -The maximum accepted value is 2147483648. - -This is the millisecond version of \fICURLOPT_SERVER_RESPONSE_TIMEOUT(3)\fP. -.SH DEFAULT -None -.SH PROTOCOLS -FTP, IMAP, POP3, SMTP, and SSH -.SH EXAMPLE -.nf -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 237 milliseconds */ - curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, 237L); - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 8.6.0. -.SH RETURN VALUE -Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns -CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when -converted to milliseconds is too large. -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.md new file mode 100644 index 000000000..a7d9c9137 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.md @@ -0,0 +1,74 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SERVER_RESPONSE_TIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_SERVER_RESPONSE_TIMEOUT_MS - time allowed to wait for server response + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, + long timeout); +~~~ + +# DESCRIPTION + +Pass a long. Causes libcurl to set a *timeout* period (in milliseconds) on the +amount of time that the server is allowed to take in order to send a response +message for a command before the session is considered dead. While libcurl is +waiting for a response, this value overrides CURLOPT_TIMEOUT(3). It is +recommended that if used in conjunction with CURLOPT_TIMEOUT(3), you set +CURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3) to a value smaller than +CURLOPT_TIMEOUT(3). + +The maximum accepted value is 2147483648. + +This is the millisecond version of CURLOPT_SERVER_RESPONSE_TIMEOUT(3). + +# DEFAULT + +None + +# PROTOCOLS + +FTP, IMAP, POP3, SMTP, and SSH + +# EXAMPLE + +~~~c +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 237 milliseconds */ + curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, 237L); + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 8.6.0. + +# RETURN VALUE + +Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns +CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when +converted to milliseconds is too large. diff --git a/docs/libcurl/opts/CURLOPT_SERVICE_NAME.3 b/docs/libcurl/opts/CURLOPT_SERVICE_NAME.3 deleted file mode 100644 index 02d18494d..000000000 --- a/docs/libcurl/opts/CURLOPT_SERVICE_NAME.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SERVICE_NAME 3 "17 Jun 2015" libcurl libcurl -.SH NAME -CURLOPT_SERVICE_NAME \- authentication service name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVICE_NAME, char *name); -.fi -.SH DESCRIPTION -Pass a char * as parameter to a string holding the \fIname\fP of the service -for DIGEST-MD5, SPNEGO and Kerberos 5 authentication mechanisms. The default -service names are "ftp", "HTTP", "imap", "ldap", "pop" and "smtp". This option -allows you to change them. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -See above -.SH PROTOCOLS -HTTP, FTP, IMAP, LDAP, POP3 and SMTP -.SH EXAMPLE -.nf -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 -Added in 7.43.0 for HTTP, 7.49.0 for FTP, IMAP, POP3 and SMTP, -7.82.0 for OpenLDAP. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXY_SERVICE_NAME (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_SERVICE_NAME.md b/docs/libcurl/opts/CURLOPT_SERVICE_NAME.md new file mode 100644 index 000000000..0e13ca712 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SERVICE_NAME.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SERVICE_NAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYTYPE (3) + - CURLOPT_PROXY_SERVICE_NAME (3) +--- + +# NAME + +CURLOPT_SERVICE_NAME - authentication service name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVICE_NAME, char *name); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter to a string holding the *name* of the service +for DIGEST-MD5, SPNEGO and Kerberos 5 authentication mechanisms. The default +service names are "ftp", "HTTP", "imap", "ldap", "pop" and "smtp". This option +allows you to change them. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +See above + +# PROTOCOLS + +HTTP, FTP, IMAP, LDAP, POP3 and SMTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.43.0 for HTTP, 7.49.0 for FTP, IMAP, POP3 and SMTP, +7.82.0 for OpenLDAP. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SHARE.3 b/docs/libcurl/opts/CURLOPT_SHARE.3 deleted file mode 100644 index 22a662ac6..000000000 --- a/docs/libcurl/opts/CURLOPT_SHARE.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SHARE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SHARE \- share handle to use -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SHARE, CURLSH *share); -.fi -.SH DESCRIPTION -Pass a \fIshare\fP handle as a parameter. The share handle must have been -created by a previous call to \fIcurl_share_init(3)\fP. Setting this option, -makes this curl handle use the data from the shared handle instead of keeping -the data to itself. This enables several curl handles to share data. If the -curl handles are used simultaneously in multiple threads, you \fBMUST\fP use -the locking methods in the share handle. See \fIcurl_share_setopt(3)\fP for -details. - -If you add a share that is set to share cookies, your easy handle uses that -cookie cache and get the cookie engine enabled. If you stop sharing an object -that was using cookies (or change to another object that does not share -cookies), the easy handle gets its cookie engine disabled. - -Data that the share object is not set to share is dealt with the usual way, as -if no share was used. - -Set this option to NULL again to stop using that share object. -.SH DEFAULT -NULL -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - 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); - res = curl_easy_perform(curl2); - curl_easy_cleanup(curl2); - - curl_share_cleanup(shobject); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_COOKIE (3), -.BR CURLSHOPT_SHARE (3) diff --git a/docs/libcurl/opts/CURLOPT_SHARE.md b/docs/libcurl/opts/CURLOPT_SHARE.md new file mode 100644 index 000000000..3c0e7d259 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SHARE.md @@ -0,0 +1,88 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SHARE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_COOKIE (3) + - CURLSHOPT_SHARE (3) +--- + +# NAME + +CURLOPT_SHARE - share handle to use + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SHARE, CURLSH *share); +~~~ + +# DESCRIPTION + +Pass a *share* handle as a parameter. The share handle must have been +created by a previous call to curl_share_init(3). Setting this option, +makes this curl handle use the data from the shared handle instead of keeping +the data to itself. This enables several curl handles to share data. If the +curl handles are used simultaneously in multiple threads, you **MUST** use +the locking methods in the share handle. See curl_share_setopt(3) for +details. + +If you add a share that is set to share cookies, your easy handle uses that +cookie cache and get the cookie engine enabled. If you stop sharing an object +that was using cookies (or change to another object that does not share +cookies), the easy handle gets its cookie engine disabled. + +Data that the share object is not set to share is dealt with the usual way, as +if no share was used. + +Set this option to NULL again to stop using that share object. + +# DEFAULT + +NULL + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + 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); + res = curl_easy_perform(curl2); + curl_easy_cleanup(curl2); + + curl_share_cleanup(shobject); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3 b/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3 deleted file mode 100644 index f671aa989..000000000 --- a/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SOCKOPTDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SOCKOPTDATA \- pointer to pass to sockopt callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKOPTDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the first -argument in the sockopt callback set with \fICURLOPT_SOCKOPTFUNCTION(3)\fP. -.SH DEFAULT -The default value of this parameter is NULL. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -static int sockopt_callback(void *clientp, curl_socket_t curlfd, - curlsocktype purpose) -{ - int val = *(int *)clientp; - setsockopt((int)curlfd, SOL_SOCKET, SO_RCVBUF, - (const char *)&val, sizeof(val)); - return CURL_SOCKOPT_OK; -} - -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/"); - - /* 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); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.16.0 -.SH RETURN VALUE -Returns \fICURLE_OK\fP if the option is supported, and \fICURLE_UNKNOWN_OPTION\fP if not. -.SH "SEE ALSO" -.BR CURLOPT_OPENSOCKETFUNCTION (3), -.BR CURLOPT_SOCKOPTFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.md b/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.md new file mode 100644 index 000000000..f44bf532d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SOCKOPTDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_OPENSOCKETFUNCTION (3) + - CURLOPT_SOCKOPTFUNCTION (3) +--- + +# NAME + +CURLOPT_SOCKOPTDATA - pointer to pass to sockopt callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKOPTDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the first +argument in the sockopt callback set with CURLOPT_SOCKOPTFUNCTION(3). + +# DEFAULT + +The default value of this parameter is NULL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +static int sockopt_callback(void *clientp, curl_socket_t curlfd, + curlsocktype purpose) +{ + int val = *(int *)clientp; + setsockopt((int)curlfd, SOL_SOCKET, SO_RCVBUF, + (const char *)&val, sizeof(val)); + return CURL_SOCKOPT_OK; +} + +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/"); + + /* 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); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.0 + +# RETURN VALUE + +Returns *CURLE_OK* if the option is supported, and *CURLE_UNKNOWN_OPTION* if not. diff --git a/docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3 b/docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.md similarity index 54% rename from docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.md index 269490f85..f5de31685 100644 --- a/docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_SOCKOPTFUNCTION.md @@ -1,32 +1,22 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SOCKOPTFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SOCKOPTFUNCTION \- callback for setting socket options -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SOCKOPTFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_OPENSOCKETFUNCTION (3) + - CURLOPT_SEEKFUNCTION (3) + - CURLOPT_SOCKOPTDATA (3) +--- + +# NAME + +CURLOPT_SOCKOPTFUNCTION - callback for setting socket options + +# SYNOPSIS + +~~~c #include typedef enum { @@ -45,41 +35,50 @@ int sockopt_callback(void *clientp, curlsocktype purpose); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKOPTFUNCTION, sockopt_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. When set, this callback function gets called by libcurl when the socket has been created, but before the connect call to allow applications to change -specific socket options. The callback's \fIpurpose\fP argument identifies the +specific socket options. The callback's *purpose* argument identifies the exact purpose for this particular socket: -\fICURLSOCKTYPE_IPCXN\fP for actively created connections or since 7.28.0 -\fICURLSOCKTYPE_ACCEPT\fP for FTP when the connection was setup with PORT/EPSV +*CURLSOCKTYPE_IPCXN* for actively created connections or since 7.28.0 +*CURLSOCKTYPE_ACCEPT* for FTP when the connection was setup with PORT/EPSV (in earlier versions these sockets were not passed to this callback). Future versions of libcurl may support more purposes. libcurl passes the newly -created socket descriptor to the callback in the \fIcurlfd\fP parameter so +created socket descriptor to the callback in the *curlfd* parameter so additional setsockopt() calls can be done at the user's discretion. -The \fIclientp\fP pointer contains whatever user-defined value set using the -\fICURLOPT_SOCKOPTDATA(3)\fP function. +The *clientp* pointer contains whatever user-defined value set using the +CURLOPT_SOCKOPTDATA(3) function. -Return \fICURL_SOCKOPT_OK\fP from the callback on success. Return -\fICURL_SOCKOPT_ERROR\fP from the callback function to signal an unrecoverable +Return *CURL_SOCKOPT_OK* from the callback on success. Return +*CURL_SOCKOPT_ERROR* from the callback function to signal an unrecoverable error to the library and it closes the socket and returns -\fICURLE_COULDNT_CONNECT\fP. Alternatively, the callback function can return -\fICURL_SOCKOPT_ALREADY_CONNECTED\fP, to tell libcurl that the socket is +*CURLE_COULDNT_CONNECT*. Alternatively, the callback function can return +*CURL_SOCKOPT_ALREADY_CONNECTED*, to tell libcurl that the socket is already connected and then libcurl does no attempt to connect. This allows an application to pass in an already connected socket with -\fICURLOPT_OPENSOCKETFUNCTION(3)\fP and then have this function make libcurl +CURLOPT_OPENSOCKETFUNCTION(3) and then have this function make libcurl not attempt to connect (again). -.SH DEFAULT + +# DEFAULT + By default, this callback is NULL and unused. -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* make libcurl use the already established socket 'sockfd' */ static curl_socket_t opensocket(void *clientp, @@ -121,13 +120,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY -Added in 7.16.0. The \fICURL_SOCKOPT_ALREADY_CONNECTED\fP return code was +~~~ + +# AVAILABILITY + +Added in 7.16.0. The *CURL_SOCKOPT_ALREADY_CONNECTED* return code was added in 7.21.5. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_OPENSOCKETFUNCTION (3), -.BR CURLOPT_SEEKFUNCTION (3), -.BR CURLOPT_SOCKOPTDATA (3) diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3 b/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3 deleted file mode 100644 index d2276cffc..000000000 --- a/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SOCKS5_AUTH 3 "27 April 2017" libcurl libcurl -.SH NAME -CURLOPT_SOCKS5_AUTH \- methods for SOCKS5 proxy authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_AUTH, long bitmask); -.fi -.SH DESCRIPTION -Pass a long as parameter, which is set to a bitmask, to tell libcurl which -authentication method(s) are allowed for SOCKS5 proxy authentication. The only -supported flags are \fICURLAUTH_BASIC\fP, which allows username/password -authentication, \fICURLAUTH_GSSAPI\fP, which allows GSS-API authentication, and -\fICURLAUTH_NONE\fP, which allows no authentication. Set the actual user name -and password with the \fICURLOPT_PROXYUSERPWD(3)\fP option. -.SH DEFAULT -CURLAUTH_BASIC|CURLAUTH_GSSAPI -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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:pass@myproxy.com"); - - /* enable username/password authentication only */ - curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.55.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_NOT_BUILT_IN if the bitmask contains unsupported flags. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.md b/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.md new file mode 100644 index 000000000..457ef9940 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SOCKS5_AUTH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_SOCKS5_AUTH - methods for SOCKS5 proxy authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_AUTH, long bitmask); +~~~ + +# DESCRIPTION + +Pass a long as parameter, which is set to a bitmask, to tell libcurl which +authentication method(s) are allowed for SOCKS5 proxy authentication. The only +supported flags are *CURLAUTH_BASIC*, which allows username/password +authentication, *CURLAUTH_GSSAPI*, which allows GSS-API authentication, and +*CURLAUTH_NONE*, which allows no authentication. Set the actual user name and +password with the CURLOPT_PROXYUSERPWD(3) option. + +# DEFAULT + +CURLAUTH_BASIC|CURLAUTH_GSSAPI + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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:pass@myproxy.com"); + + /* enable username/password authentication only */ + curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.55.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_NOT_BUILT_IN if the bitmask contains unsupported flags. diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3 b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3 deleted file mode 100644 index 2388a1686..000000000 --- a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SOCKS5_GSSAPI_NEC 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SOCKS5_GSSAPI_NEC \- SOCKS proxy GSSAPI negotiation protection -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_GSSAPI_NEC, long nec); -.fi -.SH DESCRIPTION -Pass a long set to 1 to enable or 0 to disable. As part of the GSSAPI -negotiation a protection mode is negotiated. The RFC 1961 says in section -4.3/4.4 it should be protected, but the NEC reference implementation does not. -If enabled, this option allows the unprotected exchange of the protection mode -negotiation. -.SH DEFAULT -? -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy"); - curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_NEC, 1L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SOCKS5_GSSAPI_SERVICE (3), -.BR CURLOPT_PROXY (3) diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.md b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.md new file mode 100644 index 000000000..08a1ced6a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SOCKS5_GSSAPI_NEC +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_SOCKS5_GSSAPI_SERVICE (3) +--- + +# NAME + +CURLOPT_SOCKS5_GSSAPI_NEC - SOCKS proxy GSSAPI negotiation protection + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_GSSAPI_NEC, long nec); +~~~ + +# DESCRIPTION + +Pass a long set to 1 to enable or 0 to disable. As part of the GSSAPI +negotiation a protection mode is negotiated. The RFC 1961 says in section +4.3/4.4 it should be protected, but the NEC reference implementation does not. +If enabled, this option allows the unprotected exchange of the protection mode +negotiation. + +# DEFAULT + +? + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy"); + curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_NEC, 1L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3 b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3 deleted file mode 100644 index c5b32ec2a..000000000 --- a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SOCKS5_GSSAPI_SERVICE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SOCKS5_GSSAPI_SERVICE \- SOCKS5 proxy authentication service name -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_GSSAPI_SERVICE, - char *name); -.fi -.SH DESCRIPTION -Deprecated since 7.49.0. Use \fICURLOPT_PROXY_SERVICE_NAME(3)\fP instead. - -Pass a \fBchar *\fP as parameter to a string holding the \fIname\fP of the -service. The default service name for a SOCKS5 server is \fI"rcmd"\fP. This -option allows you to change it. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -See above -.SH PROTOCOLS -All network protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy"); - curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE, "rcmd-special"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.4, deprecated in 7.49.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY (3), -.BR CURLOPT_PROXYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.md b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.md new file mode 100644 index 000000000..47f6e28db --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SOCKS5_GSSAPI_SERVICE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY (3) + - CURLOPT_PROXYTYPE (3) +--- + +# NAME + +CURLOPT_SOCKS5_GSSAPI_SERVICE - SOCKS5 proxy authentication service name + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_GSSAPI_SERVICE, + char *name); +~~~ + +# DESCRIPTION + +Deprecated since 7.49.0. Use CURLOPT_PROXY_SERVICE_NAME(3) instead. + +Pass a char pointer as parameter to a string holding the *name* of the +service. The default service name for a SOCKS5 server is *rcmd*. This option +allows you to change it. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +See above + +# PROTOCOLS + +All network protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://proxy"); + curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE, "rcmd-special"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4, deprecated in 7.49.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3 b/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3 deleted file mode 100644 index a6c16c846..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_AUTH_TYPES 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_AUTH_TYPES \- auth types for SFTP and SCP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask); -.fi -.SH DESCRIPTION -Pass a long set to a bitmask consisting of one or more of -CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, -CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT. - -Set \fICURLSSH_AUTH_ANY\fP to let libcurl pick a suitable one. Currently -CURLSSH_AUTH_HOST has no effect. If CURLSSH_AUTH_AGENT is used, libcurl -attempts to connect to ssh-agent or pageant and let the agent attempt the -authentication. -.SH DEFAULT -CURLSSH_AUTH_ANY (all available) -.SH PROTOCOLS -SFTP and SCP -.SH EXAMPLE -.nf -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 -CURLSSH_AUTH_HOST was added in 7.16.1, CURLSSH_AUTH_AGENT was added in 7.28.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3), -.BR CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3), -.BR CURLOPT_SSH_PUBLIC_KEYFILE (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.md b/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.md new file mode 100644 index 000000000..205e94d19 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_AUTH_TYPES.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_AUTH_TYPES +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) + - CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3) + - CURLOPT_SSH_PUBLIC_KEYFILE (3) +--- + +# NAME + +CURLOPT_SSH_AUTH_TYPES - auth types for SFTP and SCP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask); +~~~ + +# DESCRIPTION + +Pass a long set to a bitmask consisting of one or more of +CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, +CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT. + +Set *CURLSSH_AUTH_ANY* to let libcurl pick a suitable one. Currently +CURLSSH_AUTH_HOST has no effect. If CURLSSH_AUTH_AGENT is used, libcurl +attempts to connect to ssh-agent or pageant and let the agent attempt the +authentication. + +# DEFAULT + +CURLSSH_AUTH_ANY (all available) + +# PROTOCOLS + +SFTP and SCP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +CURLSSH_AUTH_HOST was added in 7.16.1, CURLSSH_AUTH_AGENT was added in 7.28.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.3 b/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.3 deleted file mode 100644 index 9a1fab01d..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_COMPRESSION 3 "05 Aug 2017" libcurl libcurl -.SH NAME -CURLOPT_SSH_COMPRESSION \- enable SSH compression -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_COMPRESSION, long enable); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1L to enable or 0L to disable. - -Enables built-in SSH compression. This is a request, not an order; the server -may or may not do it. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -All SSH based protocols: SCP, SFTP -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.56.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_ACCEPT_ENCODING (3), -.BR CURLOPT_TRANSFER_ENCODING (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.md b/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.md new file mode 100644 index 000000000..5e2b2785d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_COMPRESSION.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_COMPRESSION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ACCEPT_ENCODING (3) + - CURLOPT_TRANSFER_ENCODING (3) +--- + +# NAME + +CURLOPT_SSH_COMPRESSION - enable SSH compression + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_COMPRESSION, long enable); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1L to enable or 0L to disable. + +Enables built-in SSH compression. This is a request, not an order; the server +may or may not do it. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +All SSH based protocols: SCP, SFTP + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.56.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.3 b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.3 deleted file mode 100644 index c0a5720c5..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_KEYDATA 3 "4 Nov 2021" libcurl libcurl -.SH NAME -CURLOPT_SSH_HOSTKEYDATA \- pointer to pass to the SSH host key callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOSTKEYDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a void * as parameter. This \fIpointer\fP is passed along untouched to -the callback set with \fICURLOPT_SSH_HOSTKEYFUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -SCP and SFTP -.SH EXAMPLE -.nf -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 *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); - } -} -.fi -.SH AVAILABILITY -Added in 7.84.0, works only with libssh2 backend. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSH_HOSTKEYFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.md b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.md new file mode 100644 index 000000000..39cbd0ddd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYDATA.md @@ -0,0 +1,73 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_KEYDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_HOSTKEYFUNCTION (3) +--- + +# NAME + +CURLOPT_SSH_HOSTKEYDATA - pointer to pass to the SSH host key callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOSTKEYDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a void * as parameter. This *pointer* is passed along untouched to +the callback set with CURLOPT_SSH_HOSTKEYFUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +SCP and SFTP + +# EXAMPLE + +~~~c +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 *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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.84.0, works only with libssh2 backend. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.3 b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.3 deleted file mode 100644 index 132e9e94d..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_HOSTKEYFUNCTION 3 "4 Nov 2021" libcurl libcurl -.SH NAME -CURLOPT_SSH_HOSTKEYFUNCTION \- callback to check host key -.SH SYNOPSIS -.nf -#include - -int keycallback(void *clientp, - int keytype, - const char *key, - size_t keylen); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOSTKEYFUNCTION, - keycallback); -.fi -.SH DESCRIPTION -Pass a pointer to your callback function, which should match the prototype -shown above. It overrides \fICURLOPT_SSH_KNOWNHOSTS(3)\fP. - -This callback gets called when the verification of the SSH host key is needed. - -\fBkey\fP is \fBkeylen\fP bytes long and is the key to check. \fBkeytype\fP -says what type it is, from the \fBCURLKHTYPE_*\fP series in the -\fBcurl_khtype\fP enum. - -\fBclientp\fP is a custom pointer set with \fICURLOPT_SSH_HOSTKEYDATA(3)\fP. - -The callback MUST return one of the following return codes to tell libcurl how -to act: -.IP CURLKHMATCH_OK -The host key is accepted, the connection should continue. -.IP CURLKHMATCH_MISMATCH -the host key is rejected, the connection is canceled. -.SH DEFAULT -NULL -.SH PROTOCOLS -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 */ -{ - /* 'clientp' points to the callback_data struct */ - /* investigate the situation and return the correct value */ - return CURLKHMATCH_OK; -} -int main(void) -{ - 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.84.0 , work only with libssh2 backend. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSH_HOSTKEYDATA (3), -.BR CURLOPT_SSH_KNOWNHOSTS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.md b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.md new file mode 100644 index 000000000..ed5797520 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_HOSTKEYFUNCTION.md @@ -0,0 +1,98 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_HOSTKEYFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_HOSTKEYDATA (3) + - CURLOPT_SSH_KNOWNHOSTS (3) +--- + +# NAME + +CURLOPT_SSH_HOSTKEYFUNCTION - callback to check host key + +# SYNOPSIS + +~~~c +#include + +int keycallback(void *clientp, + int keytype, + const char *key, + size_t keylen); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOSTKEYFUNCTION, + keycallback); +~~~ + +# DESCRIPTION + +Pass a pointer to your callback function, which should match the prototype +shown above. It overrides CURLOPT_SSH_KNOWNHOSTS(3). + +This callback gets called when the verification of the SSH host key is needed. + +**key** is **keylen** bytes long and is the key to check. **keytype** +says what type it is, from the **CURLKHTYPE_*** series in the +**curl_khtype** enum. + +**clientp** is a custom pointer set with CURLOPT_SSH_HOSTKEYDATA(3). + +The callback MUST return one of the following return codes to tell libcurl how +to act: + +## CURLKHMATCH_OK + +The host key is accepted, the connection should continue. + +## CURLKHMATCH_MISMATCH + +the host key is rejected, the connection is canceled. + +# DEFAULT + +NULL + +# PROTOCOLS + +SCP and SFTP + +# EXAMPLE + +~~~c +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 */ +{ + /* 'clientp' points to the callback_data struct */ + /* investigate the situation and return the correct value */ + return CURLKHMATCH_OK; +} +int main(void) +{ + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.84.0 , work only with libssh2 backend. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3 b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3 deleted file mode 100644 index e0b2586ed..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 \- MD5 checksum of SSH server public key -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, - char *md5); -.SH DESCRIPTION -Pass a char * pointing to a string containing 32 hexadecimal digits. The -string should be the 128 bit MD5 checksum of the remote host's public key, and -libcurl aborts the connection to the host unless the MD5 checksum match. - -MD5 is a weak algorithm. We strongly recommend using -\fICURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3)\fP instead. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -SCP and SFTP -.SH EXAMPLE -.nf -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 -Added in 7.17.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_AUTH_TYPES (3), -.BR CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3), -.BR CURLOPT_SSH_PUBLIC_KEYFILE (3), -.BR CURLOPT_SSH_KNOWNHOSTS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md new file mode 100644 index 000000000..4b7876501 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_AUTH_TYPES (3) + - CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3) + - CURLOPT_SSH_KNOWNHOSTS (3) + - CURLOPT_SSH_PUBLIC_KEYFILE (3) +--- + +# NAME + +CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 - MD5 checksum of SSH server public key + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, + char *md5); +~~~ + +# DESCRIPTION + +Pass a char pointer pointing to a string containing 32 hexadecimal digits. The +string should be the 128 bit MD5 checksum of the remote host's public key, and +libcurl aborts the connection to the host unless the MD5 checksum match. + +MD5 is a weak algorithm. We strongly recommend using +CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3) instead. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +SCP and SFTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.17.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3 b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3 deleted file mode 100644 index 266b7b0ac..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 3 "27 Aug 2021" libcurl libcurl -.SH NAME -CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 \- SHA256 hash of SSH server public key -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, - char *sha256); -.SH DESCRIPTION -Pass a char * pointing to a string containing a Base64-encoded SHA256 hash of -the remote host's public key. The transfer fails if the given hash does not -match the hash the remote host provides. - -.SH DEFAULT -NULL -.SH PROTOCOLS -SCP and SFTP -.SH EXAMPLE -.nf -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 -Added in 7.80.0 -Requires the libssh2 backend. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_AUTH_TYPES (3), -.BR CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3), -.BR CURLOPT_SSH_PUBLIC_KEYFILE (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md new file mode 100644 index 000000000..41562db63 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_AUTH_TYPES (3) + - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) + - CURLOPT_SSH_PUBLIC_KEYFILE (3) +--- + +# NAME + +CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 - SHA256 hash of SSH server public key + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, + char *sha256); +~~~ + +# DESCRIPTION + +Pass a char pointer pointing to a string containing a Base64-encoded SHA256 +hash of the remote host's public key. The transfer fails if the given hash +does not match the hash the remote host provides. + +# DEFAULT + +NULL + +# PROTOCOLS + +SCP and SFTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.80.0 +Requires the libssh2 backend. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3 b/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3 deleted file mode 100644 index 04ae0a557..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_KEYDATA 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_KEYDATA \- pointer passed to the SSH key callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KEYDATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a void * as parameter. This \fIpointer\fP is passed along verbatim to the -callback set with \fICURLOPT_SSH_KEYFUNCTION(3)\fP. -.SH DEFAULT -NULL -.SH PROTOCOLS -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, - enum curl_khmatch match, - void *clientp) -{ - /* 'clientp' points to the callback_data struct */ - /* investigate the situation and return the correct value */ - return CURLKHSTAT_FINE_ADD_TO_FILE; -} - -int main(void) -{ - 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); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.6 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSH_KEYDATA (3), -.BR CURLOPT_SSH_KNOWNHOSTS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.md b/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.md new file mode 100644 index 000000000..e90cace34 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_KEYDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_KEYDATA (3) + - CURLOPT_SSH_KNOWNHOSTS (3) +--- + +# NAME + +CURLOPT_SSH_KEYDATA - pointer passed to the SSH key callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KEYDATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a void * as parameter. This *pointer* is passed along verbatim to the +callback set with CURLOPT_SSH_KEYFUNCTION(3). + +# DEFAULT + +NULL + +# PROTOCOLS + +SFTP and SCP + +# EXAMPLE + +~~~c +struct mine { + void *custom; +}; +static int keycb(CURL *easy, + const struct curl_khkey *knownkey, + const struct curl_khkey *foundkey, + enum curl_khmatch match, + void *clientp) +{ + /* 'clientp' points to the callback_data struct */ + /* investigate the situation and return the correct value */ + return CURLKHSTAT_FINE_ADD_TO_FILE; +} + +int main(void) +{ + 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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.6 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3 b/docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.md similarity index 64% rename from docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.md index 1abe37d63..5fc40060e 100644 --- a/docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_SSH_KEYFUNCTION.md @@ -1,32 +1,21 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_KEYFUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_KEYFUNCTION \- callback for known host matching logic -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_KEYFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_KEYDATA (3) + - CURLOPT_SSH_KNOWNHOSTS (3) +--- + +# NAME + +CURLOPT_SSH_KEYFUNCTION - callback for known host matching logic + +# SYNOPSIS + +~~~c #include enum curl_khstat { @@ -61,50 +50,69 @@ int ssh_keycallback(CURL *easy, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KEYFUNCTION, ssh_keycallback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. It gets called when the known_host matching has been done, to allow the application to act and decide for libcurl how to proceed. The callback is only -called if \fICURLOPT_SSH_KNOWNHOSTS(3)\fP is also set. +called if CURLOPT_SSH_KNOWNHOSTS(3) is also set. This callback function gets passed the CURL handle, the key from the -known_hosts file \fIknownkey\fP, the key from the remote site \fIfoundkey\fP, +known_hosts file *knownkey*, the key from the remote site *foundkey*, info from libcurl on the matching status and a custom pointer (set with -\fICURLOPT_SSH_KEYDATA(3)\fP). It MUST return one of the following return +CURLOPT_SSH_KEYDATA(3)). It MUST return one of the following return codes to tell libcurl how to act: -.IP CURLKHSTAT_FINE_REPLACE + +## CURLKHSTAT_FINE_REPLACE + The new host+key is accepted and libcurl replaces the old host+key into the known_hosts file before continuing with the connection. This also adds the new host+key combo to the known_host pool kept in memory if it was not already present there. The adding of data to the file is done by completely replacing the file with a new copy, so the permissions of the file must allow this. (Added in 7.73.0) -.IP CURLKHSTAT_FINE_ADD_TO_FILE + +## CURLKHSTAT_FINE_ADD_TO_FILE + The host+key is accepted and libcurl appends it to the known_hosts file before continuing with the connection. This also adds the host+key combo to the known_host pool kept in memory if it was not already present there. The adding of data to the file is done by completely replacing the file with a new copy, so the permissions of the file must allow this. -.IP CURLKHSTAT_FINE + +## CURLKHSTAT_FINE + The host+key is accepted libcurl continues with the connection. This also adds the host+key combo to the known_host pool kept in memory if it was not already present there. -.IP CURLKHSTAT_REJECT + +## CURLKHSTAT_REJECT + The host+key is rejected. libcurl denies the connection to continue and it is closed. -.IP CURLKHSTAT_DEFER + +## CURLKHSTAT_DEFER + The host+key is rejected, but the SSH connection is asked to be kept alive. -This feature could be used when the app wants to somehow return back and act -on the host+key situation and then retry without needing the overhead of -setting it up from scratch again. -.SH DEFAULT +This feature could be used when the app wants to return and act on the +host+key situation and then retry without needing the overhead of setting it +up from scratch again. + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + SFTP and SCP -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c struct mine { void *custom; }; @@ -133,11 +141,12 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.19.6 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSH_KEYDATA (3), -.BR CURLOPT_SSH_KNOWNHOSTS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3 b/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3 deleted file mode 100644 index 8984fedb7..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_KNOWNHOSTS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_KNOWNHOSTS \- file name holding the SSH known hosts -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KNOWNHOSTS, char *fname); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string holding the file name of the -known_host file to use. The known_hosts file should use the OpenSSH file -format as supported by libssh2. If this file is specified, libcurl only -accepts connections with hosts that are known and present in that file, with a -matching public key. Use \fICURLOPT_SSH_KEYFUNCTION(3)\fP to alter the default -behavior on host and key matches and mismatches. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -SFTP and SCP -.SH EXAMPLE -.nf -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 -Added in 7.19.6 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_AUTH_TYPES (3), -.BR CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.md b/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.md new file mode 100644 index 000000000..cc5304fc1 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_KNOWNHOSTS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_AUTH_TYPES (3) + - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) +--- + +# NAME + +CURLOPT_SSH_KNOWNHOSTS - file name holding the SSH known hosts + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KNOWNHOSTS, char *fname); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string holding the file name of the +known_host file to use. The known_hosts file should use the OpenSSH file +format as supported by libssh2. If this file is specified, libcurl only +accepts connections with hosts that are known and present in that file, with a +matching public key. Use CURLOPT_SSH_KEYFUNCTION(3) to alter the default +behavior on host and key matches and mismatches. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +SFTP and SCP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.6 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.3 b/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.3 deleted file mode 100644 index 974a5b786..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_PRIVATE_KEYFILE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_PRIVATE_KEYFILE \- private key file for SSH auth -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PRIVATE_KEYFILE, - char *filename); -.SH DESCRIPTION -Pass a char * pointing to a \fIfilename\fP for your private key. If not used, -libcurl defaults to \fB$HOME/.ssh/id_rsa\fP or \fB$HOME/.ssh/id_dsa\fP if the -HOME environment variable is set, and in the current directory if HOME is not -set. - -If the file is password-protected, set the password with -\fICURLOPT_KEYPASSWD(3)\fP. - -The SSH library derives the public key from this private key when possible. If -the SSH library cannot derive the public key from the private one and no -public one is provided with \fICURLOPT_SSH_PUBLIC_KEYFILE(3)\fP, the transfer -fails. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -As explained above -.SH PROTOCOLS -SFTP and SCP -.SH EXAMPLE -.nf -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 -Added in 7.16.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_PUBLIC_KEYFILE (3), -.BR CURLOPT_SSH_AUTH_TYPES (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.md b/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.md new file mode 100644 index 000000000..e8a40079b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_PRIVATE_KEYFILE.md @@ -0,0 +1,76 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_PRIVATE_KEYFILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_AUTH_TYPES (3) + - CURLOPT_SSH_PUBLIC_KEYFILE (3) +--- + +# NAME + +CURLOPT_SSH_PRIVATE_KEYFILE - private key file for SSH auth + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PRIVATE_KEYFILE, + char *filename); +~~~ + +# DESCRIPTION + +Pass a char pointer pointing to a *filename* for your private key. If not +used, libcurl defaults to **$HOME/.ssh/id_rsa** or **$HOME/.ssh/id_dsa** if +the HOME environment variable is set, and in the current directory if HOME is +not set. + +If the file is password-protected, set the password with +CURLOPT_KEYPASSWD(3). + +The SSH library derives the public key from this private key when possible. If +the SSH library cannot derive the public key from the private one and no +public one is provided with CURLOPT_SSH_PUBLIC_KEYFILE(3), the transfer +fails. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +As explained above + +# PROTOCOLS + +SFTP and SCP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3 b/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3 deleted file mode 100644 index 6a1d6991b..000000000 --- a/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSH_PUBLIC_KEYFILE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSH_PUBLIC_KEYFILE \- public key file for SSH auth -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PUBLIC_KEYFILE, - char *filename); -.SH DESCRIPTION -Pass a char * pointing to a \fIfilename\fP for your public key. If not used, -libcurl defaults to \fB$HOME/.ssh/id_dsa.pub\fP if the HOME environment -variable is set, and just "id_dsa.pub" in the current directory if HOME is not -set. - -If NULL (or an empty string) is passed to this option, libcurl passes no -public key to the SSH library, which then rather derives it from the private -key. If the SSH library cannot derive the public key from the private one and -no public one is provided, the transfer fails. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -SFTP and SCP -.SH EXAMPLE -.nf -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 -The "" trick was added in 7.26.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSH_PRIVATE_KEYFILE (3), -.BR CURLOPT_SSH_AUTH_TYPES (3) diff --git a/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.md b/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.md new file mode 100644 index 000000000..35d65ad93 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSH_PUBLIC_KEYFILE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSH_AUTH_TYPES (3) + - CURLOPT_SSH_PRIVATE_KEYFILE (3) +--- + +# NAME + +CURLOPT_SSH_PUBLIC_KEYFILE - public key file for SSH auth + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PUBLIC_KEYFILE, + char *filename); +~~~ + +# DESCRIPTION + +Pass a char pointer pointing to a *filename* for your public key. If not used, +libcurl defaults to **$HOME/.ssh/id_dsa.pub** if the HOME environment variable +is set, and just "id_dsa.pub" in the current directory if HOME is not set. + +If NULL (or an empty string) is passed to this option, libcurl passes no +public key to the SSH library, which then rather derives it from the private +key. If the SSH library cannot derive the public key from the private one and +no public one is provided, the transfer fails. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +SFTP and SCP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +The "" trick was added in 7.26.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLCERT.3 b/docs/libcurl/opts/CURLOPT_SSLCERT.3 deleted file mode 100644 index d3ded42fa..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLCERT.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLCERT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLCERT \- SSL client certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT, char *cert); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the file name of your client certificate. The default format is "P12" on -Secure Transport and "PEM" on other engines, and can be changed with -\fICURLOPT_SSLCERTTYPE(3)\fP. - -With Secure Transport, this can also be the nickname of the certificate you -wish to authenticate with as it is named in the security database. If you want -to use a file from the current directory, please precede it with "./" prefix, -in order to avoid confusion with a nickname. - -(Schannel only) Client certificates can be specified by a path expression to a -certificate store. (You can import \fIPFX\fP to a store first). You can use -"\\\\" to refer to a certificate in -the system certificates store, for example, -\fB"CurrentUser\\MY\\934a7ac6f8a5d579285a74fa"\fP. The thumbprint is usually a -SHA-1 hex string which you can see in certificate details. Following store -locations are supported: \fBCurrentUser\fP, \fBLocalMachine\fP, -\fBCurrentService\fP, \fBServices\fP, \fBCurrentUserGroupPolicy\fP, -\fBLocalMachineGroupPolicy\fP, \fBLocalMachineEnterprise\fP. Schannel also -support P12 certificate file, with the string "P12" specified with -\fICURLOPT_SSLCERTTYPE(3)\fP. - -When using a client certificate, you most likely also need to provide a -private key with \fICURLOPT_SSLKEY(3)\fP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLCERTTYPE (3), -.BR CURLOPT_SSLKEY (3), -.BR CURLOPT_KEYPASSWD (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLCERT.md b/docs/libcurl/opts/CURLOPT_SSLCERT.md new file mode 100644 index 000000000..3029832db --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLCERT.md @@ -0,0 +1,87 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLCERT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_KEYPASSWD (3) + - CURLOPT_SSLCERTTYPE (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_SSLCERT - SSL client certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT, char *cert); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the file name of your client certificate. The default format is "P12" on +Secure Transport and "PEM" on other engines, and can be changed with +CURLOPT_SSLCERTTYPE(3). + +With Secure Transport, this can also be the nickname of the certificate you +wish to authenticate with as it is named in the security database. If you want +to use a file from the current directory, please precede it with "./" prefix, +in order to avoid confusion with a nickname. + +(Schannel only) Client certificates can be specified by a path expression to a +certificate store. (You can import *PFX* to a store first). You can use +"" to refer to a certificate in the +system certificates store, for example, +**"CurrentUserMY934a7ac6f8a5d579285a74fa"**. The thumbprint is usually a SHA-1 +hex string which you can see in certificate details. Following store locations +are supported: **CurrentUser**, **LocalMachine**, **CurrentService**, +**Services**, **CurrentUserGroupPolicy**, **LocalMachineGroupPolicy**, +**LocalMachineEnterprise**. Schannel also support P12 certificate file, with +the string "P12" specified with CURLOPT_SSLCERTTYPE(3). + +When using a client certificate, you most likely also need to provide a +private key with CURLOPT_SSLKEY(3). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3 b/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3 deleted file mode 100644 index e800c5cbd..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLCERTTYPE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLCERTTYPE \- type of client SSL certificate -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERTTYPE, char *type); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the format of your certificate. - -Supported formats are "PEM" and "DER", except with Secure Transport or -Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or -later, or OS X 10.7 or later) and Schannel support "P12" for PKCS#12-encoded -files. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -"PEM" -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -If built TLS enabled. Added in 7.9.3 -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLCERT (3), -.BR CURLOPT_SSLKEY (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.md b/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.md new file mode 100644 index 000000000..420ca4f86 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLCERTTYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLCERT (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_SSLCERTTYPE - type of client SSL certificate + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERTTYPE, char *type); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the format of your certificate. + +Supported formats are "PEM" and "DER", except with Secure Transport or +Schannel. OpenSSL (versions 0.9.3 and later), Secure Transport (on iOS 5 or +later, or OS X 10.7 or later) and Schannel support "P12" for PKCS#12-encoded +files. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +"PEM" + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +If built TLS enabled. Added in 7.9.3 + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 b/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 deleted file mode 100644 index 37a53362e..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLCERT_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_SSLCERT_BLOB \- SSL client certificate from memory blob -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT_BLOB, - struct curl_blob *stblob); -.fi -.SH DESCRIPTION -Pass a pointer to a curl_blob structure, which contains (pointer and size) a -client certificate. The format must be "P12" on Secure Transport or -Schannel. The format must be "P12" or "PEM" on OpenSSL. The format must be -"DER" or "PEM" on mbedTLS. The format must be specified with -\fICURLOPT_SSLCERTTYPE(3)\fP. - -If the blob is initialized with the flags member of struct curl_blob set to -CURL_BLOB_COPY, the application does not have to keep the buffer around after -setting this. - -This option is an alternative to \fICURLOPT_SSLCERT(3)\fP which instead -expects a file name as input. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf - -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 -Added in 7.71.0. This option is supported by the OpenSSL, Secure Transport, -Schannel and mbedTLS (since 7.78.0) backends. -.SH RETURN VALUE -Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLCERTTYPE (3), -.BR CURLOPT_SSLKEY (3), -.BR CURLOPT_KEYPASSWD (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.md b/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.md new file mode 100644 index 000000000..5f7d73896 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.md @@ -0,0 +1,83 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLCERT_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_KEYPASSWD (3) + - CURLOPT_SSLCERTTYPE (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_SSLCERT_BLOB - SSL client certificate from memory blob + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT_BLOB, + struct curl_blob *stblob); +~~~ + +# DESCRIPTION + +Pass a pointer to a curl_blob structure, which contains (pointer and size) a +client certificate. The format must be "P12" on Secure Transport or +Schannel. The format must be "P12" or "PEM" on OpenSSL. The format must be +"DER" or "PEM" on mbedTLS. The format must be specified with +CURLOPT_SSLCERTTYPE(3). + +If the blob is initialized with the flags member of struct curl_blob set to +CURL_BLOB_COPY, the application does not have to keep the buffer around after +setting this. + +This option is an alternative to CURLOPT_SSLCERT(3) which instead +expects a file name as input. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c + +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.71.0. This option is supported by the OpenSSL, Secure Transport, +Schannel and mbedTLS (since 7.78.0) backends. + +# RETURN VALUE + +Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLENGINE.3 b/docs/libcurl/opts/CURLOPT_SSLENGINE.3 deleted file mode 100644 index 495841da9..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLENGINE.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLENGINE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLENGINE \- SSL engine identifier -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLENGINE, char *id); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. It is used as the -identifier for the crypto engine you want to use for your private key. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Only if the SSL backend is OpenSSL built with engine support. -.SH RETURN VALUE -CURLE_OK - Engine found. - -CURLE_SSL_ENGINE_NOTFOUND - Engine not found, or OpenSSL was not built with -engine support. - -CURLE_SSL_ENGINE_INITFAILED - Engine found but initialization failed. - -CURLE_NOT_BUILT_IN - Option not built in, OpenSSL is not the SSL backend. - -CURLE_UNKNOWN_OPTION - Option not recognized. - -CURLE_OUT_OF_MEMORY - Insufficient heap space. -.SH "SEE ALSO" -.BR CURLINFO_SSL_ENGINES (3), -.BR CURLOPT_SSLENGINE_DEFAULT (3), -.BR CURLOPT_SSLKEY (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLENGINE.md b/docs/libcurl/opts/CURLOPT_SSLENGINE.md new file mode 100644 index 000000000..45ccc42c5 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLENGINE.md @@ -0,0 +1,74 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLENGINE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_SSL_ENGINES (3) + - CURLOPT_SSLENGINE_DEFAULT (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_SSLENGINE - SSL engine identifier + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLENGINE, char *id); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. It is used as the +identifier for the crypto engine you want to use for your private key. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Only if the SSL backend is OpenSSL built with engine support. + +# RETURN VALUE + +CURLE_OK - Engine found. + +CURLE_SSL_ENGINE_NOTFOUND - Engine not found, or OpenSSL was not built with +engine support. + +CURLE_SSL_ENGINE_INITFAILED - Engine found but initialization failed. + +CURLE_NOT_BUILT_IN - Option not built in, OpenSSL is not the SSL backend. + +CURLE_UNKNOWN_OPTION - Option not recognized. + +CURLE_OUT_OF_MEMORY - Insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3 b/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3 deleted file mode 100644 index 0e904c67f..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLENGINE_DEFAULT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLENGINE_DEFAULT \- make SSL engine default -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLENGINE_DEFAULT, long val); -.fi -.SH DESCRIPTION -Pass a long set to 1 to make the already specified crypto engine the default -for (asymmetric) crypto operations. - -This option has no effect unless set after \fICURLOPT_SSLENGINE(3)\fP. -.SH DEFAULT -None -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic"); - curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Only if the SSL backend is OpenSSL built with engine support. -.SH RETURN VALUE -CURLE_OK - Engine set as default. - -CURLE_SSL_ENGINE_SETFAILED - Engine could not be set as default. - -CURLE_NOT_BUILT_IN - Option not built in, OpenSSL is not the SSL backend. - -CURLE_UNKNOWN_OPTION - Option not recognized. - -CURLE_OUT_OF_MEMORY - Insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLENGINE (3), -.BR CURLOPT_SSLCERT (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.md b/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.md new file mode 100644 index 000000000..d082f7b54 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLENGINE_DEFAULT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLCERT (3) + - CURLOPT_SSLENGINE (3) +--- + +# NAME + +CURLOPT_SSLENGINE_DEFAULT - make SSL engine default + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLENGINE_DEFAULT, long val); +~~~ + +# DESCRIPTION + +Pass a long set to 1 to make the already specified crypto engine the default +for (asymmetric) crypto operations. + +This option has no effect unless set after CURLOPT_SSLENGINE(3). + +# DEFAULT + +None + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSLENGINE, "dynamic"); + curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Only if the SSL backend is OpenSSL built with engine support. + +# RETURN VALUE + +CURLE_OK - Engine set as default. + +CURLE_SSL_ENGINE_SETFAILED - Engine could not be set as default. + +CURLE_NOT_BUILT_IN - Option not built in, OpenSSL is not the SSL backend. + +CURLE_UNKNOWN_OPTION - Option not recognized. + +CURLE_OUT_OF_MEMORY - Insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLKEY.3 b/docs/libcurl/opts/CURLOPT_SSLKEY.3 deleted file mode 100644 index 7f54c4eaf..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLKEY.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLKEY 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLKEY \- private key file for TLS and SSL client cert -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the file name of your private key. The default format is "PEM" and can be -changed with \fICURLOPT_SSLKEYTYPE(3)\fP. - -(Windows, iOS and Mac OS X) This option is ignored by Secure Transport and -Schannel SSL backends because they expect the private key to be already present -in the key-chain or PKCS#12 file containing the certificate. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLCERT (3), -.BR CURLOPT_SSLKEY_BLOB (3), -.BR CURLOPT_SSLKEYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLKEY.md b/docs/libcurl/opts/CURLOPT_SSLKEY.md new file mode 100644 index 000000000..94c65b2f6 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLKEY.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLKEY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLCERT (3) + - CURLOPT_SSLKEYTYPE (3) + - CURLOPT_SSLKEY_BLOB (3) +--- + +# NAME + +CURLOPT_SSLKEY - private key file for TLS and SSL client cert + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the file name of your private key. The default format is "PEM" and can be +changed with CURLOPT_SSLKEYTYPE(3). + +(Windows, iOS and Mac OS X) This option is ignored by Secure Transport and +Schannel SSL backends because they expect the private key to be already present +in the key-chain or PKCS#12 file containing the certificate. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3 b/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3 deleted file mode 100644 index 957d175ea..000000000 --- a/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLKEYTYPE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLKEYTYPE \- type of the private key file -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEYTYPE, char *type); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the format of your private key. Supported formats are "PEM", "DER" and "ENG". - -The format "ENG" enables you to load the private key from a crypto engine. In -this case \fICURLOPT_SSLKEY(3)\fP is used as an identifier passed to the -engine. You have to set the crypto engine with \fICURLOPT_SSLENGINE(3)\fP. -\&"DER" format key file currently does not work because of a bug in OpenSSL. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -"PEM" -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLCERT (3), -.BR CURLOPT_SSLKEY (3), -.BR CURLOPT_PROXY_SSLKEYTYPE (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.md b/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.md new file mode 100644 index 000000000..8a2023ea4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLKEYTYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLKEYTYPE (3) + - CURLOPT_SSLCERT (3) + - CURLOPT_SSLKEY (3) +--- + +# NAME + +CURLOPT_SSLKEYTYPE - type of the private key file + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEYTYPE, char *type); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the format of your private key. Supported formats are "PEM", "DER" and "ENG". + +The format "ENG" enables you to load the private key from a crypto engine. In +this case CURLOPT_SSLKEY(3) is used as an identifier passed to the +engine. You have to set the crypto engine with CURLOPT_SSLENGINE(3). +&"DER" format key file currently does not work because of a bug in OpenSSL. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +"PEM" + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 b/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 rename to docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.md index 8d3f21da3..4adf80328 100644 --- a/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 +++ b/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.md @@ -1,54 +1,51 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLKEY_BLOB 3 "24 Jun 2020" libcurl libcurl -.SH NAME -CURLOPT_SSLKEY_BLOB \- private key for client cert from memory blob -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLKEY_BLOB +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLKEY (3) + - CURLOPT_SSLKEYTYPE (3) +--- + +# NAME + +CURLOPT_SSLKEY_BLOB - private key for client cert from memory blob + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY_BLOB, struct curl_blob *blob); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to a curl_blob structure, which contains information (pointer and size) for a private key. Compatible with OpenSSL. The format (like "PEM") -must be specified with \fICURLOPT_SSLKEYTYPE(3)\fP. +must be specified with CURLOPT_SSLKEYTYPE(3). If the blob is initialized with the flags member of struct curl_blob set to CURL_BLOB_COPY, the application does not have to keep the buffer around after setting this. -This option is an alternative to \fICURLOPT_SSLKEY(3)\fP which instead expects +This option is an alternative to CURLOPT_SSLKEY(3) which instead expects a file name as input. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c extern char *certificateData; /* point to cert */ extern size_t filesize; /* size of cert */ @@ -78,12 +75,13 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.71.0. This option is supported by the OpenSSL backends. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_SSLKEYTYPE (3), -.BR CURLOPT_SSLKEY (3) diff --git a/docs/libcurl/opts/CURLOPT_SSLVERSION.3 b/docs/libcurl/opts/CURLOPT_SSLVERSION.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_SSLVERSION.3 rename to docs/libcurl/opts/CURLOPT_SSLVERSION.md index 2031b6803..f64a13b5f 100644 --- a/docs/libcurl/opts/CURLOPT_SSLVERSION.3 +++ b/docs/libcurl/opts/CURLOPT_SSLVERSION.md @@ -1,37 +1,30 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSLVERSION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSLVERSION \- preferred TLS/SSL version -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSLVERSION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_IPRESOLVE (3) + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_SSLVERSION - preferred TLS/SSL version + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLVERSION, long version); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long as parameter to control which version range of SSL/TLS versions to use. @@ -40,60 +33,87 @@ version to be more and more secure in this order through history: SSL v2, SSLv3, TLS v1.0, TLS v1.1, TLS v1.2 and the most recent TLS v1.3. Use one of the available defines for this purpose. The available options are: -.RS -.IP CURL_SSLVERSION_DEFAULT + +## CURL_SSLVERSION_DEFAULT + The default acceptable version range. The minimum acceptable version is by default TLS v1.0 since 7.39.0 (unless the TLS library has a stricter rule). -.IP CURL_SSLVERSION_TLSv1 -TLS v1.0 or later -.IP CURL_SSLVERSION_SSLv2 -SSL v2 - refused -.IP CURL_SSLVERSION_SSLv3 -SSL v3 - refused -.IP CURL_SSLVERSION_TLSv1_0 -TLS v1.0 or later (Added in 7.34.0) -.IP CURL_SSLVERSION_TLSv1_1 -TLS v1.1 or later (Added in 7.34.0) -.IP CURL_SSLVERSION_TLSv1_2 -TLS v1.2 or later (Added in 7.34.0) -.IP CURL_SSLVERSION_TLSv1_3 -TLS v1.3 or later (Added in 7.52.0) -.RE -The maximum TLS version can be set by using \fIone\fP of the -CURL_SSLVERSION_MAX_ macros below. It is also possible to OR \fIone\fP of the -CURL_SSLVERSION_ macros with \fIone\fP of the CURL_SSLVERSION_MAX_ macros. +## CURL_SSLVERSION_TLSv1 + +TLS v1.0 or later + +## CURL_SSLVERSION_SSLv2 + +SSL v2 - refused + +## CURL_SSLVERSION_SSLv3 + +SSL v3 - refused + +## CURL_SSLVERSION_TLSv1_0 + +TLS v1.0 or later (Added in 7.34.0) + +## CURL_SSLVERSION_TLSv1_1 + +TLS v1.1 or later (Added in 7.34.0) + +## CURL_SSLVERSION_TLSv1_2 + +TLS v1.2 or later (Added in 7.34.0) + +## CURL_SSLVERSION_TLSv1_3 + +TLS v1.3 or later (Added in 7.52.0) + +The maximum TLS version can be set by using *one* of the +CURL_SSLVERSION_MAX_ macros below. It is also possible to OR *one* of the +CURL_SSLVERSION_ macros with *one* of the CURL_SSLVERSION_MAX_ macros. The MAX macros are not supported for WolfSSL. -.RS -.IP CURL_SSLVERSION_MAX_DEFAULT + +## CURL_SSLVERSION_MAX_DEFAULT + The flag defines the maximum supported TLS version by libcurl, or the default value from the SSL library is used. libcurl uses a sensible default maximum, which was TLS v1.2 up to before 7.61.0 and is TLS v1.3 since then - assuming the TLS library support it. (Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_0 + +## CURL_SSLVERSION_MAX_TLSv1_0 + The flag defines maximum supported TLS version as TLS v1.0. (Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_1 + +## CURL_SSLVERSION_MAX_TLSv1_1 + The flag defines maximum supported TLS version as TLS v1.1. (Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_2 + +## CURL_SSLVERSION_MAX_TLSv1_2 + The flag defines maximum supported TLS version as TLS v1.2. (Added in 7.54.0) -.IP CURL_SSLVERSION_MAX_TLSv1_3 + +## CURL_SSLVERSION_MAX_TLSv1_3 + The flag defines maximum supported TLS version as TLS v1.3. (Added in 7.54.0) -.RE In versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were -documented to allow \fIonly\fP the specified TLS version, but behavior was +documented to allow *only* the specified TLS version, but behavior was inconsistent depending on the TLS library. -.SH DEFAULT +# DEFAULT + CURL_SSLVERSION_DEFAULT -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -107,18 +127,17 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + SSLv2 and SSLv3 are refused completely since curl 7.77.0 SSLv2 is disabled by default since 7.18.1. Other SSL versions availability may vary depending on which backend libcurl has been built to use. SSLv3 is disabled by default since 7.39.0. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_IPRESOLVE (3), -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3 b/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3 deleted file mode 100644 index 8196b5529..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_CIPHER_LIST 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_CIPHER_LIST \- ciphers to use for TLS -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_CIPHER_LIST, char *list); -.fi -.SH DESCRIPTION -Pass a char *, pointing to a null-terminated string holding the list of -ciphers to use for the SSL connection. The list must be syntactically correct, -it consists of one or more cipher strings separated by colons. Commas or -spaces are also acceptable separators but colons are normally used, \&!, \&- -and \&+ can be used as operators. - -For OpenSSL and GnuTLS valid examples of cipher lists include \fBRC4-SHA\fP, -\fBSHA1+DES\fP, \fBTLSv1\fP and \fBDEFAULT\fP. The default list is normally -set when you compile OpenSSL. - -For WolfSSL, valid examples of cipher lists include \fBECDHE-RSA-RC4-SHA\fP, -\fBAES256-SHA:AES256-SHA256\fP, etc. - -For BearSSL, valid examples of cipher lists include -\fBECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256\fP, or when using IANA names -\fBTLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\fP, -etc. -With BearSSL you do not add/remove ciphers. If one uses this option then all -known ciphers are disabled and only those passed in are enabled. - -For Schannel, you can use this option to set algorithms but not specific cipher -suites. Refer to the ciphers lists document for algorithms. - -Find more details about cipher lists on this URL: - - https://curl.se/docs/ssl-ciphers.html - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, use internal default -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.9, in 7.83.0 for BearSSL - -If built TLS enabled. -.SH RETURN VALUE -Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_TLS13_CIPHERS (3), -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_PROXY_SSL_CIPHER_LIST (3), -.BR CURLOPT_PROXY_TLS13_CIPHERS (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.md b/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.md new file mode 100644 index 000000000..2d7c32da2 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_CIPHER_LIST.md @@ -0,0 +1,92 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_CIPHER_LIST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSL_CIPHER_LIST (3) + - CURLOPT_PROXY_TLS13_CIPHERS (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_TLS13_CIPHERS (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_SSL_CIPHER_LIST - ciphers to use for TLS + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_CIPHER_LIST, char *list); +~~~ + +# DESCRIPTION + +Pass a char pointer, pointing to a null-terminated string holding the list of +ciphers to use for the SSL connection. The list must be syntactically correct, +it consists of one or more cipher strings separated by colons. Commas or +spaces are also acceptable separators but colons are normally used, &!, &- and +&+ can be used as operators. + +For OpenSSL and GnuTLS valid examples of cipher lists include **RC4-SHA**, +**SHA1+DES**, **TLSv1** and **DEFAULT**. The default list is normally +set when you compile OpenSSL. + +For WolfSSL, valid examples of cipher lists include **ECDHE-RSA-RC4-SHA**, +**AES256-SHA:AES256-SHA256**, etc. + +For BearSSL, valid examples of cipher lists include +**ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256**, or when using IANA names +**TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256**, +etc. +With BearSSL you do not add/remove ciphers. If one uses this option then all +known ciphers are disabled and only those passed in are enabled. + +For Schannel, you can use this option to set algorithms but not specific cipher +suites. Refer to the ciphers lists document for algorithms. + +Find more details about cipher lists on this URL: + + https://curl.se/docs/ssl-ciphers.html + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, use internal default + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.9, in 7.83.0 for BearSSL + +If built TLS enabled. + +# RETURN VALUE + +Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3 b/docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3 rename to docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.md index 6abe2a9bf..6e328a5bd 100644 --- a/docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3 +++ b/docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.md @@ -1,46 +1,43 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_CTX_DATA 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_CTX_DATA \- pointer passed to SSL context callback -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_CTX_DATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CTX_FUNCTION (3) +--- + +# NAME + +CURLOPT_SSL_CTX_DATA - pointer passed to SSL context callback + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_CTX_DATA, void *pointer); -.fi -.SH DESCRIPTION -Data \fIpointer\fP to pass to the ssl context callback set by the option -\fICURLOPT_SSL_CTX_FUNCTION(3)\fP, this is the pointer you get as third +~~~ + +# DESCRIPTION + +Data *pointer* to pass to the ssl context callback set by the option +CURLOPT_SSL_CTX_FUNCTION(3), this is the pointer you get as third parameter. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* OpenSSL specific */ #include @@ -60,14 +57,14 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) */ PEM_read_bio_X509(bio, &cert, 0, NULL); if(!cert) - printf("PEM_read_bio_X509 failed...\\n"); + printf("PEM_read_bio_X509 failed...\n"); /* get a pointer to the X509 certificate store (which may be empty) */ store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); /* add our certificate to this store */ if(X509_STORE_add_cert(store, cert) == 0) - printf("error adding certificate\\n"); + printf("error adding certificate\n"); /* decrease reference counts */ X509_free(cert); @@ -82,15 +79,15 @@ int main(void) CURL *ch; CURLcode rv; char *mypem = /* example CA cert PEM - shortened */ - "-----BEGIN CERTIFICATE-----\\n" - "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\\n" - "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\\n" - "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\\n" - "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\\n" - "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\\n" - "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\\n" - "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\\n" - "-----END CERTIFICATE-----\\n"; + "-----BEGIN CERTIFICATE-----\n" + "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\n" + "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\n" + "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\n" + "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\n" + "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\n" + "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\n" + "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n" + "-----END CERTIFICATE-----\n"; curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); @@ -103,24 +100,25 @@ int main(void) curl_easy_setopt(ch, CURLOPT_SSL_CTX_DATA, mypem); rv = curl_easy_perform(ch); if(!rv) - printf("*** transfer succeeded ***\\n"); + printf("*** transfer succeeded ***\n"); else - printf("*** transfer failed ***\\n"); + printf("*** transfer failed ***\n"); curl_easy_cleanup(ch); curl_global_cleanup(); return rv; } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.11.0 for OpenSSL, in 7.42.0 for wolfSSL, in 7.54.0 for mbedTLS, in 7.83.0 in BearSSL. Other SSL backends are not supported. -.SH RETURN VALUE + +# RETURN VALUE + CURLE_OK if supported; or an error such as: CURLE_NOT_BUILT_IN - Not supported by the SSL backend CURLE_UNKNOWN_OPTION -.SH "SEE ALSO" -.BR CURLOPT_SSL_CTX_FUNCTION (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3 b/docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.md similarity index 58% rename from docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3 rename to docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.md index 3ec1c95e5..ae8b8bbad 100644 --- a/docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.md @@ -1,39 +1,31 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_CTX_FUNCTION 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_CTX_FUNCTION \- SSL context callback for OpenSSL, wolfSSL or mbedTLS -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_CTX_FUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSL_CTX_DATA (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_SSL_CTX_FUNCTION - SSL context callback for OpenSSL, wolfSSL or mbedTLS + +# SYNOPSIS + +~~~c #include CURLcode ssl_ctx_callback(CURL *curl, void *ssl_ctx, void *clientp); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_CTX_FUNCTION, ssl_ctx_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + This option only works for libcurl powered by OpenSSL, wolfSSL, mbedTLS or BearSSL. If libcurl was built against another SSL library this functionality is absent. @@ -44,16 +36,16 @@ shown above. This callback function gets called by libcurl just before the initialization of an SSL connection after having processed all other SSL related options to give a last chance to an application to modify the behavior of the SSL -initialization. The \fIssl_ctx\fP parameter is actually a pointer to the SSL -library's \fISSL_CTX\fP for OpenSSL or wolfSSL, a pointer to -\fImbedtls_ssl_config\fP for mbedTLS or a pointer to -\fIbr_ssl_client_context\fP for BearSSL. If an error is returned from the +initialization. The *ssl_ctx* parameter is actually a pointer to the SSL +library's *SSL_CTX* for OpenSSL or wolfSSL, a pointer to +*mbedtls_ssl_config* for mbedTLS or a pointer to +*br_ssl_client_context* for BearSSL. If an error is returned from the callback no attempt to establish a connection is made and the perform -operation returns the callback's error code. Set the \fIclientp\fP argument -with the \fICURLOPT_SSL_CTX_DATA(3)\fP option. +operation returns the callback's error code. Set the *clientp* argument +with the CURLOPT_SSL_CTX_DATA(3) option. This function gets called on all new connections made to a server, during the -SSL negotiation. The \fIssl_ctx\fP points to a newly initialized object each +SSL negotiation. The *ssl_ctx* points to a newly initialized object each time, but note the pointer may be the same as from a prior call. To use this properly, a non-trivial amount of knowledge of your SSL library is @@ -62,27 +54,33 @@ callbacks to add additional validation code for certificates, and even to change the actual URI of an HTTPS request. For OpenSSL, asynchronous certificate verification via -\fISSL_set_retry_verify\fP is supported. (Added in 8.3.0) +*SSL_set_retry_verify* is supported. (Added in 8.3.0) -WARNING: The \fICURLOPT_SSL_CTX_FUNCTION(3)\fP callback allows the application +WARNING: The CURLOPT_SSL_CTX_FUNCTION(3) callback allows the application to reach in and modify SSL details in the connection without libcurl itself knowing anything about it, which then subsequently can lead to libcurl unknowingly reusing SSL connections with different properties. To remedy this -you may set \fICURLOPT_FORBID_REUSE(3)\fP from the callback function. +you may set CURLOPT_FORBID_REUSE(3) from the callback function. -WARNING: If you are using DNS-over-HTTPS (DoH) via \fICURLOPT_DOH_URL(3)\fP +WARNING: If you are using DNS-over-HTTPS (DoH) via CURLOPT_DOH_URL(3) then this callback is also called for those transfers and the curl handle is -set to an internal handle. \fBThis behavior is subject to change.\fP We -recommend before performing your transfer set \fICURLOPT_PRIVATE(3)\fP on your +set to an internal handle. **This behavior is subject to change.** We +recommend before performing your transfer set CURLOPT_PRIVATE(3) on your curl handle so you can identify it in the context callback. If you have a reason to modify DoH SSL context please let us know on the curl-library mailing list because we are considering removing this capability. -.SH DEFAULT + +# DEFAULT + NULL -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c /* OpenSSL specific */ #include @@ -102,14 +100,14 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) */ PEM_read_bio_X509(bio, &cert, 0, NULL); if(!cert) - printf("PEM_read_bio_X509 failed...\\n"); + printf("PEM_read_bio_X509 failed...\n"); /* get a pointer to the X509 certificate store (which may be empty) */ store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); /* add our certificate to this store */ if(X509_STORE_add_cert(store, cert) == 0) - printf("error adding certificate\\n"); + printf("error adding certificate\n"); /* decrease reference counts */ X509_free(cert); @@ -124,15 +122,15 @@ int main(void) CURL *ch; CURLcode rv; char *mypem = /* example CA cert PEM - shortened */ - "-----BEGIN CERTIFICATE-----\\n" - "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\\n" - "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\\n" - "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\\n" - "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\\n" - "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\\n" - "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\\n" - "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\\n" - "-----END CERTIFICATE-----\\n"; + "-----BEGIN CERTIFICATE-----\n" + "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\n" + "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\n" + "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\n" + "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\n" + "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\n" + "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\n" + "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n" + "-----END CERTIFICATE-----\n"; curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); @@ -145,24 +143,25 @@ int main(void) curl_easy_setopt(ch, CURLOPT_SSL_CTX_DATA, mypem); rv = curl_easy_perform(ch); if(!rv) - printf("*** transfer succeeded ***\\n"); + printf("*** transfer succeeded ***\n"); else - printf("*** transfer failed ***\\n"); + printf("*** transfer failed ***\n"); curl_easy_cleanup(ch); curl_global_cleanup(); return rv; } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.11.0 for OpenSSL, in 7.42.0 for wolfSSL, in 7.54.0 for mbedTLS, in 7.83.0 in BearSSL. Other SSL backends are not supported. -.SH RETURN VALUE + +# RETURN VALUE + CURLE_OK if supported; or an error such as: CURLE_NOT_BUILT_IN - Not supported by the SSL backend CURLE_UNKNOWN_OPTION -.SH "SEE ALSO" -.BR CURLOPT_SSL_CTX_DATA (3), -.BR CURLOPT_SSL_VERIFYPEER (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 b/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 deleted file mode 100644 index ef123896b..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_EC_CURVES 3 "29 Aug 2020" libcurl libcurl -.SH NAME -CURLOPT_SSL_EC_CURVES \- key exchange curves -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_EC_CURVES, char *alg_list); -.fi -.SH DESCRIPTION -Pass a string as parameter with a colon delimited list of (EC) algorithms. This -option defines the client's key exchange algorithms in the SSL handshake (if -the SSL backend libcurl is built to use supports it). -.SH DEFAULT -"", embedded in SSL backend -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSL_EC_CURVES, "X25519:P-521"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.73.0. Supported by the OpenSSL backend. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSL_OPTIONS (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_TLS13_CIPHERS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.md b/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.md new file mode 100644 index 000000000..adfaae34c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.md @@ -0,0 +1,61 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_EC_CURVES +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSL_CIPHER_LIST (3) + - CURLOPT_SSL_OPTIONS (3) + - CURLOPT_TLS13_CIPHERS (3) +--- + +# NAME + +CURLOPT_SSL_EC_CURVES - key exchange curves + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_EC_CURVES, char *alg_list); +~~~ + +# DESCRIPTION + +Pass a string as parameter with a colon delimited list of (EC) algorithms. This +option defines the client's key exchange algorithms in the SSL handshake (if +the SSL backend libcurl is built to use supports it). + +# DEFAULT + +"", embedded in SSL backend + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSL_EC_CURVES, "X25519:P-521"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.73.0. Supported by the OpenSSL backend. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3 b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3 deleted file mode 100644 index 346ca32bf..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_ENABLE_ALPN 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_ENABLE_ALPN \- Application Layer Protocol Negotiation -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn); -.fi -.SH DESCRIPTION -Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This -option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl -is built to use supports it), which can be used to negotiate http2. -.SH DEFAULT -1, enabled -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.36.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSL_ENABLE_NPN (3), -.BR CURLOPT_SSL_OPTIONS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.md b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.md new file mode 100644 index 000000000..e1b456a06 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.md @@ -0,0 +1,60 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_ENABLE_ALPN +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSL_ENABLE_NPN (3) + - CURLOPT_SSL_OPTIONS (3) +--- + +# NAME + +CURLOPT_SSL_ENABLE_ALPN - Application Layer Protocol Negotiation + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn); +~~~ + +# DESCRIPTION + +Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This +option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl +is built to use supports it), which can be used to negotiate http2. + +# DEFAULT + +1, enabled + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.36.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3 b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3 deleted file mode 100644 index 69fd82671..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_ENABLE_NPN 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_ENABLE_NPN \- use NPN -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_NPN, long npn); -.fi -.SH DESCRIPTION -Deprecated in 7.86.0. Setting this option has no function. - -Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This -option enables/disables NPN in the SSL handshake (if the SSL backend libcurl -is built to use supports it), which can be used to negotiate http2. -.SH DEFAULT -1, enabled -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_NPN, 1L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.36.0. Deprecated in 7.86.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSL_ENABLE_ALPN (3), -.BR CURLOPT_SSL_OPTIONS (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.md b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.md new file mode 100644 index 000000000..36221cabd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_ENABLE_NPN.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_ENABLE_NPN +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSL_ENABLE_ALPN (3) + - CURLOPT_SSL_OPTIONS (3) +--- + +# NAME + +CURLOPT_SSL_ENABLE_NPN - use NPN + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_NPN, long npn); +~~~ + +# DESCRIPTION + +Deprecated in 7.86.0. Setting this option has no function. + +Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This +option enables/disables NPN in the SSL handshake (if the SSL backend libcurl +is built to use supports it), which can be used to negotiate http2. + +# DEFAULT + +1, enabled + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_NPN, 1L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.36.0. Deprecated in 7.86.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.3 b/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.3 deleted file mode 100644 index 34d6633fc..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.3 +++ /dev/null @@ -1,64 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_FALSESTART 3 "14 Feb 2015" libcurl libcurl -.SH NAME -CURLOPT_SSL_FALSESTART \- TLS false start -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_FALSESTART, long enable); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1L to enable or 0 to disable. - -This option determines whether libcurl should use false start during the TLS -handshake. False start is a mode where a TLS client starts sending application -data before verifying the server's Finished message, thus saving a round trip -when performing a full handshake. -.SH DEFAULT -0 -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -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 -Added in 7.42.0. This option is currently only supported by the Secure -Transport (on iOS 7.0 or later, or OS X 10.9 or later) TLS backend. -.SH RETURN VALUE -Returns CURLE_OK if false start is supported by the SSL backend, otherwise -returns CURLE_NOT_BUILT_IN. -.SH SEE ALSO -.BR CURLOPT_TCP_FASTOPEN "(3), " diff --git a/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.md b/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.md new file mode 100644 index 000000000..084728c70 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_FALSESTART.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_FALSESTART +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TCP_FASTOPEN (3) +--- + +# NAME + +CURLOPT_SSL_FALSESTART - TLS false start + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_FALSESTART, long enable); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1L to enable or 0 to disable. + +This option determines whether libcurl should use false start during the TLS +handshake. False start is a mode where a TLS client starts sending application +data before verifying the server's Finished message, thus saving a round trip +when performing a full handshake. + +# DEFAULT + +0 + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.42.0. This option is currently only supported by the Secure +Transport (on iOS 7.0 or later, or OS X 10.9 or later) TLS backend. + +# RETURN VALUE + +Returns CURLE_OK if false start is supported by the SSL backend, otherwise +returns CURLE_NOT_BUILT_IN. diff --git a/docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_SSL_OPTIONS.md similarity index 60% rename from docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3 rename to docs/libcurl/opts/CURLOPT_SSL_OPTIONS.md index d131ac5d6..ffc62c33c 100644 --- a/docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3 +++ b/docs/libcurl/opts/CURLOPT_SSL_OPTIONS.md @@ -1,65 +1,67 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_OPTIONS 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_OPTIONS \- SSL behavior options -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSL_OPTIONS (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CIPHER_LIST (3) +--- + +# NAME + +CURLOPT_SSL_OPTIONS - SSL behavior options + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_OPTIONS, long bitmask); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long with a bitmask to tell libcurl about specific SSL behaviors. Available bits: -.IP CURLSSLOPT_ALLOW_BEAST + +## CURLSSLOPT_ALLOW_BEAST + Tells libcurl to not attempt to use any workarounds for a security flaw in the -SSL3 and TLS1.0 protocols. If this option is not used or this bit is set to 0, +SSL3 and TLS1.0 protocols. If this option is not used or this bit is set to 0, the SSL layer libcurl uses may use a work-around for this flaw although it might cause interoperability problems with some (older) SSL implementations. WARNING: avoiding this work-around lessens the security, and by setting this -option to 1 you ask for exactly that. This option is only supported for -Secure Transport and OpenSSL. -.IP CURLSSLOPT_NO_REVOKE +option to 1 you ask for exactly that. This option is only supported for Secure +Transport and OpenSSL. + +## CURLSSLOPT_NO_REVOKE + Tells libcurl to disable certificate revocation checks for those SSL backends where such behavior is present. This option is only supported for Schannel (the native Windows SSL library), with an exception in the case of Windows' Untrusted Publishers block list which it seems cannot be bypassed. (Added in 7.44.0) -.IP CURLSSLOPT_NO_PARTIALCHAIN + +## CURLSSLOPT_NO_PARTIALCHAIN + Tells libcurl to not accept "partial" certificate chains, which it otherwise does by default. This option is only supported for OpenSSL and fails the certificate verification if the chain ends with an intermediate certificate and not with a root cert. (Added in 7.68.0) -.IP CURLSSLOPT_REVOKE_BEST_EFFORT + +## CURLSSLOPT_REVOKE_BEST_EFFORT + Tells libcurl to ignore certificate revocation checks in case of missing or offline distribution points for those SSL backends where such behavior is present. This option is only supported for Schannel (the native Windows SSL -library). If combined with \fICURLSSLOPT_NO_REVOKE\fP, the latter takes +library). If combined with *CURLSSLOPT_NO_REVOKE*, the latter takes precedence. (Added in 7.70.0) -.IP CURLSSLOPT_NATIVE_CA + +## CURLSSLOPT_NATIVE_CA + Tell libcurl to use the operating system's native CA store for certificate verification. If you set this option and also set a CA certificate file or directory then during verification those certificates are searched in addition @@ -68,7 +70,9 @@ to the native CA store. Works with wolfSSL on Windows, Linux (Debian, Ubuntu, Gentoo, Fedora, RHEL), macOS, Android and iOS (added in 8.3.0), with GnuTLS (added in 8.5.0) or on Windows when built to use OpenSSL (Added in 7.71.0). -.IP CURLSSLOPT_AUTO_CLIENT_CERT + +## CURLSSLOPT_AUTO_CLIENT_CERT + Tell libcurl to automatically locate and use a client certificate for authentication, when requested by the server. This option is only supported for Schannel (the native Windows SSL library). Prior to 7.77.0 this was the @@ -76,12 +80,18 @@ default behavior in libcurl with Schannel. Since the server can request any certificate that supports client authentication in the OS certificate store it could be a privacy violation and unexpected. (Added in 7.77.0) -.SH DEFAULT + +# DEFAULT + 0 -.SH PROTOCOLS + +# PROTOCOLS + All TLS-based protocols -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -95,12 +105,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.25.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_OPTIONS (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.3 b/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.3 deleted file mode 100644 index de2839098..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_SESSIONID_CACHE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_SESSIONID_CACHE \- use the SSL session-ID cache -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_SESSIONID_CACHE, - long enabled); -.SH DESCRIPTION -Pass a long set to 0 to disable libcurl's use of SSL session-ID caching. Set -this to 1 to enable it. By default all transfers are done using the cache -enabled. While nothing ever should get hurt by attempting to reuse SSL -session-IDs, there seem to be or have been broken SSL implementations in the -wild that may require you to disable this in order for you to succeed. -.SH DEFAULT -1 -.SH PROTOCOLS -All TLS-based -.SH EXAMPLE -.nf -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 -Added in 7.16.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_DNS_CACHE_TIMEOUT (3), -.BR CURLOPT_MAXAGE_CONN (3), -.BR CURLOPT_MAXLIFETIME_CONN (3), -.BR CURLOPT_SSLVERSION (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.md b/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.md new file mode 100644 index 000000000..a6b3cf195 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_SESSIONID_CACHE.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_SESSIONID_CACHE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DNS_CACHE_TIMEOUT (3) + - CURLOPT_MAXAGE_CONN (3) + - CURLOPT_MAXLIFETIME_CONN (3) + - CURLOPT_SSLVERSION (3) +--- + +# NAME + +CURLOPT_SSL_SESSIONID_CACHE - use the SSL session-ID cache + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_SESSIONID_CACHE, + long enabled); +~~~ + +# DESCRIPTION + +Pass a long set to 0 to disable libcurl's use of SSL session-ID caching. Set +this to 1 to enable it. By default all transfers are done using the cache +enabled. While nothing ever should get hurt by attempting to reuse SSL +session-IDs, there seem to be or have been broken SSL implementations in the +wild that may require you to disable this in order for you to succeed. + +# DEFAULT + +1 + +# PROTOCOLS + +All TLS-based + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.16.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 b/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 rename to docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.md index 3bdf665de..742b01b9a 100644 --- a/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 +++ b/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.md @@ -1,38 +1,30 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_VERIFYHOST 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_VERIFYHOST \- verify the certificate's name against host -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_VERIFYHOST +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_PINNEDPUBLICKEY (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_SSL_VERIFYHOST - verify the certificate's name against host + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYHOST, long verify); -.fi -.SH DESCRIPTION -Pass a long as parameter specifying what to \fIverify\fP. +~~~ + +# DESCRIPTION + +Pass a long as parameter specifying what to *verify*. This option determines whether libcurl verifies that the server cert is for the server it is known as. @@ -40,7 +32,7 @@ the server it is known as. When negotiating TLS and SSL connections, the server sends a certificate indicating its identity. -When \fICURLOPT_SSL_VERIFYHOST(3)\fP is 2, that certificate must indicate that +When CURLOPT_SSL_VERIFYHOST(3) is 2, that certificate must indicate that the server is the server to which you meant to connect, or the connection fails. Simply put, it means it has to have the same name in the certificate as is in the URL you operate against. @@ -49,24 +41,23 @@ Curl considers the server the intended one when the Common Name field or a Subject Alternate Name field in the certificate matches the host name in the URL to which you told Curl to connect. -If \fIverify\fP value is set to 1: +If *verify* value is set to 1: In 7.28.0 and earlier: treated as a debug option of some sorts, not supported anymore due to frequently leading to programmer mistakes. -From 7.28.1 to 7.65.3: setting it to 1 made \fIcurl_easy_setopt(3)\fP return +From 7.28.1 to 7.65.3: setting it to 1 made curl_easy_setopt(3) return an error and leaving the flag untouched. From 7.66.0: treats 1 and 2 the same. -When the \fIverify\fP value is 0, the connection succeeds regardless of the +When the *verify* value is 0, the connection succeeds regardless of the names in the certificate. Use that ability with caution! The default value for this option is 2. This option controls checking the server's certificate's claimed identity. -The server could be lying. To control lying, see -\fICURLOPT_SSL_VERIFYPEER(3)\fP. +The server could be lying. To control lying, see CURLOPT_SSL_VERIFYPEER(3). WARNING: disabling verification of the certificate allows bad guys to man-in-the-middle the communication without you knowing it. Disabling @@ -78,18 +69,26 @@ When libcurl uses secure protocols it trusts responses and allows for example HSTS and Alt-Svc information to be stored and used subsequently. Disabling certificate verification can make libcurl trust and use such information from malicious servers. -.SH LIMITATIONS -Secure Transport: If \fIverify\fP value is 0, then SNI is also disabled. SNI is + +# LIMITATIONS + +Secure Transport: If *verify* value is 0, then SNI is also disabled. SNI is a TLS extension that sends the hostname to the server. The server may use that information to do such things as sending back a specific certificate for the hostname, or forwarding the request to a specific origin server. Some hostnames may be inaccessible if SNI is not sent. -.SH DEFAULT + +# DEFAULT + 2 -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -102,14 +101,14 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + If built TLS enabled. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not. -If 1 is set as argument, \fICURLE_BAD_FUNCTION_ARGUMENT\fP is returned. -.SH "SEE ALSO" -.BR CURLOPT_CAINFO (3), -.BR CURLOPT_PINNEDPUBLICKEY (3), -.BR CURLOPT_SSL_VERIFYPEER (3) +If 1 is set as argument, *CURLE_BAD_FUNCTION_ARGUMENT* is returned. diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 b/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.md similarity index 53% rename from docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 rename to docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.md index a5ec49b0a..7acadc8e7 100644 --- a/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 +++ b/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.md @@ -1,37 +1,32 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_VERIFYPEER 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_VERIFYPEER \- verify the peer's SSL certificate -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_VERIFYPEER +Section: 3 +Source: libcurl +See-also: + - CURLINFO_CAINFO (3) + - CURLINFO_CAPATH (3) + - CURLOPT_CAINFO (3) + - CURLOPT_PROXY_SSL_VERIFYHOST (3) + - CURLOPT_PROXY_SSL_VERIFYPEER (3) + - CURLOPT_SSL_VERIFYHOST (3) +--- + +# NAME + +CURLOPT_SSL_VERIFYPEER - verify the peer's SSL certificate + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a long as parameter to enable or disable. This option determines whether curl verifies the authenticity of the peer's @@ -43,10 +38,10 @@ i.e. that you can trust that the server is who the certificate says it is. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates you supply. curl uses a default bundle of CA certificates (the path for that is determined at build time) and you can -specify alternate certificates with the \fICURLOPT_CAINFO(3)\fP option or the -\fICURLOPT_CAPATH(3)\fP option. +specify alternate certificates with the CURLOPT_CAINFO(3) option or the +CURLOPT_CAPATH(3) option. -When \fICURLOPT_SSL_VERIFYPEER(3)\fP is enabled, and the verification fails to +When CURLOPT_SSL_VERIFYPEER(3) is enabled, and the verification fails to prove that the certificate is signed by a CA, the connection fails. When this option is disabled (set to zero), the CA certificates are not loaded @@ -54,9 +49,9 @@ and the peer certificate verification is simply skipped. Authenticating the certificate is not enough to be sure about the server. You typically also want to ensure that the server is the server you mean to be -talking to. Use \fICURLOPT_SSL_VERIFYHOST(3)\fP for that. The check that the +talking to. Use CURLOPT_SSL_VERIFYHOST(3) for that. The check that the host name in the certificate is valid for the host name you are connecting to -is done independently of the \fICURLOPT_SSL_VERIFYPEER(3)\fP option. +is done independently of the CURLOPT_SSL_VERIFYPEER(3) option. WARNING: disabling verification of the certificate allows bad guys to man-in-the-middle the communication without you knowing it. Disabling @@ -68,12 +63,18 @@ When libcurl uses secure protocols it trusts responses and allows for example HSTS and Alt-Svc information to be stored and used subsequently. Disabling certificate verification can make libcurl trust and use such information from malicious servers. -.SH DEFAULT + +# DEFAULT + 1 - enabled -.SH PROTOCOLS + +# PROTOCOLS + All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -86,15 +87,12 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + If built TLS enabled. -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_PROXY_SSL_VERIFYPEER (3), -.BR CURLOPT_PROXY_SSL_VERIFYHOST (3), -.BR CURLOPT_CAINFO (3), -.BR CURLINFO_CAINFO (3), -.BR CURLINFO_CAPATH (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3 b/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3 deleted file mode 100644 index 0bfe7da12..000000000 --- a/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SSL_VERIFYSTATUS 3 "04 Dec 2014" libcurl libcurl -.SH NAME -CURLOPT_SSL_VERIFYSTATUS \- verify the certificate's status -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYSTATUS, long verify); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1 to enable or 0 to disable. - -This option determines whether libcurl verifies the status of the server cert -using the "Certificate Status Request" TLS extension (aka. OCSP stapling). - -Note that if this option is enabled but the server does not support the TLS -extension, the verification fails. -.SH DEFAULT -0 -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - /* ask for OCSP stapling! */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1L); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.41.0. This option is currently only supported by the OpenSSL and -GnuTLS TLS backends. -.SH RETURN VALUE -Returns CURLE_OK if OCSP stapling is supported by the SSL backend, otherwise -returns CURLE_NOT_BUILT_IN. -.SH "SEE ALSO" -.BR CURLOPT_SSL_VERIFYHOST (3), -.BR CURLOPT_SSL_VERIFYPEER (3), -.BR CURLOPT_CAINFO (3) diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.md b/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.md new file mode 100644 index 000000000..66dbd7465 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SSL_VERIFYSTATUS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CAINFO (3) + - CURLOPT_SSL_VERIFYHOST (3) + - CURLOPT_SSL_VERIFYPEER (3) +--- + +# NAME + +CURLOPT_SSL_VERIFYSTATUS - verify the certificate's status + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYSTATUS, long verify); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1 to enable or 0 to disable. + +This option determines whether libcurl verifies the status of the server cert +using the "Certificate Status Request" TLS extension (aka. OCSP stapling). + +Note that if this option is enabled but the server does not support the TLS +extension, the verification fails. + +# DEFAULT + +0 + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + /* ask for OCSP stapling! */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1L); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.41.0. This option is currently only supported by the OpenSSL and +GnuTLS TLS backends. + +# RETURN VALUE + +Returns CURLE_OK if OCSP stapling is supported by the SSL backend, otherwise +returns CURLE_NOT_BUILT_IN. diff --git a/docs/libcurl/opts/CURLOPT_STDERR.3 b/docs/libcurl/opts/CURLOPT_STDERR.3 deleted file mode 100644 index 79a97d45c..000000000 --- a/docs/libcurl/opts/CURLOPT_STDERR.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_STDERR 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_STDERR \- redirect stderr to another stream -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream); -.fi -.SH DESCRIPTION -Pass a FILE * as parameter. Tell libcurl to use this \fIstream\fP instead of -stderr when showing the progress meter and displaying \fICURLOPT_VERBOSE(3)\fP -data. - -If you are using libcurl as a Windows DLL, this option causes an exception and -a crash in the library since it cannot access a FILE * passed on from the -application. A work-around is to instead use \fICURLOPT_DEBUGFUNCTION(3)\fP. -.SH DEFAULT -stderr -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_VERBOSE (3), -.BR CURLOPT_NOPROGRESS (3), -.BR CURLOPT_DEBUGFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_STDERR.md b/docs/libcurl/opts/CURLOPT_STDERR.md new file mode 100644 index 000000000..a20e50366 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_STDERR.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_STDERR +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_NOPROGRESS (3) + - CURLOPT_VERBOSE (3) +--- + +# NAME + +CURLOPT_STDERR - redirect stderr to another stream + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream); +~~~ + +# DESCRIPTION + +Pass a FILE * as parameter. Tell libcurl to use this *stream* instead of +stderr when showing the progress meter and displaying CURLOPT_VERBOSE(3) +data. + +If you are using libcurl as a Windows DLL, this option causes an exception and +a crash in the library since it cannot access a FILE * passed on from the +application. A work-around is to instead use CURLOPT_DEBUGFUNCTION(3). + +# DEFAULT + +stderr + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.3 b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.3 deleted file mode 100644 index 48276467c..000000000 --- a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_STREAM_DEPENDS 3 "13 Sep 2015" libcurl libcurl -.SH NAME -CURLOPT_STREAM_DEPENDS \- stream this transfer depends on -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS, - CURL *dephandle); -.fi -.SH DESCRIPTION -Pass a CURL * pointer in \fIdephandle\fP to identify the stream within the -same connection that this stream is depending upon. This option clears the -exclusive bit and is mutually exclusive to the -\fICURLOPT_STREAM_DEPENDS_E(3)\fP option. - -The spec says "Including a dependency expresses a preference to allocate -resources to the identified stream rather than to the dependent stream." - -This option can be set during transfer. - -\fIdephandle\fP must not be the same as \fIhandle\fP, that makes this function -return an error. It must be another easy handle, and it also needs to be a -handle of a transfer that is about to be sent over the same HTTP/2 connection -for this option to have an actual effect. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP/2 -.SH EXAMPLE -.nf -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); - - /* then add both to a multi handle and transfer them! */ - } -} -.fi -.SH AVAILABILITY -Added in 7.46.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_STREAM_DEPENDS_E (3), -.BR CURLOPT_STREAM_WEIGHT (3) diff --git a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.md b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.md new file mode 100644 index 000000000..ba2489a30 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_STREAM_DEPENDS +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_STREAM_DEPENDS_E (3) + - CURLOPT_STREAM_WEIGHT (3) +--- + +# NAME + +CURLOPT_STREAM_DEPENDS - stream this transfer depends on + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS, + CURL *dephandle); +~~~ + +# DESCRIPTION + +Pass a CURL pointer in *dephandle* to identify the stream within the same +connection that this stream is depending upon. This option clears the +exclusive bit and is mutually exclusive to the CURLOPT_STREAM_DEPENDS_E(3) +option. + +The spec says "Including a dependency expresses a preference to allocate +resources to the identified stream rather than to the dependent stream." + +This option can be set during transfer. + +*dephandle* must not be the same as *handle*, that makes this function return +an error. It must be another easy handle, and it also needs to be a handle of +a transfer that is about to be sent over the same HTTP/2 connection for this +option to have an actual effect. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP/2 + +# EXAMPLE + +~~~c +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); + + /* then add both to a multi handle and transfer them! */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.46.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3 b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3 deleted file mode 100644 index c26ba812d..000000000 --- a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_STREAM_DEPENDS_E 3 "13 Sep 2015" libcurl libcurl -.SH NAME -CURLOPT_STREAM_DEPENDS_E \- stream this transfer depends on exclusively -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS_E, - CURL *dephandle); -.fi -.SH DESCRIPTION -Pass a CURL * pointer in \fIdephandle\fP to identify the stream within the -same connection that this stream is depending upon exclusively. That means it -depends on it and sets the Exclusive bit. - -The spec says "Including a dependency expresses a preference to allocate -resources to the identified stream rather than to the dependent stream." - -Setting a dependency with the exclusive flag for a reprioritized stream causes -all the dependencies of the new parent stream to become dependent on the -reprioritized stream. - -This option can be set during transfer. - -\fIdephandle\fP must not be the same as \fIhandle\fP, that makes this function -return an error. It must be another easy handle, and it also needs to be a -handle of a transfer that is about to be sent over the same HTTP/2 connection -for this option to have an actual effect. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP/2 -.SH EXAMPLE -.nf -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); - - /* then add both to a multi handle and transfer them! */ - } -} -.fi -.SH AVAILABILITY -Added in 7.46.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLOPT_HTTP_VERSION (3), -.BR CURLOPT_STREAM_DEPENDS (3), -.BR CURLOPT_STREAM_WEIGHT (3) diff --git a/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.md b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.md new file mode 100644 index 000000000..e8dbc113f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_STREAM_DEPENDS_E.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_STREAM_DEPENDS_E +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLOPT_HTTP_VERSION (3) + - CURLOPT_STREAM_DEPENDS (3) + - CURLOPT_STREAM_WEIGHT (3) +--- + +# NAME + +CURLOPT_STREAM_DEPENDS_E - stream this transfer depends on exclusively + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_DEPENDS_E, + CURL *dephandle); +~~~ + +# DESCRIPTION + +Pass a CURL pointer in *dephandle* to identify the stream within the same +connection that this stream is depending upon exclusively. That means it +depends on it and sets the Exclusive bit. + +The spec says "Including a dependency expresses a preference to allocate +resources to the identified stream rather than to the dependent stream." + +Setting a dependency with the exclusive flag for a reprioritized stream causes +all the dependencies of the new parent stream to become dependent on the +reprioritized stream. + +This option can be set during transfer. + +*dephandle* must not be the same as *handle*, that makes this function return +an error. It must be another easy handle, and it also needs to be a handle of +a transfer that is about to be sent over the same HTTP/2 connection for this +option to have an actual effect. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP/2 + +# EXAMPLE + +~~~c +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); + + /* then add both to a multi handle and transfer them! */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.46.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3 b/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3 deleted file mode 100644 index 7534d1d59..000000000 --- a/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_STREAM_WEIGHT 3 "13 Sep 2015" libcurl libcurl -.SH NAME -CURLOPT_STREAM_WEIGHT \- numerical stream weight -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_WEIGHT, long weight); -.fi -.SH DESCRIPTION -Set the long \fIweight\fP to a number between 1 and 256. - -When using HTTP/2, this option sets the individual weight for this particular -stream used by the easy \fIhandle\fP. Setting and using weights only makes -sense and is only usable when doing multiple streams over the same -connections, which thus implies that you use \fICURLMOPT_PIPELINING(3)\fP. - -This option can be set during transfer and causes the updated weight info get -sent to the server the next time an HTTP/2 frame is sent to the server. - -See section 5.3 of RFC 7540 for protocol details. - -Streams with the same parent should be allocated resources proportionally -based on their weight. So if you have two streams going, stream A with weight -16 and stream B with weight 32, stream B gets two thirds (32/48) of the -available bandwidth (assuming the server can send off the data equally for -both streams). -.SH DEFAULT -If nothing is set, the HTTP/2 protocol itself uses its own default which is -16. -.SH PROTOCOLS -HTTP/2 -.SH EXAMPLE -.nf -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); - - /* then add both to a multi handle and transfer them! */ - } -} -.fi -.SH AVAILABILITY -Added in 7.46.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLMOPT_PIPELINING (3), -.BR CURLOPT_PIPEWAIT (3), -.BR CURLOPT_STREAM_DEPENDS (3), -.BR CURLOPT_STREAM_DEPENDS_E (3) diff --git a/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.md b/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.md new file mode 100644 index 000000000..3e1e9d5b3 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.md @@ -0,0 +1,81 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_STREAM_WEIGHT +Section: 3 +Source: libcurl +See-also: + - CURLMOPT_PIPELINING (3) + - CURLOPT_PIPEWAIT (3) + - CURLOPT_STREAM_DEPENDS (3) + - CURLOPT_STREAM_DEPENDS_E (3) +--- + +# NAME + +CURLOPT_STREAM_WEIGHT - numerical stream weight + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_WEIGHT, long weight); +~~~ + +# DESCRIPTION + +Set the long *weight* to a number between 1 and 256. + +When using HTTP/2, this option sets the individual weight for this particular +stream used by the easy *handle*. Setting and using weights only makes +sense and is only usable when doing multiple streams over the same +connections, which thus implies that you use CURLMOPT_PIPELINING(3). + +This option can be set during transfer and causes the updated weight info get +sent to the server the next time an HTTP/2 frame is sent to the server. + +See section 5.3 of RFC 7540 for protocol details. + +Streams with the same parent should be allocated resources proportionally +based on their weight. So if you have two streams going, stream A with weight +16 and stream B with weight 32, stream B gets two thirds (32/48) of the +available bandwidth (assuming the server can send off the data equally for +both streams). + +# DEFAULT + +If nothing is set, the HTTP/2 protocol itself uses its own default which is +16. + +# PROTOCOLS + +HTTP/2 + +# EXAMPLE + +~~~c +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); + + /* then add both to a multi handle and transfer them! */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.46.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3 b/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3 deleted file mode 100644 index 15b73917d..000000000 --- a/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3 +++ /dev/null @@ -1,101 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_SUPPRESS_CONNECT_HEADERS 3 "13 February 2017" libcurl libcurl -.SH NAME -CURLOPT_SUPPRESS_CONNECT_HEADERS \- suppress proxy CONNECT response headers from user callbacks -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff); -.fi -.SH DESCRIPTION -When \fICURLOPT_HTTPPROXYTUNNEL(3)\fP is used and a CONNECT request is made, -suppress proxy CONNECT response headers from the user callback functions -\fICURLOPT_HEADERFUNCTION(3)\fP and \fICURLOPT_WRITEFUNCTION(3)\fP. - -Proxy CONNECT response headers can complicate header processing since it's -essentially a separate set of headers. You can enable this option to suppress -those headers. - -For example let's assume an HTTPS URL is to be retrieved via CONNECT. On -success there would normally be two sets of headers, and each header line sent -to the header function and/or the write function. The data given to the -callbacks would look like this: - -.nf -HTTP/1.1 200 Connection established -{headers}... - -HTTP/1.1 200 OK -Content-Type: application/json -{headers}... - -{body}... -.fi - -However by enabling this option the CONNECT response headers are suppressed, so -the data given to the callbacks would look like this: - -.nf -HTTP/1.1 200 OK -Content-Type: application/json -{headers}... - -{body}... -.fi - -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.54.0 -.SH RETURN VALUE -CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. -.SH "SEE ALSO" -.BR CURLOPT_HEADER (3), -.BR CURLOPT_PROXY (3), -.BR CURLOPT_HTTPPROXYTUNNEL (3) diff --git a/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.md b/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.md new file mode 100644 index 000000000..19789de29 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.md @@ -0,0 +1,103 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_SUPPRESS_CONNECT_HEADERS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADER (3) + - CURLOPT_HTTPPROXYTUNNEL (3) + - CURLOPT_PROXY (3) +--- + +# NAME + +CURLOPT_SUPPRESS_CONNECT_HEADERS - suppress proxy CONNECT response headers + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff); +~~~ + +# DESCRIPTION + +When CURLOPT_HTTPPROXYTUNNEL(3) is used and a CONNECT request is made, +suppress proxy CONNECT response headers from the user callback functions +CURLOPT_HEADERFUNCTION(3) and CURLOPT_WRITEFUNCTION(3). + +Proxy CONNECT response headers can complicate header processing since it's +essentially a separate set of headers. You can enable this option to suppress +those headers. + +For example let's assume an HTTPS URL is to be retrieved via CONNECT. On +success there would normally be two sets of headers, and each header line sent +to the header function and/or the write function. The data given to the +callbacks would look like this: + +~~~c +HTTP/1.1 200 Connection established +{headers} +... + +HTTP/1.1 200 OK +Content-Type: application/json +{headers} +... + +{body} +... +~~~ + +However by enabling this option the CONNECT response headers are suppressed, +so the data given to the callbacks would look like this: + +~~~c +HTTP/1.1 200 OK +Content-Type: application/json +{headers} +... + +{body} +... +~~~ + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.54.0 + +# RETURN VALUE + +CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. diff --git a/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3 b/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3 deleted file mode 100644 index 53e0fc59d..000000000 --- a/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TCP_FASTOPEN 3 "16 Feb 2016" libcurl libcurl -.SH NAME -CURLOPT_TCP_FASTOPEN \- TCP Fast Open -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long enable); -.fi -.SH DESCRIPTION -Pass a long as parameter set to 1L to enable or 0 to disable. - -TCP Fast Open (RFC 7413) is a mechanism that allows data to be carried in the -SYN and SYN-ACK packets and consumed by the receiving end during the initial -connection handshake, saving up to one full round-trip time (RTT). - -Beware: the TLS session cache does not work when TCP Fast Open is enabled. TCP -Fast Open is also known to be problematic on or across certain networks. -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Added in 7.49.0. This option is currently only supported on Linux and macOS -10.11 or later. -.SH RETURN VALUE -Returns CURLE_OK if fast open is supported by the operating system, otherwise -returns CURLE_NOT_BUILT_IN. -.SH SEE ALSO -.BR CURLOPT_SSL_FALSESTART "(3), " diff --git a/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.md b/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.md new file mode 100644 index 000000000..4db103b4b --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TCP_FASTOPEN +Section: 3 +Source: libcurl +See-also: + - CURLOPT_SSL_FALSESTART (3) +--- + +# NAME + +CURLOPT_TCP_FASTOPEN - TCP Fast Open + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long enable); +~~~ + +# DESCRIPTION + +Pass a long as parameter set to 1L to enable or 0 to disable. + +TCP Fast Open (RFC 7413) is a mechanism that allows data to be carried in the +SYN and SYN-ACK packets and consumed by the receiving end during the initial +connection handshake, saving up to one full round-trip time (RTT). + +Beware: the TLS session cache does not work when TCP Fast Open is enabled. TCP +Fast Open is also known to be problematic on or across certain networks. + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.49.0. This option is currently only supported on Linux and macOS +10.11 or later. + +# RETURN VALUE + +Returns CURLE_OK if fast open is supported by the operating system, otherwise +returns CURLE_NOT_BUILT_IN. diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 deleted file mode 100644 index 04e3ecb58..000000000 --- a/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TCP_KEEPALIVE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TCP_KEEPALIVE \- TCP keep-alive probing -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPALIVE, long probe); -.fi -.SH DESCRIPTION -Pass a long. If set to 1, TCP keepalive probes are used. The delay and -frequency of these probes can be controlled by the -\fICURLOPT_TCP_KEEPIDLE(3)\fP and \fICURLOPT_TCP_KEEPINTVL(3)\fP options, -provided the operating system supports them. Set to 0 (default behavior) to -disable keepalive probes -.SH DEFAULT -0 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* 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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.25.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_TCP_KEEPIDLE (3), -.BR CURLOPT_TCP_KEEPINTVL (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_MAX_RECV_SPEED_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.md b/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.md new file mode 100644 index 000000000..090431993 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TCP_KEEPALIVE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_MAX_RECV_SPEED_LARGE (3) + - CURLOPT_TCP_KEEPIDLE (3) + - CURLOPT_TCP_KEEPINTVL (3) +--- + +# NAME + +CURLOPT_TCP_KEEPALIVE - TCP keep-alive probing + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPALIVE, long probe); +~~~ + +# DESCRIPTION + +Pass a long. If set to 1, TCP keepalive probes are used. The delay and +frequency of these probes can be controlled by the +CURLOPT_TCP_KEEPIDLE(3) and CURLOPT_TCP_KEEPINTVL(3) options, +provided the operating system supports them. Set to 0 (default behavior) to +disable keepalive probes + +# DEFAULT + +0 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* 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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.25.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 deleted file mode 100644 index f845b73c5..000000000 --- a/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TCP_KEEPIDLE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TCP_KEEPIDLE \- TCP keep-alive idle time wait -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long delay); -.fi -.SH DESCRIPTION -Pass a long. Sets the \fIdelay\fP, in seconds, to wait while the connection is -idle before sending keepalive probes. Not all operating systems support this -option. - -The maximum value this accepts is 2147483648. Any larger value is capped to -this amount. -.SH DEFAULT -60 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* 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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.25.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_TCP_KEEPALIVE (3), -.BR CURLOPT_TCP_KEEPINTVL (3) diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.md b/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.md new file mode 100644 index 000000000..d8418ffb2 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TCP_KEEPIDLE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TCP_KEEPALIVE (3) + - CURLOPT_TCP_KEEPINTVL (3) +--- + +# NAME + +CURLOPT_TCP_KEEPIDLE - TCP keep-alive idle time wait + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long delay); +~~~ + +# DESCRIPTION + +Pass a long. Sets the *delay*, in seconds, to wait while the connection is +idle before sending keepalive probes. Not all operating systems support this +option. + +The maximum value this accepts is 2147483648. Any larger value is capped to +this amount. + +# DEFAULT + +60 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* 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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.25.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 deleted file mode 100644 index e3bbbc24d..000000000 --- a/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TCP_KEEPINTVL 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TCP_KEEPINTVL \- TCP keep-alive interval -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPINTVL, long interval); -.fi -.SH DESCRIPTION -Pass a long. Sets the interval, in seconds, to wait between sending keepalive -probes. Not all operating systems support this option. (Added in 7.25.0) - -The maximum value this accepts is 2147483648. Any larger value is capped to -this amount. -.SH DEFAULT -60 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* 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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_TCP_KEEPALIVE (3), -.BR CURLOPT_TCP_KEEPIDLE (3) diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.md b/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.md new file mode 100644 index 000000000..d560cf516 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TCP_KEEPINTVL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TCP_KEEPALIVE (3) + - CURLOPT_TCP_KEEPIDLE (3) +--- + +# NAME + +CURLOPT_TCP_KEEPINTVL - TCP keep-alive interval + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPINTVL, long interval); +~~~ + +# DESCRIPTION + +Pass a long. Sets the interval, in seconds, to wait between sending keepalive +probes. Not all operating systems support this option. (Added in 7.25.0) + +The maximum value this accepts is 2147483648. Any larger value is capped to +this amount. + +# DEFAULT + +60 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* 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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TCP_NODELAY.3 b/docs/libcurl/opts/CURLOPT_TCP_NODELAY.3 deleted file mode 100644 index 6166f7847..000000000 --- a/docs/libcurl/opts/CURLOPT_TCP_NODELAY.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TCP_NODELAY 3 "30 Jun 2016" libcurl libcurl -.SH NAME -CURLOPT_TCP_NODELAY \- the TCP_NODELAY option -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long nodelay); -.fi -.SH DESCRIPTION -Pass a long specifying whether the \fITCP_NODELAY\fP option is to be set or -cleared (1L = set, 0 = clear). The option is set by default. This has no -effect after the connection has been established. - -Setting this option to 1L disables TCP's Nagle algorithm on connections -created using this handle. The purpose of this algorithm is to try to minimize -the number of small packets on the network (where "small packets" means TCP -segments less than the Maximum Segment Size for the network). - -Maximizing the amount of data sent per TCP segment is good because it -amortizes the overhead of the send. However, in some cases small segments may -need to be sent without delay. This is less efficient than sending larger -amounts of data at a time, and can contribute to congestion on the network if -overdone. -.SH DEFAULT -1 -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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 -Always. The default was changed to 1 from 0 in 7.50.2. -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_BUFFERSIZE (3), -.BR CURLOPT_SOCKOPTFUNCTION (3), -.BR CURLOPT_TCP_KEEPALIVE (3) diff --git a/docs/libcurl/opts/CURLOPT_TCP_NODELAY.md b/docs/libcurl/opts/CURLOPT_TCP_NODELAY.md new file mode 100644 index 000000000..7fe286d26 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TCP_NODELAY.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TCP_NODELAY +Section: 3 +Source: libcurl +See-also: + - CURLOPT_BUFFERSIZE (3) + - CURLOPT_SOCKOPTFUNCTION (3) + - CURLOPT_TCP_KEEPALIVE (3) +--- + +# NAME + +CURLOPT_TCP_NODELAY - the TCP_NODELAY option + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long nodelay); +~~~ + +# DESCRIPTION + +Pass a long specifying whether the *TCP_NODELAY* option is to be set or +cleared (1L = set, 0 = clear). The option is set by default. This has no +effect after the connection has been established. + +Setting this option to 1L disables TCP's Nagle algorithm on connections +created using this handle. The purpose of this algorithm is to try to minimize +the number of small packets on the network (where "small packets" means TCP +segments less than the Maximum Segment Size for the network). + +Maximizing the amount of data sent per TCP segment is good because it +amortizes the overhead of the send. However, in some cases small segments may +need to be sent without delay. This is less efficient than sending larger +amounts of data at a time, and can contribute to congestion on the network if +overdone. + +# DEFAULT + +1 + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Always. The default was changed to 1 from 0 in 7.50.2. + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3 b/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3 deleted file mode 100644 index f42e5a42a..000000000 --- a/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TELNETOPTIONS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TELNETOPTIONS \- set of telnet options -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TELNETOPTIONS, - struct curl_slist *cmds); -.fi -.SH DESCRIPTION -Provide a pointer to a curl_slist with variables to pass to the telnet -negotiations. The variables should be in the format . libcurl -supports the options \fBTTYPE\fP, \fBXDISPLOC\fP and \fBNEW_ENV\fP. See the -TELNET standard for details. -.SH DEFAULT -NULL -.SH PROTOCOLS -TELNET -.SH EXAMPLE -.nf -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 -Along with TELNET -.SH RETURN VALUE -Returns CURLE_OK if TELNET is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_QUOTE (3) diff --git a/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.md b/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.md new file mode 100644 index 000000000..e1db12ed8 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TELNETOPTIONS.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TELNETOPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPHEADER (3) + - CURLOPT_QUOTE (3) +--- + +# NAME + +CURLOPT_TELNETOPTIONS - set of telnet options + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TELNETOPTIONS, + struct curl_slist *cmds); +~~~ + +# DESCRIPTION + +Provide a pointer to a curl_slist with variables to pass to the telnet +negotiations. The variables should be in the format . libcurl +supports the options **TTYPE**, **XDISPLOC** and **NEW_ENV**. See the +TELNET standard for details. + +# DEFAULT + +NULL + +# PROTOCOLS + +TELNET + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with TELNET + +# RETURN VALUE + +Returns CURLE_OK if TELNET is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3 b/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3 deleted file mode 100644 index 3b66a4ce3..000000000 --- a/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TFTP_BLKSIZE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TFTP_BLKSIZE \- TFTP block size -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_BLKSIZE, long blocksize); -.fi -.SH DESCRIPTION -Specify \fIblocksize\fP to use for TFTP data transmission. Valid range as per -RFC 2348 is 8-65464 bytes. The default of 512 bytes is used if this option is -not specified. The specified block size is only used if supported by the -remote server. If the server does not return an option acknowledgment or -returns an option acknowledgment with no block size, the default of 512 bytes -is used. -.SH DEFAULT -512 -.SH PROTOCOLS -TFTP -.SH EXAMPLE -.nf -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 -Added in 7.19.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_MAXFILESIZE (3) diff --git a/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.md b/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.md new file mode 100644 index 000000000..07cbebae4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TFTP_BLKSIZE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAXFILESIZE (3) +--- + +# NAME + +CURLOPT_TFTP_BLKSIZE - TFTP block size + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_BLKSIZE, long blocksize); +~~~ + +# DESCRIPTION + +Specify *blocksize* to use for TFTP data transmission. Valid range as per +RFC 2348 is 8-65464 bytes. The default of 512 bytes is used if this option is +not specified. The specified block size is only used if supported by the +remote server. If the server does not return an option acknowledgment or +returns an option acknowledgment with no block size, the default of 512 bytes +is used. + +# DEFAULT + +512 + +# PROTOCOLS + +TFTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 deleted file mode 100644 index 70d4c3f44..000000000 --- a/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TFTP_NO_OPTIONS 3 "23 Feb 2016" libcurl libcurl -.SH NAME -CURLOPT_TFTP_NO_OPTIONS \- send no TFTP options requests -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff); -.fi -.SH DESCRIPTION -Set \fIonoff\fP to 1L to exclude all TFTP options defined in RFC 2347, -RFC 2348 and RFC 2349 from read and write requests. - -This option improves interoperability with legacy servers that do not -acknowledge or properly implement TFTP options. When this option is used -\fICURLOPT_TFTP_BLKSIZE(3)\fP is ignored. -.SH DEFAULT -0 -.SH PROTOCOLS -TFTP -.SH EXAMPLE -.nf -size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp) -{ - return fwrite(ptr, size, nmemb, (FILE *)fp); -} - -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"); - - /* do not send TFTP options requests */ - curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L); - - /* Perform the request */ - curl_easy_perform(curl); - - fclose(fp); - } - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.48.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH SEE ALSO -.BR CURLOPT_TFTP_BLKSIZE "(3), " diff --git a/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.md b/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.md new file mode 100644 index 000000000..fd4e4921f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.md @@ -0,0 +1,78 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TFTP_NO_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TFTP_BLKSIZE (3) +--- + +# NAME + +CURLOPT_TFTP_NO_OPTIONS - send no TFTP options requests + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_NO_OPTIONS, long onoff); +~~~ + +# DESCRIPTION + +Set *onoff* to 1L to exclude all TFTP options defined in RFC 2347, +RFC 2348 and RFC 2349 from read and write requests. + +This option improves interoperability with legacy servers that do not +acknowledge or properly implement TFTP options. When this option is used +CURLOPT_TFTP_BLKSIZE(3) is ignored. + +# DEFAULT + +0 + +# PROTOCOLS + +TFTP + +# EXAMPLE + +~~~c +size_t write_callback(char *ptr, size_t size, size_t nmemb, void *fp) +{ + return fwrite(ptr, size, nmemb, (FILE *)fp); +} + +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"); + + /* do not send TFTP options requests */ + curl_easy_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L); + + /* Perform the request */ + curl_easy_perform(curl); + + fclose(fp); + } + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.48.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TIMECONDITION.3 b/docs/libcurl/opts/CURLOPT_TIMECONDITION.3 deleted file mode 100644 index 14c901a16..000000000 --- a/docs/libcurl/opts/CURLOPT_TIMECONDITION.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TIMECONDITION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TIMECONDITION \- select condition for a time request -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond); -.fi -.SH DESCRIPTION -Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE(3)\fP time -value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP -or \fICURL_TIMECOND_IFUNMODSINCE\fP. - -The last modification time of a file is not always known and in such instances -this feature has no effect even if the given time condition would not have -been met. \fIcurl_easy_getinfo(3)\fP with the \fICURLINFO_CONDITION_UNMET\fP -option can be used after a transfer to learn if a zero-byte successful -"transfer" was due to this condition not matching. -.SH DEFAULT -CURL_TIMECOND_NONE (0) -.SH PROTOCOLS -HTTP, FTP, RTSP, and FILE -.SH EXAMPLE -.nf -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); - - /* If-Modified-Since the above time stamp */ - curl_easy_setopt(curl, CURLOPT_TIMECONDITION, - (long)CURL_TIMECOND_IFMODSINCE); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_TIMEVALUE (3), -.BR CURLINFO_FILETIME (3) diff --git a/docs/libcurl/opts/CURLOPT_TIMECONDITION.md b/docs/libcurl/opts/CURLOPT_TIMECONDITION.md new file mode 100644 index 000000000..80d93a516 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMECONDITION.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TIMECONDITION +Section: 3 +Source: libcurl +See-also: + - CURLINFO_FILETIME (3) + - CURLOPT_TIMEVALUE (3) +--- + +# NAME + +CURLOPT_TIMECONDITION - select condition for a time request + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond); +~~~ + +# DESCRIPTION + +Pass a long as parameter. This defines how the CURLOPT_TIMEVALUE(3) time +value is treated. You can set this parameter to *CURL_TIMECOND_IFMODSINCE* +or *CURL_TIMECOND_IFUNMODSINCE*. + +The last modification time of a file is not always known and in such instances +this feature has no effect even if the given time condition would not have +been met. curl_easy_getinfo(3) with the *CURLINFO_CONDITION_UNMET* +option can be used after a transfer to learn if a zero-byte successful +"transfer" was due to this condition not matching. + +# DEFAULT + +CURL_TIMECOND_NONE (0) + +# PROTOCOLS + +HTTP, FTP, RTSP, and FILE + +# EXAMPLE + +~~~c +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); + + /* If-Modified-Since the above time stamp */ + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, + (long)CURL_TIMECOND_IFMODSINCE); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_TIMEOUT.3 b/docs/libcurl/opts/CURLOPT_TIMEOUT.3 deleted file mode 100644 index 3d608bab4..000000000 --- a/docs/libcurl/opts/CURLOPT_TIMEOUT.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TIMEOUT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TIMEOUT \- maximum time the transfer is allowed to complete -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT, long timeout); -.fi -.SH DESCRIPTION -Pass a long as parameter containing \fItimeout\fP - the maximum time in -seconds that you allow the entire transfer operation to take. The whole thing, -from start to end. Normally, name lookups can take a considerable time and -limiting operations risk aborting perfectly normal operations. - -\fICURLOPT_TIMEOUT_MS(3)\fP is the same function but set in milliseconds. - -If both \fICURLOPT_TIMEOUT(3)\fP and \fICURLOPT_TIMEOUT_MS(3)\fP are set, the -value set last is used. - -Since this option puts a hard limit on how long time a request is allowed to -take, it has limited use in dynamic use cases with varying transfer -times. That is especially apparent when using the multi interface, which may -queue the transfer, and that time is included. You are advised to explore -\fICURLOPT_LOW_SPEED_LIMIT(3)\fP, \fICURLOPT_LOW_SPEED_TIME(3)\fP or using -\fICURLOPT_PROGRESSFUNCTION(3)\fP to implement your own timeout logic. - -The connection timeout set with \fICURLOPT_CONNECTTIMEOUT(3)\fP is included in -this general all-covering timeout. - -With \fICURLOPT_CONNECTTIMEOUT(3)\fP set to 3 and \fICURLOPT_TIMEOUT(3)\fP set -to 5, the operation can never last longer than 5 seconds. - -With \fICURLOPT_CONNECTTIMEOUT(3)\fP set to 4 and \fICURLOPT_TIMEOUT(3)\fP set -to 2, the operation can never last longer than 2 seconds. - -This option may cause libcurl to use the SIGALRM signal to timeout system -calls on builds not using asynch DNS. In unix-like systems, this might cause -signals to be used unless \fICURLOPT_NOSIGNAL(3)\fP is set. -.SH DEFAULT -Default timeout is 0 (zero) which means it never times out during transfer. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative -value or a value that when converted to milliseconds is too large. -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TCP_KEEPALIVE (3), -.BR CURLOPT_TIMEOUT_MS (3) diff --git a/docs/libcurl/opts/CURLOPT_TIMEOUT.md b/docs/libcurl/opts/CURLOPT_TIMEOUT.md new file mode 100644 index 000000000..02a3d3dbe --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMEOUT.md @@ -0,0 +1,90 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TIMEOUT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TCP_KEEPALIVE (3) + - CURLOPT_TIMEOUT_MS (3) +--- + +# NAME + +CURLOPT_TIMEOUT - maximum time the transfer is allowed to complete + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT, long timeout); +~~~ + +# DESCRIPTION + +Pass a long as parameter containing *timeout* - the maximum time in +seconds that you allow the entire transfer operation to take. The whole thing, +from start to end. Normally, name lookups can take a considerable time and +limiting operations risk aborting perfectly normal operations. + +CURLOPT_TIMEOUT_MS(3) is the same function but set in milliseconds. + +If both CURLOPT_TIMEOUT(3) and CURLOPT_TIMEOUT_MS(3) are set, the +value set last is used. + +Since this option puts a hard limit on how long time a request is allowed to +take, it has limited use in dynamic use cases with varying transfer +times. That is especially apparent when using the multi interface, which may +queue the transfer, and that time is included. You are advised to explore +CURLOPT_LOW_SPEED_LIMIT(3), CURLOPT_LOW_SPEED_TIME(3) or using +CURLOPT_PROGRESSFUNCTION(3) to implement your own timeout logic. + +The connection timeout set with CURLOPT_CONNECTTIMEOUT(3) is included in +this general all-covering timeout. + +With CURLOPT_CONNECTTIMEOUT(3) set to 3 and CURLOPT_TIMEOUT(3) set +to 5, the operation can never last longer than 5 seconds. + +With CURLOPT_CONNECTTIMEOUT(3) set to 4 and CURLOPT_TIMEOUT(3) set +to 2, the operation can never last longer than 2 seconds. + +This option may cause libcurl to use the SIGALRM signal to timeout system +calls on builds not using asynch DNS. In unix-like systems, this might cause +signals to be used unless CURLOPT_NOSIGNAL(3) is set. + +# DEFAULT + +Default timeout is 0 (zero) which means it never times out during transfer. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative +value or a value that when converted to milliseconds is too large. diff --git a/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3 b/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3 deleted file mode 100644 index a829881eb..000000000 --- a/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TIMEOUT_MS 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TIMEOUT_MS \- maximum time the transfer is allowed to complete -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT_MS, long timeout); -.fi -.SH DESCRIPTION -Pass a long as parameter containing \fItimeout\fP - the maximum time in -milliseconds that you allow the libcurl transfer operation to take. - -See \fICURLOPT_TIMEOUT(3)\fP for details. -.SH DEFAULT -Default timeout is 0 (zero) which means it never times out during transfer. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_CONNECTTIMEOUT (3), -.BR CURLOPT_LOW_SPEED_LIMIT (3), -.BR CURLOPT_TCP_KEEPALIVE (3), -.BR CURLOPT_TIMEOUT (3) diff --git a/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.md b/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.md new file mode 100644 index 000000000..0bb037f7c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.md @@ -0,0 +1,64 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TIMEOUT_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECTTIMEOUT (3) + - CURLOPT_LOW_SPEED_LIMIT (3) + - CURLOPT_TCP_KEEPALIVE (3) + - CURLOPT_TIMEOUT (3) +--- + +# NAME + +CURLOPT_TIMEOUT_MS - maximum time the transfer is allowed to complete + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT_MS, long timeout); +~~~ + +# DESCRIPTION + +Pass a long as parameter containing *timeout* - the maximum time in +milliseconds that you allow the libcurl transfer operation to take. + +See CURLOPT_TIMEOUT(3) for details. + +# DEFAULT + +Default timeout is 0 (zero) which means it never times out during transfer. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 b/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 deleted file mode 100644 index cf899e0ca..000000000 --- a/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TIMEVALUE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TIMEVALUE \- time value for conditional -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val); -.fi -.SH DESCRIPTION -Pass a long \fIval\fP as parameter. This should be the time counted as seconds -since 1 Jan 1970, and the time is used in a condition as specified with -\fICURLOPT_TIMECONDITION(3)\fP. - -On systems with 32 bit 'long' variables (such as Windows), this option cannot -set dates beyond the year 2038. Consider \fICURLOPT_TIMEVALUE_LARGE(3)\fP -instead. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP, FTP, RTSP, and FILE -.SH EXAMPLE -.nf -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); - - /* If-Modified-Since the above time stamp */ - curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_TIMECONDITION (3), -.BR CURLOPT_TIMEVALUE_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE.md b/docs/libcurl/opts/CURLOPT_TIMEVALUE.md new file mode 100644 index 000000000..cc8f6032c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMEVALUE.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TIMEVALUE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TIMECONDITION (3) + - CURLOPT_TIMEVALUE_LARGE (3) +--- + +# NAME + +CURLOPT_TIMEVALUE - time value for conditional + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val); +~~~ + +# DESCRIPTION + +Pass a long *val* as parameter. This should be the time counted as seconds +since 1 Jan 1970, and the time is used in a condition as specified with +CURLOPT_TIMECONDITION(3). + +On systems with 32 bit 'long' variables (such as Windows), this option cannot +set dates beyond the year 2038. Consider CURLOPT_TIMEVALUE_LARGE(3) +instead. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP, FTP, RTSP, and FILE + +# EXAMPLE + +~~~c +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); + + /* If-Modified-Since the above time stamp */ + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 deleted file mode 100644 index e3b7759d5..000000000 --- a/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TIMEVALUE_LARGE 3 "25 Jan 2018" libcurl libcurl -.SH NAME -CURLOPT_TIMEVALUE_LARGE \- time value for conditional -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE, - curl_off_t val); -.fi -.SH DESCRIPTION -Pass a curl_off_t \fIval\fP as parameter. This should be the time counted as -seconds since 1 Jan 1970, and the time is used in a condition as specified -with \fICURLOPT_TIMECONDITION(3)\fP. - -The difference between this option and \fICURLOPT_TIMEVALUE(3)\fP is the type -of the argument. On systems where 'long' is only 32 bit wide, this option has -to be used to set dates beyond the year 2038. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP, FTP, RTSP, and FILE -.SH EXAMPLE -.nf -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); - - /* If-Modified-Since the above time stamp */ - curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.59.0. -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_TIMECONDITION (3), -.BR CURLOPT_TIMEVALUE (3), -.BR CURLINFO_FILETIME (3) diff --git a/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.md b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.md new file mode 100644 index 000000000..1424f6617 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TIMEVALUE_LARGE +Section: 3 +Source: libcurl +See-also: + - CURLINFO_FILETIME (3) + - CURLOPT_TIMECONDITION (3) + - CURLOPT_TIMEVALUE (3) +--- + +# NAME + +CURLOPT_TIMEVALUE_LARGE - time value for conditional + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE, + curl_off_t val); +~~~ + +# DESCRIPTION + +Pass a curl_off_t *val* as parameter. This should be the time counted as +seconds since 1 Jan 1970, and the time is used in a condition as specified +with CURLOPT_TIMECONDITION(3). + +The difference between this option and CURLOPT_TIMEVALUE(3) is the type +of the argument. On systems where 'long' is only 32 bit wide, this option has +to be used to set dates beyond the year 2038. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP, FTP, RTSP, and FILE + +# EXAMPLE + +~~~c +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); + + /* If-Modified-Since the above time stamp */ + curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.59.0. + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 b/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 deleted file mode 100644 index d7450e154..000000000 --- a/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TLS13_CIPHERS 3 "25 May 2018" libcurl libcurl -.SH NAME -CURLOPT_TLS13_CIPHERS \- ciphers suites to use for TLS 1.3 -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLS13_CIPHERS, char *list); -.fi -.SH DESCRIPTION -Pass a char *, pointing to a null-terminated string holding the list of cipher -suites to use for the TLS 1.3 connection. The list must be syntactically -correct, it consists of one or more cipher suite strings separated by colons. - -Find more details about cipher lists on this URL: - - https://curl.se/docs/ssl-ciphers.html - -This option is currently used only when curl is built to use OpenSSL 1.1.1 or -later, or Schannel. If you are using a different SSL backend you can try -setting TLS 1.3 cipher suites by using the \fICURLOPT_SSL_CIPHER_LIST(3)\fP -option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, use internal default -.SH PROTOCOLS -All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_TLS13_CIPHERS, - "TLS_CHACHA20_POLY1305_SHA256"); - res = curl_easy_perform(curl); - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.61.0 for OpenSSL. Available when built with OpenSSL >= 1.1.1. - -Added in 7.85.0 for Schannel. -.SH RETURN VALUE -Returns CURLE_OK if supported, CURLE_NOT_BUILT_IN otherwise. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_SSL_CIPHER_LIST (3), -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_PROXY_TLS13_CIPHERS (3), -.BR CURLOPT_SSL_CIPHER_LIST (3), -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_USE_SSL (3) diff --git a/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.md b/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.md new file mode 100644 index 000000000..add1f2f8e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TLS13_CIPHERS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_PROXY_SSL_CIPHER_LIST (3) + - CURLOPT_PROXY_TLS13_CIPHERS (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_CIPHER_LIST (3) + - CURLOPT_USE_SSL (3) +--- + +# NAME + +CURLOPT_TLS13_CIPHERS - ciphers suites to use for TLS 1.3 + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLS13_CIPHERS, char *list); +~~~ + +# DESCRIPTION + +Pass a char pointer, pointing to a null-terminated string holding the list of +cipher suites to use for the TLS 1.3 connection. The list must be +syntactically correct, it consists of one or more cipher suite strings +separated by colons. + +Find more details about cipher lists on this URL: + + https://curl.se/docs/ssl-ciphers.html + +This option is currently used only when curl is built to use OpenSSL 1.1.1 or +later, or Schannel. If you are using a different SSL backend you can try +setting TLS 1.3 cipher suites by using the CURLOPT_SSL_CIPHER_LIST(3) +option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, use internal default + +# PROTOCOLS + +All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_TLS13_CIPHERS, + "TLS_CHACHA20_POLY1305_SHA256"); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.61.0 for OpenSSL. Available when built with OpenSSL >= 1.1.1. + +Added in 7.85.0 for Schannel. + +# RETURN VALUE + +Returns CURLE_OK if supported, CURLE_NOT_BUILT_IN otherwise. diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3 b/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3 deleted file mode 100644 index 3170bff2d..000000000 --- a/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TLSAUTH_PASSWORD 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TLSAUTH_PASSWORD \- password to use for TLS authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_PASSWORD, char *pwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should point to the null-terminated password -to use for the TLS authentication method specified with the -\fICURLOPT_TLSAUTH_TYPE(3)\fP option. Requires that the -\fICURLOPT_TLSAUTH_USERNAME(3)\fP option also be set. - -The application does not have to keep the string around after setting this -option. - -This feature relies in TLS SRP which does not work with TLS 1.3. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -Added in 7.21.4, with the OpenSSL and GnuTLS backends only -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_PROXY_TLSAUTH_PASSWORD (3), -.BR CURLOPT_TLSAUTH_TYPE (3), -.BR CURLOPT_TLSAUTH_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.md b/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.md new file mode 100644 index 000000000..1d0e1d01d --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.md @@ -0,0 +1,70 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TLSAUTH_PASSWORD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_TLSAUTH_PASSWORD (3) + - CURLOPT_TLSAUTH_TYPE (3) + - CURLOPT_TLSAUTH_USERNAME (3) +--- + +# NAME + +CURLOPT_TLSAUTH_PASSWORD - password to use for TLS authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_PASSWORD, char *pwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should point to the null-terminated +password to use for the TLS authentication method specified with the +CURLOPT_TLSAUTH_TYPE(3) option. Requires that the +CURLOPT_TLSAUTH_USERNAME(3) option also be set. + +The application does not have to keep the string around after setting this +option. + +This feature relies in TLS SRP which does not work with TLS 1.3. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.4, with the OpenSSL and GnuTLS backends only + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3 b/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3 deleted file mode 100644 index ec743c372..000000000 --- a/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TLSAUTH_TYPE 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TLSAUTH_TYPE \- TLS authentication methods -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_TYPE, char *type); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. The string should be -the method of the TLS authentication. Supported method is "SRP". - -.IP SRP -TLS-SRP authentication. Secure Remote Password authentication for TLS is -defined in RFC 5054 and provides mutual authentication if both sides have a -shared secret. To use TLS-SRP, you must also set the -\fICURLOPT_TLSAUTH_USERNAME(3)\fP and \fICURLOPT_TLSAUTH_PASSWORD(3)\fP -options. - -The application does not have to keep the string around after setting this -option. - -TLS SRP does not work with TLS 1.3. -.SH DEFAULT -blank -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this -to work. Added in 7.21.4 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_TLSAUTH_USERNAME (3), -.BR CURLOPT_TLSAUTH_PASSWORD (3) diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.md b/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.md new file mode 100644 index 000000000..f3e0803d4 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TLSAUTH_TYPE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TLSAUTH_PASSWORD (3) + - CURLOPT_TLSAUTH_USERNAME (3) +--- + +# NAME + +CURLOPT_TLSAUTH_TYPE - TLS authentication methods + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_TYPE, char *type); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. The string should be +the method of the TLS authentication. Supported method is "SRP". + +## SRP + +TLS-SRP authentication. Secure Remote Password authentication for TLS is +defined in RFC 5054 and provides mutual authentication if both sides have a +shared secret. To use TLS-SRP, you must also set the +CURLOPT_TLSAUTH_USERNAME(3) and CURLOPT_TLSAUTH_PASSWORD(3) +options. + +The application does not have to keep the string around after setting this +option. + +TLS SRP does not work with TLS 1.3. + +# DEFAULT + +blank + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this +to work. Added in 7.21.4 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3 b/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3 deleted file mode 100644 index a604c1ef0..000000000 --- a/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TLSAUTH_USERNAME 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TLSAUTH_USERNAME \- user name to use for TLS authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_USERNAME, char *user); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should point to the null-terminated username -to use for the TLS authentication method specified with the -\fICURLOPT_TLSAUTH_TYPE(3)\fP option. Requires that the -\fICURLOPT_TLSAUTH_PASSWORD(3)\fP option also be set. - -The application does not have to keep the string around after setting this -option. - -This feature relies in TLS SRP which does not work with TLS 1.3. -.SH DEFAULT -NULL -.SH PROTOCOLS -All TLS-based protocols -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - CURLcode res; - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - curl_easy_setopt(curl, CURLOPT_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 -Added in 7.21.4, with the OpenSSL and GnuTLS backends only -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_TLSAUTH_TYPE (3), -.BR CURLOPT_TLSAUTH_PASSWORD (3) diff --git a/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.md b/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.md new file mode 100644 index 000000000..1127046af --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TLSAUTH_USERNAME.md @@ -0,0 +1,69 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TLSAUTH_USERNAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TLSAUTH_PASSWORD (3) + - CURLOPT_TLSAUTH_TYPE (3) +--- + +# NAME + +CURLOPT_TLSAUTH_USERNAME - user name to use for TLS authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_USERNAME, char *user); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should point to the null-terminated +username to use for the TLS authentication method specified with the +CURLOPT_TLSAUTH_TYPE(3) option. Requires that the +CURLOPT_TLSAUTH_PASSWORD(3) option also be set. + +The application does not have to keep the string around after setting this +option. + +This feature relies in TLS SRP which does not work with TLS 1.3. + +# DEFAULT + +NULL + +# PROTOCOLS + +All TLS-based protocols + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + curl_easy_setopt(curl, CURLOPT_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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.4, with the OpenSSL and GnuTLS backends only + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_TRAILERDATA.3 b/docs/libcurl/opts/CURLOPT_TRAILERDATA.3 deleted file mode 100644 index d35523239..000000000 --- a/docs/libcurl/opts/CURLOPT_TRAILERDATA.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TRAILERDATA 3 "14 Aug 2018" libcurl libcurl -.SH NAME -CURLOPT_TRAILERDATA \- pointer passed to trailing headers callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERDATA, void *userdata); -.fi -.SH DESCRIPTION -Data pointer to be passed to the HTTP trailer callback function. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -struct MyData { - void *custom; -}; - -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 -.SH AVAILABILITY -This option was added in curl 7.64.0 and is present if HTTP support is enabled -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_TRAILERFUNCTION (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_TRAILERDATA.md b/docs/libcurl/opts/CURLOPT_TRAILERDATA.md new file mode 100644 index 000000000..304b408e2 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TRAILERDATA.md @@ -0,0 +1,59 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TRAILERDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TRAILERFUNCTION (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_TRAILERDATA - pointer passed to trailing headers callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERDATA, void *userdata); +~~~ + +# DESCRIPTION + +Data pointer to be passed to the HTTP trailer callback function. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +struct MyData { + void *custom; +}; + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + struct MyData data; + curl_easy_setopt(curl, CURLOPT_TRAILERDATA, &data); + } +} +~~~ + +# AVAILABILITY + +This option was added in curl 7.64.0 and is present if HTTP support is enabled + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.3 b/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.3 deleted file mode 100644 index 0d61d1291..000000000 --- a/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.3 +++ /dev/null @@ -1,109 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TRAILERFUNCTION 3 "14 Aug 2018" libcurl libcurl -.SH NAME -CURLOPT_TRAILERFUNCTION \- callback for sending trailing headers -.SH SYNOPSIS -.nf -#include - -int curl_trailer_callback(struct curl_slist ** list, void *userdata); - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERFUNCTION, - curl_trailer_callback *func); -.fi -.SH DESCRIPTION -Pass a pointer to a callback function. - -This callback function is called once right before sending the final CR LF in -an HTTP chunked transfer to fill a list of trailing headers to be sent before -finishing the HTTP transfer. - -You can set the userdata argument with the \fICURLOPT_TRAILERDATA(3)\fP -option. - -The trailing headers included in the linked list must not be CRLF-terminated, -because libcurl adds the appropriate line termination characters after each -header item. - -If you use curl_slist_append to add trailing headers to the curl_slist then -libcurl duplicates the strings, and frees the curl_slist and the duplicates -once the trailers have been sent. - -If one of the trailing header fields is not formatted correctly it is ignored -and an info message is emitted. - -The return value can either be \fBCURL_TRAILERFUNC_OK\fP or -\fBCURL_TRAILERFUNC_ABORT\fP which would respectively instruct libcurl to -either continue with sending the trailers or to abort the request. - -If you set this option to NULL, then the transfer proceeds as usual -without any interruptions. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP -.SH EXAMPLE -#include - -static int trailer_cb(struct curl_slist **tr, void *data) -{ - /* libcurl frees the list */ - *tr = curl_slist_append(*tr, "My-super-awesome-trailer: trailer-stuff"); - return CURL_TRAILERFUNC_OK; -} - -CURL *curl = curl_easy_init(); -if(curl) { - /* Set the URL of the request */ - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - /* Now set it as a put */ - curl_easy_setopt(curl, CURLOPT_PUT, 1L); - - /* Assuming we have a function that returns the data to be pushed - Let that function be read_cb */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb); - - struct curl_slist *headers = NULL; - headers = curl_slist_append(headers, "Trailer: My-super-awesome-trailer"); - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - - /* Set the trailers filling callback */ - curl_easy_setopt(curl, CURLOPT_TRAILERFUNCTION, trailer_cb); - - /* Perform the transfer */ - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - curl_slist_free_all(headers); -} -.SH AVAILABILITY -This option was added in curl 7.64.0 and is present if HTTP support is enabled -.SH RETURN VALUE -Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_TRAILERDATA (3), -.BR CURLOPT_WRITEFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.md b/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.md new file mode 100644 index 000000000..5d79214bf --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.md @@ -0,0 +1,110 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TRAILERFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TRAILERDATA (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_TRAILERFUNCTION - callback for sending trailing headers + +# SYNOPSIS + +~~~c +#include + +int curl_trailer_callback(struct curl_slist ** list, void *userdata); + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERFUNCTION, + curl_trailer_callback *func); +~~~ + +# DESCRIPTION + +Pass a pointer to a callback function. + +This callback function is called once right before sending the final CR LF in +an HTTP chunked transfer to fill a list of trailing headers to be sent before +finishing the HTTP transfer. + +You can set the userdata argument with the CURLOPT_TRAILERDATA(3) +option. + +The trailing headers included in the linked list must not be CRLF-terminated, +because libcurl adds the appropriate line termination characters after each +header item. + +If you use curl_slist_append(3) to add trailing headers to the *curl_slist* +then libcurl duplicates the strings, and frees the *curl_slist* once the +trailers have been sent. + +If one of the trailing header fields is not formatted correctly it is ignored +and an info message is emitted. + +The return value can either be **CURL_TRAILERFUNC_OK** or +**CURL_TRAILERFUNC_ABORT** which would respectively instruct libcurl to +either continue with sending the trailers or to abort the request. + +If you set this option to NULL, then the transfer proceeds as usual +without any interruptions. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP + +# EXAMPLE +~~~c +static int trailer_cb(struct curl_slist **tr, void *data) +{ + /* libcurl frees the list */ + *tr = curl_slist_append(*tr, "My-super-awesome-trailer: trailer-stuff"); + return CURL_TRAILERFUNC_OK; +} + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + + /* Set the URL of the request */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + /* Now set it as a put */ + curl_easy_setopt(curl, CURLOPT_PUT, 1L); + + /* Assuming we have a function that returns the data to be pushed + Let that function be read_cb */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, trailer_cb); + + struct curl_slist *headers = NULL; + headers = curl_slist_append(headers, "Trailer: My-super-awesome-trailer"); + res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + /* Set the trailers filling callback */ + curl_easy_setopt(curl, CURLOPT_TRAILERFUNCTION, trailer_cb); + + /* Perform the transfer */ + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + curl_slist_free_all(headers); + } +} +~~~ +# AVAILABILITY + +This option was added in curl 7.64.0 and is present if HTTP support is enabled. + +# RETURN VALUE + +Returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3 b/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3 deleted file mode 100644 index dff01dc86..000000000 --- a/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TRANSFERTEXT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TRANSFERTEXT \- request a text based transfer for FTP -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFERTEXT, long text); -.fi -.SH DESCRIPTION -A parameter set to 1 tells the library to use ASCII mode for FTP transfers, -instead of the default binary transfer. For win32 systems it does not set the -stdout to binary mode. This option can be usable when transferring text data -between systems with different views on certain characters, such as newlines -or similar. - -libcurl does not do a complete ASCII conversion when doing ASCII transfers -over FTP. This is a known limitation/flaw that nobody has rectified. libcurl -simply sets the mode to ASCII and performs a standard transfer. -.SH DEFAULT -0, disabled -.SH PROTOCOLS -FTP -.SH EXAMPLE -.nf -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 -Along with FTP -.SH RETURN VALUE -Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CRLF (3) diff --git a/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.md b/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.md new file mode 100644 index 000000000..4f6d00485 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.md @@ -0,0 +1,65 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TRANSFERTEXT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CRLF (3) +--- + +# NAME + +CURLOPT_TRANSFERTEXT - request a text based transfer for FTP + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFERTEXT, long text); +~~~ + +# DESCRIPTION + +A parameter set to 1 tells the library to use ASCII mode for FTP transfers, +instead of the default binary transfer. For win32 systems it does not set the +stdout to binary mode. This option can be usable when transferring text data +between systems with different views on certain characters, such as newlines +or similar. + +libcurl does not do a complete ASCII conversion when doing ASCII transfers +over FTP. This is a known limitation/flaw that nobody has rectified. libcurl +simply sets the mode to ASCII and performs a standard transfer. + +# DEFAULT + +0, disabled + +# PROTOCOLS + +FTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with FTP + +# RETURN VALUE + +Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.3 b/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.3 deleted file mode 100644 index c472b7a88..000000000 --- a/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TRANSFER_ENCODING 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TRANSFER_ENCODING \- ask for HTTP Transfer Encoding -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFER_ENCODING, - long enable); -.fi -.SH DESCRIPTION -Pass a long set to 1L to \fIenable\fP or 0 to disable. - -Adds a request for compressed Transfer Encoding in the outgoing HTTP -request. If the server supports this and so desires, it can respond with the -HTTP response sent using a compressed Transfer-Encoding that is automatically -uncompressed by libcurl on reception. - -Transfer-Encoding differs slightly from the Content-Encoding you ask for with -\fICURLOPT_ACCEPT_ENCODING(3)\fP in that a Transfer-Encoding is strictly meant -to be for the transfer and thus MUST be decoded before the data arrives in the -client. Traditionally, Transfer-Encoding has been much less used and supported -by both HTTP clients and HTTP servers. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Added in 7.21.6 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ACCEPT_ENCODING (3), -.BR CURLOPT_HTTP_TRANSFER_DECODING (3) diff --git a/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.md b/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.md new file mode 100644 index 000000000..7fd38487a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING.md @@ -0,0 +1,68 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_TRANSFER_ENCODING +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ACCEPT_ENCODING (3) + - CURLOPT_HTTP_TRANSFER_DECODING (3) +--- + +# NAME + +CURLOPT_TRANSFER_ENCODING - ask for HTTP Transfer Encoding + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFER_ENCODING, + long enable); +~~~ + +# DESCRIPTION + +Pass a long set to 1L to *enable* or 0 to disable. + +Adds a request for compressed Transfer Encoding in the outgoing HTTP +request. If the server supports this and so desires, it can respond with the +HTTP response sent using a compressed Transfer-Encoding that is automatically +uncompressed by libcurl on reception. + +Transfer-Encoding differs slightly from the Content-Encoding you ask for with +CURLOPT_ACCEPT_ENCODING(3) in that a Transfer-Encoding is strictly meant +to be for the transfer and thus MUST be decoded before the data arrives in the +client. Traditionally, Transfer-Encoding has been much less used and supported +by both HTTP clients and HTTP servers. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.6 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3 b/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3 deleted file mode 100644 index 534ae813b..000000000 --- a/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_UNIX_SOCKET_PATH 3 "09 Oct 2014" libcurl libcurl -.SH NAME -CURLOPT_UNIX_SOCKET_PATH \- Unix domain socket -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UNIX_SOCKET_PATH, char *path); -.fi -.SH DESCRIPTION -Enables the use of Unix domain sockets as connection endpoint and sets the -path to \fIpath\fP. If \fIpath\fP is NULL, then Unix domain sockets are -disabled. - -When enabled, curl connects to the Unix domain socket instead of establishing -a TCP connection to the host. Since no network connection is created, curl -does not resolve the DNS hostname in the URL. - -The maximum path length on Cygwin, Linux and Solaris is 107. On other platforms -it might be even less. - -Proxy and TCP options such as \fICURLOPT_TCP_NODELAY(3)\fP are not -supported. Proxy options such as \fICURLOPT_PROXY(3)\fP have no effect either -as these are TCP-oriented, and asking a proxy server to connect to a certain -Unix domain socket is not possible. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -Default is NULL, meaning that no Unix domain sockets are used. -.SH PROTOCOLS -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 -.nf -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 can use the proc filesystem to bypass the limitation: - -.nf - int dirfd = open(long_directory_path_to_socket, O_DIRECTORY | O_RDONLY); - char path[108]; - snprintf(path, sizeof(path), "/proc/self/fd/%d/httpd.sock", dirfd); - curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, path); - /* Be sure to keep dirfd valid until you discard the handle */ -.fi -.SH AVAILABILITY -Added in 7.40.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_ABSTRACT_UNIX_SOCKET (3), -.BR CURLOPT_OPENSOCKETFUNCTION (3), -.BR unix (7) diff --git a/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.md b/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.md new file mode 100644 index 000000000..0ef3ec176 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.md @@ -0,0 +1,87 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_UNIX_SOCKET_PATH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_ABSTRACT_UNIX_SOCKET (3) + - CURLOPT_OPENSOCKETFUNCTION (3) + - unix (7) +--- + +# NAME + +CURLOPT_UNIX_SOCKET_PATH - Unix domain socket + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UNIX_SOCKET_PATH, char *path); +~~~ + +# DESCRIPTION + +Enables the use of Unix domain sockets as connection endpoint and sets the +path to *path*. If *path* is NULL, then Unix domain sockets are +disabled. + +When enabled, curl connects to the Unix domain socket instead of establishing +a TCP connection to the host. Since no network connection is created, curl +does not resolve the DNS hostname in the URL. + +The maximum path length on Cygwin, Linux and Solaris is 107. On other platforms +it might be even less. + +Proxy and TCP options such as CURLOPT_TCP_NODELAY(3) are not +supported. Proxy options such as CURLOPT_PROXY(3) have no effect either +as these are TCP-oriented, and asking a proxy server to connect to a certain +Unix domain socket is not possible. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +Default is NULL, meaning that no Unix domain sockets are used. + +# PROTOCOLS + +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). + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +If you are on Linux and somehow have a need for paths larger than 107 bytes, +you can use the proc filesystem to bypass the limitation: + +~~~c + int dirfd = open(long_directory_path_to_socket, O_DIRECTORY | O_RDONLY); + char path[108]; + snprintf(path, sizeof(path), "/proc/self/fd/%d/httpd.sock", dirfd); + curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, path); + /* Be sure to keep dirfd valid until you discard the handle */ +~~~ + +# AVAILABILITY + +Added in 7.40.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3 b/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3 deleted file mode 100644 index d16f4eab5..000000000 --- a/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_UNRESTRICTED_AUTH 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_UNRESTRICTED_AUTH \- send credentials to other hosts too -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UNRESTRICTED_AUTH, - long goahead); -.SH DESCRIPTION -Set the long \fIgohead\fP parameter to 1L to make libcurl continue to send -authentication (user+password) credentials when following locations, even when -hostname changed. This option is meaningful only when setting -\fICURLOPT_FOLLOWLOCATION(3)\fP. - -Further, when this option is not used or set to \fB0L\fP, libcurl does not -send custom nor internally generated Authentication: headers on requests done -to other hosts than the one used for the initial URL. - -By default, libcurl only sends credentials and Authentication headers to the -initial host name as given in the original URL, to avoid leaking username + -password to other sites. - -This option should be used with caution: when curl follows redirects it -blindly fetches the next URL as instructed by the server. Setting -\fICURLOPT_UNRESTRICTED_AUTH(3)\fP to 1L therefore also makes curl trust the -server and sends possibly sensitive credentials to any host the server points -out. And then maybe again and again as the following hosts can keep -redirecting to new hosts. -.SH DEFAULT -0 -.SH PROTOCOLS -HTTP -.SH EXAMPLE -.nf -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 -Along with HTTP -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_FOLLOWLOCATION (3), -.BR CURLOPT_USERPWD (3), -.BR CURLOPT_MAXREDIRS (3), -.BR CURLOPT_REDIR_PROTOCOLS_STR (3), -.BR CURLINFO_REDIRECT_COUNT (3) diff --git a/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.md b/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.md new file mode 100644 index 000000000..9dcfbf175 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.md @@ -0,0 +1,79 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_UNRESTRICTED_AUTH +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_COUNT (3) + - CURLOPT_FOLLOWLOCATION (3) + - CURLOPT_MAXREDIRS (3) + - CURLOPT_REDIR_PROTOCOLS_STR (3) + - CURLOPT_USERPWD (3) +--- + +# NAME + +CURLOPT_UNRESTRICTED_AUTH - send credentials to other hosts too + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UNRESTRICTED_AUTH, + long goahead); +~~~ + +# DESCRIPTION + +Set the long *gohead* parameter to 1L to make libcurl continue to send +authentication (user+password) credentials when following locations, even when +hostname changed. This option is meaningful only when setting +CURLOPT_FOLLOWLOCATION(3). + +Further, when this option is not used or set to **0L**, libcurl does not +send custom nor internally generated Authentication: headers on requests done +to other hosts than the one used for the initial URL. + +By default, libcurl only sends credentials and Authentication headers to the +initial host name as given in the original URL, to avoid leaking username + +password to other sites. + +This option should be used with caution: when curl follows redirects it +blindly fetches the next URL as instructed by the server. Setting +CURLOPT_UNRESTRICTED_AUTH(3) to 1L therefore also makes curl trust the +server and sends possibly sensitive credentials to any host the server points +out. And then maybe again and again as the following hosts can keep +redirecting to new hosts. + +# DEFAULT + +0 + +# PROTOCOLS + +HTTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Along with HTTP + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 b/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 deleted file mode 100644 index 9af2e03ba..000000000 --- a/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_UPKEEP_INTERVAL_MS 3 "31 Oct 2018" libcurl libcurl -.SH NAME -CURLOPT_UPKEEP_INTERVAL_MS \- connection upkeep interval -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS, - long upkeep_interval_ms); -.fi -.SH DESCRIPTION -Some protocols have "connection upkeep" mechanisms. These mechanisms usually -send some traffic on existing connections in order to keep them alive; this -can prevent connections from being closed due to overzealous firewalls, for -example. - -The user needs to explicitly call \fIcurl_easy_upkeep(3)\fP in order to -perform the upkeep work. - -Currently the only protocol with a connection upkeep mechanism is HTTP/2: when -the connection upkeep interval is exceeded and \fIcurl_easy_upkeep(3)\fP -is called, an HTTP/2 PING frame is sent on the connection. - -.SH DEFAULT -CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60 seconds) -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - /* Make a connection to an HTTP/2 server. */ - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); - - /* Set the interval to 30000ms / 30s */ - curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L); - - curl_easy_perform(curl); - - /* Perform more work here. */ - - /* While the connection is being held open, curl_easy_upkeep() can be - called. If curl_easy_upkeep() is called and the time since the last - upkeep exceeds the interval, then an HTTP/2 PING is sent. */ - curl_easy_upkeep(curl); - - /* Perform more work here. */ - - /* always cleanup */ - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.62.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH SEE ALSO -.BR CURLOPT_TCP_KEEPALIVE "(3), " diff --git a/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.md b/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.md new file mode 100644 index 000000000..283efa73e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.md @@ -0,0 +1,82 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_UPKEEP_INTERVAL_MS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_TCP_KEEPALIVE (3) +--- + +# NAME + +CURLOPT_UPKEEP_INTERVAL_MS - connection upkeep interval + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS, + long upkeep_interval_ms); +~~~ + +# DESCRIPTION + +Some protocols have "connection upkeep" mechanisms. These mechanisms usually +send some traffic on existing connections in order to keep them alive; this +can prevent connections from being closed due to overzealous firewalls, for +example. + +The user needs to explicitly call curl_easy_upkeep(3) in order to +perform the upkeep work. + +Currently the only protocol with a connection upkeep mechanism is HTTP/2: when +the connection upkeep interval is exceeded and curl_easy_upkeep(3) +is called, an HTTP/2 PING frame is sent on the connection. + +# DEFAULT + +CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60 seconds) + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + /* Make a connection to an HTTP/2 server. */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); + + /* Set the interval to 30000ms / 30s */ + curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L); + + curl_easy_perform(curl); + + /* Perform more work here. */ + + /* While the connection is being held open, curl_easy_upkeep() can be + called. If curl_easy_upkeep() is called and the time since the last + upkeep exceeds the interval, then an HTTP/2 PING is sent. */ + curl_easy_upkeep(curl); + + /* Perform more work here. */ + + /* always cleanup */ + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.62.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD.3 b/docs/libcurl/opts/CURLOPT_UPLOAD.3 deleted file mode 100644 index e02295e70..000000000 --- a/docs/libcurl/opts/CURLOPT_UPLOAD.3 +++ /dev/null @@ -1,99 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_UPLOAD 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_UPLOAD \- data upload -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD, long upload); -.fi -.SH DESCRIPTION -The long parameter \fIupload\fP set to 1 tells the library to prepare for and -perform an upload. The \fICURLOPT_READDATA(3)\fP and -\fICURLOPT_INFILESIZE(3)\fP or \fICURLOPT_INFILESIZE_LARGE(3)\fP options are -also interesting for uploads. If the protocol is HTTP, uploading means using -the PUT request unless you tell libcurl otherwise. - -Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP as usual. - -If you use PUT to an HTTP 1.1 server, you can upload data without knowing the -size before starting the transfer. The library enables this by adding a header -"Transfer-Encoding: chunked". With HTTP 1.0 or if you prefer not to use chunked -transfer, you must specify the size of the data with -\fICURLOPT_INFILESIZE(3)\fP or \fICURLOPT_INFILESIZE_LARGE(3)\fP. -.SH DEFAULT -0, default is download -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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); - - 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"); - - /* 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); - - /* Now run off and do what you have been told! */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_PUT (3), -.BR CURLOPT_READFUNCTION (3), -.BR CURLOPT_INFILESIZE_LARGE (3) diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD.md b/docs/libcurl/opts/CURLOPT_UPLOAD.md new file mode 100644 index 000000000..a54f2fd9f --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_UPLOAD.md @@ -0,0 +1,97 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_UPLOAD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_INFILESIZE_LARGE (3) + - CURLOPT_PUT (3) + - CURLOPT_READFUNCTION (3) +--- + +# NAME + +CURLOPT_UPLOAD - data upload + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD, long upload); +~~~ + +# DESCRIPTION + +The long parameter *upload* set to 1 tells the library to prepare for and +perform an upload. The CURLOPT_READDATA(3) and +CURLOPT_INFILESIZE(3) or CURLOPT_INFILESIZE_LARGE(3) options are +also interesting for uploads. If the protocol is HTTP, uploading means using +the PUT request unless you tell libcurl otherwise. + +Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. +You can disable this header with CURLOPT_HTTPHEADER(3) as usual. + +If you use PUT to an HTTP 1.1 server, you can upload data without knowing the +size before starting the transfer. The library enables this by adding a header +"Transfer-Encoding: chunked". With HTTP 1.0 or if you prefer not to use chunked +transfer, you must specify the size of the data with +CURLOPT_INFILESIZE(3) or CURLOPT_INFILESIZE_LARGE(3). + +# DEFAULT + +0, default is download + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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); + + 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"); + + /* 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); + + /* Now run off and do what you have been told! */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 b/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 deleted file mode 100644 index 521daaee1..000000000 --- a/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_UPLOAD_BUFFERSIZE 3 "18 Aug 2018" libcurl libcurl -.SH NAME -CURLOPT_UPLOAD_BUFFERSIZE \- upload buffer size -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size); -.fi -.SH DESCRIPTION -Pass a long specifying your preferred \fIsize\fP (in bytes) for the upload -buffer in libcurl. It makes libcurl uses a larger buffer that gets passed to -the next layer in the stack to get sent off. In some setups and for some -protocols, there is a huge performance benefit of having a larger upload -buffer. - -This is just treated as a request, not an order. You cannot be guaranteed to -actually get the given size. - -The upload buffer size is by default 64 kilobytes. The maximum buffer size -allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is -16 kilobytes. - -The upload buffer is allocated on-demand - so if the handle is not used for -upload, this buffer is not allocated at all. - -DO NOT set this option on a handle that is currently used for an active -transfer as that may lead to unintended consequences. -.SH DEFAULT -65536 bytes -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.62.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_BUFFERSIZE (3), -.BR CURLOPT_READFUNCTION (3), -.BR CURLOPT_TCP_NODELAY (3) diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.md b/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.md new file mode 100644 index 000000000..f32a45f98 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_UPLOAD_BUFFERSIZE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_BUFFERSIZE (3) + - CURLOPT_READFUNCTION (3) + - CURLOPT_TCP_NODELAY (3) +--- + +# NAME + +CURLOPT_UPLOAD_BUFFERSIZE - upload buffer size + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size); +~~~ + +# DESCRIPTION + +Pass a long specifying your preferred *size* (in bytes) for the upload +buffer in libcurl. It makes libcurl uses a larger buffer that gets passed to +the next layer in the stack to get sent off. In some setups and for some +protocols, there is a huge performance benefit of having a larger upload +buffer. + +This is just treated as a request, not an order. You cannot be guaranteed to +actually get the given size. + +The upload buffer size is by default 64 kilobytes. The maximum buffer size +allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is +16 kilobytes. + +The upload buffer is allocated on-demand - so if the handle is not used for +upload, this buffer is not allocated at all. + +DO NOT set this option on a handle that is currently used for an active +transfer as that may lead to unintended consequences. + +# DEFAULT + +65536 bytes + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.62.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_URL.3 b/docs/libcurl/opts/CURLOPT_URL.md similarity index 50% rename from docs/libcurl/opts/CURLOPT_URL.3 rename to docs/libcurl/opts/CURLOPT_URL.md index 9ef6913d8..de7bbcf1f 100644 --- a/docs/libcurl/opts/CURLOPT_URL.3 +++ b/docs/libcurl/opts/CURLOPT_URL.md @@ -1,39 +1,36 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_URL +Section: 3 +Source: libcurl +See-also: + - CURLINFO_REDIRECT_URL (3) + - CURLOPT_CURLU (3) + - CURLOPT_FORBID_REUSE (3) + - CURLOPT_FRESH_CONNECT (3) + - CURLOPT_PATH_AS_IS (3) + - CURLOPT_PROTOCOLS (3) + - curl_easy_perform (3) + - curl_url_get (3) + - curl_url_set (3) +--- -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_URL 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_URL \- URL for this transfer -.SH SYNOPSIS -.nf +# NAME + +CURLOPT_URL - URL for this transfer + +# SYNOPSIS + +~~~c #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_URL, char *URL); -.fi -.SH DESCRIPTION -Pass in a pointer to the \fIURL\fP to work with. The parameter should be a +~~~ + +# DESCRIPTION + +Pass in a pointer to the *URL* to work with. The parameter should be a char * to a null-terminated string which must be URL-encoded in the following format: @@ -42,39 +39,41 @@ scheme://host:port/path For a greater explanation of the format please see RFC 3986. libcurl does not validate the syntax or use the URL until the transfer is -started. Even if you set a crazy value here, \fIcurl_easy_setopt(3)\fP might -still return \fICURLE_OK\fP. +started. Even if you set a crazy value here, curl_easy_setopt(3) might +still return *CURLE_OK*. If the given URL is missing a scheme name (such as "http://" or "ftp://" etc) then libcurl guesses based on the host. If the outermost subdomain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that protocol gets used, otherwise HTTP is used. Since 7.45.0 guessing can be disabled by setting a -default protocol, see \fICURLOPT_DEFAULT_PROTOCOL(3)\fP for details. +default protocol, see CURLOPT_DEFAULT_PROTOCOL(3) for details. Should the protocol, either as specified by the URL scheme or deduced by libcurl from the host name, not be supported by libcurl then -\fICURLE_UNSUPPORTED_PROTOCOL\fP is returned from either the -\fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP functions when you -call them. Use \fIcurl_version_info(3)\fP for detailed information of which +*CURLE_UNSUPPORTED_PROTOCOL* is returned from either the +curl_easy_perform(3) or curl_multi_perform(3) functions when you +call them. Use curl_version_info(3) for detailed information of which protocols are supported by the build of libcurl you are using. -\fICURLOPT_PROTOCOLS_STR(3)\fP can be used to limit what protocols libcurl may +CURLOPT_PROTOCOLS_STR(3) can be used to limit what protocols libcurl may use for this transfer, independent of what libcurl has been compiled to support. That may be useful if you accept the URL from an external source and want to limit the accessibility. -The \fICURLOPT_URL(3)\fP string is ignored if \fICURLOPT_CURLU(3)\fP is set. +The CURLOPT_URL(3) string is ignored if CURLOPT_CURLU(3) is set. -Either \fICURLOPT_URL(3)\fP or \fICURLOPT_CURLU(3)\fP must be set before a +Either CURLOPT_URL(3) or CURLOPT_CURLU(3) must be set before a transfer is started. The application does not have to keep the string around after setting this option. -The parser used for handling the URL set with \fICURLOPT_URL(3)\fP is the same -that \fIcurl_url_set(3)\fP uses. -.SH ENCODING -The string pointed to in the \fICURLOPT_URL(3)\fP argument is generally +The parser used for handling the URL set with CURLOPT_URL(3) is the same +that curl_url_set(3) uses. + +# ENCODING + +The string pointed to in the CURLOPT_URL(3) argument is generally expected to be a sequence of characters using an ASCII compatible encoding. If libcurl is built with IDN support, the server name part of the URL can use @@ -83,10 +82,14 @@ UTF-8 (when winidn is used; or a Windows Unicode build using libidn2). If libcurl is built without IDN support, the server name is used exactly as specified when passed to the name resolver functions. -.SH DEFAULT + +# DEFAULT + There is no default URL. If this option is not set, no transfer can be performed. -.SH SECURITY CONCERNS + +# SECURITY CONCERNS + Applications may at times find it convenient to allow users to specify URLs for various purposes and that string would then end up fed to this option. @@ -104,15 +107,19 @@ custom port number can allow external users to play tricks with your local services. Accepting external URLs may also use other protocols than http:// or other -common ones. Restrict what accept with \fICURLOPT_PROTOCOLS(3)\fP. +common ones. Restrict what accept with CURLOPT_PROTOCOLS(3). User provided URLs can also be made to point to sites that redirect further on (possibly to other protocols too). Consider your -\fICURLOPT_FOLLOWLOCATION(3)\fP and \fICURLOPT_REDIR_PROTOCOLS(3)\fP settings. -.SH PROTOCOLS +CURLOPT_FOLLOWLOCATION(3) and CURLOPT_REDIR_PROTOCOLS(3) settings. + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURL *curl = curl_easy_init(); @@ -122,23 +129,17 @@ int main(void) curl_easy_perform(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + POP3 and SMTP were added in 7.31.0 -.SH RETURN VALUE + +# RETURN VALUE + Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient heap space. -Note that \fIcurl_easy_setopt(3)\fP does not parse the given string so given a -bad URL, it is not detected until \fIcurl_easy_perform(3)\fP or similar is +Note that curl_easy_setopt(3) does not parse the given string so given a +bad URL, it is not detected until curl_easy_perform(3) or similar is called. -.SH "SEE ALSO" -.BR curl_easy_perform (3), -.BR curl_url_get (3), -.BR curl_url_set (3), -.BR CURLINFO_REDIRECT_URL (3), -.BR CURLOPT_CURLU (3), -.BR CURLOPT_FORBID_REUSE (3), -.BR CURLOPT_FRESH_CONNECT (3), -.BR CURLOPT_PATH_AS_IS (3), -.BR CURLOPT_PROTOCOLS (3) diff --git a/docs/libcurl/opts/CURLOPT_USERAGENT.3 b/docs/libcurl/opts/CURLOPT_USERAGENT.3 deleted file mode 100644 index 1ed5a7bc5..000000000 --- a/docs/libcurl/opts/CURLOPT_USERAGENT.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_USERAGENT 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_USERAGENT \- HTTP user-agent header -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERAGENT, char *ua); -.fi -.SH DESCRIPTION -Pass a pointer to a null-terminated string as parameter. It is used to set the -User-Agent: header field in the HTTP request sent to the remote server. You -can also set any custom header with \fICURLOPT_HTTPHEADER(3)\fP. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL, no User-Agent: header is used by default. -.SH PROTOCOLS -HTTP, HTTPS -.SH EXAMPLE -.nf -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_perform(curl); - } -} -.fi -.SH AVAILABILITY -As long as HTTP is supported -.SH RETURN VALUE -Returns CURLE_OK if HTTP is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_CUSTOMREQUEST (3), -.BR CURLOPT_HTTPHEADER (3), -.BR CURLOPT_REFERER (3), -.BR CURLOPT_REQUEST_TARGET (3) diff --git a/docs/libcurl/opts/CURLOPT_USERAGENT.md b/docs/libcurl/opts/CURLOPT_USERAGENT.md new file mode 100644 index 000000000..a5423def0 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_USERAGENT.md @@ -0,0 +1,66 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_USERAGENT +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CUSTOMREQUEST (3) + - CURLOPT_HTTPHEADER (3) + - CURLOPT_REFERER (3) + - CURLOPT_REQUEST_TARGET (3) +--- + +# NAME + +CURLOPT_USERAGENT - HTTP user-agent header + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERAGENT, char *ua); +~~~ + +# DESCRIPTION + +Pass a pointer to a null-terminated string as parameter. It is used to set the +User-Agent: header field in the HTTP request sent to the remote server. You +can also set any custom header with CURLOPT_HTTPHEADER(3). + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL, no User-Agent: header is used by default. + +# PROTOCOLS + +HTTP, HTTPS + +# EXAMPLE + +~~~c +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_perform(curl); + } +} +~~~ + +# AVAILABILITY + +As long as HTTP is supported + +# RETURN VALUE + +Returns CURLE_OK if HTTP is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_USERNAME.3 b/docs/libcurl/opts/CURLOPT_USERNAME.3 deleted file mode 100644 index a7e25e90b..000000000 --- a/docs/libcurl/opts/CURLOPT_USERNAME.3 +++ /dev/null @@ -1,93 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_USERNAME 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_USERNAME \- user name to use in authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERNAME, - char *username); -.SH DESCRIPTION -Pass a char * as parameter, which should be pointing to the null-terminated -user name to use for the transfer. - -\fICURLOPT_USERNAME(3)\fP sets the user name to be used in protocol -authentication. You should not use this option together with the (older) -\fICURLOPT_USERPWD(3)\fP option. - -When using Kerberos V5 authentication with a Windows based server, you should -include the domain name in order for the server to successfully obtain a -Kerberos Ticket. If you do not then the initial part of the authentication -handshake may fail. - -When using NTLM, the user name can be specified simply as the user name -without the domain name should the server be part of a single domain and -forest. - -To include the domain name use either Down-Level Logon Name or UPN (User -Principal Name) formats. For example, EXAMPLE\\user and user@example.com -respectively. - -Some HTTP servers (on Windows) support inclusion of the domain for Basic -authentication as well. - -To specify the password and login options, along with the user name, use the -\fICURLOPT_PASSWORD(3)\fP and \fICURLOPT_LOGIN_OPTIONS(3)\fP options. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -blank -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.19.1 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_USERPWD (3), -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_HTTPAUTH (3), -.BR CURLOPT_PROXYAUTH (3) diff --git a/docs/libcurl/opts/CURLOPT_USERNAME.md b/docs/libcurl/opts/CURLOPT_USERNAME.md new file mode 100644 index 000000000..f74817801 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_USERNAME.md @@ -0,0 +1,92 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_USERNAME +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HTTPAUTH (3) + - CURLOPT_PASSWORD (3) + - CURLOPT_PROXYAUTH (3) + - CURLOPT_USERPWD (3) +--- + +# NAME + +CURLOPT_USERNAME - user name to use in authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERNAME, + char *username); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should be pointing to the +null-terminated user name to use for the transfer. + +CURLOPT_USERNAME(3) sets the user name to be used in protocol +authentication. You should not use this option together with the (older) +CURLOPT_USERPWD(3) option. + +When using Kerberos V5 authentication with a Windows based server, you should +include the domain name in order for the server to successfully obtain a +Kerberos Ticket. If you do not then the initial part of the authentication +handshake may fail. + +When using NTLM, the user name can be specified simply as the user name +without the domain name should the server be part of a single domain and +forest. + +To include the domain name use either Down-Level Logon Name or UPN (User +Principal Name) formats. For example, **EXAMPLE\user** and +**user@example.com** respectively. + +Some HTTP servers (on Windows) support inclusion of the domain for Basic +authentication as well. + +To specify the password and login options, along with the user name, use the +CURLOPT_PASSWORD(3) and CURLOPT_LOGIN_OPTIONS(3) options. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +blank + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.19.1 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_USERPWD.3 b/docs/libcurl/opts/CURLOPT_USERPWD.3 deleted file mode 100644 index c63a98cc1..000000000 --- a/docs/libcurl/opts/CURLOPT_USERPWD.3 +++ /dev/null @@ -1,100 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_USERPWD 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_USERPWD \- user name and password to use in authentication -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd); -.fi -.SH DESCRIPTION -Pass a char * as parameter, pointing to a null-terminated login details string -for the connection. The format of which is: [user name]:[password]. - -When using Kerberos V5 authentication with a Windows based server, you should -specify the user name part with the domain name in order for the server to -successfully obtain a Kerberos Ticket. If you do not then the initial part of -the authentication handshake may fail. - -When using NTLM, the user name can be specified simply as the user name -without the domain name should the server be part of a single domain and -forest. - -To specify the domain name use either Down-Level Logon Name or UPN (User -Principal Name) formats. For example, EXAMPLE\\user and user@example.com -respectively. - -Some HTTP servers (on Windows) support inclusion of the domain for Basic -authentication as well. - -When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform -several requests to possibly different hosts. libcurl only sends this user and -password information to hosts using the initial host name (unless -\fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows redirects to -other hosts, it does not send the user and password to those. This is enforced -to prevent accidental information leakage. - -Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP -based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and -SMTP options. - -The user and password strings are not URL decoded, so there is no way to send -in a user name containing a colon using this option. Use -\fICURLOPT_USERNAME(3)\fP for that, or include it in the URL. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -Most -.SH EXAMPLE -.nf -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"); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK on success or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_USERNAME (3), -.BR CURLOPT_PASSWORD (3), -.BR CURLOPT_PROXYUSERPWD (3) diff --git a/docs/libcurl/opts/CURLOPT_USERPWD.md b/docs/libcurl/opts/CURLOPT_USERPWD.md new file mode 100644 index 000000000..262529055 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_USERPWD.md @@ -0,0 +1,98 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_USERPWD +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PASSWORD (3) + - CURLOPT_PROXYUSERPWD (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_USERPWD - user name and password to use in authentication + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, pointing to a null-terminated login details +string for the connection. The format of which is: [user name]:[password]. + +When using Kerberos V5 authentication with a Windows based server, you should +specify the user name part with the domain name in order for the server to +successfully obtain a Kerberos Ticket. If you do not then the initial part of +the authentication handshake may fail. + +When using NTLM, the user name can be specified simply as the user name +without the domain name should the server be part of a single domain and +forest. + +To specify the domain name use either Down-Level Logon Name or UPN (User +Principal Name) formats. For example **EXAMPLE\user** and **user@example.com** +respectively. + +Some HTTP servers (on Windows) support inclusion of the domain for Basic +authentication as well. + +When using HTTP and CURLOPT_FOLLOWLOCATION(3), libcurl might perform +several requests to possibly different hosts. libcurl only sends this user and +password information to hosts using the initial host name (unless +CURLOPT_UNRESTRICTED_AUTH(3) is set), so if libcurl follows redirects to +other hosts, it does not send the user and password to those. This is enforced +to prevent accidental information leakage. + +Use CURLOPT_HTTPAUTH(3) to specify the authentication method for HTTP +based connections or CURLOPT_LOGIN_OPTIONS(3) to control IMAP, POP3 and +SMTP options. + +The user and password strings are not URL decoded, so there is no way to send +in a user name containing a colon using this option. Use +CURLOPT_USERNAME(3) for that, or include it in the URL. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +Most + +# EXAMPLE + +~~~c +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"); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK on success or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLOPT_USE_SSL.3 b/docs/libcurl/opts/CURLOPT_USE_SSL.3 deleted file mode 100644 index 837415ad7..000000000 --- a/docs/libcurl/opts/CURLOPT_USE_SSL.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_USE_SSL 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_USE_SSL \- request using SSL / TLS for the transfer -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USE_SSL, long level); -.fi -.SH DESCRIPTION -Pass a long using one of the values from below, to make libcurl use your -desired \fIlevel\fP of SSL for the transfer. - -These are all protocols that start out plain text and get "upgraded" to SSL -using the STARTTLS command. - -This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc. -.IP CURLUSESSL_NONE -do not attempt to use SSL. -.IP CURLUSESSL_TRY -Try using SSL, proceed as normal otherwise. Note that server may close the -connection if the negotiation does not succeed. -.IP CURLUSESSL_CONTROL -Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP. -.IP CURLUSESSL_ALL -Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP. -.SH DEFAULT -CURLUSESSL_NONE -.SH PROTOCOLS -FTP, SMTP, POP3, IMAP, LDAP -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Added in 7.11.0. This option was known as CURLOPT_FTP_SSL up to 7.16.4, and -the constants were known as CURLFTPSSL_* -Handled by LDAP since 7.81.0. Fully supported by the OpenLDAP backend only. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_SSLVERSION (3), -.BR CURLOPT_PROXY_SSLVERSION (3), -.BR CURLOPT_SSL_OPTIONS (3) diff --git a/docs/libcurl/opts/CURLOPT_USE_SSL.md b/docs/libcurl/opts/CURLOPT_USE_SSL.md new file mode 100644 index 000000000..3e227fcfd --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_USE_SSL.md @@ -0,0 +1,86 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_USE_SSL +Section: 3 +Source: libcurl +See-also: + - CURLOPT_PROXY_SSLVERSION (3) + - CURLOPT_SSLVERSION (3) + - CURLOPT_SSL_OPTIONS (3) +--- + +# NAME + +CURLOPT_USE_SSL - request using SSL / TLS for the transfer + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USE_SSL, long level); +~~~ + +# DESCRIPTION + +Pass a long using one of the values from below, to make libcurl use your +desired *level* of SSL for the transfer. + +These are all protocols that start out plain text and get "upgraded" to SSL +using the STARTTLS command. + +This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc. + +## CURLUSESSL_NONE + +do not attempt to use SSL. + +## CURLUSESSL_TRY + +Try using SSL, proceed as normal otherwise. Note that server may close the +connection if the negotiation does not succeed. + +## CURLUSESSL_CONTROL + +Require SSL for the control connection or fail with *CURLE_USE_SSL_FAILED*. + +## CURLUSESSL_ALL + +Require SSL for all communication or fail with *CURLE_USE_SSL_FAILED*. + +# DEFAULT + +CURLUSESSL_NONE + +# PROTOCOLS + +FTP, SMTP, POP3, IMAP, LDAP + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Added in 7.11.0. This option was known as CURLOPT_FTP_SSL up to 7.16.4, and +the constants were known as CURLFTPSSL_* +Handled by LDAP since 7.81.0. Fully supported by the OpenLDAP backend only. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_VERBOSE.3 b/docs/libcurl/opts/CURLOPT_VERBOSE.3 deleted file mode 100644 index db1a756a3..000000000 --- a/docs/libcurl/opts/CURLOPT_VERBOSE.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_VERBOSE 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_VERBOSE \- verbose mode -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_VERBOSE, long onoff); -.fi -.SH DESCRIPTION -Set the \fIonoff\fP parameter to 1 to make the library display a lot of -verbose information about its operations on this \fIhandle\fP. Useful for -libcurl and/or protocol debugging and understanding. The verbose information -is sent to stderr, or the stream set with \fICURLOPT_STDERR(3)\fP. - -You hardly ever want this enabled in production use, you almost always want -this used when you debug/report problems. - -To also get all the protocol data sent and received, consider using the -\fICURLOPT_DEBUGFUNCTION(3)\fP. -.SH DEFAULT -0, meaning disabled. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -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); - - /* Perform the request */ - curl_easy_perform(curl); - } -} -.fi -.SH AVAILABILITY -Always -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_STDERR (3), -.BR CURLOPT_DEBUGFUNCTION (3), -.BR CURLOPT_ERRORBUFFER (3), -.BR curl_global_trace (3) diff --git a/docs/libcurl/opts/CURLOPT_VERBOSE.md b/docs/libcurl/opts/CURLOPT_VERBOSE.md new file mode 100644 index 000000000..5ecc4b11a --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_VERBOSE.md @@ -0,0 +1,71 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_VERBOSE +Section: 3 +Source: libcurl +See-also: + - CURLOPT_DEBUGFUNCTION (3) + - CURLOPT_ERRORBUFFER (3) + - CURLOPT_STDERR (3) + - curl_global_trace (3) +--- + +# NAME + +CURLOPT_VERBOSE - verbose mode + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_VERBOSE, long onoff); +~~~ + +# DESCRIPTION + +Set the *onoff* parameter to 1 to make the library display a lot of +verbose information about its operations on this *handle*. Useful for +libcurl and/or protocol debugging and understanding. The verbose information +is sent to stderr, or the stream set with CURLOPT_STDERR(3). + +You hardly ever want this enabled in production use, you almost always want +this used when you debug/report problems. + +To also get all the protocol data sent and received, consider using the +CURLOPT_DEBUGFUNCTION(3). + +# DEFAULT + +0, meaning disabled. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +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); + + /* Perform the request */ + curl_easy_perform(curl); + } +} +~~~ + +# AVAILABILITY + +Always + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3 b/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3 deleted file mode 100644 index 75c5322f1..000000000 --- a/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3 +++ /dev/null @@ -1,118 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_WILDCARDMATCH 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_WILDCARDMATCH \- directory wildcard transfers -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WILDCARDMATCH, long onoff); -.fi -.SH DESCRIPTION -Set \fIonoff\fP to 1 if you want to transfer multiple files according to a -file name pattern. The pattern can be specified as part of the -\fICURLOPT_URL(3)\fP option, using an \fBfnmatch\fP-like pattern (Shell -Pattern Matching) in the last part of URL (file name). - -By default, libcurl uses its internal wildcard matching implementation. You -can provide your own matching function by the -\fICURLOPT_FNMATCH_FUNCTION(3)\fP option. - -A brief introduction of its syntax follows: -.RS -.IP "* - ASTERISK" -.nf - ftp://example.com/some/path/*.txt -.fi -for all txt's from the root directory. Only two asterisks are allowed within -the same pattern string. -.RE -.RS -.IP "? - QUESTION MARK" -Question mark matches any (exactly one) character. -.nf - ftp://example.com/some/path/photo?.jpg -.fi -.RE -.RS -.IP "[ - BRACKET EXPRESSION" -The left bracket opens a bracket expression. The question mark and asterisk have -no special meaning in a bracket expression. Each bracket expression ends by the -right bracket and matches exactly one character. Some examples follow: - -\fB[a-zA-Z0\-9]\fP or \fB[f\-gF\-G]\fP \- character interval - -\fB[abc]\fP - character enumeration - -\fB[^abc]\fP or \fB[!abc]\fP - negation - -\fB[[:name:]]\fP class expression. Supported classes are -\fBalnum\fP,\fBlower\fP, \fBspace\fP, \fBalpha\fP, \fBdigit\fP, \fBprint\fP, -\fBupper\fP, \fBblank\fP, \fBgraph\fP, \fBxdigit\fP. - -\fB[][-!^]\fP - special case \- matches only '\-', ']', '[', '!' or '^'. These -characters have no special purpose. - -\fB[\\[\\]\\\\]\fP - escape syntax. Matches '[', ']' or '\e'. - -Using the rules above, a file name pattern can be constructed: -.nf - ftp://example.com/some/path/[a-z[:upper:]\\\\].jpg -.fi -.SH PROTOCOLS -This feature is only supported for FTP download. -.SH EXAMPLE -.nf - -extern long begin_cb(struct curl_fileinfo *, void *, int); -extern long end_cb(void *ptr); - -int main(void) -{ - CURL *curl = curl_easy_init(); - if(curl) { - /* turn on wildcard matching */ - curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L); - - /* callback is called before download of concrete file started */ - curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, begin_cb); - - /* 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 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_CHUNK_BGN_FUNCTION (3), -.BR CURLOPT_CHUNK_END_FUNCTION (3), -.BR CURLOPT_FNMATCH_FUNCTION (3), -.BR CURLOPT_URL (3) diff --git a/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.md b/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.md new file mode 100644 index 000000000..4c8939bc6 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_WILDCARDMATCH.md @@ -0,0 +1,115 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_WILDCARDMATCH +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CHUNK_BGN_FUNCTION (3) + - CURLOPT_CHUNK_END_FUNCTION (3) + - CURLOPT_FNMATCH_FUNCTION (3) + - CURLOPT_URL (3) +--- + +# NAME + +CURLOPT_WILDCARDMATCH - directory wildcard transfers + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WILDCARDMATCH, long onoff); +~~~ + +# DESCRIPTION + +Set *onoff* to 1 if you want to transfer multiple files according to a +file name pattern. The pattern can be specified as part of the +CURLOPT_URL(3) option, using an **fnmatch**-like pattern (Shell +Pattern Matching) in the last part of URL (file name). + +By default, libcurl uses its internal wildcard matching implementation. You +can provide your own matching function by the +CURLOPT_FNMATCH_FUNCTION(3) option. + +A brief introduction of its syntax follows: + +## * - ASTERISK + +~~~c + ftp://example.com/some/path/*.txt +~~~ +for all txt's from the root directory. Only two asterisks are allowed within +the same pattern string. + +## ? - QUESTION MARK + +Question mark matches any (exactly one) character. +~~~c + ftp://example.com/some/path/photo?.jpg +~~~ + +## [ - BRACKET EXPRESSION + +The left bracket opens a bracket expression. The question mark and asterisk have +no special meaning in a bracket expression. Each bracket expression ends by the +right bracket and matches exactly one character. Some examples follow: + +**[a-zA-Z0-9]** or **[f-gF-G]** - character interval + +**[abc]** - character enumeration + +**[^abc]** or **[!abc]** - negation + +**[[:name:]]** class expression. Supported classes are +**alnum**,**lower**, **space**, **alpha**, **digit**, **print**, +**upper**, **blank**, **graph**, **xdigit**. + +**[][-!^]** - special case - matches only '-', ']', '[', '!' or '^'. These +characters have no special purpose. + +**[[]]** - escape syntax. Matches '[', ']' or 'e'. + +Using the rules above, a file name pattern can be constructed: +~~~c + ftp://example.com/some/path/[a-z[:upper:]\\].jpg +~~~ + +# PROTOCOLS + +This feature is only supported for FTP download. + +# EXAMPLE + +~~~c + +extern long begin_cb(struct curl_fileinfo *, void *, int); +extern long end_cb(void *ptr); + +int main(void) +{ + CURL *curl = curl_easy_init(); + if(curl) { + /* turn on wildcard matching */ + curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L); + + /* callback is called before download of concrete file started */ + curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, begin_cb); + + /* 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 */ + } +} +~~~ + +# AVAILABILITY + +Added in 7.21.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_WRITEDATA.3 b/docs/libcurl/opts/CURLOPT_WRITEDATA.3 deleted file mode 100644 index 6dc099506..000000000 --- a/docs/libcurl/opts/CURLOPT_WRITEDATA.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_WRITEDATA 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_WRITEDATA \- pointer passed to the write callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer); -.fi -.SH DESCRIPTION -A data \fIpointer\fP to pass to the write callback. If you use the -\fICURLOPT_WRITEFUNCTION(3)\fP option, this is the pointer you get in that -callback's fourth and last argument. If you do not use a write callback, you -must make \fIpointer\fP a 'FILE *' (cast to 'void *') as libcurl passes this -to \fIfwrite(3)\fP when writing data. - -The internal \fICURLOPT_WRITEFUNCTION(3)\fP writes the data to the FILE * -given with this option, or to stdout if this option has not been set. - -If you are using libcurl as a Windows DLL, you \fBMUST\fP use a -\fICURLOPT_WRITEFUNCTION(3)\fP if you set this option or you might experience -crashes. -.SH DEFAULT -By default, this is a FILE * to stdout. -.SH PROTOCOLS -Used for all protocols. -.SH EXAMPLE -A common technique is to use the write callback to store the incoming data -into a dynamically growing allocated buffer, and then this -\fICURLOPT_WRITEDATA(3)\fP is used to point to a struct or the buffer to store -data in. Like in the getinmemory example: -https://curl.se/libcurl/c/getinmemory.html -.SH AVAILABILITY -Available in all libcurl versions. This option was formerly known as -CURLOPT_FILE, the name \fICURLOPT_WRITEDATA(3)\fP was added in 7.9.7. -.SH RETURN VALUE -This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_WRITEFUNCTION (3), -.BR CURLOPT_HEADERDATA (3), -.BR CURLOPT_READDATA (3) diff --git a/docs/libcurl/opts/CURLOPT_WRITEDATA.md b/docs/libcurl/opts/CURLOPT_WRITEDATA.md new file mode 100644 index 000000000..495c6bf9c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_WRITEDATA.md @@ -0,0 +1,63 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_WRITEDATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERDATA (3) + - CURLOPT_READDATA (3) + - CURLOPT_WRITEFUNCTION (3) +--- + +# NAME + +CURLOPT_WRITEDATA - pointer passed to the write callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer); +~~~ + +# DESCRIPTION + +A data *pointer* to pass to the write callback. If you use the +CURLOPT_WRITEFUNCTION(3) option, this is the pointer you get in that +callback's fourth and last argument. If you do not use a write callback, you +must make *pointer* a 'FILE *' (cast to 'void *') as libcurl passes this +to *fwrite(3)* when writing data. + +The internal CURLOPT_WRITEFUNCTION(3) writes the data to the FILE * +given with this option, or to stdout if this option has not been set. + +If you are using libcurl as a Windows DLL, you **MUST** use a +CURLOPT_WRITEFUNCTION(3) if you set this option or you might experience +crashes. + +# DEFAULT + +By default, this is a FILE * to stdout. + +# PROTOCOLS + +Used for all protocols. + +# EXAMPLE + +A common technique is to use the write callback to store the incoming data +into a dynamically growing allocated buffer, and then this +CURLOPT_WRITEDATA(3) is used to point to a struct or the buffer to store +data in. Like in the getinmemory example: +https://curl.se/libcurl/c/getinmemory.html + +# AVAILABILITY + +Available in all libcurl versions. This option was formerly known as +CURLOPT_FILE, the name CURLOPT_WRITEDATA(3) was added in 7.9.7. + +# RETURN VALUE + +This returns CURLE_OK. diff --git a/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 b/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.md similarity index 51% rename from docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_WRITEFUNCTION.md index d992bde20..8957439d3 100644 --- a/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_WRITEFUNCTION.md @@ -1,86 +1,84 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_WRITEFUNCTION 3 "16 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_WRITEFUNCTION \- callback for writing received data -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_WRITEFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_HEADERFUNCTION (3) + - CURLOPT_READFUNCTION (3) + - CURLOPT_WRITEDATA (3) +--- + +# NAME + +CURLOPT_WRITEFUNCTION - callback for writing received data + +# SYNOPSIS + +~~~c #include size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEFUNCTION, write_callback); -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. This callback function gets called by libcurl as soon as there is data received that needs to be saved. For most transfers, this callback gets called -many times and each invoke delivers another chunk of data. \fIptr\fP points to -the delivered data, and the size of that data is \fInmemb\fP; \fIsize\fP is -always 1. +many times and each invoke delivers another chunk of data. *ptr* points to the +delivered data, and the size of that data is *nmemb*; *size* is always 1. + +The data passed to this function is not null-terminated. The callback function is passed as much data as possible in all invokes, but you must not make any assumptions. It may be one byte, it may be thousands. The maximum amount of body data that is be passed to the write -callback is defined in the curl.h header file: \fICURL_MAX_WRITE_SIZE\fP (the -usual default is 16K). If \fICURLOPT_HEADER(3)\fP is enabled, which makes -header data get passed to the write callback, you can get up to -\fICURL_MAX_HTTP_HEADER\fP bytes of header data passed into it. This usually -means 100K. +callback is defined in the curl.h header file: *CURL_MAX_WRITE_SIZE* (the +usual default is 16K). If CURLOPT_HEADER(3) is enabled, which makes header +data get passed to the write callback, you can get up to +*CURL_MAX_HTTP_HEADER* bytes of header data passed into it. This usually means +100K. This function may be called with zero bytes data if the transferred file is empty. -The data passed to this function is not null-terminated! - -Set the \fIuserdata\fP argument with the \fICURLOPT_WRITEDATA(3)\fP option. +Set the *userdata* argument with the CURLOPT_WRITEDATA(3) option. Your callback should return the number of bytes actually taken care of. If that amount differs from the amount passed to your callback function, it signals an error condition to the library. This causes the transfer to get -aborted and the libcurl function used returns \fICURLE_WRITE_ERROR\fP. +aborted and the libcurl function used returns *CURLE_WRITE_ERROR*. You can also abort the transfer by returning CURL_WRITEFUNC_ERROR (added in -7.87.0), which makes \fICURLE_WRITE_ERROR\fP get returned. +7.87.0), which makes *CURLE_WRITE_ERROR* get returned. If the callback function returns CURL_WRITEFUNC_PAUSE it pauses this -transfer. See \fIcurl_easy_pause(3)\fP for further details. +transfer. See curl_easy_pause(3) for further details. Set this option to NULL to get the internal default function used instead of your callback. The internal default function writes the data to the FILE * -given with \fICURLOPT_WRITEDATA(3)\fP. +given with CURLOPT_WRITEDATA(3). -This option does not enable HSTS, you need to use \fICURLOPT_HSTS_CTRL(3)\fP to +This option does not enable HSTS, you need to use CURLOPT_HSTS_CTRL(3) to do that. -.SH DEFAULT + +# DEFAULT + libcurl uses 'fwrite' as a callback by default. -.SH PROTOCOLS + +# PROTOCOLS + For all protocols -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c #include /* for realloc */ #include /* for memcpy */ @@ -127,12 +125,12 @@ int main(void) curl_easy_cleanup(curl); } } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Support for the CURL_WRITEFUNC_PAUSE return code was added in version 7.18.0. -.SH RETURN VALUE + +# RETURN VALUE + This returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_WRITEDATA (3), -.BR CURLOPT_READFUNCTION (3), -.BR CURLOPT_HEADERFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_WS_OPTIONS.3 b/docs/libcurl/opts/CURLOPT_WS_OPTIONS.3 deleted file mode 100644 index 3031b9524..000000000 --- a/docs/libcurl/opts/CURLOPT_WS_OPTIONS.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_WS_OPTIONS 3 "10 Jun 2022" libcurl libcurl -.SH NAME -CURLOPT_WS_OPTIONS \- WebSocket behavior options -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WS_OPTIONS, long bitmask); -.fi -.SH DESCRIPTION -Pass a long with a bitmask to tell libcurl about specific WebSocket -behaviors. - -To detach a WebSocket connection and use the \fIcurl_ws_send(3)\fP and -\fIcurl_ws_recv(3)\fP functions after the HTTP upgrade procedure, set the -\fICURLOPT_CONNECT_ONLY(3)\fP option to 2L. - -Available bits in the bitmask -.IP "CURLWS_RAW_MODE (1)" -Deliver "raw" WebSocket traffic to the \fICURLOPT_WRITEFUNCTION(3)\fP -callback. - -In raw mode, libcurl does not handle pings or any other frame for the -application. -.SH DEFAULT -0 -.SH PROTOCOLS -WebSocket -.SH EXAMPLE -.nf -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 -Added in 7.86.0 -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR curl_ws_recv (3), -.BR curl_ws_send (3), -.BR CURLOPT_CONNECT_ONLY (3) diff --git a/docs/libcurl/opts/CURLOPT_WS_OPTIONS.md b/docs/libcurl/opts/CURLOPT_WS_OPTIONS.md new file mode 100644 index 000000000..04af5bca8 --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_WS_OPTIONS.md @@ -0,0 +1,75 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_WS_OPTIONS +Section: 3 +Source: libcurl +See-also: + - CURLOPT_CONNECT_ONLY (3) + - curl_ws_recv (3) + - curl_ws_send (3) +--- + +# NAME + +CURLOPT_WS_OPTIONS - WebSocket behavior options + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WS_OPTIONS, long bitmask); +~~~ + +# DESCRIPTION + +Pass a long with a bitmask to tell libcurl about specific WebSocket +behaviors. + +To detach a WebSocket connection and use the curl_ws_send(3) and +curl_ws_recv(3) functions after the HTTP upgrade procedure, set the +CURLOPT_CONNECT_ONLY(3) option to 2L. + +Available bits in the bitmask + +## CURLWS_RAW_MODE (1) + +Deliver "raw" WebSocket traffic to the CURLOPT_WRITEFUNCTION(3) +callback. + +In raw mode, libcurl does not handle pings or any other frame for the +application. + +# DEFAULT + +0 + +# PROTOCOLS + +WebSocket + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.86.0 + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. diff --git a/docs/libcurl/opts/CURLOPT_XFERINFODATA.3 b/docs/libcurl/opts/CURLOPT_XFERINFODATA.3 deleted file mode 100644 index 4a03b9ccf..000000000 --- a/docs/libcurl/opts/CURLOPT_XFERINFODATA.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_XFERINFODATA 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_XFERINFODATA \- pointer passed to the progress callback -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XFERINFODATA, void *pointer); -.fi -.SH DESCRIPTION -Pass a \fIpointer\fP that is untouched by libcurl and passed as the first -argument in the progress callback set with \fICURLOPT_XFERINFOFUNCTION(3)\fP. - -This is an alias for \fICURLOPT_PROGRESSDATA(3)\fP. -.SH DEFAULT -The default value of this parameter is NULL. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct progress { - char *private; - size_t size; -}; - -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 */ - - 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_cb); - } -} -.fi -.SH AVAILABILITY -Added in 7.32.0 -.SH RETURN VALUE -Returns CURLE_OK -.SH "SEE ALSO" -.BR CURLOPT_NOPROGRESS (3), -.BR CURLOPT_VERBOSE (3), -.BR CURLOPT_XFERINFOFUNCTION (3) diff --git a/docs/libcurl/opts/CURLOPT_XFERINFODATA.md b/docs/libcurl/opts/CURLOPT_XFERINFODATA.md new file mode 100644 index 000000000..145057c5c --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_XFERINFODATA.md @@ -0,0 +1,80 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_XFERINFODATA +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NOPROGRESS (3) + - CURLOPT_VERBOSE (3) + - CURLOPT_XFERINFOFUNCTION (3) +--- + +# NAME + +CURLOPT_XFERINFODATA - pointer passed to the progress callback + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XFERINFODATA, void *pointer); +~~~ + +# DESCRIPTION + +Pass a *pointer* that is untouched by libcurl and passed as the first +argument in the progress callback set with CURLOPT_XFERINFOFUNCTION(3). + +This is an alias for CURLOPT_PROGRESSDATA(3). + +# DEFAULT + +The default value of this parameter is NULL. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct progress { + char *private; + size_t size; +}; + +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 */ + + 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_cb); + } +} +~~~ + +# AVAILABILITY + +Added in 7.32.0 + +# RETURN VALUE + +Returns CURLE_OK diff --git a/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.3 b/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md similarity index 52% rename from docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.3 rename to docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md index 61521f391..b965db591 100644 --- a/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.3 +++ b/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md @@ -1,32 +1,21 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_XFERINFOFUNCTION 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_XFERINFOFUNCTION \- progress meter callback -.SH SYNOPSIS -.nf +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_XFERINFOFUNCTION +Section: 3 +Source: libcurl +See-also: + - CURLOPT_NOPROGRESS (3) + - CURLOPT_XFERINFODATA (3) +--- + +# NAME + +CURLOPT_XFERINFOFUNCTION - progress meter callback + +# SYNOPSIS + +~~~c #include int progress_callback(void *clientp, @@ -37,8 +26,10 @@ int progress_callback(void *clientp, CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XFERINFOFUNCTION, progress_callback); -.fi -.SH DESCRIPTION +~~~ + +# DESCRIPTION + Pass a pointer to your callback function, which should match the prototype shown above. @@ -47,14 +38,14 @@ frequent interval. While data is being transferred it gets called frequently, and during slow periods like when nothing is being transferred it can slow down to about one call per second. -\fIclientp\fP is the pointer set with \fICURLOPT_XFERINFODATA(3)\fP, it is not +*clientp* is the pointer set with CURLOPT_XFERINFODATA(3), it is not used by libcurl but is only passed along from the application to the callback. The callback gets told how much data libcurl is about to transfer and has -already transferred, in number of bytes. \fIdltotal\fP is the total number of -bytes libcurl expects to download in this transfer. \fIdlnow\fP is the number -of bytes downloaded so far. \fIultotal\fP is the total number of bytes libcurl -expects to upload in this transfer. \fIulnow\fP is the number of bytes +already transferred, in number of bytes. *dltotal* is the total number of +bytes libcurl expects to download in this transfer. *dlnow* is the number +of bytes downloaded so far. *ultotal* is the total number of bytes libcurl +expects to upload in this transfer. *ulnow* is the number of bytes uploaded so far. Unknown/unused argument values passed to the callback are set to zero (like if @@ -66,21 +57,27 @@ If your callback function returns CURL_PROGRESSFUNC_CONTINUE it makes libcurl to continue executing the default progress function. Returning any other non-zero value from this callback makes libcurl abort the -transfer and return \fICURLE_ABORTED_BY_CALLBACK\fP. +transfer and return *CURLE_ABORTED_BY_CALLBACK*. If you transfer data with the multi interface, this function is not called during periods of idleness unless you call the appropriate libcurl function that performs transfers. -\fICURLOPT_NOPROGRESS(3)\fP must be set to 0 to make this function actually +CURLOPT_NOPROGRESS(3) must be set to 0 to make this function actually get called. -.SH DEFAULT + +# DEFAULT + By default, libcurl has an internal progress meter. That is rarely wanted by users. -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c struct progress { char *private; size_t size; @@ -93,7 +90,7 @@ static size_t progress_callback(void *clientp, curl_off_t ulnow) { struct progress *memory = clientp; - printf("my ptr: %p\\n", memory->private); + printf("my ptr: %p\n", memory->private); /* use the values */ @@ -112,11 +109,12 @@ int main(void) curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback); } } -.fi -.SH AVAILABILITY -Added in 7.32.0. This callback replaces \fICURLOPT_PROGRESSFUNCTION(3)\fP -.SH RETURN VALUE +~~~ + +# AVAILABILITY + +Added in 7.32.0. This callback replaces CURLOPT_PROGRESSFUNCTION(3) + +# RETURN VALUE + Returns CURLE_OK. -.SH "SEE ALSO" -.BR CURLOPT_NOPROGRESS (3), -.BR CURLOPT_XFERINFODATA (3) diff --git a/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.3 b/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.3 deleted file mode 100644 index 98ac90f1e..000000000 --- a/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_XOAUTH2_BEARER 3 "19 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_XOAUTH2_BEARER \- OAuth 2.0 access token -.SH SYNOPSIS -.nf -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XOAUTH2_BEARER, char *token); -.fi -.SH DESCRIPTION -Pass a char * as parameter, which should point to the null-terminated OAuth -2.0 Bearer Access Token for use with HTTP, IMAP, LDAP, POP3 and SMTP servers -that support the OAuth 2.0 Authorization Framework. - -Note: For IMAP, LDAP, POP3 and SMTP, the user name used to generate the -Bearer Token should be supplied via the \fICURLOPT_USERNAME(3)\fP option. - -The application does not have to keep the string around after setting this -option. -.SH DEFAULT -NULL -.SH PROTOCOLS -HTTP, IMAP, LDAP, POP3 and SMTP -.SH EXAMPLE -.nf -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 -Added in 7.33.0. Support for OpenLDAP added in 7.82.0. -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or -CURLE_OUT_OF_MEMORY if there was insufficient heap space. -.SH "SEE ALSO" -.BR CURLOPT_MAIL_AUTH (3), -.BR CURLOPT_USERNAME (3) diff --git a/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.md b/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.md new file mode 100644 index 000000000..af91ea03e --- /dev/null +++ b/docs/libcurl/opts/CURLOPT_XOAUTH2_BEARER.md @@ -0,0 +1,67 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLOPT_XOAUTH2_BEARER +Section: 3 +Source: libcurl +See-also: + - CURLOPT_MAIL_AUTH (3) + - CURLOPT_USERNAME (3) +--- + +# NAME + +CURLOPT_XOAUTH2_BEARER - OAuth 2.0 access token + +# SYNOPSIS + +~~~c +#include + +CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XOAUTH2_BEARER, char *token); +~~~ + +# DESCRIPTION + +Pass a char pointer as parameter, which should point to the null-terminated +OAuth 2.0 Bearer Access Token for use with HTTP, IMAP, LDAP, POP3 and SMTP +servers that support the OAuth 2.0 Authorization Framework. + +Note: For IMAP, LDAP, POP3 and SMTP, the user name used to generate the +Bearer Token should be supplied via the CURLOPT_USERNAME(3) option. + +The application does not have to keep the string around after setting this +option. + +# DEFAULT + +NULL + +# PROTOCOLS + +HTTP, IMAP, LDAP, POP3 and SMTP + +# EXAMPLE + +~~~c +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); + } +} +~~~ + +# AVAILABILITY + +Added in 7.33.0. Support for OpenLDAP added in 7.82.0. + +# RETURN VALUE + +Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or +CURLE_OUT_OF_MEMORY if there was insufficient heap space. diff --git a/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.3 b/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.3 deleted file mode 100644 index 174326cb1..000000000 --- a/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH CURLSHOPT_LOCKFUNC 3 "8 Aug 2003" libcurl libcurl -.SH NAME -CURLSHOPT_LOCKFUNC - mutex lock callback -.SH SYNOPSIS -.nf -#include - -void lockcb(CURL *handle, curl_lock_data data, curl_lock_access access, - void *clientp); - -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_LOCKFUNC, lockcb); -.fi -.SH DESCRIPTION -Set a mutex lock callback for the share object, to allow it to get used by -multiple threads concurrently. There is a corresponding -\fICURLSHOPT_UNLOCKFUNC(3)\fP callback called when the mutex is again released. - -The \fIlockcb\fP argument must be a pointer to a function matching the -prototype shown above. The arguments to the callback are: - -\fIhandle\fP is the currently active easy handle in use when the share object -is intended to get used. - -The \fIdata\fP argument tells what kind of data libcurl wants to lock. Make -sure that the callback uses a different lock for each kind of data. - -\fIaccess\fP defines what access type libcurl wants, shared or single. - -\fIclientp\fP is the private pointer you set with \fICURLSHOPT_USERDATA(3)\fP. -This pointer is not used by libcurl itself. -.SH PROTOCOLS -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; - 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 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred. See \fIlibcurl-errors(3)\fP for the full list with -descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR CURLSHOPT_UNLOCKFUNC (3) diff --git a/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.md b/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.md new file mode 100644 index 000000000..f41f86ebf --- /dev/null +++ b/docs/libcurl/opts/CURLSHOPT_LOCKFUNC.md @@ -0,0 +1,77 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLSHOPT_LOCKFUNC +Section: 3 +Source: libcurl +See-also: + - CURLSHOPT_UNLOCKFUNC (3) + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + +CURLSHOPT_LOCKFUNC - mutex lock callback + +# SYNOPSIS + +~~~c +#include + +void lockcb(CURL *handle, curl_lock_data data, curl_lock_access access, + void *clientp); + +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_LOCKFUNC, lockcb); +~~~ + +# DESCRIPTION + +Set a mutex lock callback for the share object, to allow it to get used by +multiple threads concurrently. There is a corresponding +CURLSHOPT_UNLOCKFUNC(3) callback called when the mutex is again released. + +The *lockcb* argument must be a pointer to a function matching the +prototype shown above. The arguments to the callback are: + +*handle* is the currently active easy handle in use when the share object +is intended to get used. + +The *data* argument tells what kind of data libcurl wants to lock. Make +sure that the callback uses a different lock for each kind of data. + +*access* defines what access type libcurl wants, shared or single. + +*clientp* is the private pointer you set with CURLSHOPT_USERDATA(3). +This pointer is not used by libcurl itself. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +extern void mutex_lock(CURL *handle, curl_lock_data data, + curl_lock_access access, void *clientp); + +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, mutex_lock); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred. See libcurl-errors(3) for the full list with +descriptions. diff --git a/docs/libcurl/opts/CURLSHOPT_SHARE.3 b/docs/libcurl/opts/CURLSHOPT_SHARE.md similarity index 52% rename from docs/libcurl/opts/CURLSHOPT_SHARE.3 rename to docs/libcurl/opts/CURLSHOPT_SHARE.md index 49f976040..66ed27034 100644 --- a/docs/libcurl/opts/CURLSHOPT_SHARE.3 +++ b/docs/libcurl/opts/CURLSHOPT_SHARE.md @@ -1,57 +1,59 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH CURLSHOPT_SHARE 3 "8 Aug 2003" libcurl libcurl -.SH NAME +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLSHOPT_SHARE +Section: 3 +Source: libcurl +See-also: + - CURLSHOPT_UNSHARE (3) + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + CURLSHOPT_SHARE - add data to share -.SH SYNOPSIS -.nf + +# SYNOPSIS + +~~~c #include CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_SHARE, long type); -.fi -.SH DESCRIPTION -The \fItype\fP parameter specifies what specific data that should be shared -and kept in the share object that was created with \fIcurl_share_init(3)\fP. -The given \fItype\fP must be be one of the values described below. You can set -\fICURLSHOPT_SHARE(3)\fP multiple times with different data arguments to have +~~~ + +# DESCRIPTION + +The *type* parameter specifies what specific data that should be shared +and kept in the share object that was created with curl_share_init(3). +The given *type* must be be one of the values described below. You can set +CURLSHOPT_SHARE(3) multiple times with different data arguments to have the share object share multiple types of data. Unset a type again by setting -\fICURLSHOPT_UNSHARE(3)\fP. -.IP CURL_LOCK_DATA_COOKIE +CURLSHOPT_UNSHARE(3). + +## CURL_LOCK_DATA_COOKIE + Cookie data is shared across the easy handles using this shared object. Note that this does not activate an easy handle's cookie handling. You can do that -separately by using \fICURLOPT_COOKIEFILE(3)\fP for example. -.IP CURL_LOCK_DATA_DNS +separately by using CURLOPT_COOKIEFILE(3) for example. + +## CURL_LOCK_DATA_DNS + Cached DNS hosts are shared across the easy handles using this shared object. Note that when you use the multi interface, all easy handles added to the same multi handle share DNS cache by default without using this option. -.IP CURL_LOCK_DATA_SSL_SESSION + +## CURL_LOCK_DATA_SSL_SESSION + SSL session IDs are shared across the easy handles using this shared object. This reduces the time spent in the SSL handshake when reconnecting to the same server. Note SSL session IDs are reused within the same easy handle by default. Note this symbol was added in 7.10.3 but was not implemented until 7.23.0. -.IP CURL_LOCK_DATA_CONNECT + +## CURL_LOCK_DATA_CONNECT + Put the connection cache in the share object and make all easy handles using this share object share the connection cache. @@ -62,12 +64,14 @@ get additional transfers added to them if the existing connection is held by the same multi or easy handle. libcurl does not support doing HTTP/2 streams in different threads using a shared connection. -Support for \fBCURL_LOCK_DATA_CONNECT\fP was added in 7.57.0, but the symbol +Support for **CURL_LOCK_DATA_CONNECT** was added in 7.57.0, but the symbol existed before this. Note that when you use the multi interface, all easy handles added to the same multi handle shares connection cache by default without using this option. -.IP CURL_LOCK_DATA_PSL + +## CURL_LOCK_DATA_PSL + The Public Suffix List stored in the share object is made available to all easy handle bound to the later. Since the Public Suffix List is periodically refreshed, this avoids updates in too many different contexts. @@ -76,33 +80,38 @@ Added in 7.61.0. Note that when you use the multi interface, all easy handles added to the same multi handle shares PSL cache by default without using this option. -.IP CURL_LOCK_DATA_HSTS + +## CURL_LOCK_DATA_HSTS + The in-memory HSTS cache. It is not supported to share the HSTS between multiple concurrent threads. Added in 7.88.0 -.SH PROTOCOLS + +# PROTOCOLS + All -.SH EXAMPLE -.nf + +# EXAMPLE + +~~~c int main(void) { CURLSHcode sh; 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)); + printf("Error: %s\n", curl_share_strerror(sh)); } -.fi -.SH AVAILABILITY +~~~ + +# AVAILABILITY + Added in 7.10 -.SH RETURN VALUE + +# RETURN VALUE + CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred. See \fIlibcurl-errors(3)\fP for the full list with +error occurred. See libcurl-errors(3) for the full list with descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR CURLSHOPT_UNSHARE (3) diff --git a/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.3 b/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.3 deleted file mode 100644 index 1994b6fd9..000000000 --- a/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH CURLSHOPT_UNLOCKFUNC 3 "8 Aug 2003" libcurl libcurl -.SH NAME -CURLSHOPT_UNLOCKFUNC - mutex unlock callback -.SH SYNOPSIS -.nf -#include - -void unlockcb(CURL *handle, curl_lock_data data, void *clientp); - -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb); -.fi -.SH DESCRIPTION -Set a mutex unlock callback for the share object. There is a corresponding -\fICURLSHOPT_LOCKFUNC(3)\fP callback called when the mutex is first locked. - -The \fIunlockcb\fP argument must be a pointer to a function matching the -prototype shown above. The arguments to the callback are: - -\fIhandle\fP is the currently active easy handle in use when the share object -is released. - -The \fIdata\fP argument tells what kind of data libcurl wants to unlock. Make -sure that the callback uses a different lock for each kind of data. - -\fIclientp\fP is the private pointer you set with \fICURLSHOPT_USERDATA(3)\fP. -This pointer is not used by libcurl itself. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -extern void mutex_unlock(CURL *, curl_lock_data, void *); - -int main(void) -{ - CURLSHcode sh; - 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 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred. See \fIlibcurl-errors(3)\fP for the full list with -descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR CURLSHOPT_LOCKFUNC (3) diff --git a/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.md b/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.md new file mode 100644 index 000000000..16f9a377e --- /dev/null +++ b/docs/libcurl/opts/CURLSHOPT_UNLOCKFUNC.md @@ -0,0 +1,72 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLSHOPT_UNLOCKFUNC +Section: 3 +Source: libcurl +See-also: + - CURLSHOPT_LOCKFUNC (3) + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + +CURLSHOPT_UNLOCKFUNC - mutex unlock callback + +# SYNOPSIS + +~~~c +#include + +void unlockcb(CURL *handle, curl_lock_data data, void *clientp); + +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb); +~~~ + +# DESCRIPTION + +Set a mutex unlock callback for the share object. There is a corresponding +CURLSHOPT_LOCKFUNC(3) callback called when the mutex is first locked. + +The *unlockcb* argument must be a pointer to a function matching the +prototype shown above. The arguments to the callback are: + +*handle* is the currently active easy handle in use when the share object +is released. + +The *data* argument tells what kind of data libcurl wants to unlock. Make +sure that the callback uses a different lock for each kind of data. + +*clientp* is the private pointer you set with CURLSHOPT_USERDATA(3). +This pointer is not used by libcurl itself. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +extern void mutex_unlock(CURL *, curl_lock_data, void *); + +int main(void) +{ + CURLSHcode sh; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred. See libcurl-errors(3) for the full list with +descriptions. diff --git a/docs/libcurl/opts/CURLSHOPT_UNSHARE.3 b/docs/libcurl/opts/CURLSHOPT_UNSHARE.3 deleted file mode 100644 index e0d252bf3..000000000 --- a/docs/libcurl/opts/CURLSHOPT_UNSHARE.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH CURLSHOPT_UNSHARE 3 "8 Aug 2003" libcurl libcurl -.SH NAME -CURLSHOPT_UNSHARE - remove data to share -.SH SYNOPSIS -.nf -#include - -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNSHARE, long type); -.fi -.SH DESCRIPTION -The \fItype\fP parameter specifies what specific data that should no longer be -shared and kept in the share object that was created with -\fIcurl_share_init(3)\fP. In other words, stop sharing that data in this -shared object. The given \fItype\fP must be be one of the values described -below. You can set \fICURLSHOPT_UNSHARE(3)\fP multiple times with different -data arguments to remove multiple types from the shared object. Add data to -share again with \fICURLSHOPT_SHARE(3)\fP. -.IP CURL_LOCK_DATA_COOKIE -Cookie data is no longer shared across the easy handles using this shared -object. -.IP CURL_LOCK_DATA_DNS -Cached DNS hosts are no longer shared across the easy handles using this -shared object. -.IP CURL_LOCK_DATA_SSL_SESSION -SSL session IDs are no longer shared across the easy handles using this shared -object. -.IP CURL_LOCK_DATA_CONNECT -The connection cache is no longer shared. -.IP CURL_LOCK_DATA_PSL -The Public Suffix List is no longer shared. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -int main(void) -{ - CURLSHcode sh; - 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 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred. See \fIlibcurl-errors(3)\fP for the full list with -descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR CURLSHOPT_SHARE (3) diff --git a/docs/libcurl/opts/CURLSHOPT_UNSHARE.md b/docs/libcurl/opts/CURLSHOPT_UNSHARE.md new file mode 100644 index 000000000..e3cf5988c --- /dev/null +++ b/docs/libcurl/opts/CURLSHOPT_UNSHARE.md @@ -0,0 +1,84 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLSHOPT_UNSHARE +Section: 3 +Source: libcurl +See-also: + - CURLSHOPT_SHARE (3) + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + +CURLSHOPT_UNSHARE - remove data to share + +# SYNOPSIS + +~~~c +#include + +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNSHARE, long type); +~~~ + +# DESCRIPTION + +The *type* parameter specifies what specific data that should no longer be +shared and kept in the share object that was created with +curl_share_init(3). In other words, stop sharing that data in this +shared object. The given *type* must be be one of the values described +below. You can set CURLSHOPT_UNSHARE(3) multiple times with different +data arguments to remove multiple types from the shared object. Add data to +share again with CURLSHOPT_SHARE(3). + +## CURL_LOCK_DATA_COOKIE + +Cookie data is no longer shared across the easy handles using this shared +object. + +## CURL_LOCK_DATA_DNS + +Cached DNS hosts are no longer shared across the easy handles using this +shared object. + +## CURL_LOCK_DATA_SSL_SESSION + +SSL session IDs are no longer shared across the easy handles using this shared +object. + +## CURL_LOCK_DATA_CONNECT + +The connection cache is no longer shared. + +## CURL_LOCK_DATA_PSL + +The Public Suffix List is no longer shared. + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +int main(void) +{ + CURLSHcode sh; + 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)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred. See libcurl-errors(3) for the full list with +descriptions. diff --git a/docs/libcurl/opts/CURLSHOPT_USERDATA.3 b/docs/libcurl/opts/CURLSHOPT_USERDATA.3 deleted file mode 100644 index cb5347fe9..000000000 --- a/docs/libcurl/opts/CURLSHOPT_USERDATA.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.TH CURLSHOPT_USERDATA 3 "8 Aug 2003" libcurl libcurl -.SH NAME -CURLSHOPT_USERDATA - pointer passed to the lock and unlock mutex callbacks -.SH SYNOPSIS -.nf -#include - -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp); -.fi -.SH DESCRIPTION -The \fIclientp\fP parameter is held verbatim by libcurl and is passed on as -the \fIclientp\fP argument to the callbacks set with -\fICURLSHOPT_LOCKFUNC(3)\fP and \fICURLSHOPT_UNLOCKFUNC(3)\fP. -.SH PROTOCOLS -All -.SH EXAMPLE -.nf -struct secrets { - void *custom; -}; - -int main(void) -{ - CURLSHcode sh; - struct secrets private_stuff; - 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 -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred. See \fIlibcurl-errors(3)\fP for the full list with -descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup (3), -.BR curl_share_init (3), -.BR curl_share_setopt (3), -.BR CURLSHOPT_LOCKFUNC (3) diff --git a/docs/libcurl/opts/CURLSHOPT_USERDATA.md b/docs/libcurl/opts/CURLSHOPT_USERDATA.md new file mode 100644 index 000000000..d0ec7772d --- /dev/null +++ b/docs/libcurl/opts/CURLSHOPT_USERDATA.md @@ -0,0 +1,62 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: CURLSHOPT_USERDATA +Section: 3 +Source: libcurl +See-also: + - CURLSHOPT_LOCKFUNC (3) + - curl_share_cleanup (3) + - curl_share_init (3) + - curl_share_setopt (3) +--- + +# NAME + +CURLSHOPT_USERDATA - pointer passed to the lock and unlock mutex callbacks + +# SYNOPSIS + +~~~c +#include + +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp); +~~~ + +# DESCRIPTION + +The *clientp* parameter is held verbatim by libcurl and is passed on as +the *clientp* argument to the callbacks set with +CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3). + +# PROTOCOLS + +All + +# EXAMPLE + +~~~c +struct secrets { + void *custom; +}; + +int main(void) +{ + CURLSHcode sh; + struct secrets private_stuff; + CURLSH *share = curl_share_init(); + sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff); + if(sh) + printf("Error: %s\n", curl_share_strerror(sh)); +} +~~~ + +# AVAILABILITY + +Added in 7.10 + +# RETURN VALUE + +CURLSHE_OK (zero) means that the option was set properly, non-zero means an +error occurred. See libcurl-errors(3) for the full list with +descriptions. diff --git a/docs/libcurl/opts/Makefile.am b/docs/libcurl/opts/Makefile.am index 250937fd1..42f9db4c5 100644 --- a/docs/libcurl/opts/Makefile.am +++ b/docs/libcurl/opts/Makefile.am @@ -26,38 +26,19 @@ AUTOMAKE_OPTIONS = foreign no-dependencies include Makefile.inc -man_DISTMANS = $(man_MANS:.3=.3.dist) +CURLPAGES = $(man_MANS:.3=.md) +CLEANFILES = $(man_MANS) +nodist_MANS = $(man_MANS) -HTMLPAGES = $(man_MANS:.3=.html) +EXTRA_DIST = $(CURLPAGES) CMakeLists.txt -PDFPAGES = $(man_MANS:.3=.pdf) +CD2NROFF = $(top_srcdir)/scripts/cd2nroff $< >$@ +CD2 = $(CD2_$(V)) +CD2_0 = @echo " RENDER " $@; +CD2_1 = +CD2_ = $(CD2_0) -CLEANFILES = $(HTMLPAGES) $(PDFPAGES) $(man_DISTMANS) +SUFFIXES = .3 .md -EXTRA_DIST = $(man_MANS) CMakeLists.txt -MAN2HTML= roffit --mandir=. $< >$@ - -SUFFIXES = .3 .html - -html: $(HTMLPAGES) - -.3.html: - $(MAN2HTML) - -pdf: $(PDFPAGES) - -.3.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") - -mancheck: - @(cd $(top_srcdir)/docs/libcurl/opts && ls `awk -F, '!/OBSOLETE/ && /^ CINIT/ { a=substr($$1, 9); print "CURLOPT_" a ".3"}' $(top_srcdir)/include/curl/curl.h`) - rm -f in_temp - @(for a in $(man_MANS); do echo $$a >>in_temp; done) - sort in_temp > in_makefile - ls CURL*.3 > in_directory - -diff -u in_makefile in_directory - rm in_temp in_directory in_makefile +.md.3: + $(CD2)$(CD2NROFF) diff --git a/docs/libcurl/opts/template.3 b/docs/libcurl/opts/template.3 deleted file mode 100644 index 495cb82e0..000000000 --- a/docs/libcurl/opts/template.3 +++ /dev/null @@ -1,41 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH CURLOPT_TEMPLATE 3 "17 Jun 2014" libcurl libcurl -.SH NAME -CURLOPT_TEMPLATE \- [short description] -.SH SYNOPSIS -#include - -CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TEMPLATE, [argument]); -.SH DESCRIPTION -.SH DEFAULT -.SH PROTOCOLS -.SH EXAMPLE -.SH AVAILABILITY -.SH RETURN VALUE -Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. -.SH "SEE ALSO" -.BR CURLOPT_STDERR (3), -.BR CURLOPT_DEBUGFUNCTION (3) diff --git a/docs/mk-ca-bundle.1 b/docs/mk-ca-bundle.1 deleted file mode 100644 index e6db0504c..000000000 --- a/docs/mk-ca-bundle.1 +++ /dev/null @@ -1,120 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" * SPDX-License-Identifier: curl -.\" * -.\" ************************************************************************** -.\" -.TH mk-ca-bundle 1 "24 Oct 2016" mk-ca-bundle mk-ca-bundle -.SH NAME -mk-ca-bundle \- convert Mozilla's certificate bundle to PEM format -.SH SYNOPSIS -mk-ca-bundle [options] -.I [outputfile] -.SH DESCRIPTION -The mk-ca-bundle tool downloads the \fIcertdata.txt\fP file from Mozilla's -source tree over HTTPS, then parses \fIcertdata.txt\fP and extracts -certificates into PEM format. By default, only CA root certificates trusted to -issue SSL server authentication certificates are extracted. These are then -processed with the OpenSSL command line tool to produce the final ca-bundle -file. - -The default \fIoutputfile\fP name is \fBca-bundle.crt\fP. By setting it to '-' -(a single dash) you will get the output sent to STDOUT instead of a file. - -The PEM format this scripts uses for output makes the result readily available -for use by just about all OpenSSL or GnuTLS powered applications, such as curl -and others. -.SH OPTIONS -The following options are supported: -.IP -b -backup an existing version of \fIoutputfilename\fP -.IP "-d [name]" -specify which Mozilla tree to pull \fIcertdata.txt\fP from (or a custom -URL). Valid names are: aurora, beta, central, Mozilla, nss, release -(default). They are shortcuts for which source tree to get the certificates -data from. -.IP -f -force rebuild even if \fIcertdata.txt\fP is current (Added in version 1.17) -.IP -i -print version info about used modules -.IP -k -Allow insecure data transfer. By default (since 1.27) this command will fail -if the HTTPS transfer fails. This overrides that decision (and opens for -man-in-the-middle attacks). -.IP -l -print license info about \fIcertdata.txt\fP -.IP -m -(Added in 1.26) Include meta data comments in the output. The meta data is -specific information about each certificate that is stored in the original -file as comments and using this option will make those comments get passed on -to the output file. The meta data is not parsed in any way by mk-ca-bundle. -.IP -n -no download of \fIcertdata.txt\fP (to use existing) -.IP "-p [purposes]:[levels]" -list of Mozilla trust purposes and levels for certificates to include in -output. Takes the form of a comma separated list of purposes, a colon, and a -comma separated list of levels. The default is to include all certificates -trusted to issue SSL Server certificates -(\fISERVER_AUTH:TRUSTED_DELEGATOR\fP). - -(Added in version 1.21, Perl only) - -Valid purposes are: -.RS -\fIALL\fP, \fIDIGITAL_SIGNATURE\fP, \fINON_REPUDIATION\fP, -\fIKEY_ENCIPHERMENT\fP, \fIDATA_ENCIPHERMENT\fP, \fIKEY_AGREEMENT\fP, -\fIKEY_CERT_SIGN\fP, \fICRL_SIGN\fP, \fISERVER_AUTH\fP (default), -\fICLIENT_AUTH\fP, \fICODE_SIGNING\fP, \fIEMAIL_PROTECTION\fP, -\fIIPSEC_END_SYSTEM\fP, \fIIPSEC_TUNNEL\fP, \fIIPSEC_USER\fP, -\fITIME_STAMPING\fP, \fISTEP_UP_APPROVED\fP -.RE -.IP -Valid trust levels are: -.RS -\fIALL\fP, \fITRUSTED_DELEGATOR\fP (default), \fINOT_TRUSTED\fP, \fIMUST_VERIFY_TRUST\fP, \fITRUSTED\fP -.RE -.IP -q -be really quiet (no progress output at all) -.IP -t -include plain text listing of certificates -.IP "-s [algorithms]" -comma separated list of signature algorithms with which to hash/fingerprint -each certificate and output when run in plain text mode. - -(Added in version 1.21, Perl only) - -Valid algorithms are: -.RS -ALL, NONE, MD5 (default), SHA1, SHA256, SHA384, SHA512 -.RE -.IP -u -unlink (remove) \fIcertdata.txt\fP after processing -.IP -v -be verbose and print out processed certificate authorities -.SH EXIT STATUS -Returns 0 on success. Returns 1 if it fails to download data. -.SH FILE FORMAT -The file format used by Mozilla for this trust information is documented here: -.nf -https://p11-glue.freedesktop.org/doc/storing-trust-policy/storing-trust-existing.html -.fi -.SH SEE ALSO -.BR curl (1) diff --git a/docs/mk-ca-bundle.md b/docs/mk-ca-bundle.md new file mode 100644 index 000000000..bacfce08b --- /dev/null +++ b/docs/mk-ca-bundle.md @@ -0,0 +1,128 @@ +--- +c: Copyright (C) Daniel Stenberg, , et al. +SPDX-License-Identifier: curl +Title: mk-ca-bundle +Section: 1 +Source: mk-ca-bundle +See-also: + - curl (1) +--- + +# NAME + +mk-ca-bundle - convert Mozilla's certificate bundle to PEM format + +# SYNOPSIS + +mk-ca-bundle [options] +*[outputfile]* + +# DESCRIPTION + +The mk-ca-bundle tool downloads the *certdata.txt* file from Mozilla's source +tree over HTTPS, then parses *certdata.txt* and extracts certificates into PEM +format. By default, only CA root certificates trusted to issue SSL server +authentication certificates are extracted. These are then processed with the +OpenSSL command line tool to produce the final ca-bundle file. + +The default *outputfile* name is **ca-bundle.crt**. By setting it to '-' (a +single dash) you will get the output sent to STDOUT instead of a file. + +The PEM format this scripts uses for output makes the result readily available +for use by just about all OpenSSL or GnuTLS powered applications, such as curl +and others. + +# OPTIONS + +The following options are supported: + +## -b + +backup an existing version of *outputfilename* + +## -d [name] + +specify which Mozilla tree to pull *certdata.txt* from (or a custom +URL). Valid names are: aurora, beta, central, Mozilla, nss, release +(default). They are shortcuts for which source tree to get the certificates +data from. + +## -f + +force rebuild even if *certdata.txt* is current (Added in version 1.17) + +## -i + +print version info about used modules + +## -k + +Allow insecure data transfer. By default (since 1.27) this command will fail +if the HTTPS transfer fails. This overrides that decision (and opens for +man-in-the-middle attacks). + +## -l + +print license info about *certdata.txt* + +## -m + +(Added in 1.26) Include meta data comments in the output. The meta data is +specific information about each certificate that is stored in the original +file as comments and using this option will make those comments get passed on +to the output file. The meta data is not parsed in any way by mk-ca-bundle. + +## -n + +no download of *certdata.txt* (to use existing) + +## -p [purposes]:[levels] + +list of Mozilla trust purposes and levels for certificates to include in +output. Takes the form of a comma separated list of purposes, a colon, and a +comma separated list of levels. The default is to include all certificates +trusted to issue SSL Server certificates (*SERVER_AUTH:TRUSTED_DELEGATOR*). + +Valid purposes are: *ALL*, *DIGITAL_SIGNATURE*, *NON_REPUDIATION*, +*KEY_ENCIPHERMENT*, *DATA_ENCIPHERMENT*, *KEY_AGREEMENT*, *KEY_CERT_SIGN*, +*CRL_SIGN*, *SERVER_AUTH* (default), *CLIENT_AUTH*, *CODE_SIGNING*, +*EMAIL_PROTECTION*, *IPSEC_END_SYSTEM*, *IPSEC_TUNNEL*, *IPSEC_USER*, +*TIME_STAMPING*, *STEP_UP_APPROVED* + +Valid trust levels are: *ALL*, *TRUSTED_DELEGATOR* (default), *NOT_TRUSTED*, +*MUST_VERIFY_TRUST*, *TRUSTED* + +## -q + +be really quiet (no progress output at all) + +## -t + +include plain text listing of certificates + +## -s [algorithms] + +comma separated list of signature algorithms with which to hash/fingerprint +each certificate and output when run in plain text mode. + +Valid algorithms are: +ALL, NONE, MD5 (default), SHA1, SHA256, SHA384, SHA512 + +## -u + +unlink (remove) *certdata.txt* after processing + +## -v + +be verbose and print out processed certificate authorities + +# EXIT STATUS + +Returns 0 on success. Returns 1 if it fails to download data. + +# FILE FORMAT + +The file format used by Mozilla for this trust information is documented here: +~~~c +https://p11-glue.freedesktop.org/doc/storing-trust-policy/storing-trust-existing.html +~~~ diff --git a/maketgz b/maketgz index a0fcd878f..4ebda82a9 100755 --- a/maketgz +++ b/maketgz @@ -145,13 +145,8 @@ fi ############################################################################ # -# Modify the man pages to display the version number and date. -# - -echo "update man pages" -./scripts/updatemanpages.pl $version >/dev/null - # make the generated file newer than the man page + touch src/tool_hugehelp.c ############################################################################ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 9d69cff9c..ae95e85ac 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -22,8 +22,8 @@ # ########################################################################### -EXTRA_DIST = updatemanpages.pl coverage.sh completion.pl firefox-db2pem.sh \ - checksrc.pl mk-ca-bundle.pl schemetable.c +EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \ + mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@ diff --git a/scripts/cd2cd b/scripts/cd2cd new file mode 100755 index 000000000..a4de2f875 --- /dev/null +++ b/scripts/cd2cd @@ -0,0 +1,226 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### + +=begin comment + +This script updates a curldown file to current/better curldown. + +Example: cd2cd [--in-place] > + +--in-place: if used, it replaces the original file with the cleaned up + version. When this is used, cd2cd accepts multiple files to work + on and it ignores errors on single files. + +=end comment +=cut + +my $cd2cd = "0.1"; # to keep check +my $dir; +my $extension; +my $inplace = 0; + +while(1) { + if($ARGV[0] eq "--in-place") { + shift @ARGV; + $inplace = 1; + } + else { + last; + } +} + + +use POSIX qw(strftime); +my @ts; +if (defined($ENV{SOURCE_DATE_EPOCH})) { + @ts = localtime($ENV{SOURCE_DATE_EPOCH}); +} else { + @ts = localtime; +} +my $date = strftime "%B %d %Y", @ts; + +sub outseealso { + my (@sa) = @_; + my $comma = 0; + my @o; + push @o, ".SH SEE ALSO\n"; + for my $s (sort @sa) { + push @o, sprintf "%s.BR $s", $comma ? ",\n": ""; + $comma = 1; + } + push @o, "\n"; + return @o; +} + +sub single { + my @head; + my @seealso; + my ($f)=@_; + my $title; + my $section; + my $source; + my $start = 0; + my $d; + my $line = 0; + open(F, "<:crlf", "$f") || + return 1; + while() { + $line++; + $d = $_; + if(!$start) { + if(/^---/) { + # header starts here + $start = 1; + push @head, $d; + } + next; + } + if(/^Title: *(.*)/i) { + $title=$1; + } + elsif(/^Section: *(.*)/i) { + $section=$1; + } + elsif(/^Source: *(.*)/i) { + $source=$1; + } + elsif(/^See-also: +(.*)/i) { + $salist = 0; + push @seealso, $1; + } + elsif(/^See-also: */i) { + if($seealso[0]) { + print STDERR "$f:$line:1:ERROR: bad See-Also, needs list\n"; + return 2; + } + $salist = 1; + } + elsif(/^ +- (.*)/i) { + # the only list we support is the see-also + if($salist) { + push @seealso, $1; + } + } + # REUSE-IgnoreStart + elsif(/^C: (.*)/i) { + $copyright=$1; + } + elsif(/^SPDX-License-Identifier: (.*)/i) { + $spdx=$1; + } + # REUSE-IgnoreEnd + elsif(/^---/) { + # end of the header section + if(!$title) { + print STDERR "ERROR: no 'Title:' in $f\n"; + return 1; + } + if(!$section) { + print STDERR "ERROR: no 'Section:' in $f\n"; + return 2; + } + if(!$seealso[0]) { + print STDERR "$f:$line:1:ERROR: no 'See-also:' present\n"; + return 2; + } + if(!$copyright) { + print STDERR "$f:$line:1:ERROR: no 'C:' field present\n"; + return 2; + } + if(!$spdx) { + print STDERR "$f:$line:1:ERROR: no 'SPDX-License-Identifier:' field present\n"; + return 2; + } + last; + } + else { + chomp; + print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';" + } + } + + if(!$start) { + print STDERR "$f:$line:1:ERROR: no header present\n"; + return 2; + } + + my @desc; + + push @desc, sprintf <, et al. +SPDX-License-Identifier: curl +Title: $title +Section: $section +Source: $source +HEAD + ; + push @desc, "See-also:\n"; + for my $s (sort @seealso) { + push @desc, " - $s\n" if($s); + } + push @desc, "---\n"; + + my $blankline = 0; + while() { + $d = $_; + $line++; + if($d =~ /^[ \t]*\n/) { + $blankline++; + } + else { + $blankline = 0; + } + # *italics* for curl symbol links get the asterisks removed + $d =~ s/\*((lib|)curl[^ ]*\(3\))\*/$1/gi; + + if(length($d) > 90) { + print STDERR "$f:$line:1:WARN: excessive line length\n"; + } + + push @desc, $d if($blankline < 2); + } + close(F); + + if($inplace) { + open(O, ">$f") || return 1; + print O @desc; + close(O); + } + else { + print @desc; + } + return 0; +} + +if($inplace) { + for my $a (@ARGV) { + # this ignores errors + single($a); + } +} +else { + exit single($ARGV[0]); +} diff --git a/scripts/cd2nroff b/scripts/cd2nroff new file mode 100755 index 000000000..5d0bab887 --- /dev/null +++ b/scripts/cd2nroff @@ -0,0 +1,331 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### + +=begin comment + +Converts a curldown file to nroff (man page). + +=end comment +=cut + +my $cd2nroff = "0.1"; # to keep check +my $dir; +my $extension; + +while(1) { + if($ARGV[0] eq "-d") { + shift @ARGV; + $dir = shift @ARGV; + } + elsif($ARGV[0] eq "-e") { + shift @ARGV; + $extension = shift @ARGV; + } + elsif($ARGV[0] eq "-h") { + print < Write the output to the file name from the meta-data in the + specified directory, instead of writing to stdout +-e If -d is used, this option can provide an added "extension", arbitrary + text really, to append to the file name. +-h This help text, +-v Show version then exit +HELP + ; + exit 0; + } + elsif($ARGV[0] eq "-v") { + print "cd2nroff version $cd2nroff\n"; + exit 0; + } + else { + last; + } +} + +use POSIX qw(strftime); +my @ts; +if (defined($ENV{SOURCE_DATE_EPOCH})) { + @ts = localtime($ENV{SOURCE_DATE_EPOCH}); +} else { + @ts = localtime; +} +my $date = strftime "%B %d %Y", @ts; + +sub outseealso { + my (@sa) = @_; + my $comma = 0; + my @o; + push @o, ".SH SEE ALSO\n"; + for my $s (sort @sa) { + push @o, sprintf "%s.BR $s", $comma ? ",\n": ""; + $comma = 1; + } + push @o, "\n"; + return @o; +} + +sub single { + my @seealso; + my ($f)=@_; + my $title; + my $section; + my $source; + my $start = 0; + my $errors; + my $fh; + if($f) { + open($fh, "<:crlf", "$f") || return 1; + } + else { + $fh = STDIN; + } + while(<$fh>) { + $line++; + if(!$start) { + if(/^---/) { + # header starts here + $start = 1; + } + next; + } + if(/^Title: *(.*)/i) { + $title=$1; + } + elsif(/^Section: *(.*)/i) { + $section=$1; + } + elsif(/^Source: *(.*)/i) { + $source=$1; + } + elsif(/^See-also: +(.*)/i) { + $salist = 0; + push @seealso, $1; + } + elsif(/^See-also: */i) { + if($seealso[0]) { + print STDERR "$f:$line:1:ERROR: bad See-Also, needs list\n"; + return 2; + } + $salist = 1; + } + elsif(/^ +- (.*)/i) { + # the only list we support is the see-also + if($salist) { + push @seealso, $1; + } + } + # REUSE-IgnoreStart + elsif(/^C: (.*)/i) { + $copyright=$1; + } + elsif(/^SPDX-License-Identifier: (.*)/i) { + $spdx=$1; + } + # REUSE-IgnoreEnd + elsif(/^---/) { + # end of the header section + if(!$title) { + print STDERR "ERROR: no 'Title:' in $f\n"; + return 1; + } + if(!$section) { + print STDERR "ERROR: no 'Section:' in $f\n"; + return 2; + } + if(!$seealso[0]) { + print STDERR "$f:$line:1:ERROR: no 'See-also:' present\n"; + return 2; + } + if(!$copyright) { + print STDERR "$f:$line:1:ERROR: no 'C:' field present\n"; + return 2; + } + if(!$spdx) { + print STDERR "$f:$line:1:ERROR: no 'SPDX-License-Identifier:' field present\n"; + return 2; + } + last; + } + else { + chomp; + print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';" + } + } + + if(!$start) { + print STDERR "$f:$line:1:ERROR: no header present\n"; + return 2; + } + + my @desc; + my $quote = 0; + my $blankline = 0; + my $header = 0; + + # cut off the leading path from the file name, if any + $f =~ s/^(.*[\\\/])//; + + push @desc, ".\\\" generated by cd2nroff $cd2nroff from $f\n"; + push @desc, ".TH $title $section \"$date\" $source\n"; + while(<$fh>) { + $line++; + + $d = $_; + + if($quote) { + if($quote == 4) { + # remove the indentation + if($d =~ /^ (.*)/) { + push @desc, "$1\n"; + next; + } + else { + # end of quote + $quote = 0; + push @desc, ".fi\n"; + next; + } + } + if(/^~~~/) { + # end of quote + $quote = 0; + push @desc, ".fi\n"; + next; + } + # convert single backslahes to doubles + $d =~ s/\\/\\\\/g; + # lines starting with a period needs it escaped + $d =~ s/^\./\\&./; + push @desc, $d; + next; + } + + # **bold** + $d =~ s/\*\*(\S.*?)\*\*/\\fB$1\\fP/g; + # *italics* + $d =~ s/\*(\S.*?)\*/\\fI$1\\fP/g; + + # mentions of curl symbols with man pages use italics by default + $d =~ s/((lib|)curl([^ ]*\(3\)))/\\fI$1\\fP/gi; + + # backticked becomes italics + $d =~ s/\`(.*?)\`/\\fI$1\\fP/g; + + if(/^## (.*)/) { + my $word = $1; + # if there are enclosing quotes, remove them first + $word =~ s/[\"\'](.*)[\"\']\z/$1/; + + # enclose in double quotes if there is a space present + if($word =~ / /) { + push @desc, ".IP \"$word\"\n"; + } + else { + push @desc, ".IP $word\n"; + } + $header = 1; + } + elsif(/^# (.*)/) { + my $word = $1; + # if there are enclosing quotes, remove them first + $word =~ s/[\"\'](.*)[\"\']\z/$1/; + push @desc, ".SH $word\n"; + $header = 1; + } + elsif(/^~~~c/) { + # start of a code section, not indented + $quote = 1; + push @desc, "\n" if($blankline && !$header); + $header = 0; + push @desc, ".nf\n"; + } + elsif(/^~~~/) { + # start of a quote section; not code, not indented + $quote = 1; + push @desc, "\n" if($blankline && !$header); + $header = 0; + push @desc, ".nf\n"; + } + elsif(/^ (.*)/) { + # quoted, indented by 4 space + $quote = 4; + push @desc, "\n" if($blankline && !$header); + $header = 0; + push @desc, ".nf\n$1\n"; + } + elsif(/^[ \t]*\n/) { + # count and ignore blank lines + $blankline++; + } + else { + # don't output newlines if this is the first content after a + # header + push @desc, "\n" if($blankline && !$header); + $blankline = 0; + $header = 0; + + # remove single line HTML comments + $d =~ s///g; + + # quote minuses in the output + $d =~ s/([^\\])-/$1\\-/g; + # replace single quotes + $d =~ s/\'/\\(aq/g; + # handle double quotes first on the line + $d =~ s/^(\s*)\"/$1\\&\"/; + + # lines starting with a period needs it escaped + $d =~ s/^\./\\&./; + + if($d =~ /^(.*) /) { + printf STDERR "$f:$line:%d:ERROR: 2 spaces detected\n", + length($1); + $errors++; + } + if($d =~ /^[ \t]*\n/) { + # replaced away all contents + $blankline= 1; + } + else { + push @desc, $d; + } + } + } + close($fh); + push @desc, outseealso(@seealso); + if($dir) { + open(O, ">$dir/$title.$section$extension"); + print O @desc; + close(O); + } + else { + print @desc; + } + return $errors; +} + +exit single($ARGV[0]); diff --git a/scripts/cdall b/scripts/cdall new file mode 100755 index 000000000..507ccc6be --- /dev/null +++ b/scripts/cdall @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### + +# provide all dir names to scan on the cmdline + +sub convert { + my ($dir)=@_; + opendir(my $dh, $dir) || die "could not open $dir"; + my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh); + closedir $dh; + + for my $cd (@cd) { + my $nroff = "$cd"; + $nroff =~ s/\.md\z/.3/; + print "$dir/$cd = $dir/$nroff\n"; + system("./scripts/cd2nroff -d $dir $dir/$cd"); + } +} + +for my $d (sort @ARGV) { + convert($d); +} diff --git a/scripts/nroff2cd b/scripts/nroff2cd new file mode 100755 index 000000000..500367f81 --- /dev/null +++ b/scripts/nroff2cd @@ -0,0 +1,193 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### + +=begin comment + +This script converts an nroff file to curldown + +Example: cd2nroff [options] > + +Note: when converting .nf sections, this tool does not know if the +section is code or just regular quotes. It then assumes and uses ~~~c +for code. + +=end comment +=cut + +my $nroff2cd = "0.1"; # to keep check + +sub single { + my ($f)=@_; + open(F, "<:crlf", "$f") || + return 1; + my $line; + my $title; + my $section; + my $source; + my @seealso; + my @desc; + my $header; # non-zero when TH is passed + my $quote = 0; # quote state + while() { + $line++; + my $d = $_; + if($_ =~ /^.\\\"/) { + # a comment we can ignore + next; + } + if(!$header) { + if($d =~ /.so (.*)/) { + # this is basically an include, so do that + my $f = $1; + # remove leading directory + $f =~ s/(.*?\/)//; + close(F); + open(F, "<:crlf", "$f") || return 1; + } + if($d =~ /^\.TH ([^ ]*) (\d) \"(.*?)\" ([^ \n]*)/) { + # header, this needs to be the first thing after leading comments + $title = $1; + $section = $2; + # date is $3 + $source = $4; + # if there are enclosing quotes around source, remove them + $source =~ s/[\"\'](.*)[\"\']\z/$1/; + $header = 1; + + print <, et al. +SPDX-License-Identifier: curl +Title: $title +Section: $section +Source: $source +HEAD + ; + } + next; + } + + if($quote) { + if($d =~ /^\.SH/) { + #end of quote without an .fi + $quote = 0; + push @desc, "~~~\n"; + } + elsif($d =~ /^\.fi/) { + #end of quote + $quote = 0; + push @desc, "~~~\n"; + next; + } + else { + # double-backslashes converted to single ones + $d =~ s/\\\\/\\/g; + push @desc, $d; + next; + } + } + if($d =~ /^\.SH (.*)/) { + my $word = $1; + # if there are enclosing quotes, remove them first + $word =~ s/[\"\'](.*)[\"\']\z/$1/; + if($word eq "SEE ALSO") { + # we just slurp up this section + next; + } + push @desc, "\n# $word\n\n"; + } + elsif($d =~ /^\.(RS|RE)/) { + # ignore these + } + elsif($d =~ /^\.IP (.*)/) { + my $word = $1; + # if there are enclosing quotes, remove them first + $word =~ s/[\"\'](.*)[\"\']\z/$1/; + push @desc, "\n## $word\n\n"; + } + elsif($d =~ /^\.IP/) { + # .IP with no text we just skip + } + elsif($d =~ /^\.BR (.*)/) { + # only used for SEE ALSO + my $word = $1; + # remove trailing comma + $word =~ s/,\z//; + + for my $s (split(/,/, $word)) { + # remove all double quotes + $s =~ s/\"//g; + # tream leading whitespace + $s =~ s/^ +//g; + push @seealso, $s; + } + } + elsif($d =~ /^\.I (.*)/) { + push @desc, "*$1*\n"; + } + elsif($d =~ /^\.B (.*)/) { + push @desc, "**$1**\n"; + } + elsif($d =~ /^\.nf/) { + push @desc, "~~~c\n"; + $quote = 1; + } + else { + # embolden + $d =~ s/\\fB(.*?)\\fP/**$1**/g; + # links to "curl.*()" are left bare since cd2nroff handles them + # specially + $d =~ s/\\fI(curl.*?\(3\))\\fP/$1/ig; + # emphasize + $d =~ s/\\fI(.*?)\\fP/*$1*/g; + # emphasize on a split line + $d =~ s/\\fI/*/g; + # bold on a split line + $d =~ s/\\fB/**/g; + # remove backslash amp + $d =~ s/\\&//g; + # remove backslashes + $d =~ s/\\//g; + # fix single quotes + $d =~ s/\(aq/'/g; + # fix double quotes + $d =~ s/\(dq/\"/g; + push @desc, $d; + } + } + close(F); + + print "See-also:\n"; + for my $s (sort @seealso) { + print " - $s\n" if($s); + } + print "---\n"; + print @desc; + + return !$header; +} + +exit single($ARGV[0]); + diff --git a/scripts/updatemanpages.pl b/scripts/updatemanpages.pl deleted file mode 100755 index 58a8755e8..000000000 --- a/scripts/updatemanpages.pl +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env perl -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -# SPDX-License-Identifier: curl -# -########################################################################### - -# Update man pages. - -use strict; -use warnings; -use Tie::File; - -# Data from the command line. - -my $curlver = $ARGV[0]; -my $curldate = $ARGV[1]; - -# Directories and extensions. - -my @dirlist = ("docs/", "docs/libcurl/", "docs/libcurl/opts/", "tests/"); -my @extlist = (".1", ".3"); -my @excludelist = ("mk-ca-bundle.1", "template.3"); - -# Subroutines - -sub printargs{ - # Print arguments and exit. - - print "usage: updatemanpages.pl \n"; - exit; -} - -sub getthline{ - # Process file looking for .TH section. - - my $filename = shift; - my $file_handle; - my $file_line; - - # Open the file. - - open($file_handle, $filename); - - # Look for the .TH section, process it into an array, - # modify it and write to file. - - tie(my @file_data, 'Tie::File', $filename); - foreach my $file_data_line(@file_data) { - if($file_data_line =~ /^.TH/) { - $file_line = $file_data_line; - last; - } - } - - # Close the file. - - close($file_handle); - return $file_line; -} - -sub extractth{ - # Extract .TH section as an array. - - my $input = shift; - - # Split the line into an array. - - my @tharray; - my $inputsize = length($input); - my $inputcurrent = ""; - my $quotemode = 0; - - for(my $inputseek = 0; $inputseek < $inputsize; $inputseek++) { - - if(substr($input, $inputseek, 1) eq " " && $quotemode eq 0) { - push(@tharray, $inputcurrent); - $inputcurrent = ""; - next; - } - - $inputcurrent = $inputcurrent . substr($input, $inputseek, 1); - - if(substr($input, $inputseek, 1) eq "\"") { - if($quotemode eq 0) { - $quotemode = 1; - } - else { - $quotemode = 0; - } - } - } - - if($inputcurrent ne "") { - push(@tharray, $inputcurrent); - } - - return @tharray; -} - -sub getdate{ - # Get the date from the .TH section. - - my $filename = shift; - my $thline; - my @tharray; - my $date = ""; - - $thline = getthline($filename); - - # Return nothing if there is no .TH section found. - - if(!$thline || $thline eq "") { - return ""; - } - - @tharray = extractth($thline); - - # Remove the quotes at the start and end. - - $date = substr($tharray[3], 1, -1); - return $date; -} - -sub processth{ - # Process .TH section. - - my $input = shift; - my $date = shift; - - # Split the line into an array. - - my @tharray = extractth($input); - - # Alter the date. - - my $itemdate = "\""; - $itemdate .= $date; - $itemdate .= "\""; - $tharray[3] = $itemdate; - - # Alter the item version. - - my $itemver = $tharray[4]; - my $itemname = ""; - - for(my $itemnameseek = 1; - $itemnameseek < length($itemver); - $itemnameseek++) { - if(substr($itemver, $itemnameseek, 1) eq " " || - substr($itemver, $itemnameseek, 1) eq "\"") { - last; - } - $itemname .= substr($itemver, $itemnameseek, 1); - } - - $itemver = "\""; - $itemver .= $itemname; - $itemver .= " "; - $itemver .= $curlver; - $itemver .= "\""; - - $tharray[4] = $itemver; - - my $thoutput = ""; - - foreach my $thvalue (@tharray) { - $thoutput .= $thvalue; - $thoutput .= " "; - } - $thoutput =~ s/\s+$//; - $thoutput .= "\n"; - - # Return updated string. - - return $thoutput; -} - -sub processfile{ - # Process file looking for .TH section. - - my $filename = shift; - my $date = shift; - my $file_handle; - my $file_dist_handle; - my $filename_dist; - - # Open a handle for the original file and a second file handle - # for the dist file. - - $filename_dist = $filename . ".dist"; - - open($file_handle, $filename); - open($file_dist_handle, ">" . $filename_dist); - - # Look for the .TH section, process it into an array, - # modify it and write to file. - - tie(my @file_data, 'Tie::File', $filename); - foreach my $file_data_line (@file_data) { - if($file_data_line =~ /^.TH/) { - my $file_dist_line = processth($file_data_line, $date); - print $file_dist_handle $file_dist_line . "\n"; - } - else { - print $file_dist_handle $file_data_line . "\n"; - } - } - - # Close the file. - - close($file_handle); - close($file_dist_handle); -} - -# Check that $curlver is set, otherwise print arguments and exit. - -if(!$curlver) { - printargs(); -} - -# check to see that the git command works, it requires git 2.6 something -my $gitcheck = `git log -1 --date="format:%B %d, %Y" $dirlist[0] 2>/dev/null`; -if(length($gitcheck) < 1) { - print "git version too old or $dirlist[0] is a bad argument\n"; - exit; -} - -# Look in each directory. - -my $dir_handle; - -foreach my $dirname (@dirlist) { - foreach my $extname (@extlist) { - # Go through the directory looking for files ending with - # the current extension. - - opendir($dir_handle, $dirname); - my @filelist = grep(/.$extname$/i, readdir($dir_handle)); - - foreach my $file (@filelist) { - # Skip if file is in exclude list. - - if(grep(/^$file$/, @excludelist)) { - next; - } - - # Load the file and get the date. - - my $filedate; - - # Check if dist version exists and load date from that - # file if it does. - - if(-e ($dirname . $file . ".dist")) { - $filedate = getdate(($dirname . $file . ".dist")); - } - else { - $filedate = getdate(($dirname . $file)); - } - - # Skip if value is empty. - - if(!$filedate || $filedate eq "") { - next; - } - - # Check the man page in the git repository. - - my $repodata = `LC_TIME=C git log -1 --date="format:%B %d, %Y" \\ - --since="$filedate" $dirname$file | grep ^Date:`; - - # If there is output then update the man page - # with the new date/version. - - # Process the file if there is output. - - if($repodata) { - my $thisdate; - if(!$curldate) { - if($repodata =~ /^Date: +(.*)/) { - $thisdate = $1; - } - else { - print STDERR "Warning: " . ($dirname . $file) . ": found no " . - "date\n"; - } - } - else { - $thisdate = $curldate; - } - processfile(($dirname . $file), $thisdate); - print $dirname . $file . " page updated to $thisdate\n"; - } - } - closedir($dir_handle); - } -} - -__END__ - -=pod - -=head1 updatemanpages.pl - -Updates the man pages with the version number and optional date. If the date -isn't provided, the last modified date from git is used. - -=head2 USAGE - -updatemanpages.pl version [date] - -=head3 version - -Specifies version (required) - -=head3 date - -Specifies date (optional) - -=head2 SETTINGS - -=head3 @dirlist - -Specifies the list of directories to look for files in. - -=head3 @extlist - -Specifies the list of files with extensions to process. - -=head3 @excludelist - -Specifies the list of files to not process. - -=head2 NOTES - -This script is used during maketgz. - -=cut diff --git a/tests/Makefile.am b/tests/Makefile.am index b1fc25b0f..a6d0708f7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -72,8 +72,6 @@ PERLFLAGS = -I$(srcdir) CLEANFILES = .http.pid .https.pid .ftp.pid .ftps.pid $(MANDISTPAGES) -MAN2HTML= roffit $< >$@ - curl: @cd $(top_builddir) && $(MAKE) @@ -123,16 +121,6 @@ torture-test: perlcheck all event-test: perlcheck all $(TEST) $(TEST_E) $(TFLAGS) -.1.html: - $(MAN2HTML) - -.1.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") - checksrc: (cd libtest && $(MAKE) checksrc) (cd unit && $(MAKE) checksrc) diff --git a/tests/data/test1140 b/tests/data/test1140 index fc2a08d01..5f26c73f4 100644 --- a/tests/data/test1140 +++ b/tests/data/test1140 @@ -19,7 +19,7 @@ Verify the nroff of man pages -%SRCDIR/test1140.pl %SRCDIR/../docs/ %SRCDIR/../docs/libcurl/*.3 %SRCDIR/../docs/libcurl/opts/*.3 %SRCDIR/../docs/*.1 +%SRCDIR/test1140.pl %PWD/../docs/ %PWD/../docs/libcurl/*.3 %PWD/../docs/libcurl/opts/*.3 %PWD/../docs/*.1 diff --git a/tests/data/test1173 b/tests/data/test1173 index c1dc5c22a..97d338df3 100644 --- a/tests/data/test1173 +++ b/tests/data/test1173 @@ -19,7 +19,7 @@ Man page syntax checks -%SRCDIR/test1173.pl %SRCDIR/../docs/libcurl/symbols-in-versions %SRCDIR/../docs/*.1 %SRCDIR/../docs/libcurl/*.3 %SRCDIR/../docs/libcurl/opts/*.3 +%SRCDIR/test1173.pl %SRCDIR/../docs/libcurl/symbols-in-versions %PWD/../docs/*.1 %PWD/../docs/libcurl/*.3 %PWD/../docs/libcurl/opts/*.3 diff --git a/tests/data/test1177 b/tests/data/test1177 index 75af5b4c7..6cc94a5b1 100644 --- a/tests/data/test1177 +++ b/tests/data/test1177 @@ -18,7 +18,7 @@ Verify that feature names and CURL_VERSION_* in lib and docs are in sync -%SRCDIR/test1177.pl %SRCDIR/../docs/libcurl/curl_version_info.3 %SRCDIR/../include/curl/curl.h %SRCDIR/../lib/version.c +%SRCDIR/test1177.pl %PWD/../docs/libcurl/curl_version_info.3 %SRCDIR/../include/curl/curl.h %SRCDIR/../lib/version.c diff --git a/tests/data/test1477 b/tests/data/test1477 index 554ac141f..a8c4659e4 100644 --- a/tests/data/test1477 +++ b/tests/data/test1477 @@ -17,7 +17,7 @@ Verify that error codes in headers and libcurl-errors.3 are in sync -%SRCDIR/test1477.pl %SRCDIR/.. +%SRCDIR/test1477.pl %SRCDIR/.. %PWD/.. diff --git a/tests/test1139.pl b/tests/test1139.pl index ce49a61ba..c86081431 100755 --- a/tests/test1139.pl +++ b/tests/test1139.pl @@ -67,7 +67,8 @@ my %alias = ( sub scanmanpage { my ($file, @words) = @_; - open(my $mh, "<", "$file"); + open(my $mh, "<", "$file") || + die "could not open $file"; my @m; while(<$mh>) { if($_ =~ /^\.IP (.*)/) { @@ -128,7 +129,7 @@ while(<$r>) { elsif($type eq "MOPT") { push @curlmopt, $opt, } - if(! -f "$root/docs/libcurl/opts/$opt.3") { + if(! -f "$buildroot/docs/libcurl/opts/$opt.3") { print STDERR "Missing $opt.3\n"; $errors++; } @@ -137,9 +138,9 @@ while(<$r>) { } close($r); -scanmanpage("$root/docs/libcurl/curl_easy_setopt.3", @curlopt); -scanmanpage("$root/docs/libcurl/curl_easy_getinfo.3", @curlinfo); -scanmanpage("$root/docs/libcurl/curl_multi_setopt.3", @curlmopt); +scanmanpage("$buildroot/docs/libcurl/curl_easy_setopt.3", @curlopt); +scanmanpage("$buildroot/docs/libcurl/curl_easy_getinfo.3", @curlinfo); +scanmanpage("$buildroot/docs/libcurl/curl_multi_setopt.3", @curlmopt); # using this hash array, we can skip specific options my %opts = ( diff --git a/tests/test1140.pl b/tests/test1140.pl index 4dddf7cf1..b9438dec0 100755 --- a/tests/test1140.pl +++ b/tests/test1140.pl @@ -74,6 +74,7 @@ sub file { } if($str =~ /((libcurl|curl)([^ ]*))\(3\)/i) { my $man = "$1.3"; + $man =~ s/\\//g; # cut off backslashes if(!manpresent($man)) { print "error: $f:$line: referring to non-existing man page $man\n"; $errors++; @@ -92,6 +93,7 @@ sub file { my $i= $1; while($i =~ s/((lib|)curl([^ ]*)) *\"\(3\)(,|) *\" *//i ) { my $man = "$1.3"; + $man =~ s/\\//g; # cut off backslashes if(!manpresent($man)) { print "error: $f:$line: referring to non-existing man page $man\n"; $errors++; diff --git a/tests/test1177.pl b/tests/test1177.pl index 3c055d9b3..e989e3a89 100755 --- a/tests/test1177.pl +++ b/tests/test1177.pl @@ -44,7 +44,7 @@ while(<$m>) { if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) { $manversion{$1}++; } - if($_ =~ /^\.ip """([^"]+)"""/i) { + if($_ =~ /^\.ip (.*)/i) { $manname{$1}++; } } @@ -85,7 +85,7 @@ for my $n (keys %sourcename) { } } for my $n (keys %manname) { - if(!$sourcename{$n}) { + if(!$sourcename{$n} && ($n ne "\"no name\"")) { print STDERR "$manpage: $n is not in the source!\n"; $error++; } diff --git a/tests/test1275.pl b/tests/test1275.pl index 707f286cc..63b74bf4e 100755 --- a/tests/test1275.pl +++ b/tests/test1275.pl @@ -30,7 +30,8 @@ my @m = `git ls-files -- $root`; my $errors; my %accepted=('curl' => 1, - 'libcurl' => 1); + 'libcurl' => 1, + 'c-ares' => 1); sub checkfile { my ($f) = @_; @@ -50,9 +51,9 @@ sub checkfile { $ignore ^= 1; } if(!$ignore) { - if(($prevl =~ /\.\z/) && ($line =~ /^( *)([a-z]+)/)) { + if(($prevl =~ /\.\z/) && ($line =~ /^( *)([a-z-]+)/)) { my ($prefix, $word) = ($1, $2); - if(!$accepted{$word}) { + if($word =~ /^[a-z]/ && !$accepted{$word}) { my $c = length($prefix); print STDERR "$f:$l:$c:error: lowercase $word after period\n"; @@ -62,14 +63,16 @@ sub checkfile { $errors++; } } - elsif($line =~ /^(.*)\. +([a-z]+)/) { + elsif($line =~ /^(.*)\. +([a-z-]+)/) { my ($prefix, $word) = ($1, $2); if(($prefix =~ /\.\.\z/) || ($prefix =~ /[0-9]\z/) || ($prefix =~ /e.g\z/) || ($prefix =~ /i.e\z/) || + ($prefix =~ /E.g\z/) || ($prefix =~ /etc\z/) || + ($word !~ /^[a-z]/) || $accepted{$word}) { } else { diff --git a/tests/test1477.pl b/tests/test1477.pl index 9c8f9e882..ad564b26d 100755 --- a/tests/test1477.pl +++ b/tests/test1477.pl @@ -31,7 +31,8 @@ use warnings; # we may get the dir roots pointed out my $root=$ARGV[0] || "."; -my $manpge = "$root/docs/libcurl/libcurl-errors.3"; +my $buildroot=$ARGV[1] || "."; +my $manpge = "$buildroot/docs/libcurl/libcurl-errors.3"; my $curlh = "$root/include/curl"; my $errors=0;