End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Net::HTTP.get_print
get_print(uri_or_host, path_or_headers = nil, port = nil)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/net/http.rb, line 443
def HTTP.get_print(uri_or_host, path_or_headers = nil, port = nil)
get_response(uri_or_host, path_or_headers, port) {|res|
res.read_body do |chunk|
$stdout.print chunk
end
}
nil
end
Gets the body text from the target and outputs it to $stdout. The target can either be specified as (uri, headers), or as (host, path, port = 80); so:
Example
Net::HTTP.get_print URI('http://www.example.com/index.html')
or:
Example
Net::HTTP.get_print 'www.example.com', '/index.html'
you can also specify request headers:
Example
Net::HTTP.get_print URI('http://www.example.com/index.html'), { 'Accept' => 'text/html' }
See also
.get
.get_response
.default_port
.http_default_port
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1