From 62ec1a53735aa0a4a716f24fc57bf0462f560116 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Fri, 2 Sep 2005 14:40:33 +0000 Subject: Drop trailing \000 if present on RAW_POST_DATA (works around bug in Safari Ajax implementation) #918 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2106 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/cgi_ext') 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 507fd2fba7..d07be9f931 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 @@ class CGI #:nodoc: 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) -- cgit v1.2.3