Parses a given string
as a blob that contains configuration for openssl.
If the source of the IO
is a file, then consider using parse_config.
Another entry point for the parser. If you use this method, you must implement RECEIVER#METHOD_ID method.
RECEIVER#METHOD_ID is a method to get next token. It must ‘yield’ the token, which format is [TOKEN-SYMBOL, VALUE].
Starts the parser. init
is a data accumulator and is passed to the next event handler (as of Enumerable#inject
).
returns the timestamp as a time object.
ancillarydata should be one of following type:
SOL_SOCKET/SCM_TIMESTAMP (microsecond) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
SOL_SOCKET/SCM_TIMESTAMPNS (nanosecond) GNU/Linux
SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
Addrinfo.udp
(“127.0.0.1”, 0).bind {|s1|
Addrinfo.udp("127.0.0.1", 0).bind {|s2| s1.setsockopt(:SOCKET, :TIMESTAMP, true) s2.send "a", 0, s1.local_address ctl = s1.recvmsg.last p ctl #=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581> t = ctl.timestamp p t #=> 2009-02-24 17:35:46 +0900 p t.usec #=> 775581 p t.nsec #=> 775581000 }
}
Changes the parameters of the deflate stream to allow changes between different types of data that require different types of compression. Any unprocessed data is flushed before changing the params.
See Zlib::Deflate.new
for a description of level
and strategy
.
Returns last modification time recorded in the gzip file header.
Returns the last access time for this file as an object of class Time
.
File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
Returns the modification time of stat.
File.stat("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
Returns the change time for stat (that is, the time directory information about the file was changed, not the file itself).
Note that on Windows (NTFS), returns creation time (birth time).
File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
Returns true
if stat has its sticky bit set, false
if it doesn’t or if the operating system doesn’t support this feature.
File.stat("testfile").sticky? #=> false
Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.
cookies = CGI::Cookie.parse("raw_cookie_string") # { "name1" => cookie1, "name2" => cookie2, ... }
Returns the last modification time of the (remote) file. If local
is true
, it is returned as a local time, otherwise it’s a UTC time.
Turns on net/http 1.2 (Ruby 1.8) features. Defaults to ON in Ruby 1.8 or later.
Creates a new Net::HTTP
object, then additionally opens the TCP connection and HTTP
session.
Arguments are the following:
hostname or IP address of the server
port of the server
address of proxy
port of proxy
user of proxy
pass of proxy
optional hash
opt sets following values by its accessor. The keys are ca_file
, ca_path
, cert, cert_store
, ciphers, close_on_empty_response
, key, open_timeout
, read_timeout
, ssl_timeout
, ssl_version
, use_ssl, verify_callback
, verify_depth
and verify_mode. If you set :use_ssl as true, you can use https and default value of verify_mode
is set as OpenSSL::SSL::VERIFY_PEER.
If the optional block is given, the newly created Net::HTTP
object is passed to it and closed when the block finishes. In this case, the return value of this method is the return value of the block. If no block is given, the return value of this method is the newly created Net::HTTP
object itself, and the caller is responsible for closing it upon completion using the finish() method.
Returns true if the HTTP
session has been started.
Opens a TCP connection and HTTP
session.
When this method is called with a block, it passes the Net::HTTP
object to the block, and closes the TCP connection and HTTP
session after the block has been executed.
When called with a block, it returns the return value of the block; otherwise, it returns self.
Sends a CAPABILITY command, and returns an array of capabilities that the server supports. Each capability is a string. See [IMAP] for a list of possible capabilities.
Note that the Net::IMAP
class does not modify its behaviour according to the capabilities of the server; it is up to the user of the class to ensure that a certain capability is supported by a server before using it.
Sends a STARTTLS command to start TLS session.
Sends an AUTHENTICATE command to authenticate the client. The auth_type
parameter is a string that represents the authentication mechanism to be used. Currently Net::IMAP
supports the authentication mechanisms:
LOGIN:: login using cleartext user and password. CRAM-MD5:: login with cleartext user and encrypted password (see [RFC-2195] for a full description). This mechanism requires that the server have the user's password stored in clear-text password.
For both of these mechanisms, there should be two args
: username and (cleartext) password. A server may not support one or the other of these mechanisms; check capability()
for a capability of the form “AUTH=LOGIN” or “AUTH=CRAM-MD5”.
Authentication is done using the appropriate authenticator object: see @@authenticators for more information on plugging in your own authenticator.
For example:
imap.authenticate('LOGIN', user, password)
A Net::IMAP::NoResponseError
is raised if authentication fails.
Creates a new POP3
object and open the connection. Equivalent to
Net::POP3.new(address, port, isapop).start(account, password)
If block
is provided, yields the newly-opened POP3
object to it, and automatically closes it at the end of the session.
Net::POP3.start(addr, port, account, password) do |pop| pop.each_mail do |m| file.write m.pop m.delete end end
true
if the POP3
session has started.
Starts a POP3
session.
When called with block, gives a POP3
object to the block and closes the session after block call finishes.
This method raises a POPAuthenticationError
if authentication fails.
Returns truth value if this object uses STARTTLS. If this object always uses STARTTLS, returns :always. If this object uses STARTTLS when the server support TLS, returns :auto.
Creates a new Net::SMTP
object and connects to the server.
This method is equivalent to:
Net::SMTP.new(address, port).start(helo_domain, account, password, authtype)
Net::SMTP.start('your.smtp.server') do |smtp| smtp.send_message msgstr, 'from@example.com', ['dest@example.com'] end
If called with a block, the newly-opened Net::SMTP
object is yielded to the block, and automatically closed when the block finishes. If called without a block, the newly-opened Net::SMTP
object is returned to the caller, and it is the caller’s responsibility to close it when finished.
address
is the hostname or ip address of your smtp server.
port
is the port to connect to; it defaults to port 25.
helo
is the HELO domain provided by the client to the server (see overview comments); it defaults to ‘localhost’.
The remaining arguments are used for SMTP
authentication, if required or desired. user
is the account name; secret
is your password or other authentication token; and authtype
is the authentication type, one of :plain, :login, or :cram_md5. See the discussion of SMTP
Authentication in the overview notes.
This method may raise: