* lib/net/protocol.rb: Protocol.new requires at least one arg.
* lib/net/smtp.rb: ditto.
* lib/net/pop.rb: ditto.
* lib/net/http.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2001-08-17 03:08:45 +00:00
parent 1414cebea8
commit 772ed5507e
8 changed files with 49 additions and 37 deletions

View File

@ -1,3 +1,13 @@
Fri Aug 17 12:13:48 2001 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: Protocol.new requires at least one arg.
* lib/net/smtp.rb: ditto.
* lib/net/pop.rb: ditto.
* lib/net/http.rb: ditto.
Thu Aug 16 13:54:04 2001 Usaku Nakamura <usa@ruby-lang.org> Thu Aug 16 13:54:04 2001 Usaku Nakamura <usa@ruby-lang.org>
* ext/socket/socket.c (s_recvfrom): fix typo. * ext/socket/socket.c (s_recvfrom): fix typo.
@ -311,6 +321,8 @@ Tue Jul 17 06:01:12 2001 Minero Aoki <aamine@loveruby.net>
* doc/net/smtp.rd.ja, pop.rd.ja, http.rd.ja: new files. * doc/net/smtp.rd.ja, pop.rd.ja, http.rd.ja: new files.
* MANIFEST: add doc/net/{http,pop,smtp}.rd.ja.
Tue Jul 17 11:22:01 2001 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Jul 17 11:22:01 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* regex.c (NUM_FAILURE_ITEMS): was confusing NUM_REG_ITEMS and * regex.c (NUM_FAILURE_ITEMS): was confusing NUM_REG_ITEMS and

View File

@ -119,14 +119,14 @@ Ruby 1.6
=== クラスメソッド === クラスメソッド
: new( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) : new( address, port = 80, proxy_addr = nil, proxy_port = nil )
新しい HTTP オブジェクトを生成します。address は HTTP サーバーの FQDN で、 新しい HTTP オブジェクトを生成します。address は HTTP サーバーの FQDN で、
port は接続するポート番号です。このメソッドではまだ接続はしません。 port は接続するポート番号です。このメソッドではまだ接続はしません。
proxy_addr を与えるとプロクシを介して接続するオブジェクトを生成します。 proxy_addr を与えるとプロクシを介して接続するオブジェクトを生成します。
: start( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) : start( address, port = 80, proxy_addr = nil, proxy_port = nil )
: start( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) {|http| .... } : start( address, port = 80, proxy_addr = nil, proxy_port = nil ) {|http| .... }
以下と同じです。 以下と同じです。
Net::HTTP.new(address, port, proxy_addr, proxy_port).start(&block) Net::HTTP.new(address, port, proxy_addr, proxy_port).start(&block)

View File

@ -109,12 +109,12 @@ APOP ǧ
=== クラスメソッド === クラスメソッド
: new( address = 'localhost', port = 110, apop = false ) : new( address, port = 110, apop = false )
Net::POP3 オブジェクトを生成します。まだ接続はしません。 Net::POP3 オブジェクトを生成します。まだ接続はしません。
apop が真のときは APOP 認証を行うオブジェクトを生成します。 apop が真のときは APOP 認証を行うオブジェクトを生成します。
: start( address = 'localhost', port = 110, account, password ) : start( address, port = 110, account, password )
: start( address = 'localhost', port = 110, account, password ) {|pop| .... } : start( address, port = 110, account, password ) {|pop| .... }
address の port 番ポートに接続し、アカウント account パスワード address の port 番ポートに接続し、アカウント account パスワード
password で POP ログインします。第二引数 port に nil を渡すと password で POP ログインします。第二引数 port に nil を渡すと
POP3 のデフォルトポート(110)を使います。 POP3 のデフォルトポート(110)を使います。
@ -126,7 +126,7 @@ APOP ǧ
end end
end end
: foreach( address = 'localhost', port = 110, account, password ) {|mail| .... } : foreach( address, port = 110, account, password ) {|mail| .... }
POP セッションを開き、サーバ上のすべてのメールに対して繰り返します。 POP セッションを開き、サーバ上のすべてのメールに対して繰り返します。
以下と同じです。 以下と同じです。
@ -143,8 +143,8 @@ APOP ǧ
m.delete if $DELETE m.delete if $DELETE
end end
: delete_all( address = 'localhost', port = 110, account, password ) : delete_all( address, port = 110, account, password )
: delete_all( address = 'localhost', port = 110, account, password ) {|mail| .... } : delete_all( address, port = 110, account, password ) {|mail| .... }
POP セッションを開き、サーバ上のメールをすべて削除します。 POP セッションを開き、サーバ上のメールをすべて削除します。
ブロックが与えられた時は削除する前にブロックにそのメールを ブロックが与えられた時は削除する前にブロックにそのメールを
渡します。以下と同じです。 渡します。以下と同じです。
@ -154,7 +154,7 @@ APOP ǧ
m.pop file m.pop file
end end
: auth_only( address = 'localhost', port = 110, account, password ) : auth_only( address, port = 110, account, password )
POP セッションを開き認証だけを行って接続を切ります。 POP セッションを開き認証だけを行って接続を切ります。
POP before SMTP 専用です。 POP before SMTP 専用です。

