クラス
-
Net
:: HTTP (7) -
Net
:: HTTPResponse (2)
キーワード
- get (2)
- patch (2)
- post (2)
-
read
_ body (2) -
set
_ debug _ output (1)
検索結果
先頭5件
- Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse - Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse - Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) -> Net :: HTTPResponse - Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) {|body _ segment| . . . } -> Net :: HTTPResponse - Net
:: HTTP # post(path , data , header = nil , dest = nil) -> Net :: HTTPResponse
-
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...、返り値が [レスポンスオブジェクト, そのボディ] となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html'... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...、返り値が [レスポンスオブジェクト, そのボディ] となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html'... -
Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティに対し文字列 data を PATCH リクエストで送ります。
サーバ上の path にあるエンティティに対し文字列 data を
PATCH リクエストで送ります。
返り値は Net::HTTPResponse のインスタンスです。
ブロックと一緒に呼びだされたときはエンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の HTTPResponse オブジェクトは有効な body を
持ちません。
Dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path POST先のパスを文字列で指定します。... -
Net
:: HTTP # patch(path , data , initheader=nil , dest=nil) {|body _ segment| . . . } -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティに対し文字列 data を PATCH リクエストで送ります。
サーバ上の path にあるエンティティに対し文字列 data を
PATCH リクエストで送ります。
返り値は Net::HTTPResponse のインスタンスです。
ブロックと一緒に呼びだされたときはエンティティボディを少しずつ文字列として
ブロックに与えます。このとき戻り値の HTTPResponse オブジェクトは有効な body を
持ちません。
Dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path POST先のパスを文字列で指定します。... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...例外が発生します。
また、返り値が [レスポンスオブジェクト, そのボディ] となります。
//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... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (25.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...例外が発生します。
また、返り値が [レスポンスオブジェクト, そのボディ] となります。
//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... -
Net
:: HTTP # set _ debug _ output(io) -> () (25.0) -
デバッグ出力の出力先を指定します。 このメソッドは深刻なセキュリティホールの原因 になるため、デバッグ以外では決して使わないでください。
デバッグ出力の出力先を指定します。
このメソッドは深刻なセキュリティホールの原因
になるため、デバッグ以外では決して使わないでください。
io に nil を指定するとデバッグ出力を止めます。
@param io 出力先を指定します。このオブジェクトは
メソッド << を持っている必要があります。
//emlist[例][ruby]{
http.set_debug_output($stderr)
//} -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (25.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:/... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (25.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:/...