るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Net::HTTPHeader#add_field(key, val) -> () (6127.0)

key ヘッダフィールドに val を追加します。

...されます。

@
param key ヘッダフィール名を文字列で与えます。
@
param val keyで指定したフィールドに追加する文字列を与えます。
@
see Net::HTTPHeader#[] , Net::HTTPHeader#[]=,
Net::HTTPHeader#get_fields

//emlist[例][ruby]{
request.add_field 'X-My-Heade...
...equest.get_fields('X-My-Header') #=> ["a"]
request.add_field 'X-My-Header', 'b'
p request['X-My-Header'] #=> "a, b"
p request.get_fields('X-My-Header') #=> ["a", "b"]
request.add_field 'X-My-Header', 'c'
p request['X-My-Header'] #=> "a, b, c"
p request.get_fields('X-My-...

Net::HTTPHeader#basic_auth(account, password) -> [String] (6121.0)

Authorization: ヘッダを BASIC 認証用にセットします。

...Authorization: ヘッダを BASIC 認証用にセットします。

@
param account アカウント名を文字列で与えます。
@
param password パスワードを文字列で与えます。

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

uri = URI.parse('http://www.example.com/index.html')
req = Net:...
...:HTTP::Get.new(uri.request_uri)
req.basic_auth("user", "pass") # => ["Basic dXNlcjpwYXNz"]
//}...

Net::HTTPHeader#get_fields(key) -> [String] (6121.0)

key ヘッダフィールドの値 (文字列) を配列で返します。

...を区別しません。

@
param key ヘッダフィール名を文字列で与えます。

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

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}

@
see Net::HTTPHeader#[] , Ne...
...t::HTTPHeader#[]=,
Net::HTTPHeader#add_field...

Net::HTTPHeader#proxy_basic_auth(account, password) -> [String] (6121.0)

Proxy 認証のために Proxy-Authorization: ヘッダをセットします。

...thorization: ヘッダをセットします。

@
param account アカウント名を文字列で与えます。
@
param password パスワードを文字列で与えます。

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

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.re...
...quest_uri)
req.proxy_basic_auth("account", "password") # => ["Basic YWNjb3VudDpwYXNzd29yZA=="]
//}...

Net::HTTPGenericRequest#body -> String (3115.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::HTTPGenericRequest#body=(body) (3021.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#bod...

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

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

...
I
O オブジェクトなどのストリームで設定します。
f は read(size) メソッドが定義されている必要があります。

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

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

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

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

...
I
O オブジェクトなどのストリームで設定します。
f は read(size) メソッドが定義されている必要があります。

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

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

Net::HTTP#post(path, data, header = nil, dest = nil) -> Net::HTTPResponse (251.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。

...nt-Type として
"application/x-www-form-urlencoded" を用います。

dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@
param path POST先の...
...パスを文字列で指定します。
@
param header リクエストの HTTP ヘッダをハッシュで指定します。
@
param dest 利用しないでください。

1.1 互換モードの場合は、レスポンスに応じて例外が発生します。
また、返り値が [レスポンス...
...す。

//emlist[例][ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')

# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', '...
<< 1 2 3 ... > >>