A Modern and Flexible Web Client for R

The curl() and curl_download() functions provide highly configurable drop-in replacements for base url() and download.file() with better performance, support for encryption (https, ftps), gzip compression, authentication, and other 'libcurl' goodies. The core of the package implements a framework for performing fully customized requests where data can be processed either in memory, on disk, or streaming via the callback or connection interfaces. Some knowledge of 'libcurl' is recommended; for a more-user-friendly web client see the 'httr' package which builds on this package with http specific tools and logic.



  • The 'data' callback from multi_add() gains a 'final' parameter
  • The 'data' callback from multi_add() can be given a file path to stream to files
  • New internal efficient file_writer type used when 'data' callback is a file path
  • Progress / Xfer callback functions are now explicitly protected (#157)
  • Tweak some unit tests to give less false positives
  • curl_echo() has been changed to return better structured output
  • Added curl_fetch_echo() as a wrapper for curl_echo()
  • Response for curl_fetch_memory() gains a 'type' field with the content-type
  • Fix a unit test for OpenSSL 1.1.1
  • Better default progress function if no progresfun or xferinfofun is set
  • Skip unit tests if no internet is available
  • Fix rchk and valgrind warnings from CRAN
  • Updated symbol table up with curl 7.64.0
  • Use native routine registration and visibility


  • Windows: Update libcurl to 7.59.0
  • Update curl_symbols dataset to 7.59.0
  • Fix an IDN unit test (malmö.se has messed up their SSL cert)
  • Add unit test for multi_fdset
  • Add backport of trimws for R 3.1


  • Fix potential memory bug in curl() when doubling the buffer is insufficient.
  • Windows: update to libcurl 7.56.1, restore support for libssh2.
  • Added unit test for curl_echo() to post large multipart data.
  • Fix IDN unit test error "string has forbidden bi-directional properties"


  • MAJOR CHANGE ON WINDOWS: On Windows 7 / 2008-R2 and up we switch from OpenSSL to native Windows SSL (secure channel). Therefore curl now uses certificates from the windows certificate manager. This enables users on corporate/government networks to connect through enterprise proxies and such. On Windows Vista/2008 and older (including CRAN) we still use OpenSSL to guarantee TLS 1.1/1.2 support. Other changes:
  • Windows: updated libcurl to v7.56.0 with dual SSL and native IDN/SSPI
  • multi_add() and curl_fetch_multi() gain an optional 'data' callback parameter
  • New function multi_fdset() returns the file descriptors of a multi pool
  • Add CURLOPT_PROXYAUTH = CURLAUTH_ANY to default handle settings


  • Windows: switch back to OpenSSL instead of SecureChannel because Windows 2008 (CRAN) does not support TLS 1.1 and TLS 1.2 which is required for many servers now.

2.8 (unpublished)

  • Windows: EXPERIMENTAL: on R 3.5+ curl now uses SecureChannel instead of OpenSSL for https.
  • Windows: updated libcurl to v7.54.1 with native windows IDN. Dropped nghttp2 and rtmp support.
  • Windows: nslookup() now uses IdnToAscii() for non-ascii domains
  • Add IDN unit tests on supported platforms
  • Error messages from libcurl include more detail when available (via CURLOPT_ERRORBUFFER)
  • Set a default CURLOPT_READFUNCTION because libcurls default can cause R to freeze
  • Fix a bug for empty forms and/or empty form-fields (+ added unit tests for this)
  • The 'multi_run()' function gains a parameter 'poll' to return immediately when a request completes.
  • Disable 'Expect: 100-continue' for POST requests (deprecated in libcurl)
  • Fix two rchk PROTECT warnings (thanks to Tomas Kalibera)


  • New function parse_headers_list() to parse response headers into named list
  • nslookup() gains a parameter 'multi' to return multiple matches
  • Automatically set 'POSTFIELDSIZE_LARGE' when setting 'POSTFIELDS' or 'COPYPOSTFIELDS' to raw vector
  • Do not crash when passing invalid objects as handles
  • Workaround for empty forms, i.e. calling handle_setform() with no arguments


  • nslookup() gains a parameter ipv4_only = TRUE (fixes unit test on Mavericks)


  • Add curl_echo() function for easy testing
  • Add support for curlopt_xferinfofunction, used in curl_echo()
  • Automatically set curlopt_noprogress = 0 when setting one of the progress functions
  • Automatically use XFERINFOFUNCTION vs PROGRESSFUNCTION depending on libcurl version
  • Default User-Agent is now: options("HTTPUserAgent")
  • Requests will now abort if progress/xferinfo callback raises an error
  • Open a connection with mode 'f' to skip stop_for_status() during open()


  • Windows: update libcurl to 7.53.1 with libssl 1.0.2k
  • New form_data() function to POST form with string/raw values with custom conten-type
  • Fix busy waiting for curl_fetch_stream()
  • Tweaks for open(con, blocking = FALSE)
  • Switch memcpy() to memmove() to please valgrind
  • Assert that curl() connection is only opened in read mode


  • All interruptable handles now use a global pool to share connections. Fixes #79.
  • Enable interruptable interface by default, even in non-interactive mode.
  • Update libcurl on Windows to 7.51.0
  • Unit tests now try serveral httpbin mirrors in case one goes down
  • Support open(con, blocking = FALSE) and isIncomplete() for curl() connections
  • Switch curl_fetch_stream to non-blocking implementation


  • Fixed bug in multi that did not actually enable or disable multiplexing.
  • Switch unit tests to HTTP/2 server to get HTTP/2 testing coverage
  • Fix big endian build on GLIBC systems (tnx Aurelien Jarno and Andreas Tille)


  • If libcurl >= 7.47 and was built --with-nghttp2, automatically enable HTTP/2 on HTTPS connections (matches behavior of 'curl' cmd util)
  • Upgrade to libcurl 7.50.3 (--with-nghttp2) on Windows (Adds HTTP/2 support)
  • Fix a unit test that would fail on fast servers


  • New multi interface for concurrent async requests!
  • Updated vignette with simple multi examples
  • Export handle_data() to get handle state


  • Fix for getaddrinfo GNU extension on some unix platforms


  • Fix ASAN warning in curl.c (reference after free)


  • Fix for FreeBSD
  • Simplify handle refCount system
  • Better handle locking to prevent using/modifying open handles
  • Make unit tests always close connection to prevent 'unused connection' warnings
  • Add support for interruptions in curl_download()


  • The non-blocking download method is now only used in interactive mode
  • Use options(curl_interrupt = TRUE) to force nonblocking in non-interactive mode
  • Updated libcurl on windows to 7.47.1. This should fix IPv6 problems.
  • Update the curl_symbols table to 7.48


  • Use non-blocking code in curl_fetch_memory to support user interruptions.
  • Configure script no longer assumes bash so it works on OpenBSD.
  • Fix for Snow Leopard CRAN build server.
  • Added has_internet() function.


  • Added nslookup() as cross-platform alternative to nsl()


  • Move the creation of the option table to ./R/options.R
  • The curl_options() function gains an argument to filter by name
  • Properly invoke winhttp.def file in Makevars.win (required for new toolchain)


  • Refactor configure script to use pkg-config
  • Use the preprocessor to extract CURLOPT symbols during install
  • Don't use setInternet2() in R > 3.2.2


  • Optimization for windows to make realloc in curl_fetch_memory faster
  • Updated the curl_symbols table to 7.43
  • Updated the static libraries on Windows:
    • libcurl 7.43.0
    • openssl 1.0.2d
    • libssh2 1.6.0
    • libiconv 1.14-5
    • libidn 1.31-1
  • New functions for Windows: ie_proxy_info and ie_get_proxy_for_url


  • Convert url argument to utf8 strings in escape/unescape
  • Endian fix for BSD systems
  • Add support for setting curlopt_xxx_large options


  • Fix for very old versions of libcurl (RHEL 5)
  • Do not convert paths to UTF-8 (only URLs)
  • Improve error message for unknown options


  • Fix for curl() character reader to invert byte-order on big endian architectures.


  • Rename the C function 'fetch' to 'fetchdata' because of Solaris conflict.
  • Move warning about missing CA bundle on Windows to onAttach.


  • Validation of SSL certificates is now enabled by default if a bundle is available.
  • Major rewrite to support configurable and reusable handles
  • Added new_handle, handle_setopt, handle_setheaders, handle_setform, handle_reset, etc.
  • Added curl_fetch interfaces for httr
  • Add ie_proxy_settings to get system proxy configuration on windows


  • Check for CURLM_CALL_MULTI_PERFORM to support very old versions of libcurl


  • Fixed a memory bug that could cause R to crash
  • Add curl_escape, curl_unescape
  • Add curl_version and curl_options


  • Add curl_download function
  • More efficient use of realloc
  • Fix for older versions of libcurl (e.g. Snow Leopard)
  • Add support for user interrupts while downloading (ESC or CTRL+C)
  • Fixed bug that caused GC to corrupt connection object
  • Refactoring and cleanup


  • add support for recycling connections


  • initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


4.3.2 by Jeroen Ooms, 4 months ago

https://github.com/jeroen/curl (devel) https://curl.se/libcurl/ (upstream)

Report a bug at https://github.com/jeroen/curl/issues

Browse source code at https://github.com/cran/curl

Authors: Jeroen Ooms [aut, cre] , Hadley Wickham [ctb] , RStudio [cph]

Documentation:   PDF Manual  

Task views: Web Technologies and Services

MIT + file LICENSE license

Suggests spelling, testthat, knitr, jsonlite, rmarkdown, magrittr, httpuv, webutils

System requirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).

Imported by AzureCosmosR, AzureGraph, BatchGetSymbols, CRANsearcher, DataSpaceR, EventStudy, FKF.SP, FedData, GSODR, GetBCBData, GetDFPData, GetDFPData2, GetLattesData, GetTDData, InterVA5, LAGOSNE, Microsoft365R, NFCP, NLPclient, OAIHarvester, OpenML, PWFSLSmoke, PandemicLP, PortalHacienda, RCzechia, REDCapExporter, RGISTools, RInno, RPublica, RPushbullet, Ravages, SMMT, TTR, TwitterAutomatedTrading, UniprotR, V8, VicmapR, W3CMarkupValidator, abbyyR, addinslist, alfred, anyLib, anyflights, aopdata, arcos, asciicast, aws.ec2metadata, aws.s3, babsim.hospital, basemaps, basifoR, bigrquery, bioRad, biocompute, biomartr, bitmexr, blastula, brranching, captr, cartography, cder, ceramic, cimir, clarifai, climate, clinPK, cloudstoR, coinmarketcapr, completejourney, conflr, contentid, covid19us, credentials, crul, crunch, ctrdata, cwbtools, czechrates, czso, dadjokeapi, daiR, data360r, dataRetrieval, datagovindia, dragon, ecb, ech, ecmwfr, ecochange, eiopaR, elastic, emayili, eph, eurlex, eurostat, exifr, exiftoolr, federalregister, felp, finreportr, fishflux, fishualize, foghorn, gbfs, geneHummus, geniusr, geobr, geofi, geoknife, geouy, geoviz, gimms, gitgadget, githubinstall, gitignore, googleCloudRunner, googleCloudStorageR, googlesheets4, googleway, gpg, gtrendsR, hddtools, heapsofpapers, helsinki, hereR, hlidacr, hsrecombi, httptest, httr, httr2, ichimoku, ihpdr, ipeadatar, istacr, jsonld, languagelayeR, legislatoR, libbib, lifx, mRpostman, magick, malariaAtlas, mapboxapi, mapping, maptiles, mdapack, medrxivr, mlr3oml, moveVis, natmanager, neonUtilities, nflfastR, nflreadr, nflseedR, nhdR, njtr1, nzffdr, ocs4R, opencpu, opendatatoronto, opentripplanner, osmdata, osrm, outsider, owidR, pRecipe, pafdR, pageviews, pak, pdfetch, pedquant, pestr, pivotaltrackR, pkgcache, pkgdepends, pkggraph, pkgsearch, plumbertableau, ppcong, priceR, protti, psychmeta, ptm, qpdf, qrandom, quantmod, quickerstats, r5r, rGEDI, radiant.data, radous, ralger, random, randquotes, rcitoid, rcmdcheck, rdbnomics, rdfp, rdian, rdryad, rdtLite, readthat, request, rfinance, rfishbase, rgho, rglobi, ricu, rinat, rio, rnbp, rnpn, rnrfa, robis, rosm, rsconnect, rsoi, rstoat, rtsdata, rversions, safedata, salesforcer, sbtools, secret, sharpshootR, shinyloadtest, shopifyr, socialmixr, soilDB, splashr, standartox, statcanR, statnipokladna, statswalesr, stevedore, taxadb, taxizedb, taxonomizr, telegram, telegram.bot, tesseract, textreadr, threesixtygiving, tidyquant, tinyscholar, traitdataform, udapi, uklr, urlchecker, usethis, virtuoso, vmr, wdpar, webdriver, webmockr, webutils, wikitaxa, xmlrpc2, zipcodeR.

Depended on by CytobankAPI, GoogleKnowledgeGraphR, RapidoPGS, VarfromPDB.

Suggested by AMR, BIOMASS, BiocManager, DescriptiveStats.OBeu, OpenSpecy, RMySQL, RestRserve, Rilostat, RxODE, appler, argoFloats, attempt, babette, bslib, ced, cfbfastR, childesr, cometr, commonmark, covr, cowsay, data.table, datapackage.r, devtools, drake, epiflows, fastai, fauxpas, fbar, ffscrapr, fitzRoy, gdtools, geysertimes, gms, googledrive, grattan, gutenbergr, gwsem, httpuv, installr, isoWater, jsonlite, jsontools, legco, link2GI, maketools, mauricer, mcboost, meltr, mockthat, neonstore, onsr, osmplotr, oxcgrt, pds3, plotly, polmineR, presser, processx, projmgr, protolite, ps, rchie, readr, remotes, rgdal, rgugik, sass, showtext, showtextdb, specmine, sysfonts, tarchetypes, targets, testthat, thematic, tiledb, uchardet, valr, varbvs, vcr, vegperiod, vroom, webfakes, windsoraiR, winfapReader, xfun, xml2.

See at CRAN