Comments (2)
It is good practice to close()
the connection. If you forget to, the garbage collector closes the connection when it cleans up the con
object (with a warning). This holds for all connection types by the way (url()
, file()
, socket()
etc), not just curl()
. See also this topic.
Within a function, it is common to use the on.exit
finalizer for housekeeping. The benefit of on.exit
is that it also runs if the function exits with an error, so you can be sure the connection always gets closed.
do_something <- function(SOME_URL){
con <- curl(SOME_URL, open = "r")
on.exit(close(con))
readLines(con)
}
from curl.
Thanks that is helpful. Yes I had already decided to properly close the connections because the sheer volume of warnings was alarming. Good tip re: on.exit()
.
from curl.
Related Issues (20)
- inconsistent SSL version in vignette
- Allow users to pass pool object in `multi_download()`
- Use httpuv::randomPort() in curl_echo
- Why is curl_echo() slow sometimes HOT 2
- How to resolve "SSL: no alternative certificate subject name matches target host name '<proxy.server.address>'"
- httpuv delays in curl_echo on Linux HOT 1
- Can't get all bytes received before RST HOT 1
- installation warning: skipping pax global extended headers HOT 1
- Sudden negotiate error with 5.2.1
- Xcode Run on ios with Undefined symbol error HOT 1
- Support for request rate limiting? HOT 1
- stubbed version for (non)use in webr installs requiring curl HOT 3
- curl failure with Apple M Series and macOS Sonoma 14.5 HOT 12
- Multipart element from raw vector but with filename
- Windows ARM64 source build - fails if parallel make jobs used (winlibs download race condition) HOT 1
- Error in curl::curl_fetch_memory(url, handle = handle) : Error in curl::curl_fetch_memory(url, handle = handle) HOT 4
- Delete a file from my SFTP server using a custom request? HOT 2
- An unknown option was passed in to libcurl HOT 11
- Check ETag of file / url in curl::multi_download()
- Schannel: CertGetCertificwteChain trust error CERT_TRUST_REVOCATION_STATUS_UNKNOWN HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curl.