Is uri
the URI
for this server?
Unmarshall a marshalled DRbObject
.
If the referenced object is located within the local server, then the object itself is returned. Otherwise, a new DRbObject
is created to act as a stub for the remote referenced object.
Reads the next expression from this printer.
See IO#gets
for more information.
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
, headers
), 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')
you can also specify request headers:
Net::HTTP.get(URI('http://www.example.com/index.html'), { 'Accept' => 'text/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.
Pushes back erred argument(s) to argv
.
Default stringizing method to emit standard error message.