Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from httr to httr2 #54

Open
lshep opened this issue Dec 9, 2024 · 2 comments
Open

Update from httr to httr2 #54

lshep opened this issue Dec 9, 2024 · 2 comments

Comments

@lshep
Copy link
Contributor

lshep commented Dec 9, 2024

self description

@HenrikBengtsson
Copy link

HenrikBengtsson commented Feb 14, 2025

To install the patch in PR #57, use:

remotes::install_github("Bioconductor/BiocFileCache#57")
packageVersion("BiocFileCache")
#> [1] '2.15.4'

To test, use:

library(BiocFileCache)
path <- tempfile()
bfc <- BiocFileCache(path, ask = FALSE)
remoteresource <- "https://bioconductorhubs.blob.core.windows.net/annotationhub/goldenpath/hg19/database/stsMap_0.0.1.RData"

## Get HTTPS proxy settings from established environment variable
proxy <- Sys.getenv("https_proxy")

## Alternatively, set it manually
proxy <- Sys.getenv("https://proxyserver:8080")

stopifnot(nzchar(proxy))
bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)

@HenrikBengtsson
Copy link

Environment variable https_proxy is an established variable that most internet libraries recognizes. Many systems relying on a proxy server have this set by default. Because of this, I will test both with and without that one being set.

I'll be testing with R 4.4.2 running on Rocky 8 Linux. All CRAN and Bioconductor packages are up-to-date. I'm testing with:

installed using

BiocManager::install("BiocFileCache")
packageVersion("BiocFileCache")
#> [1] '2.14.0'

and

remotes::install_github("Bioconductor/BiocFileCache#57")
packageVersion("BiocFileCache")
#> [1] '2.15.4'

Results

Without proxy argument, without env var https_proxy

BiocFileCache 2.14.0 (ERROR)

> packageVersion("BiocFileCache")
[1] '2.14.0'
> stopifnot(!nzchar(Sys.getenv("https_proxy")))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource)
Error in .util_download(x, rid[i], proxy, config, "bfcadd()", ...) : 
  bfcadd() failed; see warnings()
In addition: Warning messages:
1: download failed
  web resource path: 'https://bioconductorhubs.blob.core.windows.net/annotationhub/goldenpath/hg19/database/stsMap_0.0.1.RData'
  local file path: '/scratch/hb/Rtmpb7dsek/file33d16f77c6f2db/33d16f457610ee_stsMap_0.0.1.RData'
  reason: Couldn't resolve host name [bioconductorhubs.blob.core.windows.net]: Could not resolve host: bioconductorhubs.blob.core.windows.net 
2: bfcadd() failed; resource removed
  rid: BFC1
  fpath: 'https://bioconductorhubs.blob.core.windows.net/annotationhub/goldenpath/hg19/database/stsMap_0.0.1.RData'
  reason: download failed 

Enter a frame number, or 0 to exit   

1: bfcadd(bfc, rname = "uniquename", fpath = remoteresource)
2: bfcadd(bfc, rname = "uniquename", fpath = remoteresource)
3: .util_download(x, rid[i], proxy, config, "bfcadd()", ...)
4: stop(call, " failed; see warnings()")

BiocFileCache 2.15.4 (ERROR)

> packageVersion("BiocFileCache")
[1] '2.15.4'
> stopifnot(!nzchar(Sys.getenv("https_proxy")))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource)
Error in .util_download(x, rid[i], proxy, config, "bfcadd()", ...) : 
  bfcadd() failed; see warnings()
In addition: Warning messages:
1: download failed
  web resource path: 'https://bioconductorhubs.blob.core.windows.net/annotationhub/goldenpath/hg19/database/stsMap_0.0.1.RData'
  local file path: '/scratch/hb/RtmpTQQFhC/filec3a2cb98018d/c3a2c16abc8b9_stsMap_0.0.1.RData'
  reason: Failed to perform HTTP request.
Caused by error in `curl::curl_fetch_disk()`:
! Couldn't resolve host name [bioconductorhubs.blob.core.windows.net]: Could not resolve host: bioconductorhubs.blob.core.windows.net 
2: bfcadd() failed; resource removed
  rid: BFC1
  fpath: 'https://bioconductorhubs.blob.core.windows.net/annotationhub/goldenpath/hg19/database/stsMap_0.0.1.RData'
  reason: download failed 

