ActionPack raw_post_data_fix.rb#read_body bug with AMF data

Hey Everyone,

I just found a slight problem with the “read_body” method in

This line:

Fix for Safari Ajax postings that always append \000

content.chop! if content[-1] == 0

This causes problems with Flash AMF binary format. As AMF always appends
a \000 to the stream as well. I’m the developer over at RubyAMF and have
been running into problems with AMF data being truncated in the Rails
plugin. This is the cause of it.

So can a condition be put in the method so that if the content-type is
“application/x-amf” that it doesn’t “chop” the data.

I’ve changed the method to this and it fixes the problem:

content_type = env_table[‘CONTENT_TYPE’]
if content[-1] == 0 && content_type != ‘application/x-amf’
content.chop! if content[-1] == 0

I can talk with whomever is developing actionpack to give you a
supporting test cast and how to see what happens with AMF. I would
really appreciate this, as it’s a knee breaker for RubyAMF.

Thanks much
Aaron S.

whoops, that method should be:

if content[-1] == 0 && content_type != ‘application/x-amf’
content.chop! ####

Just an update. I can handle this issue with Rails truncating the last
byte, but just for future AMF support in Rails it would be good to have
that in there.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs