rails/rails — pull request #8490 by mattv (2012-12-11 22:03:50+00:00)
Title: Fix rewinding in ActionDispatch::Request#raw_post

There's a bug in `ActionDispatch::Request#raw_post`:

If `@env['RAW_POST_DATA']` is nil, `#raw_post` will attempt to set it to the result of `#body` (which will return `@env['rack.input']` if `@env['RAW_POST_DATA']` is nil).

`#raw_post`will then attempt to rewind the result of another call to `#body`. Since `@env['RAW_POST_DATA']` has already been set, the result of `#body` is not `@env['rack.input']` anymore.

This causes `@env['rack.input']` to never be rewound.

This is also an issue in 3.2 and earlier versions of Rails.