mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
aamine
* lib/net/smtp.rb: SMTP.new requires at least one arg. * lib/net/pop.rb: POP.new requires at least one arg. * lib/net/pop.rb: uses "raise *Error.new" instead of simple raise. * lib/net/http.rb: HTTP.new requires at least one arg. * lib/net/http.rb: changes implicit start algolithm. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4ed1344bd7
commit
a20863ff41
5 changed files with 47 additions and 44 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Fri Dec 7 19:12:14 2001 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* lib/net/smtp.rb: SMTP.new requires at least one arg.
|
||||||
|
|
||||||
|
* lib/net/pop.rb: POP.new requires at least one arg.
|
||||||
|
|
||||||
|
* lib/net/pop.rb: uses "raise *Error.new" instead of simple raise.
|
||||||
|
|
||||||
|
* lib/net/http.rb: HTTP.new requires at least one arg.
|
||||||
|
|
||||||
|
* lib/net/http.rb: changes implicit start algolithm.
|
||||||
|
|
||||||
Fri Dec 7 15:49:39 2001 Usaku Nakamura <usa@ruby-lang.org>
|
Fri Dec 7 15:49:39 2001 Usaku Nakamura <usa@ruby-lang.org>
|
||||||
|
|
||||||
* ext/extmk.rb.in: ignore adding -Wl,-R to DLDFLAGS when the directory
|
* ext/extmk.rb.in: ignore adding -Wl,-R to DLDFLAGS when the directory
|
||||||
|
|
|
@ -11,9 +11,8 @@ This program is free software. You can re-distribute and/or
|
||||||
modify this program under the same terms as Ruby itself,
|
modify this program under the same terms as Ruby itself,
|
||||||
Ruby Distribute License or GNU General Public License.
|
Ruby Distribute License or GNU General Public License.
|
||||||
|
|
||||||
NOTE: You can get Japanese version of this document from
|
NOTE: You can find Japanese version of this document in
|
||||||
Ruby Documentation Project (RDP):
|
the doc/net directory of the standard ruby interpreter package.
|
||||||
((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>))
|
|
||||||
|
|
||||||
== What is this module?
|
== What is this module?
|
||||||
|
|
||||||
|
@ -639,7 +638,14 @@ module Net
|
||||||
define_http_method_interface :Post, true, true
|
define_http_method_interface :Post, true, true
|
||||||
define_http_method_interface :Put, false, true
|
define_http_method_interface :Put, false, true
|
||||||
|
|
||||||
def request( req, body = nil )
|
def request( req, body = nil, &block )
|
||||||
|
unless active? then
|
||||||
|
start {
|
||||||
|
req['connection'] = 'close'
|
||||||
|
return request(req, body, &block)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
connecting( req ) {
|
connecting( req ) {
|
||||||
req.__send__( :exec,
|
req.__send__( :exec,
|
||||||
@socket, @curr_http_version, edit_path(req.path), body )
|
@socket, @curr_http_version, edit_path(req.path), body )
|
||||||
|
@ -660,14 +666,7 @@ module Net
|
||||||
|
|
||||||
|
|
||||||
def connecting( req )
|
def connecting( req )
|
||||||
unless active? then
|
if @socket.closed? then
|
||||||
implicit = true
|
|
||||||
req['connection'] ||= 'close'
|
|
||||||
end
|
|
||||||
|
|
||||||
if not @socket then
|
|
||||||
start
|
|
||||||
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
|
||||||
|
@ -692,10 +691,6 @@ 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 )
|
||||||
|
|
|
@ -10,9 +10,8 @@ This program is free software. You can re-distribute and/or
|
||||||
modify this program under the same terms as Ruby itself,
|
modify this program under the same terms as Ruby itself,
|
||||||
Ruby Distribute License or GNU General Public License.
|
Ruby Distribute License or GNU General Public License.
|
||||||
|
|
||||||
NOTE: You can get Japanese version of this document from
|
NOTE: You can find Japanese version of this document in
|
||||||
Ruby Documentation Project (RDP):
|
the doc/net directory of the standard ruby interpreter package.
|
||||||
((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>))
|
|
||||||
|
|
||||||
== What is This Module?
|
== What is This Module?
|
||||||
|
|
||||||
|
@ -422,14 +421,15 @@ module Net
|
||||||
"#<#{type} #{@num}#{@deleted ? ' deleted' : ''}>"
|
"#<#{type} #{@num}#{@deleted ? ' deleted' : ''}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def all( dest = '' )
|
def pop( dest = '', &block )
|
||||||
if block_given? then
|
if block then
|
||||||
dest = NetPrivate::ReadAdapter.new( Proc.new )
|
dest = NetPrivate::ReadAdapter.new( block )
|
||||||
end
|
end
|
||||||
@command.retr( @num, dest )
|
@command.retr( @num, dest )
|
||||||
end
|
end
|
||||||
alias pop all
|
|
||||||
alias mail all
|
alias all pop
|
||||||
|
alias mail pop
|
||||||
|
|
||||||
def top( lines, dest = '' )
|
def top( lines, dest = '' )
|
||||||
@command.top( @num, lines, dest )
|
@command.top( @num, lines, dest )
|
||||||
|
@ -440,7 +440,7 @@ module Net
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
@command.dele( @num )
|
@command.dele @num
|
||||||
@deleted = true
|
@deleted = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -470,9 +470,9 @@ module Net
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth( acnt, pass )
|
def auth( account, pass )
|
||||||
critical {
|
critical {
|
||||||
@socket.writeline 'USER ' + acnt
|
@socket.writeline 'USER ' + account
|
||||||
check_reply_auth
|
check_reply_auth
|
||||||
|
|
||||||
@socket.writeline 'PASS ' + pass
|
@socket.writeline 'PASS ' + pass
|
||||||
|
@ -537,21 +537,19 @@ module Net
|
||||||
|
|
||||||
def check_reply_auth
|
def check_reply_auth
|
||||||
begin
|
begin
|
||||||
cod = check_reply( SuccessCode )
|
return check_reply( SuccessCode )
|
||||||
rescue ProtocolError
|
rescue ProtocolError => err
|
||||||
raise ProtoAuthError, 'Fail to POP authentication'
|
raise ProtoAuthError.new( 'Fail to POP authentication', err.response )
|
||||||
end
|
end
|
||||||
|
|
||||||
return cod
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_reply
|
def get_reply
|
||||||
str = @socket.readline
|
str = @socket.readline
|
||||||
|
|
||||||
if /\A\+/ === str then
|
if /\A\+/ === str then
|
||||||
return Response.new( SuccessCode, str[0,3], str[3, str.size - 3].strip )
|
Response.new( SuccessCode, str[0,3], str[3, str.size - 3].strip )
|
||||||
else
|
else
|
||||||
return Response.new( ErrorCode, str[0,4], str[4, str.size - 4].strip )
|
Response.new( ErrorCode, str[0,4], str[4, str.size - 4].strip )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -564,7 +562,7 @@ module Net
|
||||||
rep = super( sock )
|
rep = super( sock )
|
||||||
|
|
||||||
m = /<.+>/.match( rep.msg ) or
|
m = /<.+>/.match( rep.msg ) or
|
||||||
raise ProtoAuthError, "not APOP server: cannot login"
|
raise ProtoAuthError.new( "not APOP server: cannot login", nil )
|
||||||
@stamp = m[0]
|
@stamp = m[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,8 @@ This program is free software. You can re-distribute and/or
|
||||||
modify this program under the same terms as Ruby itself,
|
modify this program under the same terms as Ruby itself,
|
||||||
Ruby Distribute License or GNU General Public License.
|
Ruby Distribute License or GNU General Public License.
|
||||||
|
|
||||||
NOTE: You can get Japanese version of this document from
|
NOTE: You can find Japanese version of this document in
|
||||||
Ruby Documentation Project (RDP):
|
the doc/net directory of the standard ruby interpreter package.
|
||||||
((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>))
|
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ module Net
|
||||||
|
|
||||||
|
|
||||||
def initialize( addr, port = nil )
|
def initialize( addr, port = nil )
|
||||||
@address = addr || 'localhost'
|
@address = addr
|
||||||
@port = port || type.port
|
@port = port || type.port
|
||||||
|
|
||||||
@command = nil
|
@command = nil
|
||||||
|
@ -213,9 +212,9 @@ module Net
|
||||||
|
|
||||||
class Response
|
class Response
|
||||||
|
|
||||||
def initialize( ctype, cno, msg )
|
def initialize( ctype, code, msg )
|
||||||
@code_type = ctype
|
@code_type = ctype
|
||||||
@code = cno
|
@code = code
|
||||||
@message = msg
|
@message = msg
|
||||||
super()
|
super()
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,9 +10,8 @@ This program is free software. You can re-distribute and/or
|
||||||
modify this program under the same terms as Ruby itself,
|
modify this program under the same terms as Ruby itself,
|
||||||
Ruby Distribute License or GNU General Public License.
|
Ruby Distribute License or GNU General Public License.
|
||||||
|
|
||||||
NOTE: You can get Japanese version of this document from
|
NOTE: You can find Japanese version of this document in
|
||||||
Ruby Documentation Project (RDP):
|
the doc/net directory of the standard ruby interpreter package.
|
||||||
((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>))
|
|
||||||
|
|
||||||
== What is This Module?
|
== What is This Module?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue