206件ヒット
[201-206件を表示]
(0.026秒)
クラス
-
Net
:: HTTP (158) -
Net
:: HTTPGenericRequest (24) -
Net
:: HTTPResponse (24)
キーワード
-
body
_ stream (12) -
body
_ stream= (12) - cert (12)
-
cert
_ store (12) - get (24)
- key (12)
-
open
_ timeout (12) -
open
_ timeout= (12) -
peer
_ cert (12) - post (24)
-
read
_ body (24) -
read
_ timeout (12) -
read
_ timeout= (12) -
write
_ timeout (7) -
write
_ timeout= (7)
検索結果
-
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (8.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.example.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|
r...