[Rd] Using a consistent User Agent header for all available download methods?

Patrick Schratz p@t-@ @end|ng |rom m@||box@org
Sat Jul 26 19:23:40 CEST 2025


Dear R-devel,

For a project of mine which aims to improve R package distribution and 
routing, I came across the fact that the treatment of the User Agent 
info alongside download requests is not consistent.
`?download.file` explains this in detail, so I’ll assume this info to 
be know and just quote the most important bit:

> The default is "R (version platform arch os)" except when 
> ‘⁠libcurl⁠’ is used when it is "libcurl/version" for the 
> ‘⁠libcurl⁠’ version in use.

My question is:
Why is that? And why is the value of `getOption("HTTPUserAgent”)` not 
being sent consistently alongside all http(s) requests? Right now, it 
differs by OS and download method.

In my specific use case, `getOption("HTTPUserAgent”)` would contain 
some OS information that could be used for dynamic routing of requests.
Right now, this works for some environments (e.g. most Linux 
distributions), however, on others, (e.g. macOS), only “libcurl 
<version>” is sent, even though `HTTPUserAgent` is defined as an 
option.

Aside from my specific use case, I’d argue that sending an informative 
User Agent is a gentle way to identify oneself when making a request.
The current content of the User Agent info on each platform is again a 
different topic, but for now I would just like to get some feedback on 
the topic of sending it in the first place.

Best
Patrick




	[[alternative HTML version deleted]]



More information about the R-devel mailing list