CINXE.COM

Drive with multi_socket - everything curl

<!DOCTYPE HTML> <html lang="en" class="light" dir="ltr"> <head> <!-- Book generated using mdBook --> <meta charset="UTF-8"> <title>Drive with multi_socket - everything curl</title> <!-- Custom HTML head --> <meta name="description" content="everything there is to know about curl, libcurl and the cURL project"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="theme-color" content="#ffffff"> <link rel="icon" href="../../favicon.svg"> <link rel="shortcut icon" href="../../favicon.png"> <link rel="stylesheet" href="../../css/variables.css"> <link rel="stylesheet" href="../../css/general.css"> <link rel="stylesheet" href="../../css/chrome.css"> <link rel="stylesheet" href="../../css/print.css" media="print"> <!-- Fonts --> <link rel="stylesheet" href="../../FontAwesome/css/font-awesome.css"> <link rel="stylesheet" href="../../fonts/fonts.css"> <!-- Highlight.js Stylesheets --> <link rel="stylesheet" href="../../highlight.css"> <link rel="stylesheet" href="../../tomorrow-night.css"> <link rel="stylesheet" href="../../ayu-highlight.css"> <!-- Custom theme stylesheets --> </head> <body class="sidebar-visible no-js"> <div id="body-container"> <!-- Provide site root to javascript --> <script> var path_to_root = "../../"; var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; </script> <!-- Work around some values being stored in localStorage wrapped in quotes --> <script> try { var theme = localStorage.getItem('mdbook-theme'); var sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } </script> <!-- Set the theme before any content is loaded, prevents flash --> <script> var theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } var html = document.querySelector('html'); html.classList.remove('light') html.classList.add(theme); var body = document.querySelector('body'); body.classList.remove('no-js') body.classList.add('js'); </script> <input type="checkbox" id="sidebar-toggle-anchor" class="hidden"> <!-- Hide / unhide sidebar before it is displayed --> <script> var body = document.querySelector('body'); var sidebar = null; var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; body.classList.remove('sidebar-visible'); body.classList.add("sidebar-" + sidebar); </script> <nav id="sidebar" class="sidebar" aria-label="Table of contents"> <div class="sidebar-scrollbox"> <ol class="chapter"><li class="chapter-item "><a href="../../index.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item "><a href="../../how-to-read.html"><strong aria-hidden="true">2.</strong> How to read</a></li><li class="chapter-item "><a href="../../project/index.html"><strong aria-hidden="true">3.</strong> The cURL project</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../project/started.html"><strong aria-hidden="true">3.1.</strong> How it started</a></li><li class="chapter-item "><a href="../../project/name.html"><strong aria-hidden="true">3.2.</strong> The name</a></li><li class="chapter-item "><a href="../../project/does.html"><strong aria-hidden="true">3.3.</strong> What does curl do?</a></li><li class="chapter-item "><a href="../../project/comm.html"><strong aria-hidden="true">3.4.</strong> Project communication</a></li><li class="chapter-item "><a href="../../project/etiquette.html"><strong aria-hidden="true">3.5.</strong> Mailing list etiquette</a></li><li class="chapter-item "><a href="../../project/maillists.html"><strong aria-hidden="true">3.6.</strong> Mailing lists</a></li><li class="chapter-item "><a href="../../project/bugs.html"><strong aria-hidden="true">3.7.</strong> Reporting bugs</a></li><li class="chapter-item "><a href="../../project/support.html"><strong aria-hidden="true">3.8.</strong> Commercial support</a></li><li class="chapter-item "><a href="../../project/releases.html"><strong aria-hidden="true">3.9.</strong> Releases</a></li><li class="chapter-item "><a href="../../project/security.html"><strong aria-hidden="true">3.10.</strong> Security</a></li><li class="chapter-item "><a href="../../project/trust.html"><strong aria-hidden="true">3.11.</strong> Trust</a></li><li class="chapter-item "><a href="../../project/coc.html"><strong aria-hidden="true">3.12.</strong> Code of Conduct</a></li><li class="chapter-item "><a href="../../project/devel.html"><strong aria-hidden="true">3.13.</strong> Development</a></li><li class="chapter-item "><a href="../../project/devteam.html"><strong aria-hidden="true">3.14.</strong> The development team</a></li><li class="chapter-item "><a href="../../project/users.html"><strong aria-hidden="true">3.15.</strong> Users of curl</a></li><li class="chapter-item "><a href="../../project/future.html"><strong aria-hidden="true">3.16.</strong> Future</a></li></ol></li><li class="chapter-item "><a href="../../protocols/index.html"><strong aria-hidden="true">4.</strong> Network and protocols</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../protocols/network.html"><strong aria-hidden="true">4.1.</strong> Networking simplified</a></li><li class="chapter-item "><a href="../../protocols/protocols.html"><strong aria-hidden="true">4.2.</strong> Protocols</a></li><li class="chapter-item "><a href="../../protocols/curl.html"><strong aria-hidden="true">4.3.</strong> curl protocols</a></li><li class="chapter-item "><a href="../../protocols/http.html"><strong aria-hidden="true">4.4.</strong> HTTP basics</a></li></ol></li><li class="chapter-item "><a href="../../install/index.html"><strong aria-hidden="true">5.</strong> Install curl and libcurl</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../install/linux.html"><strong aria-hidden="true">5.1.</strong> Linux</a></li><li class="chapter-item "><a href="../../install/windows/index.html"><strong aria-hidden="true">5.2.</strong> Windows</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../install/windows/win-msys2.html"><strong aria-hidden="true">5.2.1.</strong> MSYS2</a></li><li class="chapter-item "><a href="../../install/windows/win-vcpkg.html"><strong aria-hidden="true">5.2.2.</strong> vcpkg</a></li></ol></li><li class="chapter-item "><a href="../../install/macos.html"><strong aria-hidden="true">5.3.</strong> macOS</a></li><li class="chapter-item "><a href="../../install/container.html"><strong aria-hidden="true">5.4.</strong> Container</a></li></ol></li><li class="chapter-item "><a href="../../source/index.html"><strong aria-hidden="true">6.</strong> Source code</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../source/opensource/index.html"><strong aria-hidden="true">6.1.</strong> Open Source</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../source/opensource/license.html"><strong aria-hidden="true">6.1.1.</strong> License</a></li><li class="chapter-item "><a href="../../source/opensource/copyright.html"><strong aria-hidden="true">6.1.2.</strong> Copyright</a></li></ol></li><li class="chapter-item "><a href="../../source/layout.html"><strong aria-hidden="true">6.2.</strong> Code layout</a></li><li class="chapter-item "><a href="../../source/options.html"><strong aria-hidden="true">6.3.</strong> Handling build options</a></li><li class="chapter-item "><a href="../../source/style.html"><strong aria-hidden="true">6.4.</strong> Code style</a></li><li class="chapter-item "><a href="../../source/contributing.html"><strong aria-hidden="true">6.5.</strong> Contributing</a></li><li class="chapter-item "><a href="../../source/reportvuln.html"><strong aria-hidden="true">6.6.</strong> Reporting vulnerabilities</a></li><li class="chapter-item "><a href="../../source/web.html"><strong aria-hidden="true">6.7.</strong> Website</a></li></ol></li><li class="chapter-item "><a href="../../build/index.html"><strong aria-hidden="true">7.</strong> Build curl and libcurl</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../build/autotools.html"><strong aria-hidden="true">7.1.</strong> Autotools</a></li><li class="chapter-item "><a href="../../build/cmake.html"><strong aria-hidden="true">7.2.</strong> CMake</a></li><li class="chapter-item "><a href="../../build/separate.html"><strong aria-hidden="true">7.3.</strong> Separate install</a></li><li class="chapter-item "><a href="../../build/windows.html"><strong aria-hidden="true">7.4.</strong> Windows</a></li><li class="chapter-item "><a href="../../build/deps.html"><strong aria-hidden="true">7.5.</strong> Dependencies</a></li><li class="chapter-item "><a href="../../build/tls.html"><strong aria-hidden="true">7.6.</strong> TLS libraries</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../build/boringssl.html"><strong aria-hidden="true">7.6.1.</strong> BoringSSL</a></li></ol></li></ol></li><li class="chapter-item "><a href="../../cmdline/index.html"><strong aria-hidden="true">8.</strong> Command line concepts</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../cmdline/differences.html"><strong aria-hidden="true">8.1.</strong> Differences</a></li><li class="chapter-item "><a href="../../cmdline/options/index.html"><strong aria-hidden="true">8.2.</strong> Command line options</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../cmdline/options/short.html"><strong aria-hidden="true">8.2.1.</strong> Short options</a></li><li class="chapter-item "><a href="../../cmdline/options/long.html"><strong aria-hidden="true">8.2.2.</strong> Long options</a></li><li class="chapter-item "><a href="../../cmdline/options/args.html"><strong aria-hidden="true">8.2.3.</strong> Arguments to options</a></li><li class="chapter-item "><a href="../../cmdline/options/negative.html"><strong aria-hidden="true">8.2.4.</strong> Negative options</a></li></ol></li><li class="chapter-item "><a href="../../cmdline/versions.html"><strong aria-hidden="true">8.3.</strong> Options depend on version</a></li><li class="chapter-item "><a href="../../cmdline/urls/index.html"><strong aria-hidden="true">8.4.</strong> URLs</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../cmdline/urls/scheme.html"><strong aria-hidden="true">8.4.1.</strong> Scheme</a></li><li class="chapter-item "><a href="../../cmdline/urls/auth.html"><strong aria-hidden="true">8.4.2.</strong> Name and password</a></li><li class="chapter-item "><a href="../../cmdline/urls/host.html"><strong aria-hidden="true">8.4.3.</strong> Host</a></li><li class="chapter-item "><a href="../../cmdline/urls/port.html"><strong aria-hidden="true">8.4.4.</strong> Port number</a></li><li class="chapter-item "><a href="../../cmdline/urls/path.html"><strong aria-hidden="true">8.4.5.</strong> Path</a></li><li class="chapter-item "><a href="../../cmdline/urls/query.html"><strong aria-hidden="true">8.4.6.</strong> Query</a></li><li class="chapter-item "><a href="../../cmdline/urls/ftptype.html"><strong aria-hidden="true">8.4.7.</strong> FTP type</a></li><li class="chapter-item "><a href="../../cmdline/urls/fragment.html"><strong aria-hidden="true">8.4.8.</strong> Fragment</a></li><li class="chapter-item "><a href="../../cmdline/urls/browsers.html"><strong aria-hidden="true">8.4.9.</strong> Browsers</a></li><li class="chapter-item "><a href="../../cmdline/urls/options.html"><strong aria-hidden="true">8.4.10.</strong> Many options and URLs</a></li><li class="chapter-item "><a href="../../cmdline/urls/globbing.html"><strong aria-hidden="true">8.4.11.</strong> URL globbing</a></li><li class="chapter-item "><a href="../../cmdline/urls/connreuse.html"><strong aria-hidden="true">8.4.12.</strong> Connection reuse</a></li><li class="chapter-item "><a href="../../cmdline/urls/parallel.html"><strong aria-hidden="true">8.4.13.</strong> Parallel transfers</a></li><li class="chapter-item "><a href="../../cmdline/urls/trurl.html"><strong aria-hidden="true">8.4.14.</strong> trurl</a></li></ol></li><li class="chapter-item "><a href="../../cmdline/listopts.html"><strong aria-hidden="true">8.5.</strong> List options</a></li><li class="chapter-item "><a href="../../cmdline/configfile.html"><strong aria-hidden="true">8.6.</strong> Config file</a></li><li class="chapter-item "><a href="../../cmdline/variables.html"><strong aria-hidden="true">8.7.</strong> Variables</a></li><li class="chapter-item "><a href="../../cmdline/passwords.html"><strong aria-hidden="true">8.8.</strong> Passwords</a></li><li class="chapter-item "><a href="../../cmdline/progressmeter.html"><strong aria-hidden="true">8.9.</strong> Progress meter</a></li><li class="chapter-item "><a href="../../cmdline/curlver.html"><strong aria-hidden="true">8.10.</strong> Version</a></li><li class="chapter-item "><a href="../../cmdline/exitcode.html"><strong aria-hidden="true">8.11.</strong> Exit code</a></li><li class="chapter-item "><a href="../../cmdline/copyas.html"><strong aria-hidden="true">8.12.</strong> Copy as curl</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/index.html"><strong aria-hidden="true">9.</strong> Command line transfers</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/verbose/index.html"><strong aria-hidden="true">9.1.</strong> Verbose</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/verbose/trace.html"><strong aria-hidden="true">9.1.1.</strong> Trace options</a></li><li class="chapter-item "><a href="../../usingcurl/verbose/writeout.html"><strong aria-hidden="true">9.1.2.</strong> Write out</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/downloads/index.html"><strong aria-hidden="true">9.2.</strong> Downloads</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/downloads/whatis.html"><strong aria-hidden="true">9.2.1.</strong> What is downloading?</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/storing.html"><strong aria-hidden="true">9.2.2.</strong> Storing downloads</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/url-named.html"><strong aria-hidden="true">9.2.3.</strong> Download to a file named by the URL</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/content-disp.html"><strong aria-hidden="true">9.2.4.</strong> Use the target filename from the server</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/charsets.html"><strong aria-hidden="true">9.2.5.</strong> HTML and charsets</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/redirects.html"><strong aria-hidden="true">9.2.6.</strong> Shell redirects</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/multiple.html"><strong aria-hidden="true">9.2.7.</strong> Multiple downloads</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/browsers.html"><strong aria-hidden="true">9.2.8.</strong> My browser shows something else</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/max-filesize.html"><strong aria-hidden="true">9.2.9.</strong> Maximum filesize</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/metadata-fs.html"><strong aria-hidden="true">9.2.10.</strong> Storing metadata in file system</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/raw.html"><strong aria-hidden="true">9.2.11.</strong> Raw</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/retry.html"><strong aria-hidden="true">9.2.12.</strong> Retry</a></li><li class="chapter-item "><a href="../../usingcurl/downloads/resume.html"><strong aria-hidden="true">9.2.13.</strong> Resuming and ranges</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/uploads.html"><strong aria-hidden="true">9.3.</strong> Uploads</a></li><li class="chapter-item "><a href="../../usingcurl/transfers/index.html"><strong aria-hidden="true">9.4.</strong> Transfer controls</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/transfers/tooslow.html"><strong aria-hidden="true">9.4.1.</strong> Stop slow transfers</a></li><li class="chapter-item "><a href="../../usingcurl/transfers/rate-limiting.html"><strong aria-hidden="true">9.4.2.</strong> Rate limiting</a></li><li class="chapter-item "><a href="../../usingcurl/transfers/request-rate.html"><strong aria-hidden="true">9.4.3.</strong> Request rate limiting</a></li><li class="chapter-item "><a href="../../usingcurl/transfers/compression.html"><strong aria-hidden="true">9.4.4.</strong> Compression</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/connections/index.html"><strong aria-hidden="true">9.5.</strong> Connections</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/connections/name.html"><strong aria-hidden="true">9.5.1.</strong> Name resolve tricks</a></li><li class="chapter-item "><a href="../../usingcurl/connections/timeout.html"><strong aria-hidden="true">9.5.2.</strong> Connection timeout</a></li><li class="chapter-item "><a href="../../usingcurl/connections/happy.html"><strong aria-hidden="true">9.5.3.</strong> Happy Eyeballs</a></li><li class="chapter-item "><a href="../../usingcurl/connections/interface.html"><strong aria-hidden="true">9.5.4.</strong> Network interface</a></li><li class="chapter-item "><a href="../../usingcurl/connections/local-port.html"><strong aria-hidden="true">9.5.5.</strong> Local port number</a></li><li class="chapter-item "><a href="../../usingcurl/connections/keepalive.html"><strong aria-hidden="true">9.5.6.</strong> Keep alive</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/timeouts.html"><strong aria-hidden="true">9.6.</strong> Timeouts</a></li><li class="chapter-item "><a href="../../usingcurl/netrc.html"><strong aria-hidden="true">9.7.</strong> .netrc</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/index.html"><strong aria-hidden="true">9.8.</strong> Proxies</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/proxies/discover.html"><strong aria-hidden="true">9.8.1.</strong> Discover your proxy</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/pac.html"><strong aria-hidden="true">9.8.2.</strong> PAC</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/captive.html"><strong aria-hidden="true">9.8.3.</strong> Captive portals</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/type.html"><strong aria-hidden="true">9.8.4.</strong> Proxy type</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/http.html"><strong aria-hidden="true">9.8.5.</strong> HTTP proxy</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/socks.html"><strong aria-hidden="true">9.8.6.</strong> SOCKS proxy</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/mitm.html"><strong aria-hidden="true">9.8.7.</strong> MITM proxy</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/auth.html"><strong aria-hidden="true">9.8.8.</strong> Proxy authentication</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/https.html"><strong aria-hidden="true">9.8.9.</strong> HTTPS proxy</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/env.html"><strong aria-hidden="true">9.8.10.</strong> Proxy environment variables</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/headers.html"><strong aria-hidden="true">9.8.11.</strong> Proxy headers</a></li><li class="chapter-item "><a href="../../usingcurl/proxies/haproxy.html"><strong aria-hidden="true">9.8.12.</strong> haproxy</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/tls.html"><strong aria-hidden="true">9.9.</strong> TLS</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/tls/ciphers.html"><strong aria-hidden="true">9.9.1.</strong> Ciphers</a></li><li class="chapter-item "><a href="../../usingcurl/tls/enable.html"><strong aria-hidden="true">9.9.2.</strong> Enable TLS</a></li><li class="chapter-item "><a href="../../usingcurl/tls/versions.html"><strong aria-hidden="true">9.9.3.</strong> TLS versions</a></li><li class="chapter-item "><a href="../../usingcurl/tls/verify.html"><strong aria-hidden="true">9.9.4.</strong> Verifying server certificates</a></li><li class="chapter-item "><a href="../../usingcurl/tls/pinning.html"><strong aria-hidden="true">9.9.5.</strong> Certificate pinning</a></li><li class="chapter-item "><a href="../../usingcurl/tls/stapling.html"><strong aria-hidden="true">9.9.6.</strong> OCSP stapling</a></li><li class="chapter-item "><a href="../../usingcurl/tls/clientcert.html"><strong aria-hidden="true">9.9.7.</strong> Client certificates</a></li><li class="chapter-item "><a href="../../usingcurl/tls/auth.html"><strong aria-hidden="true">9.9.8.</strong> TLS auth</a></li><li class="chapter-item "><a href="../../usingcurl/tls/backends.html"><strong aria-hidden="true">9.9.9.</strong> TLS backends</a></li><li class="chapter-item "><a href="../../usingcurl/tls/sslkeylogfile.html"><strong aria-hidden="true">9.9.10.</strong> SSLKEYLOGFILE</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/ssh/index.html"><strong aria-hidden="true">9.10.</strong> SCP and SFTP</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../usingcurl/ssh/url.html"><strong aria-hidden="true">9.10.1.</strong> URLs</a></li><li class="chapter-item "><a href="../../usingcurl/ssh/auth.html"><strong aria-hidden="true">9.10.2.</strong> Authentication</a></li><li class="chapter-item "><a href="../../usingcurl/ssh/knownhosts.html"><strong aria-hidden="true">9.10.3.</strong> Known hosts</a></li></ol></li><li class="chapter-item "><a href="../../usingcurl/reademail.html"><strong aria-hidden="true">9.11.</strong> Reading email</a></li><li class="chapter-item "><a href="../../usingcurl/smtp.html"><strong aria-hidden="true">9.12.</strong> Sending email</a></li><li class="chapter-item "><a href="../../usingcurl/dict.html"><strong aria-hidden="true">9.13.</strong> DICT</a></li><li class="chapter-item "><a href="../../usingcurl/ipfs.html"><strong aria-hidden="true">9.14.</strong> IPFS</a></li><li class="chapter-item "><a href="../../usingcurl/mqtt.html"><strong aria-hidden="true">9.15.</strong> MQTT</a></li><li class="chapter-item "><a href="../../usingcurl/telnet.html"><strong aria-hidden="true">9.16.</strong> TELNET</a></li><li class="chapter-item "><a href="../../usingcurl/tftp.html"><strong aria-hidden="true">9.17.</strong> TFTP</a></li></ol></li><li class="chapter-item "><a href="../../http/index.html"><strong aria-hidden="true">10.</strong> Command line HTTP</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/method.html"><strong aria-hidden="true">10.1.</strong> Method</a></li><li class="chapter-item "><a href="../../http/response.html"><strong aria-hidden="true">10.2.</strong> Responses</a></li><li class="chapter-item "><a href="../../http/auth.html"><strong aria-hidden="true">10.3.</strong> Authentication</a></li><li class="chapter-item "><a href="../../http/versions/index.html"><strong aria-hidden="true">10.4.</strong> HTTP versions</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/versions/http09.html"><strong aria-hidden="true">10.4.1.</strong> HTTP/0.9</a></li><li class="chapter-item "><a href="../../http/versions/http2.html"><strong aria-hidden="true">10.4.2.</strong> HTTP/2</a></li><li class="chapter-item "><a href="../../http/versions/http3.html"><strong aria-hidden="true">10.4.3.</strong> HTTP/3</a></li></ol></li><li class="chapter-item "><a href="../../http/post/index.html"><strong aria-hidden="true">10.5.</strong> HTTP POST</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/post/simple.html"><strong aria-hidden="true">10.5.1.</strong> Simple POST</a></li><li class="chapter-item "><a href="../../http/post/content-type.html"><strong aria-hidden="true">10.5.2.</strong> Content-Type</a></li><li class="chapter-item "><a href="../../http/post/binary.html"><strong aria-hidden="true">10.5.3.</strong> Posting binary</a></li><li class="chapter-item "><a href="../../http/post/json.html"><strong aria-hidden="true">10.5.4.</strong> JSON</a></li><li class="chapter-item "><a href="../../http/post/url-encode.html"><strong aria-hidden="true">10.5.5.</strong> URL encode data</a></li><li class="chapter-item "><a href="../../http/post/convert-to-get.html"><strong aria-hidden="true">10.5.6.</strong> Convert to GET</a></li><li class="chapter-item "><a href="../../http/post/expect100.html"><strong aria-hidden="true">10.5.7.</strong> Expect 100-continue</a></li><li class="chapter-item "><a href="../../http/post/chunked.html"><strong aria-hidden="true">10.5.8.</strong> Chunked encoded POSTs</a></li><li class="chapter-item "><a href="../../http/post/hiddenfields.html"><strong aria-hidden="true">10.5.9.</strong> Hidden form fields</a></li><li class="chapter-item "><a href="../../http/post/browsersends.html"><strong aria-hidden="true">10.5.10.</strong> Figure out what a browser sends</a></li><li class="chapter-item "><a href="../../http/post/javascript.html"><strong aria-hidden="true">10.5.11.</strong> JavaScript and forms</a></li><li class="chapter-item "><a href="../../http/post/multipart.html"><strong aria-hidden="true">10.5.12.</strong> Multipart formposts</a></li><li class="chapter-item "><a href="../../http/post/postvspost.html"><strong aria-hidden="true">10.5.13.</strong> -d vs -F</a></li></ol></li><li class="chapter-item "><a href="../../http/put.html"><strong aria-hidden="true">10.6.</strong> HTTP PUT</a></li><li class="chapter-item "><a href="../../http/redirects.html"><strong aria-hidden="true">10.7.</strong> Redirects</a></li><li class="chapter-item "><a href="../../http/modify/index.html"><strong aria-hidden="true">10.8.</strong> Customize your HTTP</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/modify/method.html"><strong aria-hidden="true">10.8.1.</strong> Request method</a></li><li class="chapter-item "><a href="../../http/modify/target.html"><strong aria-hidden="true">10.8.2.</strong> Request target</a></li><li class="chapter-item "><a href="../../http/modify/fragment.html"><strong aria-hidden="true">10.8.3.</strong> Fragment</a></li><li class="chapter-item "><a href="../../http/modify/headers.html"><strong aria-hidden="true">10.8.4.</strong> Customize headers</a></li><li class="chapter-item "><a href="../../http/modify/referer.html"><strong aria-hidden="true">10.8.5.</strong> Referer</a></li><li class="chapter-item "><a href="../../http/modify/user-agent.html"><strong aria-hidden="true">10.8.6.</strong> User-agent</a></li><li class="chapter-item "><a href="../../http/modify/ranges.html"><strong aria-hidden="true">10.8.7.</strong> Ranges</a></li><li class="chapter-item "><a href="../../http/modify/conditionals.html"><strong aria-hidden="true">10.8.8.</strong> Conditionals</a></li><li class="chapter-item "><a href="../../http/modify/compression.html"><strong aria-hidden="true">10.8.9.</strong> Compression</a></li></ol></li><li class="chapter-item "><a href="../../http/cookies/index.html"><strong aria-hidden="true">10.9.</strong> Cookies</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/cookies/engine.html"><strong aria-hidden="true">10.9.1.</strong> Cookie engine</a></li><li class="chapter-item "><a href="../../http/cookies/reading.html"><strong aria-hidden="true">10.9.2.</strong> Reading cookies from file</a></li><li class="chapter-item "><a href="../../http/cookies/writing.html"><strong aria-hidden="true">10.9.3.</strong> Writing cookies to file</a></li><li class="chapter-item "><a href="../../http/cookies/newsession.html"><strong aria-hidden="true">10.9.4.</strong> New cookie session</a></li><li class="chapter-item "><a href="../../http/cookies/fileformat.html"><strong aria-hidden="true">10.9.5.</strong> Cookie file format</a></li></ol></li><li class="chapter-item "><a href="../../http/https.html"><strong aria-hidden="true">10.10.</strong> HTTPS</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../http/https/hsts.html"><strong aria-hidden="true">10.10.1.</strong> HSTS</a></li><li class="chapter-item "><a href="../../http/https/altsvc.html"><strong aria-hidden="true">10.10.2.</strong> Alternative Services</a></li></ol></li><li class="chapter-item "><a href="../../http/browserlike.html"><strong aria-hidden="true">10.11.</strong> Scripting browser-like tasks</a></li></ol></li><li class="chapter-item "><a href="../../ftp/index.html"><strong aria-hidden="true">11.</strong> Command line FTP</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../ftp/dirlist.html"><strong aria-hidden="true">11.1.</strong> FTP Directory listing</a></li><li class="chapter-item "><a href="../../ftp/upload.html"><strong aria-hidden="true">11.2.</strong> Uploading with FTP</a></li><li class="chapter-item "><a href="../../ftp/cmds.html"><strong aria-hidden="true">11.3.</strong> Custom FTP commands</a></li><li class="chapter-item "><a href="../../ftp/twoconnections.html"><strong aria-hidden="true">11.4.</strong> Two connections</a></li><li class="chapter-item "><a href="../../ftp/traversedir.html"><strong aria-hidden="true">11.5.</strong> Directory traversing</a></li><li class="chapter-item "><a href="../../ftp/ftps.html"><strong aria-hidden="true">11.6.</strong> FTPS</a></li></ol></li><li class="chapter-item "><a href="../../libcurl/index.html"><strong aria-hidden="true">12.</strong> libcurl</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../libcurl/headers.html"><strong aria-hidden="true">12.1.</strong> Header files</a></li><li class="chapter-item "><a href="../../libcurl/globalinit.html"><strong aria-hidden="true">12.2.</strong> Global initialization</a></li><li class="chapter-item "><a href="../../libcurl/api.html"><strong aria-hidden="true">12.3.</strong> API compatibility</a></li><li class="chapter-item "><a href="../../libcurl/--libcurl.html"><strong aria-hidden="true">12.4.</strong> --libcurl</a></li><li class="chapter-item "><a href="../../libcurl/threading.html"><strong aria-hidden="true">12.5.</strong> multi-threading</a></li><li class="chapter-item "><a href="../../libcurl/curlcode.html"><strong aria-hidden="true">12.6.</strong> CURLcode return codes</a></li><li class="chapter-item "><a href="../../libcurl/verbose.html"><strong aria-hidden="true">12.7.</strong> Verbose operations</a></li><li class="chapter-item "><a href="../../libcurl/caches.html"><strong aria-hidden="true">12.8.</strong> Caches</a></li><li class="chapter-item "><a href="../../libcurl/performance.html"><strong aria-hidden="true">12.9.</strong> Performance</a></li><li class="chapter-item "><a href="../../libcurl/cplusplus.html"><strong aria-hidden="true">12.10.</strong> for C++ programmers</a></li></ol></li><li class="chapter-item expanded "><a href="../../transfers/index.html"><strong aria-hidden="true">13.</strong> libcurl transfers</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/easyhandle.html"><strong aria-hidden="true">13.1.</strong> Easy handle</a></li><li class="chapter-item "><a href="../../transfers/options/index.html"><strong aria-hidden="true">13.2.</strong> curl easy options</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/options/num.html"><strong aria-hidden="true">13.2.1.</strong> Set numerical options</a></li><li class="chapter-item "><a href="../../transfers/options/strings.html"><strong aria-hidden="true">13.2.2.</strong> Set string options</a></li><li class="chapter-item "><a href="../../transfers/options/tls.html"><strong aria-hidden="true">13.2.3.</strong> TLS options</a></li><li class="chapter-item "><a href="../../transfers/options/all.html"><strong aria-hidden="true">13.2.4.</strong> All options</a></li><li class="chapter-item "><a href="../../transfers/options/info.html"><strong aria-hidden="true">13.2.5.</strong> Get option information</a></li></ol></li><li class="chapter-item expanded "><a href="../../transfers/drive/index.html"><strong aria-hidden="true">13.3.</strong> Drive transfers</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/drive/easy.html"><strong aria-hidden="true">13.3.1.</strong> Drive with easy</a></li><li class="chapter-item "><a href="../../transfers/drive/multi.html"><strong aria-hidden="true">13.3.2.</strong> Drive with multi</a></li><li class="chapter-item expanded "><a href="../../transfers/drive/multi-socket.html" class="active"><strong aria-hidden="true">13.3.3.</strong> Drive with multi_socket</a></li></ol></li><li class="chapter-item "><a href="../../transfers/callbacks/index.html"><strong aria-hidden="true">13.4.</strong> Callbacks</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/callbacks/write.html"><strong aria-hidden="true">13.4.1.</strong> Write data</a></li><li class="chapter-item "><a href="../../transfers/callbacks/read.html"><strong aria-hidden="true">13.4.2.</strong> Read data</a></li><li class="chapter-item "><a href="../../transfers/callbacks/progress.html"><strong aria-hidden="true">13.4.3.</strong> Progress information</a></li><li class="chapter-item "><a href="../../transfers/callbacks/header.html"><strong aria-hidden="true">13.4.4.</strong> Header data</a></li><li class="chapter-item "><a href="../../transfers/callbacks/debug.html"><strong aria-hidden="true">13.4.5.</strong> Debug</a></li><li class="chapter-item "><a href="../../transfers/callbacks/sockopt.html"><strong aria-hidden="true">13.4.6.</strong> sockopt</a></li><li class="chapter-item "><a href="../../transfers/callbacks/sslcontext.html"><strong aria-hidden="true">13.4.7.</strong> SSL context</a></li><li class="chapter-item "><a href="../../transfers/callbacks/seek.html"><strong aria-hidden="true">13.4.8.</strong> Seek and ioctl</a></li><li class="chapter-item "><a href="../../transfers/callbacks/conversions.html"><strong aria-hidden="true">13.4.9.</strong> Network data conversion</a></li><li class="chapter-item "><a href="../../transfers/callbacks/openclosesocket.html"><strong aria-hidden="true">13.4.10.</strong> Opensocket and closesocket</a></li><li class="chapter-item "><a href="../../transfers/callbacks/sshkey.html"><strong aria-hidden="true">13.4.11.</strong> SSH key</a></li><li class="chapter-item "><a href="../../transfers/callbacks/rtsp.html"><strong aria-hidden="true">13.4.12.</strong> RTSP interleaved data</a></li><li class="chapter-item "><a href="../../transfers/callbacks/ftpmatch.html"><strong aria-hidden="true">13.4.13.</strong> FTP wildcard matching</a></li><li class="chapter-item "><a href="../../transfers/callbacks/resolver.html"><strong aria-hidden="true">13.4.14.</strong> Resolver start</a></li><li class="chapter-item "><a href="../../transfers/callbacks/trailers.html"><strong aria-hidden="true">13.4.15.</strong> Sending trailers</a></li><li class="chapter-item "><a href="../../transfers/callbacks/hsts.html"><strong aria-hidden="true">13.4.16.</strong> HSTS</a></li><li class="chapter-item "><a href="../../transfers/callbacks/prereq.html"><strong aria-hidden="true">13.4.17.</strong> Prereq</a></li></ol></li><li class="chapter-item "><a href="../../transfers/conn/index.html"><strong aria-hidden="true">13.5.</strong> Connection control</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/conn/how.html"><strong aria-hidden="true">13.5.1.</strong> How libcurl connects</a></li><li class="chapter-item "><a href="../../transfers/conn/local.html"><strong aria-hidden="true">13.5.2.</strong> Local address and port number</a></li><li class="chapter-item "><a href="../../transfers/conn/reuse.html"><strong aria-hidden="true">13.5.3.</strong> Connection reuse</a></li><li class="chapter-item "><a href="../../transfers/conn/keepalive.html"><strong aria-hidden="true">13.5.4.</strong> Keep alive</a></li><li class="chapter-item "><a href="../../transfers/conn/names.html"><strong aria-hidden="true">13.5.5.</strong> Name resolving</a></li><li class="chapter-item "><a href="../../transfers/conn/proxies.html"><strong aria-hidden="true">13.5.6.</strong> Proxies</a></li></ol></li><li class="chapter-item "><a href="../../transfers/control/index.html"><strong aria-hidden="true">13.6.</strong> Transfer control</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../transfers/control/stop.html"><strong aria-hidden="true">13.6.1.</strong> Stop</a></li><li class="chapter-item "><a href="../../transfers/control/stopslow.html"><strong aria-hidden="true">13.6.2.</strong> Stop slow transfers</a></li><li class="chapter-item "><a href="../../transfers/control/ratelimit.html"><strong aria-hidden="true">13.6.3.</strong> Rate limit</a></li><li class="chapter-item "><a href="../../transfers/control/meter.html"><strong aria-hidden="true">13.6.4.</strong> Progress meter</a></li><li class="chapter-item "><a href="../../transfers/control/progress-callback.html"><strong aria-hidden="true">13.6.5.</strong> Progress callback</a></li></ol></li><li class="chapter-item "><a href="../../transfers/auth.html"><strong aria-hidden="true">13.7.</strong> Authentication</a></li><li class="chapter-item "><a href="../../transfers/cleanup.html"><strong aria-hidden="true">13.8.</strong> Cleanup</a></li><li class="chapter-item "><a href="../../transfers/getinfo.html"><strong aria-hidden="true">13.9.</strong> Post transfer info</a></li></ol></li><li class="chapter-item "><a href="../../libcurl-http/index.html"><strong aria-hidden="true">14.</strong> libcurl HTTP</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../libcurl-http/responses.html"><strong aria-hidden="true">14.1.</strong> Responses</a></li><li class="chapter-item "><a href="../../libcurl-http/requests.html"><strong aria-hidden="true">14.2.</strong> Requests</a></li><li class="chapter-item "><a href="../../libcurl-http/versions.html"><strong aria-hidden="true">14.3.</strong> Versions</a></li><li class="chapter-item "><a href="../../libcurl-http/ranges.html"><strong aria-hidden="true">14.4.</strong> Ranges</a></li><li class="chapter-item "><a href="../../libcurl-http/auth.html"><strong aria-hidden="true">14.5.</strong> Authentication</a></li><li class="chapter-item "><a href="../../libcurl-http/cookies.html"><strong aria-hidden="true">14.6.</strong> Cookies</a></li><li class="chapter-item "><a href="../../libcurl-http/download.html"><strong aria-hidden="true">14.7.</strong> Download</a></li><li class="chapter-item "><a href="../../libcurl-http/upload.html"><strong aria-hidden="true">14.8.</strong> Upload</a></li><li class="chapter-item "><a href="../../libcurl-http/multiplexing.html"><strong aria-hidden="true">14.9.</strong> Multiplexing</a></li><li class="chapter-item "><a href="../../libcurl-http/hsts.html"><strong aria-hidden="true">14.10.</strong> HSTS</a></li><li class="chapter-item "><a href="../../libcurl-http/alt-svc.html"><strong aria-hidden="true">14.11.</strong> alt-svc</a></li></ol></li><li class="chapter-item "><a href="../../helpers/index.html"><strong aria-hidden="true">15.</strong> libcurl helpers</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../helpers/sharing.html"><strong aria-hidden="true">15.1.</strong> Share data between handles</a></li><li class="chapter-item "><a href="../../helpers/url/index.html"><strong aria-hidden="true">15.2.</strong> URL API</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../helpers/url/include.html"><strong aria-hidden="true">15.2.1.</strong> Include files</a></li><li class="chapter-item "><a href="../../helpers/url/init.html"><strong aria-hidden="true">15.2.2.</strong> Create, cleanup, duplicate</a></li><li class="chapter-item "><a href="../../helpers/url/parse.html"><strong aria-hidden="true">15.2.3.</strong> Parse a URL</a></li><li class="chapter-item "><a href="../../helpers/url/redirect.html"><strong aria-hidden="true">15.2.4.</strong> Redirect to URL</a></li><li class="chapter-item "><a href="../../helpers/url/get.html"><strong aria-hidden="true">15.2.5.</strong> Get a URL</a></li><li class="chapter-item "><a href="../../helpers/url/get-part.html"><strong aria-hidden="true">15.2.6.</strong> Get URL parts</a></li><li class="chapter-item "><a href="../../helpers/url/set-part.html"><strong aria-hidden="true">15.2.7.</strong> Set URL parts</a></li><li class="chapter-item "><a href="../../helpers/url/append-query.html"><strong aria-hidden="true">15.2.8.</strong> Append to the query</a></li><li class="chapter-item "><a href="../../helpers/url/setopt.html"><strong aria-hidden="true">15.2.9.</strong> CURLOPT_CURLU</a></li></ol></li><li class="chapter-item "><a href="../../helpers/ws/index.html"><strong aria-hidden="true">15.3.</strong> WebSocket</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../helpers/ws/support.html"><strong aria-hidden="true">15.3.1.</strong> Support</a></li><li class="chapter-item "><a href="../../helpers/ws/urls.html"><strong aria-hidden="true">15.3.2.</strong> URLs</a></li><li class="chapter-item "><a href="../../helpers/ws/concept.html"><strong aria-hidden="true">15.3.3.</strong> Concept</a></li><li class="chapter-item "><a href="../../helpers/ws/options.html"><strong aria-hidden="true">15.3.4.</strong> Options</a></li><li class="chapter-item "><a href="../../helpers/ws/read.html"><strong aria-hidden="true">15.3.5.</strong> Read</a></li><li class="chapter-item "><a href="../../helpers/ws/meta.html"><strong aria-hidden="true">15.3.6.</strong> Meta</a></li><li class="chapter-item "><a href="../../helpers/ws/write.html"><strong aria-hidden="true">15.3.7.</strong> Write</a></li></ol></li><li class="chapter-item "><a href="../../helpers/headerapi/index.html"><strong aria-hidden="true">15.4.</strong> Headers API</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../helpers/headerapi/struct.html"><strong aria-hidden="true">15.4.1.</strong> Header struct</a></li><li class="chapter-item "><a href="../../helpers/headerapi/get.html"><strong aria-hidden="true">15.4.2.</strong> Get a header</a></li><li class="chapter-item "><a href="../../helpers/headerapi/iterate.html"><strong aria-hidden="true">15.4.3.</strong> Iterate over headers</a></li></ol></li></ol></li><li class="chapter-item "><a href="../../examples/index.html"><strong aria-hidden="true">16.</strong> libcurl examples</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../examples/get.html"><strong aria-hidden="true">16.1.</strong> Get a simple HTTP page</a></li><li class="chapter-item "><a href="../../examples/getinmem.html"><strong aria-hidden="true">16.2.</strong> Get a response into memory</a></li><li class="chapter-item "><a href="../../examples/login.html"><strong aria-hidden="true">16.3.</strong> Submit a login form over HTTP</a></li><li class="chapter-item "><a href="../../examples/ftplist.html"><strong aria-hidden="true">16.4.</strong> Get an FTP directory listing</a></li><li class="chapter-item "><a href="../../examples/http-ul-nonblock.html"><strong aria-hidden="true">16.5.</strong> Non-blocking HTTP form-post</a></li></ol></li><li class="chapter-item "><a href="../../bindings/index.html"><strong aria-hidden="true">17.</strong> libcurl bindings</a></li><li class="chapter-item "><a href="../../internals/index.html"><strong aria-hidden="true">18.</strong> libcurl internals</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../internals/easy.html"><strong aria-hidden="true">18.1.</strong> Easy handles and connections</a></li><li class="chapter-item "><a href="../../internals/multi.html"><strong aria-hidden="true">18.2.</strong> Everything is multi</a></li><li class="chapter-item "><a href="../../internals/statemachines.html"><strong aria-hidden="true">18.3.</strong> State machines</a></li><li class="chapter-item "><a href="../../internals/handler.html"><strong aria-hidden="true">18.4.</strong> Protocol handler</a></li><li class="chapter-item "><a href="../../internals/backends.html"><strong aria-hidden="true">18.5.</strong> Backends</a></li><li class="chapter-item "><a href="../../internals/caches.html"><strong aria-hidden="true">18.6.</strong> Caches and state</a></li><li class="chapter-item "><a href="../../internals/timeouts.html"><strong aria-hidden="true">18.7.</strong> Timeouts</a></li><li class="chapter-item "><a href="../../internals/windows-vs-unix.html"><strong aria-hidden="true">18.8.</strong> Windows vs Unix</a></li><li class="chapter-item "><a href="../../internals/memory-debugging.html"><strong aria-hidden="true">18.9.</strong> Memory debugging</a></li><li class="chapter-item "><a href="../../internals/content-encoding.html"><strong aria-hidden="true">18.10.</strong> Content Encoding</a></li><li class="chapter-item "><a href="../../internals/structs.html"><strong aria-hidden="true">18.11.</strong> Structs</a></li><li class="chapter-item "><a href="../../internals/resolving.html"><strong aria-hidden="true">18.12.</strong> Resolving hostnames</a></li><li class="chapter-item "><a href="../../internals/tests/index.html"><strong aria-hidden="true">18.13.</strong> Tests</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../internals/tests/file-format.html"><strong aria-hidden="true">18.13.1.</strong> Test file format</a></li><li class="chapter-item "><a href="../../internals/tests/build.html"><strong aria-hidden="true">18.13.2.</strong> Build tests</a></li><li class="chapter-item "><a href="../../internals/tests/run.html"><strong aria-hidden="true">18.13.3.</strong> Run tests</a></li><li class="chapter-item "><a href="../../internals/tests/debug.html"><strong aria-hidden="true">18.13.4.</strong> Debug builds</a></li><li class="chapter-item "><a href="../../internals/tests/servers.html"><strong aria-hidden="true">18.13.5.</strong> Test servers</a></li><li class="chapter-item "><a href="../../internals/tests/curl.html"><strong aria-hidden="true">18.13.6.</strong> curl tests</a></li><li class="chapter-item "><a href="../../internals/tests/libcurl.html"><strong aria-hidden="true">18.13.7.</strong> libcurl tests</a></li><li class="chapter-item "><a href="../../internals/tests/unit.html"><strong aria-hidden="true">18.13.8.</strong> Unit tests</a></li><li class="chapter-item "><a href="../../internals/tests/valgrind.html"><strong aria-hidden="true">18.13.9.</strong> Valgrind</a></li><li class="chapter-item "><a href="../../internals/tests/ci.html"><strong aria-hidden="true">18.13.10.</strong> Continuous Integration</a></li><li class="chapter-item "><a href="../../internals/tests/autobuilds.html"><strong aria-hidden="true">18.13.11.</strong> Autobuilds</a></li><li class="chapter-item "><a href="../../internals/tests/torture.html"><strong aria-hidden="true">18.13.12.</strong> Torture</a></li></ol></li></ol></li><li class="chapter-item "><a href="../../bookindex.html"><strong aria-hidden="true">19.</strong> Index</a></li></ol> </div> <div id="sidebar-resize-handle" class="sidebar-resize-handle"> <div class="sidebar-resize-indicator"></div> </div> </nav> <!-- Track and set sidebar scroll position --> <script> var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox'); sidebarScrollbox.addEventListener('click', function(e) { if (e.target.tagName === 'A') { sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop); } }, { passive: true }); var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll'); sessionStorage.removeItem('sidebar-scroll'); if (sidebarScrollTop) { // preserve sidebar scroll position when navigating via links within sidebar sidebarScrollbox.scrollTop = sidebarScrollTop; } else { // scroll sidebar to current active section when navigating via "next/previous chapter" buttons var activeSection = document.querySelector('#sidebar .active'); if (activeSection) { activeSection.scrollIntoView({ block: 'center' }); } } </script> <div id="page-wrapper" class="page-wrapper"> <div class="page"> <div id="menu-bar-hover-placeholder"></div> <div id="menu-bar" class="menu-bar sticky"> <div class="left-buttons"> <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> <i class="fa fa-bars"></i> </label> <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> <i class="fa fa-paint-brush"></i> </button> <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li> <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> </ul> <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> <i class="fa fa-search"></i> </button> </div> <h1 class="menu-title">everything curl</h1> <div class="right-buttons"> <a href="../../print.html" title="Print this book" aria-label="Print this book"> <i id="print-button" class="fa fa-print"></i> </a> </div> </div> <div id="search-wrapper" class="hidden"> <form id="searchbar-outer" class="searchbar-outer"> <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> </form> <div id="searchresults-outer" class="searchresults-outer hidden"> <div id="searchresults-header" class="searchresults-header"></div> <ul id="searchresults"> </ul> </div> </div> <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> <script> document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); }); </script> <div id="content" class="content"> <main> <h1 id="drive-with-multi_socket"><a class="header" href="#drive-with-multi_socket">Drive with multi_socket</a></h1> <p>multi_socket is the extra spicy version of the regular multi interface and is designed for event-driven applications. Make sure you read the <a href="multi.html">Drive with multi interface</a> section first.</p> <p>multi_socket supports multiple parallel transfers—all done in the same single thread—and have been used to run several tens of thousands of transfers in a single application. It is usually the API that makes the most sense if you do a large number (&gt;100 or so) of parallel transfers.</p> <p>Event-driven in this case means that your application uses a system level library or setup that subscribes to a number of sockets and it lets your application know when one of those sockets are readable or writable and it tells you exactly which one.</p> <p>This setup allows clients to scale up the number of simultaneous transfers much higher than with other systems, and still maintain good performance. The regular APIs otherwise waste far too much time scanning through lists of all the sockets.</p> <h2 id="pick-one"><a class="header" href="#pick-one">Pick one</a></h2> <p>There are numerous event based systems to select from out there, and libcurl is completely agnostic to which one you use. libevent, libev and libuv are three popular ones but you can also go directly to your operating system's native solutions such as epoll, kqueue, /dev/poll, pollset or Event Completion.</p> <h2 id="many-easy-handles"><a class="header" href="#many-easy-handles">Many easy handles</a></h2> <p>Just like with the regular multi interface, you add easy handles to a multi handle with <code>curl_multi_add_handle()</code>. One easy handle for each transfer you want to perform.</p> <p>You can add them at any time while the transfers are running and you can also similarly remove easy handles at any time using the <code>curl_multi_remove_handle</code> call. Typically though, you remove a handle only after its transfer is completed.</p> <h2 id="multi_socket-callbacks"><a class="header" href="#multi_socket-callbacks">multi_socket callbacks</a></h2> <p>As explained above, this event-based mechanism relies on the application to know which sockets that are used by libcurl and what activities libcurl waits for on those sockets: if it waits for the socket to become readable, writable or both.</p> <p>The application also needs to tell libcurl when the timeout time has expired, as it is control of driving everything libcurl cannot do it itself. libcurl informs the application updated timeout values as soon as it needs to.</p> <h3 id="socket_callback"><a class="header" href="#socket_callback">socket_callback</a></h3> <p>libcurl informs the application about socket activity to wait for with a callback called <a href="https://curl.se/libcurl/c/CURLMOPT_SOCKETFUNCTION.html">CURLMOPT_SOCKETFUNCTION</a>. Your application needs to implement such a function:</p> <pre><code>int socket_callback(CURL *easy, /* easy handle */ curl_socket_t s, /* socket */ int what, /* what to wait for */ void *userp, /* private callback pointer */ void *socketp) /* private socket pointer */ { /* told about the socket 's' */ } /* set the callback in the multi handle */ curl_multi_setopt(multi_handle, CURLMOPT_SOCKETFUNCTION, socket_callback); </code></pre> <p>Using this, libcurl sets and removes sockets your application should monitor. Your application tells the underlying event-based system to wait for the sockets. This callback is called multiple times if there are multiple sockets to wait for, and it is called again when the status changes and perhaps you should switch from waiting for a writable socket to instead wait for it to become readable.</p> <p>When one of the sockets that the application is monitoring on libcurl's behalf registers that it becomes readable or writable, as requested, you tell libcurl about it by calling <code>curl_multi_socket_action()</code> and passing in the affected socket and an associated bitmask specifying which socket activity that was registered:</p> <pre><code>int running_handles; ret = curl_multi_socket_action(multi_handle, sockfd, /* the socket with activity */ ev_bitmask, /* the specific activity */ &amp;running_handles); </code></pre> <h3 id="timer_callback"><a class="header" href="#timer_callback">timer_callback</a></h3> <p>The application is in control and waits for socket activity. Even without socket activity there are things libcurl needs to do. Timeout things, calling the progress callback, starting over a retry or failing a transfer that takes too long, etc. To make that work, the application must also make sure to handle a single-shot timeout that libcurl sets.</p> <p>libcurl sets the timeout with the timer_callback <a href="https://curl.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html">CURLMOPT_TIMERFUNCTION</a>:</p> <pre><code>int timer_callback(multi_handle, /* multi handle */ timeout_ms, /* milliseconds to wait */ userp) /* private callback pointer */ { /* the new time-out value to wait for is in 'timeout_ms' */ } /* set the callback in the multi handle */ curl_multi_setopt(multi_handle, CURLMOPT_TIMERFUNCTION, timer_callback); </code></pre> <p>There is only one timeout for the application to handle for the entire multi handle, no matter how many individual easy handles that have been added or transfers that are in progress. The timer callback gets updated with the current nearest-in-time period to wait. If libcurl gets called before the timeout expiry time because of socket activity, it may update the timeout value again before it expires.</p> <p>When the event system of your choice eventually tells you that the timer has expired, you need to tell libcurl about it:</p> <pre><code>curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &amp;running); </code></pre> <p>…in many cases, this makes libcurl call the timer_callback again and set a new timeout for the next expiry period.</p> <h3 id="how-to-start-everything"><a class="header" href="#how-to-start-everything">How to start everything</a></h3> <p>When you have added one or more easy handles to the multi handle and set the socket and timer callbacks in the multi handle, you are ready to start the transfer.</p> <p>To kick it all off, you tell libcurl it timed out (because all easy handles start out with a short timeout) which make libcurl call the callbacks to set things up and from then on you can just let your event system drive:</p> <pre><code>/* all easy handles and callbacks are setup */ curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &amp;running); /* now the callbacks should have been called and we have sockets to wait for and possibly a timeout, too. Make the event system do its magic */ event_base_dispatch(event_base); /* libevent2 has this API */ /* at this point we have exited the event loop */ </code></pre> <h3 id="when-is-it-done"><a class="header" href="#when-is-it-done">When is it done?</a></h3> <p>The 'running_handles' counter returned by <code>curl_multi_socket_action</code> holds the number of current transfers not completed. When that number reaches zero, we know there are no transfers going on.</p> <p>Each time the 'running_handles' counter changes, <code>curl_multi_info_read()</code> returns info about the specific transfers that completed.</p> </main> <nav class="nav-wrapper" aria-label="Page navigation"> <!-- Mobile navigation buttons --> <a rel="prev" href="../../transfers/drive/multi.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <i class="fa fa-angle-left"></i> </a> <a rel="next prefetch" href="../../transfers/callbacks/index.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> <div style="clear: both"></div> </nav> </div> </div> <nav class="nav-wide-wrapper" aria-label="Page navigation"> <a rel="prev" href="../../transfers/drive/multi.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <i class="fa fa-angle-left"></i> </a> <a rel="next prefetch" href="../../transfers/callbacks/index.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> </nav> </div> <script> window.playground_copyable = true; </script> <script src="../../elasticlunr.min.js"></script> <script src="../../mark.min.js"></script> <script src="../../searcher.js"></script> <script src="../../clipboard.min.js"></script> <script src="../../highlight.js"></script> <script src="../../book.js"></script> <!-- Custom JS scripts --> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10