mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
o smtp.rb: not catch NameError in auth
o http.rb: not close connection in get_body, Only connection() closes socket git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4fcb1c47e5
commit
1c4c8b743e
3 changed files with 12 additions and 11 deletions
|
@ -156,7 +156,7 @@ All "key" is case-insensitive.
|
||||||
|
|
||||||
|
|
||||||
def get( path, u_header = nil, dest = nil, &block )
|
def get( path, u_header = nil, dest = nil, &block )
|
||||||
resp = get2( path, u_header ) {|f| dest = f.entity( dest, &block ) }
|
resp = get2( path, u_header ) {|f| dest = f.body( dest, &block ) }
|
||||||
resp.value
|
resp.value
|
||||||
return resp, dest
|
return resp, dest
|
||||||
end
|
end
|
||||||
|
@ -184,7 +184,7 @@ All "key" is case-insensitive.
|
||||||
|
|
||||||
def post( path, data, u_header = nil, dest = nil, &block )
|
def post( path, data, u_header = nil, dest = nil, &block )
|
||||||
resp = post2( path, data, u_header ) {|f|
|
resp = post2( path, data, u_header ) {|f|
|
||||||
dest = f.entity( dest, &block ) }
|
dest = f.body( dest, &block ) }
|
||||||
resp.value
|
resp.value
|
||||||
return resp, dest
|
return resp, dest
|
||||||
end
|
end
|
||||||
|
@ -199,7 +199,7 @@ All "key" is case-insensitive.
|
||||||
# not tested because I could not setup apache (__;;;
|
# not tested because I could not setup apache (__;;;
|
||||||
def put( path, src, u_header = nil )
|
def put( path, src, u_header = nil )
|
||||||
ret = nil
|
ret = nil
|
||||||
resp = put2( path, src, u_header ) {|f| ret = f.entity }
|
resp = put2( path, src, u_header ) {|f| ret = f.body }
|
||||||
resp.value
|
resp.value
|
||||||
return resp, ret
|
return resp, ret
|
||||||
end
|
end
|
||||||
|
@ -249,8 +249,12 @@ All "key" is case-insensitive.
|
||||||
if /keep-alive/i === resp['connection'] then
|
if /keep-alive/i === resp['connection'] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
elsif resp.key? 'proxy-connection' then
|
||||||
|
if /keep-alive/i === resp['proxy-connection'] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
elsif header.key? 'Connection' then
|
elsif header.key? 'Connection' then
|
||||||
if /\A\s*keep-alive/i === header['Connection'] then
|
if /keep-alive/i === header['Connection'] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -518,12 +522,10 @@ All "key" is case-insensitive.
|
||||||
tmp = resp['connection']
|
tmp = resp['connection']
|
||||||
if tmp and /close/i === tmp then
|
if tmp and /close/i === tmp then
|
||||||
@socket.read_all dest
|
@socket.read_all dest
|
||||||
@socket.close
|
|
||||||
else
|
else
|
||||||
tmp = resp['proxy-connection']
|
tmp = resp['proxy-connection']
|
||||||
if tmp and /close/i === tmp then
|
if tmp and /close/i === tmp then
|
||||||
@socket.read_all dest
|
@socket.read_all dest
|
||||||
@socket.close
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,7 +68,7 @@ Object
|
||||||
|
|
||||||
class Protocol
|
class Protocol
|
||||||
|
|
||||||
Version = '1.1.19'
|
Version = '1.1.20'
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
|
|
|
@ -141,12 +141,11 @@ Net::Protocol
|
||||||
end
|
end
|
||||||
|
|
||||||
if user and secret then
|
if user and secret then
|
||||||
begin
|
mid = 'auth_' + (authtype || 'cram_md5').to_s
|
||||||
mid = 'auth_' + (authtype || 'cram_md5').to_s
|
unless @command.respond_to? mid then
|
||||||
@command.send mid, user, secret
|
|
||||||
rescue NameError
|
|
||||||
raise ArgumentError, "wrong auth type #{authtype.to_s}"
|
raise ArgumentError, "wrong auth type #{authtype.to_s}"
|
||||||
end
|
end
|
||||||
|
@command.send mid, user, secret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue