aamine
* lib/net/http.rb (HTTP#request_by_name): bug fix. * lib/net/http.rb: does not write Connection: by default. * lib/net/protocol.rb: "start" for started protocol is an error. * lib/net/protocol.rb: "finish" for finished protocol is an error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fa20d931bc
commit
9e79454b3d
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Wed Jul 4 04:07:36 2001 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* lib/net/http.rb (HTTP#request_by_name): bug fix.
|
||||||
|
|
||||||
|
* lib/net/http.rb: does not write Connection: by default.
|
||||||
|
|
||||||
|
* lib/net/protocol.rb: "start" for started protocol is an error.
|
||||||
|
|
||||||
|
* lib/net/protocol.rb: "finish" for finished protocol is an error.
|
||||||
|
|
||||||
Wed Jul 4 03:17:31 2001 Minero Aoki <aamine@loveruby.net>
|
Wed Jul 4 03:17:31 2001 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/net/http.rb: new method HTTP#request_by_name (test)
|
* lib/net/http.rb: new method HTTP#request_by_name (test)
|
||||||
|
@ -203,7 +203,7 @@ Yes, this is not thread-safe.
|
|||||||
|
|
||||||
: finish
|
: finish
|
||||||
finishes HTTP session.
|
finishes HTTP session.
|
||||||
If HTTP session had not started, do nothing and return false.
|
If HTTP session had not started, raises an IOError.
|
||||||
|
|
||||||
: proxy?
|
: proxy?
|
||||||
true if self is a HTTP proxy class
|
true if self is a HTTP proxy class
|
||||||
@ -610,7 +610,7 @@ module Net
|
|||||||
req.response
|
req.response
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_by_name( name, path, header, body = nil )
|
def request_by_name( name, path, header = nil, body = nil )
|
||||||
r = ::Net::NetPrivate::HTTPGenericRequest.new(
|
r = ::Net::NetPrivate::HTTPGenericRequest.new(
|
||||||
name, body ? true : false, true,
|
name, body ? true : false, true,
|
||||||
path, header )
|
path, header )
|
||||||
@ -622,17 +622,20 @@ module Net
|
|||||||
|
|
||||||
|
|
||||||
def connecting( req )
|
def connecting( req )
|
||||||
req['connection'] ||= 'keep-alive'
|
unless active? then
|
||||||
|
implicit = true
|
||||||
|
req['connection'] ||= 'close'
|
||||||
|
end
|
||||||
|
|
||||||
if not @socket then
|
if not @socket then
|
||||||
start
|
start
|
||||||
req['connection'] = 'close'
|
|
||||||
elsif @socket.closed? then
|
elsif @socket.closed? then
|
||||||
re_connect
|
re_connect
|
||||||
end
|
end
|
||||||
if not req.body_exist? or @seems_1_0_server then
|
if not req.body_exist? or @seems_1_0_server then
|
||||||
req['connection'] = 'close'
|
req['connection'] = 'close'
|
||||||
end
|
end
|
||||||
req['host'] = addr_port
|
req['host'] = addr_port()
|
||||||
|
|
||||||
yield req
|
yield req
|
||||||
req.response.__send__ :terminate
|
req.response.__send__ :terminate
|
||||||
@ -651,6 +654,10 @@ module Net
|
|||||||
D 'Conn close'
|
D 'Conn close'
|
||||||
@socket.close
|
@socket.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if implicit then
|
||||||
|
finish
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def keep_alive?( req, res )
|
def keep_alive?( req, res )
|
||||||
|
@ -201,7 +201,7 @@ net/pop also supports APOP authentication. There's two way to use APOP:
|
|||||||
|
|
||||||
: finish
|
: finish
|
||||||
finishes POP3 session.
|
finishes POP3 session.
|
||||||
If POP3 session had not be started, does nothing and return false.
|
If POP3 session had not be started, raises an IOError.
|
||||||
|
|
||||||
: mails
|
: mails
|
||||||
an array of Net::POPMail objects.
|
an array of Net::POPMail objects.
|
||||||
|
@ -122,7 +122,7 @@ module Net
|
|||||||
#
|
#
|
||||||
|
|
||||||
def start( *args )
|
def start( *args )
|
||||||
return false if active?
|
active? and raise IOError, 'protocol has been opened already'
|
||||||
|
|
||||||
if block_given? then
|
if block_given? then
|
||||||
begin
|
begin
|
||||||
@ -134,6 +134,7 @@ module Net
|
|||||||
else
|
else
|
||||||
_start args
|
_start args
|
||||||
end
|
end
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -177,12 +178,12 @@ module Net
|
|||||||
public
|
public
|
||||||
|
|
||||||
def finish
|
def finish
|
||||||
return false unless active?
|
active? or raise IOError, 'already closed protocol'
|
||||||
|
|
||||||
do_finish if @command and not @command.critical?
|
do_finish if @command and not @command.critical?
|
||||||
disconnect
|
disconnect
|
||||||
@active = false
|
@active = false
|
||||||
true
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -108,8 +108,8 @@ send or reject SMTP session by this data.
|
|||||||
: start( helo_domain = <local host name>, account = nil, password = nil, authtype = nil )
|
: start( helo_domain = <local host name>, account = nil, password = nil, authtype = nil )
|
||||||
: start( helo_domain = <local host name>, account = nil, password = nil, authtype = nil ) {|smtp| .... }
|
: start( helo_domain = <local host name>, account = nil, password = nil, authtype = nil ) {|smtp| .... }
|
||||||
opens TCP connection and starts SMTP session.
|
opens TCP connection and starts SMTP session.
|
||||||
If protocol had been started, do nothing and return false.
|
|
||||||
HELO_DOMAIN is a domain that you'll dispatch mails from.
|
HELO_DOMAIN is a domain that you'll dispatch mails from.
|
||||||
|
If protocol had been started, raises IOError.
|
||||||
|
|
||||||
When this methods is called with block, give a SMTP object to block and
|
When this methods is called with block, give a SMTP object to block and
|
||||||
close session after block call finished.
|
close session after block call finished.
|
||||||
@ -141,7 +141,7 @@ send or reject SMTP session by this data.
|
|||||||
|
|
||||||
: finish
|
: finish
|
||||||
finishes SMTP session.
|
finishes SMTP session.
|
||||||
If SMTP session had not started, do nothing and return false.
|
If SMTP session had not started, raises an IOError.
|
||||||
|
|
||||||
: send_mail( mailsrc, from_addr, *to_addrs )
|
: send_mail( mailsrc, from_addr, *to_addrs )
|
||||||
This method sends MAILSRC as mail. A SMTP object read strings
|
This method sends MAILSRC as mail. A SMTP object read strings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user