Skip to content

[bug] fread does not work with https url behind a proxy #1686

@cderv

Description

@cderv

Hi,

I recently encounter a problem with https url to read a file with fread. I had the following error

#> Error in curl::curl_download(input, tt, mode = "wb", quiet = !showProgress): Timeout was reached

The problem is I am behind a proxy and curl_download does not seem to import current proxy setting on windows for IE. And I do not find a way to configure curl proxy setting before fread

However, with download.file function, downloading the file with https url works perfectly without configuring anything.
Looking at fread, curl::curl_download is used for secure url whereas for non secure, download.file is used ?

if (!is_secureurl(input)) {
      download.file(input, tt, mode = "wb", quiet = !showProgress)
    }
    else {
      if (!requireNamespace("curl", quietly = TRUE)) 
        stop("Input URL requires https:// connection for which fread() requires 'curl' package, but cannot be found. Please install the package using 'install.packages()'.")
      curl::curl_download(input, tt, mode = "wb", quiet = !showProgress)
    }

Could it be possible that now R handles https url with download.file, the suggested curl library is no longer need and would solves this problem?


For those who could try to reproduce behin a proxy :

url <- "https://d37djvu3ytnwxt.cloudfront.net/asset-v1:MITx+15.071x_3+1T2016+type@asset+block/songs.csv"
DT <- data.table::fread(url, verbose = T)
#> Error in curl::curl_download(input, tt, mode = "wb", quiet = !showProgress): Timeout was reached

and my sessionInfo()

#> R version 3.2.4 Revised (2016-03-16 r70336)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 7 x64 (build 7601) Service Pack 1
#> 
#> locale:
#> [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
#> [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
#> [5] LC_TIME=French_France.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] data.table_1.9.6
#> 
#> loaded via a namespace (and not attached):
#>  [1] clipr_0.2.0       magrittr_1.5      formatR_1.3      
#>  [4] htmltools_0.3.5   tools_3.2.4       curl_0.9.7       
#>  [7] Rcpp_0.12.4       stringi_1.0-1     rmarkdown_0.9.5  
#> [10] knitr_1.12.3      stringr_1.0.0     digest_0.6.9     
#> [13] reprex_0.0.0.9001 chron_2.3-47      evaluate_0.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions