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
This commit is contained in:
parent
e502549be1
commit
1a7cb01d64
@ -1,3 +1,11 @@
|
|||||||
|
Tue Mar 13 14:54:39 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
<<<<<<< ChangeLog
|
<<<<<<< ChangeLog
|
||||||
Tue Mar 13 14:41:16 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Mar 13 14:41:16 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
@ -504,7 +504,10 @@ module Net
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_print( addr, path, port = nil )
|
def self.get_print( addr, path, port = nil )
|
||||||
print get( addr, path, port )
|
new( addr, port || HTTP.port ).start {|http|
|
||||||
|
http.get path, nil, $stdout
|
||||||
|
}
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -733,7 +736,7 @@ module Net
|
|||||||
end
|
end
|
||||||
|
|
||||||
def basic_auth( acc, pass )
|
def basic_auth( acc, pass )
|
||||||
@header['authorization'] = ["#{acc}:#{pass}"].pack('m').gsub(/\s+/, '')
|
@header['authorization'] = 'Basic ' + ["#{acc}:#{pass}"].pack('m').strip
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -363,7 +363,10 @@ module Net
|
|||||||
@sock.__send__ @mid, str
|
@sock.__send__ @mid, str
|
||||||
end
|
end
|
||||||
|
|
||||||
alias << write
|
def <<( str )
|
||||||
|
@sock.__send__ @mid, str
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,12 +153,15 @@ module Net
|
|||||||
end
|
end
|
||||||
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
|
mid = 'auth_' + (authtype || 'cram_md5').to_s
|
||||||
unless @command.respond_to? mid then
|
@command.respond_to? mid or
|
||||||
raise ArgumentError, "wrong auth type #{authtype.to_s}"
|
raise ArgumentError, "wrong auth type #{authtype.to_s}"
|
||||||
end
|
|
||||||
@command.send mid, user, secret
|
@command.__send__ mid, user, secret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user