別のキーワード
クラス
- CGI (12)
- Class (12)
-
Net
:: HTTP (228) -
Net
:: HTTPGenericRequest (48) -
Net
:: HTTPResponse (24)
キーワード
- body= (12)
-
body
_ stream (12) -
body
_ stream= (12) - get (24)
- get2 (24)
- head2 (24)
- header (12)
- inherited (12)
-
local
_ host= (12) -
local
_ port= (12) - post (24)
- post2 (24)
-
read
_ body (24) -
request
_ get (24) -
request
_ head (24) -
request
_ post (24) -
send
_ request (12)
検索結果
先頭5件
- Net
:: HTTP # request _ get(path , header = nil) {|response| . . . . } -> Net :: HTTPResponse - Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse - Net
:: HTTP # send _ request(name , path , data = nil , header = nil) -> Net :: HTTPResponse - CGI
# header(options = "text / html") -> String - Net
:: HTTP # head2(path , header = nil) -> Net :: HTTPResponse
-
Net
:: HTTP # request _ get(path , header = nil) {|response| . . . . } -> Net :: HTTPResponse (55.0) -
サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。
...。
@param path 取得するエンティティのパスを文字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。
//emlist[例][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body......# body is already read
# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body now
print str
end
}
//}
get2 は時代遅れなので使わないでください。
@see Net::HTTP#get, Net::HTTPResponse#read_body... -
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (50.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...se オブジェクトは有効な body を
持ちません。
dest は時代遅れの引数です。利用しないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path 取得するエンテ......ィティのパスを文字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。
@param dest 利用しないでください。
1.1 互換モードの場合は、レスポンスに応じて例外が発生します。
また、返り値が [レ......ディ] となります。
//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')
response.body
# compatible, using block
File.open('save.tx... -
Net
:: HTTP # send _ request(name , path , data = nil , header = nil) -> Net :: HTTPResponse (43.0) -
HTTP リクエストをサーバに送り、そのレスポンスを Net::HTTPResponse のインスタンスとして返します。
...インスタンスとして返します。
@param name リクエストのメソッド名を文字列で与えます。
@param path リクエストのパスを文字列で与えます。
@param data リクエストのボディを文字列で与えます。
@param header リクエストのヘッダ......をハッシュで与えます。
//emlist[例][ruby]{
response = http.send_request('GET', '/index.html')
puts response.body
//}
@see Net::HTTP#request... -
CGI
# header(options = "text / html") -> String (37.0) -
HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。
...--> "501 Method Not Implemented"
"BAD_GATEWAY" --> "502 Bad Gateway"
"VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates"
@param options Hash か文字列で HTTP ヘッダを生成するための情報を指定します。
例:
header
# Content-Type......my_header1" => "my_value",
"my_header2" => "my_value"})
例:
cgi = CGI.new('html3')
print cgi.header({"charset" => "shift_jis", "status" => "OK"})
print "<html><head><title>TITLE</title></head>\r\n"
print "<body>BODY</body></html>\r\n"
@see 35911... -
Net
:: HTTP # head2(path , header = nil) -> Net :: HTTPResponse (31.0) -
サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。
...そもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。
@param path ヘッダを取得するエンティティのパスを
文字列で指定します。
@param header リクエストの HTTP ヘッダをハ......ッシュで指定します。
head2 は時代遅れなので使わないでください。
//emlist[例][ruby]{
response = http.request_head('/index.html')
p response['content-type']
//}
@see Net::HTTP#head... -
Net
:: HTTP # head2(path , header = nil) {|response| . . . . } -> Net :: HTTPResponse (31.0) -
サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。
...そもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。
@param path ヘッダを取得するエンティティのパスを
文字列で指定します。
@param header リクエストの HTTP ヘッダをハ......ッシュで指定します。
head2 は時代遅れなので使わないでください。
//emlist[例][ruby]{
response = http.request_head('/index.html')
p response['content-type']
//}
@see Net::HTTP#head... -
Net
:: HTTP # local _ port=(port) (31.0) -
接続に用いるローカルポートを設定します。
...nil です。
@param port ローカルポート(数値、もしくはサービス名文字列)
//emlist[例][ruby]{
require 'net/http'
http = Net::HTTP.new("www.example.com")
http.local_host = "192.168.0.5"
http.local_port = "53043"
http.start do |h|
p h.get("/").body
end
//}
@see Net::HTTP#......local_port=, Net::HTTP#local_host
@see Net::HTTP.new... -
Net
:: HTTP # request _ head(path , header = nil) -> Net :: HTTPResponse (31.0) -
サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。
...そもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。
@param path ヘッダを取得するエンティティのパスを
文字列で指定します。
@param header リクエストの HTTP ヘッダをハ......ッシュで指定します。
head2 は時代遅れなので使わないでください。
//emlist[例][ruby]{
response = http.request_head('/index.html')
p response['content-type']
//}
@see Net::HTTP#head... -
Net
:: HTTP # request _ head(path , header = nil) {|response| . . . . } -> Net :: HTTPResponse (31.0) -
サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。
...そもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。
@param path ヘッダを取得するエンティティのパスを
文字列で指定します。
@param header リクエストの HTTP ヘッダをハ......ッシュで指定します。
head2 は時代遅れなので使わないでください。
//emlist[例][ruby]{
response = http.request_head('/index.html')
p response['content-type']
//}
@see Net::HTTP#head...