View File

@ -71,12 +71,12 @@ SMTP
=== クラスメソッド === クラスメソッド
: new( address = 'localhost', port = 25 ) : new( address, port = 25 )
新しい SMTP オブジェクトを生成します。address はSMTPサーバーのFQDNで、 新しい SMTP オブジェクトを生成します。address はSMTPサーバーのFQDNで、
port は接続するポート番号です。ただし、このメソッドではまだ接続はしません。 port は接続するポート番号です。ただし、このメソッドではまだ接続はしません。
: start( address = 'localhost', port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) : start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil )
: start( address = 'localhost', port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) {|smtp| .... } : start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) {|smtp| .... }
以下と同じです。 以下と同じです。
Net::SMTP.new(address,port).start(helo_domain,account,password,authtype) Net::SMTP.new(address,port).start(helo_domain,account,password,authtype)

View File

@ -132,12 +132,12 @@ Yes, this is not thread-safe.
=== Class Methods === Class Methods
: new( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) : new( address, port = 80, proxy_addr = nil, proxy_port = nil )
creates a new Net::HTTP object. creates a new Net::HTTP object.
If proxy_addr is given, creates an Net::HTTP object with proxy support. If proxy_addr is given, creates an Net::HTTP object with proxy support.
: start( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) : start( address, port = 80, proxy_addr = nil, proxy_port = nil )
: start( address = 'localhost', port = 80, proxy_addr = nil, proxy_port = nil ) {|http| .... } : start( address, port = 80, proxy_addr = nil, proxy_port = nil ) {|http| .... }
is equals to is equals to
Net::HTTP.new(address, port, proxy_addr, proxy_port).start(&block) Net::HTTP.new(address, port, proxy_addr, proxy_port).start(&block)
@ -457,7 +457,7 @@ module Net
protocol_param :port, '80' protocol_param :port, '80'
def initialize( addr = nil, port = nil ) def initialize( addr, port = nil )
super super
@curr_http_version = HTTPVersion @curr_http_version = HTTPVersion
@ -492,14 +492,14 @@ module Net
alias orig_new new alias orig_new new
def new( address = nil, port = nil, p_addr = nil, p_port = nil ) def new( address, port = nil, p_addr = nil, p_port = nil )
c = p_addr ? self::Proxy(p_addr, p_port) : self c = p_addr ? self::Proxy(p_addr, p_port) : self
i = c.orig_new( address, port ) i = c.orig_new( address, port )
setvar i setvar i
i i
end end
def start( address = nil, port = nil, p_addr = nil, p_port = nil, &block ) def start( address, port = nil, p_addr = nil, p_port = nil, &block )
new( address, port, p_addr, p_port ).start( &block ) new( address, port, p_addr, p_port ).start( &block )
end end

View File

@ -116,12 +116,12 @@ net/pop also supports APOP authentication. There's two way to use APOP:
=== Class Methods === Class Methods
: new( address = 'localhost', port = 110, apop = false ) : new( address, port = 110, apop = false )
creates a new Net::POP3 object. creates a new Net::POP3 object.
This method does not open TCP connection yet. This method does not open TCP connection yet.
: start( address = 'localhost', port = 110, account, password ) : start( address, port = 110, account, password )
: start( address = 'localhost', port = 110, account, password ) {|pop| .... } : start( address, port = 110, account, password ) {|pop| .... }
equals to Net::POP3.new( address, port ).start( account, password ) equals to Net::POP3.new( address, port ).start( account, password )
Net::POP3.start( addr, port, account, password ) do |pop| Net::POP3.start( addr, port, account, password ) do |pop|
@ -131,7 +131,7 @@ net/pop also supports APOP authentication. There's two way to use APOP:
end end
end end
: foreach( address = 'localhost', port = 110, account, password ) {|mail| .... } : foreach( address, port = 110, account, password ) {|mail| .... }
starts POP3 protocol and iterates for each POPMail object. starts POP3 protocol and iterates for each POPMail object.
This method equals to This method equals to
@ -148,8 +148,8 @@ net/pop also supports APOP authentication. There's two way to use APOP:
m.delete if $DELETE m.delete if $DELETE
end end
: delete_all( address = 'localhost', port = 110, account, password ) : delete_all( address, port = 110, account, password )
: delete_all( address = 'localhost', port = 110, account, password ) {|mail| .... } : delete_all( address, port = 110, account, password ) {|mail| .... }
starts POP3 session and delete all mails. starts POP3 session and delete all mails.
If block is given, iterates for each POPMail object before delete. If block is given, iterates for each POPMail object before delete.
@ -158,7 +158,7 @@ net/pop also supports APOP authentication. There's two way to use APOP:
m.pop file m.pop file
end end
: auth_only( address = 'localhost', port = 110, account, password ) : auth_only( address, port = 110, account, password )
(just for POP-before-SMTP) (just for POP-before-SMTP)
opens POP3 session and does autholize and quit. opens POP3 session and does autholize and quit.
This method must not be called while POP3 session is opened. This method must not be called while POP3 session is opened.
@ -303,21 +303,21 @@ module Net
class << self class << self
def foreach( address = nil, port = nil, def foreach( address, port = nil,
account = nil, password = nil, &block ) account = nil, password = nil, &block )
start( address, port, account, password ) do |pop| start( address, port, account, password ) do |pop|
pop.each_mail( &block ) pop.each_mail( &block )
end end
end end
def delete_all( address = nil, port = nil, def delete_all( address, port = nil,
account = nil, password = nil, &block ) account = nil, password = nil, &block )
start( address, port, account, password ) do |pop| start( address, port, account, password ) do |pop|
pop.delete_all( &block ) pop.delete_all( &block )
end end
end end
def auth_only( address = nil, port = nil, def auth_only( address, port = nil,
account = nil, password = nil ) account = nil, password = nil )
new( address, port ).auth_only account, password new( address, port ).auth_only account, password
end end
@ -325,13 +325,13 @@ module Net
end end
def initialize( addr = nil, port = nil, apop = false ) def initialize( addr, port = nil, apop = false )
super addr, port super addr, port
@mails = nil @mails = nil
@apop = false @apop = false
end end
def auth_only( account = nil, password = nil ) def auth_only( account, password )
begin begin
connect connect
@active = true @active = true

View File

@ -36,7 +36,7 @@ module Net
class << self class << self
def start( address = 'localhost', port = nil, *args ) def start( address, port = nil, *args )
instance = new( address, port ) instance = new( address, port )
if block_given? then if block_given? then
@ -79,7 +79,7 @@ module Net
protocol_param :socket_type, '::Net::NetPrivate::Socket' protocol_param :socket_type, '::Net::NetPrivate::Socket'
def initialize( addr = nil, port = nil ) def initialize( addr, port = nil )
@address = addr || 'localhost' @address = addr || 'localhost'
@port = port || type.port @port = port || type.port

View File

@ -90,11 +90,11 @@ send or reject SMTP session by this data.
=== Class Methods === Class Methods
: new( address = 'localhost', port = 25 ) : new( address, port = 25 )
creates a new Net::SMTP object. creates a new Net::SMTP object.
: start( address = 'localhost', port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) : start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil )
: start( address = 'localhost', port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) {|smtp| .... } : start( address, port = 25, helo_domain = Socket.gethostname, account = nil, password = nil, authtype = nil ) {|smtp| .... }
is equal to is equal to
Net::SMTP.new(address,port).start(helo_domain,account,password,authtype) Net::SMTP.new(address,port).start(helo_domain,account,password,authtype)
@ -204,7 +204,7 @@ module Net
protocol_param :command_type, '::Net::NetPrivate::SMTPCommand' protocol_param :command_type, '::Net::NetPrivate::SMTPCommand'
def initialize( addr = nil, port = nil ) def initialize( addr, port = nil )
super super
@esmtp = true @esmtp = true
end end