From edd@debian.org  Sun Nov  4 15:44:47 2001
From: edd@debian.org (Dirk Eddelbuettel)
Date: Sun, 4 Nov 2001 09:44:47 -0600
Subject: [Rd] Suggesting to have download.file() reflect a new option
Message-ID: <15333.25199.152800.194958@sonny.eddelbuettel.com>


The "auto" method of downloading a file cannot cope with a proxy firewall
requiring authentication. However, wget can handle this very easily (using
e.g. ~/.wgetrc).  While it is feasible to add the required
	 method="wget" 
to calls such as update.packages(), this approach is rather tedious and could
easily be controlled by use of a new option.

Below is a simple patch to download.file.R which, when no method is
specified, queries the (suggested) option download.file.method and sets it if
found; else the old default "auto" is used. The same patch can be applied to
windows/download.file.R.  I'd be happy to add a small patch to the
documentation of both download.file() and options() to complement this is the
patch is deemed acceptable.  

Regards,  Dirk


edd@sonny:~/debian/r-base-1.3.1> diff -u src/library/base/R/unix/download.file.R{.orig,}
--- src/library/base/R/unix/download.file.R.orig        Fri Apr 13 02:50:27 2001+++ src/library/base/R/unix/download.file.R     Sun Nov  4 09:27:47 2001
@@ -1,9 +1,12 @@
 download.file <- function(url, destfile, method,
                           quiet = FALSE, mode = "w")
 {
-    method <- if(missing(method)) "auto" else
-    match.arg(method,
-              c("auto", "internal", "wget", "lynx", "socket"))
+    method <- if (missing(method))
+      ifelse(!is.null(getOption("download.file.method")),
+             getOption("download.file.method"),
+             "auto")
+    else
+      match.arg(method, c("auto", "internal", "wget", "lynx", "socket"))
 
     if(method == "auto") {
         if(capabilities("http/ftp"))


-- 
Better to have an approximate answer to the right question 
than a precise answer to the wrong question. -- John Tukey
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Suggesting to have download.file() reflect a new option
Dirk Eddelbuettel