1getCurlInfo =
2function(curl, which = getCurlInfoConstants())
3{
4  rnames = character()
5
6  if(is.character(which)) {
7    const = getCurlInfoConstants()
8    i = pmatch(tolower(which), names(const))
9    if(any(is.na(i)))
10      stop("Invalid curl info name", names(which)[is.na(i)])
11
12    which = getCurlInfoConstants()[i]
13  }
14
15  x = .Call("R_curl_easy_getinfo", curl, as.integer(which), PACKAGE = "RCurl")
16
17# put the names back on.
18  names(x) = names(which)
19
20  x
21}
22
23
24getCurlInfoConstants =
25function()
26{
27  x = .Call("R_getCURLInfoEnum", PACKAGE = "RCurl")
28  names(x) = tolower(gsub("_", ".", names(x)))
29
30  x
31}
32
33