With proxy argument, without env var https_proxy

BiocFileCache 2.14.0 (ERROR)

> packageVersion("BiocFileCache")
[1] '2.14.0'
> stopifnot(!nzchar(Sys.getenv("https_proxy")))
> proxy <- "http://prox1:3128/"
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
  |======================================================================| 100%

Error in curl::curl_fetch_memory(url, handle = handle) : 
  Couldn't resolve host name [bioconductorhubs.blob.core.windows.net]: Could not resolve host: bioconductorhubs.blob.core.windows.net

Enter a frame number, or 0 to exit   

 1: bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
 2: bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
 3: .util_download(x, rid[i], proxy, config, "bfcadd()", ...)
 4: .util_set_cache_info(bfc, rid[ok])
 5: .httr_get_cache_info(fpath)
 6: withCallingHandlers({
    HEAD(link)
}, warning = function(w) {
    invokeRest
 7: HEAD(link)
 8: request_perform(req, hu$handle$handle)
 9: request_fetch(req$output, req$url, handle)
10: request_fetch.write_memory(req$output, req$url, handle)
11: curl::curl_fetch_memory(url, handle = handle)
12: raise_libcurl_error(6, "Couldn't resolve host name", "Could not resolve hos
13: stop(e)

BiocFileCache 2.15.4 (ERROR)

> packageVersion("BiocFileCache")
[1] '2.15.4'
> stopifnot(!nzchar(Sys.getenv("https_proxy")))
> proxy <- "http://prox1:3128/"
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
  |======================================================================| 100%

Error in (function (e)  : Error while performing HEAD request

Enter a frame number, or 0 to exit   

 1: bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
 2: bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
 3: .util_download(x, rid[i], proxy, config, "bfcadd()", ...)
 4: .util_set_cache_info(bfc, rid[ok])
 5: .httr_get_cache_info(fpath)
 6: withCallingHandlers({
    request(link) %>% req_method("HEAD") %>% req_perfo
 7: request(link) %>% req_method("HEAD") %>% req_perform()
 8: req_perform(.)
 9: handle_resp(req, resp, error_call = error_call)
10: cnd_signal(resp)
11: signal_abort(cnd)
12: signalCondition(cnd)
13: (function (e) 
{
    stop("Error while performing HEAD request")
})(list(messa
14: stop("Error while performing HEAD request")

Without proxy argument, with env var https_proxy

BiocFileCache 2.14.0 (OK)

> packageVersion("BiocFileCache")
[1] '2.14.0'
> stopifnot(nzchar(Sys.getenv("https_proxy")))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource)
                                                                         BFC1 
"/scratch/hb/RtmpSntGNu/file2787ed29233941/2787ed52b68dc8_stsMap_0.0.1.RData" 

BiocFileCache 2.15.4 (OK)

> packageVersion("BiocFileCache")
[1] '2.15.4'
> stopifnot(nzchar(Sys.getenv("https_proxy")))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource)

                                                                         BFC1
"/scratch/hb/RtmpSntGNu/file2787ed6216c1cc/2787ed6e178db_stsMap_0.0.1.RData"

With proxy argument, with env var https_proxy

BiocFileCache 2.14.0 (OK)

> packageVersion("BiocFileCache")
[1] '2.14.0'
> proxy <- Sys.getenv("https_proxy")
> stopifnot(nzchar(proxy))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
  |======================================================================| 100%

                                                                         BFC1
"/scratch/hb/RtmpSntGNu/file27821d6216c1cc/2787ed6e178db_stsMap_0.0.1.RData"

BiocFileCache 2.15.4 (OK)

> packageVersion("BiocFileCache")
[1] '2.15.4'
> proxy <- Sys.getenv("https_proxy")
> stopifnot(nzchar(proxy))
> bfcadd(bfc, rname = "uniquename", fpath = remoteresource, proxy = proxy)
  |======================================================================| 100%

                                                                        BFC1 
"/scratch/hb/RtmpSntGNu/file2787ed6216c1cc/2787ed6e178db_stsMap_0.0.1.RData"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants