The problem is that the ParamsParser reads the entire body into a
string (from what I can tell by the line "body = request.raw_post")
before handing it to the parsing backend. My suggestion is that it
hand the IO object (env['rack.input'] I assume?) to the parser
instead. This way the parser can either read the entire string, then
parse - OR if it supports parsing as a stream, start doing so directly
off the IO.

On May 15, 4:53 pm, Joshua Peek <j...@joshpeek.com> wrote:
> Check out how the current ParamsParser middleware works.
>
> You can use whatever parser to extract the request params in your
> middleware and Rails will be fooled into using that instead.
>
>
>
>
>
> On Fri, May 15, 2009 at 1:31 PM, brianmario <seniorlo...@gmail.com> wrote:
>
> > Hey everyone,
> > I was wondering what the possability was of changing these lines:
>
> > body = request.raw_post
> > Hash.from_xml(body)
> > or
> > data = ActiveSupport::JSON.decode(body)
>
> > to instead be handed the env['rack.input'] IO itself?
>
> > Being as though both calls (from_xml and decode) are handled by rails
> > elsewhere, we could move the responsibility of parsing of the request
> > body IO to the swappable XML/JSON backends.
>
> > I'm asking because I'm looking to integrate yajl-ruby as one of the
> > JSON backends for ActiveSupport in Rails 3. It's capable of parsing
> > JSON right off the IO as a stream, and this change would allow it to
> > perform it's best (and keep memory usage very low for large request
> > bodies).
>
> > As for doing it for the XML backends as well, it opens up the
> > possibility of doing the type of stream parsing for XML.
>
> --
> Joshua Peek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to