ruby-changes:2812
From: ko1@a...
Date: 18 Dec 2007 22:37:26 +0900
Subject: [ruby-changes:2812] gotoyuzo - Ruby:r14303 (trunk): * lib/rss/parser.rb, lib/rss/atom.rb, lib/rss/rss.rb,
gotoyuzo 2007-12-18 22:37:10 +0900 (Tue, 18 Dec 2007) New Revision: 14303 Modified files: trunk/ChangeLog trunk/lib/rss/atom.rb trunk/lib/rss/parser.rb trunk/lib/rss/rss.rb trunk/lib/webrick/httpproxy.rb trunk/test/rss/rss-assertions.rb trunk/test/rss/test_atom.rb Log: * lib/rss/parser.rb, lib/rss/atom.rb, lib/rss/rss.rb, test/rss/rss-assertions.rb, test/rss/test_atom.rb: use pack/unpack("m") instead of base64 library. * lib/webrick/httpproxy.rb: use delete("\n") instead of chomp/chop because the result of pack("m") might be multi-line. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rss/atom.rb?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rss/rss-assertions.rb?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/rss/test_atom.rb?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/webrick/httpproxy.rb?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rss/rss.rb?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14303&r2=14302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rss/parser.rb?r1=14303&r2=14302 Index: ChangeLog =================================================================== --- ChangeLog (revision 14302) +++ ChangeLog (revision 14303) @@ -1,3 +1,12 @@ +Tue Dec 18 22:11:50 2007 GOTOU Yuuzou <gotoyuzo@n...> + + * lib/rss/parser.rb, lib/rss/atom.rb, lib/rss/rss.rb, + test/rss/rss-assertions.rb, test/rss/test_atom.rb: use + pack/unpack("m") instead of base64 library. + + * lib/webrick/httpproxy.rb: use delete("\n") instead of chomp/chop + because the result of pack("m") might be multi-line. + Tue Dec 18 22:12:35 2007 Koichi Sasada <ko1@a...> * insnhelper.ci, vm.c: rewrite sp manipulation around method/block Index: lib/webrick/httpproxy.rb =================================================================== --- lib/webrick/httpproxy.rb (revision 14302) +++ lib/webrick/httpproxy.rb (revision 14303) @@ -118,8 +118,7 @@ proxy_host = proxy.host proxy_port = proxy.port if proxy.userinfo - credentials = "Basic " + [proxy.userinfo].pack("m*") - credentials.chomp! + credentials = "Basic " + [proxy.userinfo].pack("m").delete("\n") header['proxy-authorization'] = credentials end end @@ -179,8 +178,7 @@ if proxy = proxy_uri(req, res) proxy_request_line = "CONNECT #{host}:#{port} HTTP/1.0" if proxy.userinfo - credentials = "Basic " + [proxy.userinfo].pack("m*") - credentials.chomp! + credentials = "Basic " + [proxy.userinfo].pack("m").delete("\n") end host, port = proxy.host, proxy.port end Index: lib/rss/parser.rb =================================================================== --- lib/rss/parser.rb (revision 14302) +++ lib/rss/parser.rb (revision 14303) @@ -474,7 +474,7 @@ else if klass.have_content? if @last_element.need_base64_encode? - text = Base64.decode64(text.lstrip) + text = text.lstrip.unpack("m").first end @last_element.content = text end Index: lib/rss/atom.rb =================================================================== --- lib/rss/atom.rb (revision 14302) +++ lib/rss/atom.rb (revision 14303) @@ -1,4 +1,3 @@ -require 'base64' require 'rss/parser' module RSS Index: lib/rss/rss.rb =================================================================== --- lib/rss/rss.rb (revision 14302) +++ lib/rss/rss.rb (revision 14303) @@ -1201,7 +1201,7 @@ __send__(self.class.xml_getter).to_s else _content = content - _content = Base64.encode64(_content) if need_base64_encode? + _content = [_content].pack("m").delete("\n") if need_base64_encode? h(_content) end end Index: test/rss/rss-assertions.rb =================================================================== --- test/rss/rss-assertions.rb (revision 14302) +++ test/rss/rss-assertions.rb (revision 14303) @@ -570,7 +570,7 @@ text << char char.succ! end - base64_content = Base64.encode64(Zlib::Deflate.deflate(text)) + base64_content = [Zlib::Deflate.deflate(text)].pack("m").delete("\n") [false, true].each do |with_space| xml_content = base64_content Index: test/rss/test_atom.rb =================================================================== --- test/rss/test_atom.rb (revision 14302) +++ test/rss/test_atom.rb (revision 14303) @@ -658,7 +658,7 @@ content.content = original_content xml = REXML::Document.new(content.to_s).root assert_rexml_element([], {"type" => type}, - Base64.encode64(original_content), xml) + [original_content].pack("m").delete("\n"), xml) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml