Retrieves remotefile
in binary mode, storing the result in localfile
. If localfile
is nil, returns retrieved data. If a block is supplied, it is passed the retrieved data in blocksize
chunks.
Retrieves remotefile
in ASCII (text) mode, storing the result in localfile
. If localfile
is nil, returns retrieved data. If a block is supplied, it is passed the retrieved data one line at a time.
Retrieves remotefile
in whatever mode the session is set (text or binary). See gettextfile
and getbinaryfile
.
Closes the connection. Further operations are impossible until you open a new connection with connect
.
Returns true
iff the connection is closed.
Turns on net/http 1.2 (Ruby 1.8) features. Defaults to ON in Ruby 1.8 or later.
Sends a GET request to the target and returns the HTTP
response as a string. The target can either be specified as (uri
), or as (host
, path
, port
= 80); so:
print Net::HTTP.get(URI('http://www.example.com/index.html'))
or:
print Net::HTTP.get('www.example.com', '/index.html')
Retrieves data from path
on the connected-to host which may be an absolute path String or a URI
to extract the path from.
initheader
must be a Hash
like { ‘Accept’ => ‘/’, … }, and it defaults to an empty hash. If initheader
doesn’t have the key ‘accept-encoding’, then a value of “gzip;q=1.0,deflate;q=0.6,identity;q=0.3” is used, so that gzip compression is used in preference to deflate compression, which is used in preference to no compression. Ruby doesn’t have libraries to support the compress (Lempel-Ziv) compression, so that is not supported. The intent of this is to reduce bandwidth by default. If this routine sets up compression, then it does the decompression also, removing the header as well to prevent confusion. Otherwise it leaves the body as it found it.
This method returns a Net::HTTPResponse
object.
If called with a block, yields each fragment of the entity body in turn as a string as it is read from the socket. Note that in this case, the returned response object will not contain a (meaningful) body.
dest
argument is obsolete. It still works but you must not use it.
This method never raises an exception.
response = http.get('/index.html') # using block File.open('result.txt', 'w') {|f| http.get('/~foo/') do |str| f.write str end }
Sends a LOCK request to the path
and gets a response, as an HTTPResponse
object.
Sends a UNLOCK request to the path
and gets a response, as an HTTPResponse
object.
Sends the GETQUOTAROOT command along with the specified mailbox
. This command is generally available to both admin and user. If this mailbox exists, it returns an array containing objects of type Net::IMAP::MailboxQuotaRoot
and Net::IMAP::MailboxQuota
.
Sends the GETQUOTA command along with specified mailbox
. If this mailbox exists, then an array containing a Net::IMAP::MailboxQuota
object is returned. This command is generally only available to server admin.
Send the GETACL command along with a specified mailbox
. If this mailbox exists, an array containing objects of Net::IMAP::MailboxACLItem
will be returned.
Sends a CLOSE command to close the currently selected mailbox. The CLOSE command permanently removes from the mailbox all messages that have the Deleted flag set.
Sends a EXPUNGE command to permanently remove from the currently selected mailbox all messages that have the Deleted flag set.
returns whether verify_mode is enable from POP3.ssl_params
returns the :ca_file or :ca_path from POP3.ssl_params
Fetches the message header.
The optional dest
argument is obsolete.
This method raises a POPError
if an error occurs.
Pushes back erred argument(s) to argv
.
Default stringizing method to emit standard error message.