git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2000-01-05 07:55:36 +00:00
Родитель de71615260
Коммит deee7cb19f
4 изменённых файлов: 3 добавлений и 64 удалений

Просмотреть файл

@ -27,29 +27,24 @@ class HTTPBadResponse < HTTPError; end
== Class Methods
: new( address, port = 80 )
create new HTTP object.
: port
returns HTTP default port, 80
: command_type
returns Command class, HTTPCommand
== Methods
: get( path, header = nil, ret = '' )
get data from "path" on connecting host.
"header" is a Hash like { 'Accept' => '*/*', ... }.
The data will be written to "ret" using "<<" method.
This method returns response header (Hash) and "ret".
: head( path, header = nil )
get only header from "path" on connecting host.
"header" is a Hash like { 'Accept' => '*/*', ... }.
This method returns header as a Hash like

Просмотреть файл

@ -28,7 +28,6 @@ Net::Protocol
=== Class Methods
: new( address = 'localhost', port = 110 )
This method create a new POP3 object.
This will not open connection yet.
@ -36,15 +35,12 @@ Net::Protocol
=== Methods
: start( account, password )
This method start POP3.
: each{|popmail| ...}
This method is equals to "pop3.mails.each"
: mails
This method returns an array of ((URL:#POPMail)).
This array is renewed when login.
@ -110,28 +106,22 @@ Object
: all
: pop
: mail
This method fetches a mail and return it.
: header
This method fetches only mail header.
: top( lines )
This method fetches mail header and 'lines' lines body.
: delete
: delete!
This method deletes mail.
: size
size of mail(bytes)
: deleted?
true if mail was deleted
=end
@ -214,19 +204,16 @@ Net::Command
=== Class Methods
: new( socket )
This method creates new POP3Command object. 'socket' must be ProtocolSocket.
=== Methods
: auth( account, password )
This method do POP authorization (no RPOP)
In case of failed authorization, raises Protocol::ProtocolError exception.
: list
a list of mails which existing on server.
The list is an array like "array[ number ] = size".
@ -244,29 +231,22 @@ Net::Command
[ nil, 2452, 3355, nil, 9842, ... ]
: quit
This method ends POP using 'QUIT' commmand.
: rset
This method reset all changes done in current session,
by sending 'RSET' command.
: top( num, lines = 0 )
This method gets all mail header and 'lines' lines body
by sending 'TOP' command. 'num' is mail number.
WARNING: the TOP command is 'Optional' in RFC1939 (POP3)
: retr( num : Integer )
This method gets a mail by 'RETR' command. 'num' is mail number.
: dele( num : Integer )
This method deletes a mail on server by 'DELE'.
=end
@ -377,7 +357,6 @@ POP3Command
=== Methods
: auth( account, password )
This method do authorization by sending 'APOP' command.
If server is not APOP server, this raises Net::ProtoAuthError exception.
On other errors, raises Net::ProtocolError.

Просмотреть файл

@ -29,25 +29,21 @@ Object
=== Constants
: Version
The version of Session class. It is a string like "1.1.3".
=== Class Methods
: new( address = 'localhost', port = nil )
This method Creates a new Session object.
: start( address = 'localhost', port = nil, *args )
: start( address = 'localhost', port = nil, *args ){|session| .... }
This method creates a new Session object and start session.
If you call this method with block, Session object give itself
to block and finish session when block returns.
: Proxy( address, port )
This method creates a proxy class of its protocol.
Arguments are address/port of proxy host.
@ -55,27 +51,22 @@ Object
=== Methods
: address
the address of connecting server (FQDN).
: port
connecting port number
: start( *args )
This method start protocol. If you call this method when the protocol
is already started, this only returns false without doing anything.
'*args' are specified in subclasses.
: finish
This method ends protocol. If you call this method before protocol starts,
it only return false without doing anything.
: active?
true if session have been started
=end
@ -255,7 +246,6 @@ Object
=== Class Methods
: new( socket )
This method create new Command object. 'socket' must be ProtocolSocket.
This method is abstract class.
@ -263,7 +253,6 @@ Object
=== Methods
: quit
This method dispatch command which ends the protocol.
=end
@ -394,53 +383,42 @@ Object
=== Class Methods
: new( address = 'localhost', port = nil )
This create new ProtocolSocket object, and connect to server.
=== Methods
: close
This method closes socket.
: address, addr
a FQDN address of server
: ip_address, ipaddr
an IP address of server
: port
connecting port number.
: closed?
true if ProtocolSokcet have been closed already
: read( length )
This method read 'length' bytes and return the string.
: readuntil( target )
This method read until find 'target'. Returns read string.
: readline
read until "\r\n" and returns it without "\r\n".
: read_pendstr
This method read until "\r\n.\r\n".
At the same time, delete period at line head and final line ("\r\n.\r\n").
: read_pendlist
: read_pendlist{|line| .... }
This method read until "\r\n.\r\n". This method resembles to 'read_pendstr',
but 'read_pendlist' don't check period at line head, and returns array which
each element is one line.
@ -449,21 +427,17 @@ Object
: write( src )
This method send 'src'. ProtocolSocket read strings from 'src' by 'each'
iterator. This method returns written bytes.
: writebin( src )
This method send 'src'. ProtocolSokcet read string from 'src' by 'each'
iterator. This method returns written bytes.
: writeline( str )
This method writes 'str'. There has not to be bare "\r" or "\n" in 'str'.
: write_pendstr( src )
This method writes 'src' as a mail.
ProtocolSocket reads strings from 'src' by 'each' iterator.
This returns written bytes.

Просмотреть файл

@ -27,21 +27,19 @@ Net::Protocol
=== Class Methods
: new( address = 'localhost', port = 25 )
This method create new SMTP object.
=== Methods
: start( helo_domain = ENV['HOSTNAME'] )
This method opens TCP connection and start SMTP.
If protocol had been started, do nothing and return false.
: sendmail( mailsrc, from_domain, to_addrs )
This method sends 'mailsrc' as mail. SMTPSession read strings from 'mailsrc'
by calling 'each' iterator, and convert them into "\r\n" terminated string when write.
This method sends 'mailsrc' as mail. SMTPSession read strings
from 'mailsrc' by calling 'each' iterator, and convert them
into "\r\n" terminated string when write.
Exceptions which SMTP raises are:
* Net::ProtoSyntaxError: syntax error (errno.500)
@ -50,7 +48,6 @@ Net::Protocol
* Net::ProtoServerBusy: temporary error (errno.420/450)
: finish
This method ends SMTP.
If protocol had not started, do nothind and return false.
@ -98,34 +95,28 @@ Net::Command
=== Class Methods
: new( socket )
This method creates new SMTPCommand object, and open SMTP.
=== Methods
: helo( helo_domain )
This method send "HELO" command and start SMTP.
helo_domain is localhost's FQDN.
: mailfrom( from_addr )
This method sends "MAIL FROM" command.
from_addr is your mail address(????@????).
: rcpt( to_addrs )
This method sends "RCPT TO" command.
to_addrs is array of mail address(???@???) of destination.
: data( mailsrc )
This method send 'mailsrc' as mail. SMTP reads strings from 'mailsrc'
by calling 'each' iterator.
: quit
This method sends "QUIT" command and ends SMTP session.
=end