| 1 |
#' Internet Explorer proxy settings |
| 2 |
#' |
| 3 |
#' Lookup and mimic the system proxy settings on Windows as set by Internet |
| 4 |
#' Explorer. This can be used to configure curl to use the same proxy server. |
| 5 |
#' |
| 6 |
#' The [ie_proxy_info] function looks up your current proxy settings as configured |
| 7 |
#' in IE under "Internet Options" under "LAN Settings". The [ie_get_proxy_for_url] |
| 8 |
#' determines if and which proxy should be used to connect to a particular |
| 9 |
#' URL. If your settings have an "automatic configuration script" this |
| 10 |
#' involves downloading and executing a PAC file, which can take a while. |
| 11 |
#' |
| 12 |
#' @useDynLib curl R_proxy_info |
| 13 |
#' @export |
| 14 |
#' @rdname ie_proxy |
| 15 |
#' @name ie_proxy |
| 16 |
ie_proxy_info <- function(){ |
| 17 |
.Call(R_proxy_info) |
| 18 |
} |
| 19 |
|
| 20 |
#' @useDynLib curl R_get_proxy_for_url |
| 21 |
#' @param target_url url with host for which to lookup the proxy server |
| 22 |
#' @export |
| 23 |
#' @rdname ie_proxy |
| 24 |
ie_get_proxy_for_url <- function(target_url = "http://www.google.com"){ |
| 25 |
stopifnot(is.character(target_url)) |
| 26 |
info <- ie_proxy_info() |
| 27 |
if(length(info$Proxy)){ |
| 28 |
if(isTRUE(grepl("<local>", info$ProxyBypass, fixed = TRUE)) && |
| 29 |
isTRUE(grepl("(://)[^./]+/", paste0(target_url, "/")))){ |
| 30 |
return(NULL) |
| 31 |
} else { |
| 32 |
return(info$Proxy) |
| 33 |
} |
| 34 |
} |
| 35 |
if(isTRUE(info$AutoDetect) || length(info$AutoConfigUrl)){ |
| 36 |
out <- .Call(R_get_proxy_for_url, target_url, info$AutoDetect, info$AutoConfigUrl) |
| 37 |
if(isTRUE(out$HasProxy)){ |
| 38 |
return(out$Proxy) |
| 39 |
} |
| 40 |
} |
| 41 |
return(NULL); |
| 42 |
} |
| 43 |
|
| 44 |
#' @useDynLib curl R_windows_build |
| 45 |
get_windows_build <- function(){ |
| 46 |
.Call(R_windows_build) |
| 47 |
} |