Hello Duncan. Thanks for having a look at this. As soon as I get home I'll try your suggestion.
BTW, the link to the omega-help mailing list seems to be broken: http://www.omegahat.org/mailman/listinfo/ Thank you. chr Duncan Temple Lang (Monday 15 November 2010, 01:02): > Hi Christian > > Thanks for finding this. The problem seems to be that the finalizer > on the curl handle seems to disappear and so is not being called > when the handle is garbage collected. So there is a bug somewhere > and I'll try to hunt it down quickly. > > In the meantime, you can achieve the same effect by calling the > C routine curl_easy_cleanup. You can't do this directly with a > .Call() or .C() as there is no explicit interface in the RCurl > package to this routine. However, you can use the Rffi package > (on the omegahat repository) > > library(Rffi) > cif = CIF(voidType, list(pointerType)) > callCIF(cif, "curl_easy_cleanup", c...@ref) > > I'll keep looking for why the finalizer is getting discarded. > > Thanks again, > > D. > > On 11/14/10 6:30 AM, Christian M. wrote: > > Hello. > > > > I know that it's usually possible to write cookies to a cookie > > file by removing the curl handle and doing a gc() call. I can do > > this with getURL(), but I just can't obtain the same results with > > postForm(). > > > > If I use: > > > > curlHandle <- getCurlHandle(cookiefile=FILE, cookiejar=FILE) > > > > and then do: > > > > getURL(http://example.com/script.cgi, curl=curlHandle) > > rm(curlHandle) > > gc() > > > > it's OK, the cookie is there. But, if I do (same handle; the > > parameter is a dummy): > > > > postForm(site, .params=list(par="cookie"), curl=curlHandle, > > style="POST") > > rm(curlHandle) > > gc() > > > > no cookie is written. > > > > Probably I'm doing something wrong, but don't know what. > > > > Is it possible to store cookies read from the output of a > > postForm() call? How? > > > > Thanks. > > > > Christian > > > > PS.: I'm attaching a script that can be sourced (and its .txt > > version). It contains an example. The expected result is a file > > (cookies.txt) with two cookies. The script currently uses > > getURL() and two cookies are stored. If postForm() is used > > (currently commented), only 1 cookie is written. > > -- SDF Public Access UNIX System - http://sdf.lonestar.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.