summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-13 05:48:58 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-13 05:48:58 +0000
commit1a7cb01d6410dc7c56b46ef51b188bdf87b5fd4c (patch)
tree9d7108ce6de0b46c0fe7dab59edee2551b76c702 /lib/net/smtp.rb
parente502549be1bea41406ccef0e819b0e9cb8cdb069 (diff)
aamine
* lib/net/http.rb: add HTTPRequest#basic_auth. * lib/net/smtp.rb: raise if only account or password is given. * lib/net/protocol.rb: WriteAdapter#<< returns self. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 2e8377cddd..3b1d100fb3 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -153,12 +153,15 @@ module Net
end
end
- if user and secret then
+ if user or secret then
+ (user and secret) or
+ raise ArgumentError, "both of account and password are required"
+
mid = 'auth_' + (authtype || 'cram_md5').to_s
- unless @command.respond_to? mid then
- raise ArgumentError, "wrong auth type #{authtype.to_s}"
- end
- @command.send mid, user, secret
+ @command.respond_to? mid or
+ raise ArgumentError, "wrong auth type #{authtype.to_s}"
+
+ @command.__send__ mid, user, secret
end
end