diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index f14d6f3e54cf4e65b92c20b56d0941d736582c96..9c9ed40c6fc9fa00ecb309614fe48206ff8af561 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Drop trailing \000 if present on RAW_POST_DATA (works around bug in Safari Ajax implementation) #918 + * Fix observe_field to fall back to event-based observation if frequency <= 0 #1916 [michael@schubert.cx] * Allow use of the :with option for submit_to_remote #1936 [jon@instance-design.co.uk] diff --git a/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb b/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb index 507fd2fba76aa369d04027aebf1f0e4945a62e66..d07be9f931232f947c765b5935b9d7e5cfbf885b 100644 --- a/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb +++ b/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb @@ -52,7 +52,9 @@ def read_params_from_query def read_params_from_post stdinput.binmode if stdinput.respond_to?(:binmode) content = stdinput.read(Integer(env_table['CONTENT_LENGTH'])) || '' - env_table['RAW_POST_DATA'] = content.split("&_").first.to_s.freeze # &_ is a fix for Safari Ajax postings that always append \000 + # fix for Safari Ajax postings that always append \000 + content = content.chop if content[-1] == 0 + env_table['RAW_POST_DATA'] = content.freeze end def read_query_params(method)