Skip to content

params 'missing' due to rack bug #559

Closed
@myitcv

Description

@myitcv

This commit in rack fixes an issue whereby all requests which use a temp file (all requests larger 128 kb?) fail to be properly parsed.

The issue manifests itself in grape in the following way:

params do
  optional :picture, type: String
end
patch '/' do
  picture_from_params = params[:picture] # nil - but should not be
  picture_from_env = env['rack.request.form_hash']['picture'] # not nil - as expected

  env["rack.request.form_input"].eql? env["rack.input"] # false - THIS IS THE BUG fixed by the commit in rack
  env["rack.request.form_input"].equal? env["rack.input"] # true
end

Indeed this could have been the root cause of a few issues raised in the Google Group.

Not so much an issue from grape's perspective apart from it being the place where this error manifests itself. Definitely something to be aware of when running Ruby 1.9+ (commit comment suggests this doesn't affect Ruby 1.8.x)

So more of an FYI in case anyone else gets bitten by this.

The issue is further complicated by the fact that running rack/test doesn't cross this codepath. Presumably because temp files are not used in tests??

This issue is present in rack == 1.5.2, fixed in master as of the time of this post, but not yet released (expected in 1.5.4 I believe)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions