jeroen / curl

A Modern and Flexible Web Client for R
https://jeroen.r-universe.dev/curl
Other
217 stars 71 forks source link

curl's verbose=TRUE argument not working on Windows #230

Open allanvc opened 4 years ago

allanvc commented 4 years ago

Hi Jeroen. Thanks for this nice and useful package. I currently have a package built on top of curl. It is called mRpostman. The idea is to implement several IMAP functionalities so that R users can easily manipulate mail folders and messages from inside R. A few weeks ago, I noticed that the curl's verbose=TRUE argument is not working properly on Windows. Sometimes the communication with the server appears in the console, sometimes it doesn’t .

I test it regularly on Linux and everything works fine. So, the problem seems to be restricted to Windows.

The code below may allow you to replicate the problem:

conn_params <- list(username="user@gmail.com",
                    password="pass",
                    verbose = TRUE)

h <- curl::new_handle()

do.call(curl::handle_setopt, c(h, conn_params))

curl::handle_setopt(h, customrequest = paste0('SELECT ', "INBOX"))

curl::curl_fetch_memory("imaps://imap.gmail.com", handle = h)

In mRpostman, the equivalent would be:

library(mRpostman)
imapconf <- configure_imap(url="imaps://imap.gmail.com",
                           username="user",
                           password="pass",
                           verbose = TRUE
)

imapconf %>%
  select_mailbox(mbox = "INBOX")

This is my libcurl version on Windows:

curl::curl_version()
$version
[1] "7.64.1"

$ssl_version
[1] "(OpenSSL/1.1.1a) Schannel"

$libz_version
[1] "1.2.11"

$libssh_version
[1] "libssh2/1.8.2"

$libidn_version
[1] NA

$host
[1] "x86_64-w64-mingw32"

$protocols
 [1] "dict"   "file"   "ftp"    "ftps"   "gopher" "http"   "https"  "imap"   "imaps"  "ldap"   "ldaps" 
[12] "pop3"   "pop3s"  "rtsp"   "scp"    "sftp"   "smtp"   "smtps"  "telnet" "tftp"  

$ipv6
[1] TRUE

$http2
[1] FALSE

$idn
[1] TRUE
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252    LC_MONETARY=Portuguese_Brazil.1252
[4] LC_NUMERIC=C                       LC_TIME=Portuguese_Brazil.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mRpostman_0.3.1

loaded via a namespace (and not attached):
[1] compiler_4.0.2   assertthat_0.2.1 magrittr_1.5     tools_4.0.2      rstudioapi_0.11  curl_4.3        
[7] stringi_1.4.6    stringr_1.4.0 
github-actions[bot] commented 1 day ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If the problem still exists in the latest version, feel free to raise it again in a new issue. Please remember to keep the description terse and include a minimal example to help us look into it.