From 772678cb7a56c58b83a53bd7782348052032da77 Mon Sep 17 00:00:00 2001 From: aamine Date: Fri, 7 Dec 2001 10:12:52 +0000 Subject: [PATCH] aamine * lib/net/smtp.rb: uses Digest::MD5 instead of MD5 (again). * lib/net/pop.rb: ditto. * lib/net/http.rb (HTTP#request): must pass block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ doc/net/http.rd.ja | 2 +- doc/net/pop.rd.ja | 2 +- doc/net/smtp.rd.ja | 2 +- lib/net/http.rb | 6 +++--- lib/net/pop.rb | 6 +++--- lib/net/protocol.rb | 4 ++-- lib/net/smtp.rb | 10 +++++----- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cd3ef7b0b..ba93b7d96a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Dec 7 19:20:44 2001 Minero Aoki + + * lib/net/smtp.rb: uses Digest::MD5 instead of MD5 (again). + + * lib/net/pop.rb: ditto. + + * lib/net/http.rb (HTTP#request): must pass block. + Fri Dec 7 18:47:54 2001 Minero Aoki * lib/net/smtp.rb: SMTP.new requires at least one arg. diff --git a/doc/net/http.rd.ja b/doc/net/http.rd.ja index 75a5d37cd8..98e5b3dc63 100644 --- a/doc/net/http.rd.ja +++ b/doc/net/http.rd.ja @@ -1,6 +1,6 @@ =begin -= net/http.rb version 1.1.36 += net/http.rb version 1.1.37 == このライブラリについて diff --git a/doc/net/pop.rd.ja b/doc/net/pop.rd.ja index 3cfcd4850b..b21cf72603 100644 --- a/doc/net/pop.rd.ja +++ b/doc/net/pop.rd.ja @@ -1,6 +1,6 @@ =begin -= net/pop.rb version 1.1.36 += net/pop.rb version 1.1.37 == このライブラリについて diff --git a/doc/net/smtp.rd.ja b/doc/net/smtp.rd.ja index 7f8c4dd658..9b0c6a29af 100644 --- a/doc/net/smtp.rd.ja +++ b/doc/net/smtp.rd.ja @@ -1,6 +1,6 @@ =begin -= net/smtp.rb version 1.1.36 += net/smtp.rb version 1.1.37 == このライブラリについて diff --git a/lib/net/http.rb b/lib/net/http.rb index e4f5b612ba..01f16a8864 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1,6 +1,6 @@ =begin -= net/http.rb version 1.1.36 += net/http.rb version 1.1.37 Copyright (c) 1999-2001 Yukihiro Matsumoto @@ -591,11 +591,11 @@ module Net define_http_method_interface :Post, true, true define_http_method_interface :Put, false, true - def request( req, body = nil ) + def request( req, body = nil, &block ) unless active? then start { req['connection'] = 'close' - return request(req, body) + return request(req, body, &block) } end diff --git a/lib/net/pop.rb b/lib/net/pop.rb index a31276a622..b2dbb9339b 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -1,6 +1,6 @@ =begin -= net/pop.rb version 1.1.36 += net/pop.rb version 1.1.37 Copyright (c) 1999-2001 Yukihiro Matsumoto @@ -287,7 +287,7 @@ A class of mail which exists on POP server. =end require 'net/protocol' -require 'md5' +require 'digest/md5' module Net @@ -570,7 +570,7 @@ module Net critical { @socket.writeline sprintf( 'APOP %s %s', account, - MD5.new(@stamp + pass).hexdigest ) + Digest::MD5.hexdigest(@stamp + pass) ) check_reply_auth } end diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 9781fb690f..66ca62df30 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -1,6 +1,6 @@ =begin -= net/protocol.rb version 1.1.36 += net/protocol.rb version 1.1.37 Copyright (c) 1999-2001 Yukihiro Matsumoto @@ -31,7 +31,7 @@ module Net class Protocol - Version = '1.1.36' + Version = '1.1.37' class << self diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 8813d7f835..73db96ee27 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -1,6 +1,6 @@ =begin -= net/smtp.rb version 1.1.36 += net/smtp.rb version 1.1.37 Copyright (c) 1999-2001 Yukihiro Matsumoto @@ -191,7 +191,7 @@ SMTP objects raise these exceptions: =end require 'net/protocol' -require 'md5' +require 'digest/md5' module Net @@ -317,7 +317,7 @@ module Net critical { rep = getok( 'AUTH CRAM-MD5', ContinueCode ) challenge = rep.msg.split(' ')[1].unpack('m')[0] - secret = MD5.new( secret ).digest if secret.size > 64 + secret = Digest::MD5.digest( secret ) if secret.size > 64 isecret = secret + "\0" * (64 - secret.size) osecret = isecret.dup @@ -325,8 +325,8 @@ module Net isecret[i] ^= 0x36 osecret[i] ^= 0x5c end - tmp = MD5.new( isecret + challenge ).digest - tmp = MD5.new( osecret + tmp ).hexdigest + tmp = Digest::MD5.digest( isecret + challenge ) + tmp = Digest::MD5.hexdigest( osecret + tmp ) getok [user + ' ' + tmp].pack('m').chomp }