種類
- インスタンスメソッド (187)
- ライブラリ (11)
- モジュール関数 (11)
- クラス (11)
ライブラリ
-
net
/ http (66) -
webrick
/ httpauth (11) -
webrick
/ httpauth / basicauth (11) -
webrick
/ httpresponse (55) -
webrick
/ httpservlet / abstract (66)
クラス
-
Net
:: HTTP (44) -
Net
:: HTTPGenericRequest (22) -
WEBrick
:: HTTPResponse (55) -
WEBrick
:: HTTPServlet :: AbstractServlet (66)
モジュール
-
WEBrick
:: HTTPAuth (11)
キーワード
- BasicAuth (11)
-
basic
_ auth (11) - body (11)
- chunked= (11)
-
content
_ length (11) -
content
_ length= (11) -
do
_ DELETE (11) -
do
_ GET (11) -
do
_ HEAD (11) -
do
_ OPTIONS (11) -
do
_ POST (11) -
do
_ PUT (11) - get (22)
- post (22)
-
to
_ s (11) -
webrick
/ cgi (11)
検索結果
先頭5件
-
Net
:: HTTPGenericRequest # body=(body) (18106.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... -
WEBrick
:: HTTPResponse # body=(val) (18106.0) -
クライアントに返す内容(エンティティボディ)をセットします。
...形式エンコーディングされます。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Len... -
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (6.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.ht... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (6.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.ht... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) -> Net :: HTTPResponse (6.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', 'query=subject&target=ruby')... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (6.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', 'query=subject&target=ruby')... -
Net
:: HTTPGenericRequest # body -> String (6.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=... -
WEBrick
:: HTTPAuth . # basic _ auth(req , res , realm) {|user , pass| . . . } -> nil (6.0) -
Basic 認証を行うためのメソッドです。
...ck::HTTPStatus::Unauthorized 認証に失敗した場合に発生します。
require 'webrick'
srv.mount_proc('/basic_auth') {|req, res|
HTTPAuth.basic_auth(req, res, "WEBrick's realm") {|user, pass|
user == 'webrick' && pass == 'supersecretpassword'
}
res.body = "hoge"
}... -
WEBrick
:: HTTPAuth :: BasicAuth (6.0) -
HTTP の Basic 認証のためのクラスです。
...passwd(nil, 'username', 'supersecretpass')
authenticator = WEBrick::HTTPAuth::BasicAuth.new(:UserDB => htpd, :Realm => realm)
srv.mount_proc('/basic_auth') {|req, res|
authenticator.authenticate(req, res)
res.body = "hoge"
}
srv.start # http://127.0.0.1:10080/basic_auth... -
WEBrick
:: HTTPResponse # chunked=(flag) (6.0) -
真に設定するとクライアントに返す内容(エンティティボディ)を chunk に分けるようになります。
...分けてクライアントに返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
res.chunked = true
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 09:04:28 GMT...