Rev 7946 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{curlSetOpt}\alias{curlSetOpt}\title{Set values for the CURL options}\description{This function allows us to set values for thepossible options in the CURL data structurethat defines the HTTP request.These options persist across calls in the\code{CURLHandle} object.}\usage{curlSetOpt(..., .opts = list(), curl = getCurlHandle(),.encoding = integer(), .forceHeaderNames = FALSE,.isProtected = FALSE)}%- maybe also 'usage' for other objects documented here.\arguments{\item{...}{a named list of curl options to set after the handle hasbeen created.}\item{.opts}{a named list or \code{CURLOptions} object identifying thecurl options for the handle.}\item{curl}{the \code{CURLHandle} object created earlier viaa call to \code{\link{getCurlHandle}} or\code{\link{dupCurlHandle}}}\item{.encoding}{an integer or a string that explicitly identifies theencoding of the content that is returned by the HTTP server in itsresponse to our query. The possible strings are\sQuote{UTF-8} or \sQuote{ISO-8859-1}and the integers should be specified symbolicallyas \code{CE_UTF8} and \code{CE_LATIN1}.Note that, by default, the package attempts to process the header ofthe HTTP response to determine the encoding. This argument is usedwhen such information is erroneous and the caller knows the correctencoding.}\item{.forceHeaderNames}{a logical value which if \code{TRUE}allows the caller to explicitly indicate that the HTTPHEADERoption needs to have the names prefixed to the strings.This removes any ambiguity caused by the presence of ':' in thevalues appearing to be the separator between the name and the valueof the \code{name: value} pairs of the HTTP header.}\item{.isProtected}{a logical vector (or value that is repeated) specifying whichof the values in \dots and \code{.opts} need to be explicitlyprotected from garbage collection or not.The basic idea is that we specify \code{FALSE} ifthe value being set for the curl option may be garbage collectedbefore the \code{curl} handle is garbage collected. This would leavethe \code{curl} object in an inconsistent state, referring to an Robject (i.e. an R function), which may be used after the R object has been garbage collected.}}\value{An integer value giving the status of the return.This should be 0 as if there was an error in the libcurlmechiansim, we will throw it there.}\references{Curl homepage \url{https://curl.se/}}\author{Duncan Temple Lang}\seealso{\code{\link{getCurlHandle}}\code{\link{dupCurlHandle}}}\examples{if(url.exists("https://www.omegahat.net")) {curl = getCurlHandle()# Note the header that extends across two lines with the second line# prefixed with white space.curlSetOpt( .opts = list(httpheader = c(Date = "Wed, 1/2/2000 10:01:01",foo="abc\n extra line"), verbose = TRUE),curl = curl)ans = getURL("https://www.omegahat.net", curl = curl)}}\keyword{IO}