aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-18 13:37:10 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-18 13:37:10 +0000
commit06591ad6b1aa55a9a05a17c1194a52999782fe3f (patch)
tree14c9a6deb0d454b3123a56a12f830344ed9b65dd
parent192ec21adf718e324fbe499b38997fa5bea98375 (diff)
downloadruby-06591ad6b1aa55a9a05a17c1194a52999782fe3f.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--lib/rss/atom.rb1
-rw-r--r--lib/rss/parser.rb2
-rw-r--r--lib/rss/rss.rb2
-rw-r--r--lib/webrick/httpproxy.rb6
-rw-r--r--test/rss/rss-assertions.rb2
-rw-r--r--test/rss/test_atom.rb2
7 files changed, 15 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 8dbfd244c7..394d679687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Dec 18 22:11:50 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * 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@atdot.net>
* insnhelper.ci, vm.c: rewrite sp manipulation around method/block
diff --git a/lib/rss/atom.rb b/lib/rss/atom.rb
index 7cba934feb..10282a8743 100644
--- a/lib/rss/atom.rb
+++ b/lib/rss/atom.rb
@@ -1,4 +1,3 @@
-require 'base64'
require 'rss/parser'
module RSS
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
index b716dd8bdf..7f5f57a1ea 100644
--- a/lib/rss/parser.rb
+++ b/lib/rss/parser.rb
@@ -474,7 +474,7 @@ module RSS
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
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 0242a2a6a4..32741b03d1 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -1201,7 +1201,7 @@ EOC
__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
diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb
index 8864620e12..32603e763a 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -118,8 +118,7 @@ module WEBrick
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 @@ module WEBrick
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
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb
index 41e6cd62c5..dd06fb2572 100644
--- a/test/rss/rss-assertions.rb
+++ b/test/rss/rss-assertions.rb
@@ -570,7 +570,7 @@ EOA
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
diff --git a/test/rss/test_atom.rb b/test/rss/test_atom.rb
index c442c753b2..1f65008fa0 100644
--- a/test/rss/test_atom.rb
+++ b/test/rss/test_atom.rb
@@ -658,7 +658,7 @@ module RSS
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