summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-12 09:54:32 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-12 09:54:32 +0000
commit76819ef99ab0986f9d5b174b68fed919e4cd9585 (patch)
tree02b1c58dc07b8d9ca4e68df53fba4dfa49b6f0f8
parent9dbce410e10e409f178291c1ef1007a1d9dd718c (diff)
aamine
* lib/net/pop.rb: POP3#reset * lib/net/http.rb: a code for "Switch Protocol" was wrongly 100 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/net/http.rb2
-rw-r--r--lib/net/pop.rb31
3 files changed, 32 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index b98306937e..96c8652299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Oct 12 18:56:28 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/pop.rb: POP3#reset
+
+ * lib/net/http.rb: a code for "Switch Protocol" was wrongly 100
+
Thu Oct 12 01:23:38 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: bug fix: CGI::html(): PRETTY option didn't work.
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 5d4d226cd2..4e96963da6 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -787,7 +787,7 @@ SRC
HTTPCODE_TO_OBJ = {
'100' => ContinueCode,
- '100' => HTTPSwitchProtocol,
+ '101' => HTTPSwitchProtocol,
'200' => HTTPOK,
'201' => HTTPCreated,
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index a9d13ccb31..4eacb516d0 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -45,6 +45,9 @@ Net::Protocol
an array of ((URL:#POPMail)).
This array is renewed when session started.
+: reset
+ reset the session. All "deleted mark" are removed.
+
== Net::APOP
@@ -128,13 +131,22 @@ module Net
def initialize( addr = nil, port = nil )
super
- @mails = [].freeze
+ @mails = nil
end
attr :mails
- def each
- @mails.each {|m| yield m }
+ def each( &block )
+ io_check
+ @mails.each &block
+ end
+
+ def reset
+ io_check
+ @command.rset
+ @mails.each do |m|
+ m.instance_eval { @deleted = false }
+ end
end
@@ -144,15 +156,21 @@ module Net
@command.auth( acnt, pwd )
@mails = []
- t = type.mail_type
+ mtype = type.mail_type
@command.list.each_with_index do |size,idx|
if size then
- @mails.push t.new( idx, size, @command )
+ @mails.push mtype.new( idx, size, @command )
end
end
@mails.freeze
end
+ def io_check
+ if not @socket or @socket.closed? then
+ raise IOError, 'pop session is not opened yet'
+ end
+ end
+
end
POP = POP3
@@ -197,13 +215,14 @@ module Net
end
def header( dest = '' )
- top( 0, dest )
+ top 0, dest
end
def delete
@command.dele( @num )
@deleted = true
end
+
alias delete! delete
def deleted?