mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
o protocol.rb: Protocol#start yields self
o smtp.rb: use Socket.gethostname to get localhost name git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dce6fa0566
commit
5ec582c9bd
3 changed files with 9 additions and 16 deletions
|
@ -337,20 +337,14 @@ Net::POP3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def auth( acnt, pass )
|
def auth( account, pass )
|
||||||
critical {
|
critical {
|
||||||
@socket.writeline( "APOP #{acnt} #{digest(@stamp + pass)}" )
|
@socket.writeline sprintf( 'APOP %s %s',
|
||||||
|
account, MD5.new(@stamp + pass).hexdigest )
|
||||||
check_reply_auth
|
check_reply_auth
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def digest( str )
|
|
||||||
ret = ''
|
|
||||||
MD5.new( str ).digest.each_byte {|i| ret << sprintf('%02x', i) }
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,8 +15,6 @@ require 'socket'
|
||||||
|
|
||||||
module Net
|
module Net
|
||||||
|
|
||||||
Version = '1.1.17'
|
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
== Net::Protocol
|
== Net::Protocol
|
||||||
|
@ -68,7 +66,7 @@ Object
|
||||||
|
|
||||||
class Protocol
|
class Protocol
|
||||||
|
|
||||||
Version = ::Net::Version
|
Version = '1.1.18'
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
|
@ -165,7 +163,7 @@ Object
|
||||||
connect
|
connect
|
||||||
do_start *args
|
do_start *args
|
||||||
@active = true
|
@active = true
|
||||||
yield if iterator?
|
yield self if iterator?
|
||||||
ensure
|
ensure
|
||||||
finish if iterator?
|
finish if iterator?
|
||||||
end
|
end
|
||||||
|
@ -591,7 +589,7 @@ Object
|
||||||
do_write_do D_CRLF
|
do_write_do D_CRLF
|
||||||
wsize = do_write_fin
|
wsize = do_write_fin
|
||||||
|
|
||||||
@pipe << "wrote #{wsize} bytes text" if pipeon
|
@pipe << "wrote #{wsize} bytes text\n" if pipeon
|
||||||
wsize
|
wsize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,10 @@ Net::Protocol
|
||||||
def do_start( helodom = nil,
|
def do_start( helodom = nil,
|
||||||
user = nil, secret = nil, authtype = nil )
|
user = nil, secret = nil, authtype = nil )
|
||||||
unless helodom then
|
unless helodom then
|
||||||
helodom = ENV['HOSTNAME'] || ENV['HOST']
|
helodom = ::Socket.gethostname
|
||||||
unless helodom then
|
unless helodom then
|
||||||
raise ArgumentError, "cannot get hostname"
|
raise ArgumentError,
|
||||||
|
"cannot get localhost name; try 'smtp.start(local_host_name)'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue