From duncan at wald.ucdavis.edu  Thu Jul 20 15:49:02 2006
From: duncan at wald.ucdavis.edu (Duncan Temple Lang)
Date: Thu, 20 Jul 2006 06:49:02 -0700
Subject: [Rd] Post CGI forms with built-in R function?
In-Reply-To: <44BE5C1C.40105@wald.ucdavis.edu>
References: <AA5F2F09-B65C-47C5-B7DD-541FCA4956B5@bu.edu>
	<44BE5C1C.40105@wald.ucdavis.edu>
Message-ID: <44BF89CE.2020006@wald.ucdavis.edu>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


There is a hard coded limit of 4096 characters in
RxmlNanoHTTPScanURL and other ScanURL routines in nanohttp.c
and nanoftp.c.   And your URI is 5138 and so walks past the bounds
of the array of length 4096.

I am not yet convinced that it is worthwhile to increase this limit to
a larger number.  Using POST in this context really is a better
solution.  But we do need to add checks to the code to ensure that
the URI string is smaller than 4096.

I'll try to get an opportunity to do that tomorrow before I take off.

  D.

Duncan Temple Lang wrote:
> 
> Hi Mike
> 
>  If you don't want to have to download any packages but stick entirely
> within R, then you can mimic the code in httpRequest. But,
> as far as I know, there is no function in the standard R distribution to
> POST an HTTP request.
> 
>   As for using
>    scan("http://....")
> 
>   what is the string you are using? Are you escaping all the characters
> correctly? What's the error message?
> 
>  If what you are doing involves only relatively basic HTTP requests,
> perhaps the simplest thing to do is use the httpRequest package on CRAN.
> It does the basics.  You may have to handle chunked responses yourself
> and escaping certain characters. But that is a pure R solution that can
> be easily installed via install.packages().
> 
> 
> 
> Mike Schaffer wrote:
> 
>>>I wrote a package that requires downloading data from an external  
>>>server based on parameters specified by the user.
>>>
>>>I have used RMySQL or Rcurl to accomplish this, but in the interest  
>>>of simplicity for users of this package, I'd like this communication  
>>>to not require installing other packages and their dependencies (e.g.  
>>>RMySQL, Rcurl, etc.).  These dependencies are sometimes a deterrent  
>>>to using my package.
>>>
>>>I set up a CGI script on the server to handle data requests.  Now, is  
>>>there a *built-in* R function that could be adapted to post forms or  
>>>otherwise allows long URLs to be passed to this script to retrieve  
>>>the data requested.  I tried using just "scan", but it fails with  
>>>long URLs (sometimes a long list of parameters is required).  I think  
>>>my only option is to use POST, but it doesn't appear it is possible  
>>>without Rcurl.
>>>
>>>Can anyone help or suggest a "native" solution to the problem?
>>>
>>>Thanks.
>>>
>>>______________________________________________
>>>R-devel at r-project.org mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 
> --
> Duncan Temple Lang                    duncan at wald.ucdavis.edu
> Department of Statistics              work:  (530) 752-4782
> 4210 Mathematical Sciences Building   fax:   (530) 752-7099
> One Shields Ave.
> University of California at Davis
> Davis,
> CA 95616,
> USA

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

- --
Duncan Temple Lang                    duncan at wald.ucdavis.edu
Department of Statistics              work:  (530) 752-4782
4210 Mathematical Sciences Building   fax:   (530) 752-7099
One Shields Ave.
University of California at Davis
Davis,
CA 95616,
USA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFEv4nO9p/Jzwa2QP4RAnPnAJ974RMxo/KXfxQjaRHoHB1ZsdIy+QCeNhXg
EDk/WHaFUeH5C2v/607kovo=
=FAGn
-----END PGP SIGNATURE-----



[Rd] Post CGI forms with built-in R function?
Duncan Temple Lang