Skip to content

Need to close connection when done uploading via httr::VERB() #761

Open
@juliasilge

Description

@juliasilge

Maybe related to #333?

If you use httr::VERB(), there are some lingering open connections after uploading a file:

citation <- httr::upload_file(system.file("CITATION"))
httr::VERB(
  "POST",
  url =  "http://httpbin.org/post",
  body = citation
)
#> Response [http://httpbin.org/post]
#>   Date: 2025-04-26 01:24
#>   Status: 200
#>   Content-Type: application/json
#>   Size: 1.19 kB
#> {
#>   "args": {}, 
#>   "data": "bibentry(\"Manual\",\n         title = \"R: A Language and Environ...
#>   "files": {}, 
#>   "form": {}, 
#>   "headers": {
#>     "Accept": "application/json, text/xml, application/xml, */*", 
#>     "Accept-Encoding": "deflate, gzip", 
#>     "Content-Length": "643", 
#>     "Content-Type": "text/plain", 
#> ...
showConnections()
#>   description                                                                         
#> 3 ""                                                                                  
#> 4 "/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/base/CITATION"
#>   class  mode  text     isopen   can read can write
#> 3 "file" "w+b" "binary" "opened" "yes"    "yes"    
#> 4 "file" "rb"  "binary" "opened" "yes"    "no"

Created on 2025-04-25 with reprex v2.1.1

This is showing up in pins on Connect pretty dramatically (you'll see a half dozen "closing unused connection" if you write and then read a pin to Connect), as well as (I believe) other pins backends like GCS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions