るりまサーチ

最速Rubyリファレンスマニュアル検索!
418件ヒット [1-100件を表示] (0.093秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. rsa p

キーワード

検索結果

<< 1 2 3 ... > >>

Net::HTTPGenericRequest#body -> String (21122.0)

サーバに送るリクエストのエンティティボディを返します。

...クエストのエンティティボディを返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data"
req.body # => "Test Post Data"
//}

@see Net::HTTPGenericRequest#body=...

Net::HTTPResponse#body -> String | () | nil (21116.0)

エンティティボディを返します。

...Net::HTTPResponse#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

//emlist[例][ruby]{
require 'net/http'

uri = "http://www.example.com/i...
...ndex.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.body[0..10] # => "<!doctype h"
//}...

Net::HTTPGenericRequest#request_body_permitted? -> bool (12216.0)

リクエストにエンティティボディを一緒に送ることが許されている HTTP メソッド (POST など)の場合真を返します。

...許されている
HTTP メソッド (POST など)の場合真を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
p
ost.request_body_permitted? # => true

head = Net::HTTP::Head.new(uri.request...
..._uri)
head.request_body_permitted? # => false
//}...

Net::HTTPGenericRequest#response_body_permitted? -> bool (12216.0)

サーバからのレスポンスにエンティティボディを含むことが許されている HTTP メソッド (GET, POST など)の場合真を返します。

...TP メソッド (GET, POST など)の場合真を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
p
ost.response_body_permitted? # => true

head = Net::HTTP::Head.new(uri.request_uri)
head.resp...
...onse_body_permitted? # => false
//}...

Net::HTTPGenericRequest#body=(body) (9223.0)

サーバに送るリクエストのエンティティボディを文字列で設定します。

...

@param body 設定するボディを文字列で与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data" # => "Test Post Data"
//}

@see Net::HTTPGenericRequest#body...

絞り込み条件を変える

Net::HTTPResponse#read_body {|str| .... } -> () (9123.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...ire '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/...
...ile')
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_body do |s|...
...ディを文字列として
返します。また一度ブロックを与えてこのメソッドを呼んだ場合には、
次からは Net::ReadAdapter のインスタンスが返ってきますが、
その場合はそのオブジェクトは使わないでください。

dest は obsolete で...

Net::HTTPResponse#read_body(dest=nil) -> String|nil (9123.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...ire '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/...
...ile')
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_body do |s|...
...ディを文字列として
返します。また一度ブロックを与えてこのメソッドを呼んだ場合には、
次からは Net::ReadAdapter のインスタンスが返ってきますが、
その場合はそのオブジェクトは使わないでください。

dest は obsolete で...

Net::HTTPGenericRequest#body_stream -> object (9117.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

...あります。

@param f エンティティボディのデータを得るストリームオブジェクトを与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do...
...|f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
p
ost.body_stream = f
p
ost["Content-Length"] = f.size
end
p
ost.body_stream # => #<File:/path/to/test (closed)>
//}...

Net::HTTPGenericRequest#body_stream=(f) (9117.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

...あります。

@param f エンティティボディのデータを得るストリームオブジェクトを与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
p
ost = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do...
...|f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
p
ost.body_stream = f
p
ost["Content-Length"] = f.size
end
p
ost.body_stream # => #<File:/path/to/test (closed)>
//}...

Net::HTTPGenericRequest#body_exist? -> bool (9110.0)

このメソッドは obsolete です。

...このメソッドは obsolete です。


Net::HTTPGenericRequest#response_body_permitted?
の別名です。...

絞り込み条件を変える

<< 1 2 3 ... > >>