96件ヒット
[1-96件を表示]
(0.080秒)
ライブラリ
-
net
/ http (24) - uri (60)
-
webrick
/ httprequest (12)
クラス
-
Net
:: HTTPResponse (24) -
URI
:: Generic (60) -
WEBrick
:: HTTPRequest (12)
検索結果
先頭5件
-
URI
:: Generic # host -> String | nil (29124.0) -
自身の host を文字列で返します。設定されていない場合は nil を返します。
...自身の host を文字列で返します。設定されていない場合は nil を返します。
@see URI::Generic#hostname... -
WEBrick
:: HTTPRequest # host -> String (18134.0) -
リクエスト URI の host を文字列で返します。
...リクエスト URI の host を文字列で返します。... -
URI
:: Generic # hostname -> String | nil (17163.0) -
自身の hostname を文字列で返します。また、URI::Generic#host が設 定されていない場合は nil を返します。
...自身の hostname を文字列で返します。また、URI::Generic#host が設
定されていない場合は nil を返します。
このメソッドは URI::Generic#host に IPv6 アドレスが設定されていた
場合はブラケットを削除した文字列を返しますがそれ以......外は同じ文字列を返し
ます。
require 'uri'
u = URI("http://[::1]/bar")
p u.hostname # => "::1"
p u.host # => "[::1]"... -
URI
:: Generic # host=(s) (17148.0) -
自身の host を設定します。
... host を設定します。
@param s 自身の host を表す文字列を指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
@raise URI::InvalidURIError host と registry を同時に設定した場合に発生します。
@see URI::Generic#hostn... -
URI
:: Generic # hostname=(s) (17143.0) -
自身の hostname を設定します。
...自身の hostname を設定します。
このメソッドは引数に IPv6 アドレスを設定した場合は
URI::Generic#host にブラケットを追加した文字列を設定しますがそれ
以外は同じ処理を行います。
require 'uri'
u = URI("http://foo/bar")
p u.to_s......> "http://foo/bar"
u.hostname = "::1"
p u.to_s # => "http://[::1]/bar"
@param s 自身の hostname を表す文字列を指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
@raise URI::InvalidURIError host と registry を同... -
URI
:: Generic # select(*components) -> [String] (11031.0) -
指定された components に対応する構成要素を文字列の配列として返します。
...字列の配列として返します。
@param components 構成要素名をシンボルで指定します。
例:
require 'uri'
uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
p uri.select(:userinfo, :host, :path)
# => ["myuser:mypass", "my.example.com", "/test.rbx"]... -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (55.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http://www.exampl.......com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (55.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http://www.exampl.......com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read...