Posts HTML form data to the specified URI
object. The form data must be provided as a Hash
mapping from String to String. Example:
{ "cmd" => "search", "q" => "ruby", "max" => "50" }
This method also does Basic Authentication iff url
.user exists. But userinfo for authentication is deprecated (RFC3986). So this feature will be removed.
Example:
require 'net/http' require 'uri' Net::HTTP.post_form URI('http://www.example.com/search.cgi'), { "q" => "ruby", "max" => "50" }
Sends a GET request to the path
. Returns the response as a Net::HTTPResponse
object.
When called with a block, passes an HTTPResponse
object to the block. The body of the response will not have been read yet; the block can process it using HTTPResponse#read_body
, if desired.
Returns the response.
This method never raises Net::* exceptions.
response = http.request_get('/index.html') # The entity body is already read in this case. p response['content-type'] puts response.body # Using a block http.request_get('/index.html') {|response| p response['content-type'] response.read_body do |str| # read body now print str end }
Sends a HEAD request to the path
and returns the response as a Net::HTTPResponse
object.
Returns the response.
This method never raises Net::* exceptions.
response = http.request_head('/index.html') p response['content-type']
Sends an HTTP
request to the HTTP
server. Also sends a DATA string if data
is given.
Returns a Net::HTTPResponse
object.
This method never raises Net::* exceptions.
response = http.send_request('GET', '/index.html') puts response.body
Similar to store()
, but set
contains unique identifiers.
true if server advertises STARTTLS. You cannot get valid value before opening SMTP
session.
true if this object uses STARTTLS.
true if this object uses STARTTLS when server advertises STARTTLS.
Enables SMTP/TLS (STARTTLS) for this object. context
is a OpenSSL::SSL::SSLContext
object.
Disables SMTP/TLS (STARTTLS) for this object. Must be called before the connection is established to have any effect.
@return the XMLDecl
standalone value of this document as a String. If no XMLDecl
has been set, returns the default setting.
Creates threads that pick up UDP packets and passes them to do_write
for decoding.
Extracts the response URI
from msg
and adds it to TupleSpace
where it will be picked up by reply_service
for notification.