render :text with integers and webrick

All - Curious where to fix this bug and perhaps, more importantly, if its considered one at all.

Using webrick, render :text=>numeric_or_decimal_type

will never finish returning the response. WIth mongrel/etc. it works fine.

This can be a problem for such functions as the in_place_editor when using integer/decimal data types - the response never completes. Again, its only a problem with webrick.

Is this a flaw with webrick (i.e . it should return the request even if response.body = numeric) or should rails be insuring its sending a string in the response.body. The simple solution is to change

response.body = text

in the render_text function to

response.body = text.to_s.

This would also potentially solve things like: http://dev.rubyonrails.org/ticket/7067

What are the thoughts on resolving this? Or is it a purposeful behavior?

Thanks, Jonathan

We ran into a very similar problem with this as well. We have Apache/ Rails behind another Apache proxy. The Apache/Rails behind the proxy would reply with a response like:

... Content-Length: 4 ... <big long integer here>

The proxy layer then chopped off all but the leading 4 bytes (digits) of the number.

Surely calling:   render :text => 12421321

isn't smart, but it seems like render_text should enforce the textness of it's parameters, or it should be smarter about how it computes the size for Content-Length.

Andy

The simple solution is to change

response.body = text

in the render_text function to

response.body = text.to_s.

Fixed in changeset 6547.