rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Multipart Form-Data problem on Rack 1.1, not on Rack 1.0.1
@ 2010-05-26 22:31 joshuamiller
  2010-05-27  1:26 ` joshuamiller
  0 siblings, 1 reply; 2+ messages in thread
From: joshuamiller @ 2010-05-26 22:31 UTC (permalink / raw)
  To: Rack Development

Hi all-

Ran into a problem today posting multipart form-data to Rack 1.1
running on Passenger 2.2.11 on Ruby 1.9.1 p378, where request#POST
returns nil.  The problem seems to come from here (line 142 of lib/
rack/request.rb):

      elsif @env["rack.request.form_input"].eql? @env["rack.input"]
        @env["rack.request.form_hash"]

The two env variables on the first line are both set to this,
according to show_exceptions:

#<PhusionPassenger::Utils::RewindableInput:0xccd8854 @io=#<UNIXSocket:
0xccd9408>, @rewindable_io=#<File:/tmp/RackRewindableInput26185-0>,
@unlinked=false>

But there is no env['rack.request.form_hash']

So def params does this...

    def params
      self.GET.update(self.POST)

and it breaks.  The error goes away when I back Rack down to 1.0.1.  I
tried to figure out where form_input and input get set so I could
rewind and see where the difference is, or where form_hash is supposed
to be set, but I'm stumped.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Multipart Form-Data problem on Rack 1.1, not on Rack 1.0.1
  2010-05-26 22:31 Multipart Form-Data problem on Rack 1.1, not on Rack 1.0.1 joshuamiller
@ 2010-05-27  1:26 ` joshuamiller
  0 siblings, 0 replies; 2+ messages in thread
From: joshuamiller @ 2010-05-27  1:26 UTC (permalink / raw)
  To: Rack Development

To answer my own question here, the problem seems to have come from
the last multipart boundary ending like --boundary instead of --
boundary-- which slightly broke something in Passenger's param
parsing, and the 1.0.1 behavior (from before the Content-Type change)
silently allowed it, whereas the 1.1 behavior got stuck.  Might be
worth making sure @env['rack.request.form_hash'] exists before
returning it, but the specific problem here was definitely on the
client end.

On May 26, 6:31 pm, joshuamiller <elefant...@gmail.com> wrote:
> Hi all-
>
> Ran into a problem today posting multipart form-data to Rack 1.1
> running on Passenger 2.2.11 on Ruby 1.9.1 p378, where request#POST
> returns nil.  The problem seems to come from here (line 142 of lib/
> rack/request.rb):
>
>       elsif @env["rack.request.form_input"].eql? @env["rack.input"]
>         @env["rack.request.form_hash"]
>
> The two env variables on the first line are both set to this,
> according to show_exceptions:
>
> #<PhusionPassenger::Utils::RewindableInput:0xccd8854 @io=#<UNIXSocket:
> 0xccd9408>, @rewindable_io=#<File:/tmp/RackRewindableInput26185-0>,
> @unlinked=false>
>
> But there is no env['rack.request.form_hash']
>
> So def params does this...
>
>     def params
>       self.GET.update(self.POST)
>
> and it breaks.  The error goes away when I back Rack down to 1.0.1.  I
> tried to figure out where form_input and input get set so I could
> rewind and see where the difference is, or where form_hash is supposed
> to be set, but I'm stumped.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-27  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-26 22:31 Multipart Form-Data problem on Rack 1.1, not on Rack 1.0.1 joshuamiller
2010-05-27  1:26 ` joshuamiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).