Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8444 (closed defect: untested)

Opened 1 year ago

Last modified 1 year ago

raw_post_data_fix.rb can break binary data in put method

Reported by: mbarchfe Assigned to: bitsweat
Priority: high Milestone: 1.2.4
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc:

Description

I am using RailsDAV and found that some files (binary zip files) were not transmitted correctly using the put method. The file size was reduced by one byte. As it turned out the read_body method strips off a trailing zero. Apparently this behaviour is supposed to be a fix for Safari but unfortunately it breaks the transmission of binary data, too.

Could this be improved in a way that the chomp! would only be executed if the client is Safari?

In actionpack 1.13.3 the code is in file lib/action_controller/cgi_ext/raw_post_data_fix.rb:

class CGI

module QueryExtension

def read_body(content_length)

# Fix for Safari Ajax postings that always append \000 content.chop! if content[-1] == 0

end

end

end

In trunk the code was moved to root/trunk/actionpack/lib/action_controller/cgi_ext/query_extension.rb, but the bug still exists.

Change History

05/23/07 18:40:04 changed by bitsweat

  • owner changed from core to bitsweat.

In trunk, the last null byte is chopped only if the content type is url-encoded.

Stable can do a similar check. Got a patch + tests?

05/23/07 18:41:39 changed by bitsweat

  • status changed from new to closed.
  • resolution set to untested.