merges r30543 from trunk into ruby_1_9_2.

--
* lib/net/imap.rb: use bytesize for binary strings.
  patched by Yoshimasa Niwa. [ruby-core:34222]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2011-01-16 12:35:36 +00:00
parent c303d3838b
commit 8de1ee21e4
3 changed files with 8 additions and 3 deletions

View file

@ -1237,7 +1237,7 @@ module Net
end
def send_literal(str)
put_string("{" + str.length.to_s + "}" + CRLF)
put_string("{" + str.bytesize.to_s + "}" + CRLF)
@continuation_request_arrival.wait
raise @exception if @exception
put_string(str)
@ -2571,7 +2571,7 @@ module Net
return '""'
when /[\x80-\xff\r\n]/n
# literal
return "{" + str.length.to_s + "}" + CRLF + str
return "{" + str.bytesize.to_s + "}" + CRLF + str
when /[(){ \x00-\x1f\x7f%*"\\]/n
# quoted string
return '"' + str.gsub(/["\\]/n, "\\\\\\&") + '"'