From @|mon@@ndrew@ @end|ng |rom b@br@h@m@@c@uk  Thu Sep 12 14:01:54 2024
From: @|mon@@ndrew@ @end|ng |rom b@br@h@m@@c@uk (Simon Andrews)
Date: Thu, 12 Sep 2024 12:01:54 +0000
Subject: [Rd] Can gzfile be given the same method option as file
Message-ID: <CWXP123MB619012B710931D02CF91B812D0642@CWXP123MB6190.GBRP123.PROD.OUTLOOK.COM>

Recently my employer has introduced a security system which generates SSL certificates on the fly to be able to see the content of https connections.  To make this work they add a new root certificate to the windows certificate store.

In R this causes problems because the default library used to download data from URLs doesn't look at this store, however the "wininet" download method works so where this is used then things work (albeit with a warning about future deprecation).

For functions like download.file this works great, but it fails when running readRDS:

readRDS('https://seurat.nygenome.org/azimuth/references/homologs.rds')
Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
  cannot open compressed file 'https://seurat.nygenome.org/azimuth/references/homologs.rds', probable reason 'Invalid argument'

After some debugging I see that the root cause is from the gzfile function.

> gzfile('https://seurat.nygenome.org/azimuth/references/homologs.rds') -> g
> open(g, open="r")
Error in open.connection(g, open = "r") : cannot open the connection
In addition: Warning message:
In open.connection(g, open = "r") :
  cannot open compressed file 'https://seurat.nygenome.org/azimuth/references/homologs.rds', probable reason 'Invalid argument'

If this was not a compressed file then using file rather than gzfile we can make this work by setting the url.method option:

> options("url.method"="wininet")
> file('https://seurat.nygenome.org/azimuth/references/homologs.rds') -> g
> open(g, open="r")
Warning message:
In open.connection(g, open = "r") :
  the 'wininet' method of url() is deprecated for http:// and https:// URLs

So I get a warning, but it works.

I guess this boils down to two questions:


  1.  Is it possible to add the same "method" argument to gzfile that file uses so that people in my situation have a work round?
  2.  Given the warnings we're getting when using wininet, are their plans to make windows certficates be supported in another way?

Thanks

Simon.












	[[alternative HTML version deleted]]



[Rd] Can gzfile be given the same method option as file
Simon Andrews