Re: Accessing POST Data More Than Once

Steve Halasz <[email protected]> Mon, 14 Nov 2005 20:58:38 -0500
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <1132019918.6991.114.camel@marcy>
On Mon, 2005-11-14 at 22:38 +0000, Brian Candler wrote:
> On Mon, Nov 14, 2005 at 01:36:39PM -0600, Ben Gribaudo wrote:
> > Hi,
> > 
> > How do I access POSTed data more than one time from a script?
> > 
> > If you submit data using the example below, the first 
> > Apache.request.read returns the POSTed data while subsequent calls 
> > return nil instead of repeating the POSTed data.
> > 
> > Thank you,
> > Ben Gribaudo
> > 
> > <pre>
> > <%
> > puts Apache.request.read # expected data
> > puts Apache.request.read # nil
> > puts Apache.request.read # nil
> > %>
> 
> foo = Apache.request.read
> puts foo
> puts foo
> puts foo
> 

This of course works. But I ran into the same problem and it took me a
lot of hair-pulling before I realized why my script wasn't working. It
would be best if this worked as expected and could be called more than
once with the same result.

Steve