154件ヒット
[1-100件を表示]
(0.047秒)
種類
- インスタンスメソッド (77)
- 文書 (33)
- ライブラリ (22)
- 特異メソッド (22)
ライブラリ
-
net
/ http (33) - open-uri (22)
-
webrick
/ httprequest (11) -
webrick
/ httpresponse (33)
クラス
-
WEBrick
:: HTTPRequest (11) -
WEBrick
:: HTTPResponse (33)
モジュール
-
Net
:: HTTPHeader (33) - OpenURI (22)
キーワード
- []= (11)
- cgi (11)
-
content
_ length= (22) - delete (11)
-
open
_ uri (22) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 9 feature (11) -
webrick
/ cgi (11)
検索結果
先頭5件
-
WEBrick
:: HTTPResponse # content _ length -> Integer | nil (21138.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実際のサイズとこの値が同じかどうかの検証は行われません。
: body が IO オブジェクトである場合
content_length の値......。nil でないとき IO から content_length バイトだけ読み込みそれを
エンティティボディとします。
また 2616 4.4 で定められた Content-Length ヘッダを送ってはいけない場合に当てはまる時には
content_length の値は無視され Content-Leng......とは出来ません。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 12:04:32... -
Net
:: HTTPHeader # content _ length -> Integer|nil (21137.0) -
Content-Length: ヘッダフィールドの表している値を整数で返します。
...raise Net::HTTPHeaderSyntaxError フィールドの値が不正である場合に
発生します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_length # => nil......req.content_length = 10
req.content_length # => 10
//}... -
WEBrick
:: HTTPRequest # content _ length -> Integer (21101.0) -
リクエストの Content-Length ヘッダの値を整数で返します。リクエストに Content-Length ヘッダ が含まれていない場合は 0 を返します。
リクエストの Content-Length ヘッダの値を整数で返します。リクエストに Content-Length ヘッダ
が含まれていない場合は 0 を返します。 -
WEBrick
:: HTTPResponse # content _ length=(len) (9138.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実際のサイズとこの値が同じかどうかの検証は行われません。
: body が IO オブジェクトである場合
content_length の値......。nil でないとき IO から content_length バイトだけ読み込みそれを
エンティティボディとします。
また 2616 4.4 で定められた Content-Length ヘッダを送ってはいけない場合に当てはまる時には
content_length の値は無視され Content-Leng......とは出来ません。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 12:04:32... -
Net
:: HTTPHeader # content _ length=(len) (9137.0) -
Content-Length: ヘッダフィールドに値を設定します。
...。
@param len 設定する値を整数で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_length # => nil
req.content_length = 10 # => 10
req.content_length # => 10
//}... -
Net
:: HTTPHeader # delete(key) -> [String] | nil (3036.0) -
key ヘッダフィールドを削除します。
...は
nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_length = 10
req.content_length # => 10
req.delete("Content-Length") # => ["10"]
req.content_length # => nil
//}... -
WEBrick
:: HTTPResponse # []=(field , val) (3006.0) -
レスポンスの該当するヘッダに val を設定します。
...せん。
@param val ヘッダの値を指定します。to_s メソッドによって文字列に変換されます。
require 'time'
res['last-modified'] = Time.now.httpdate
@see WEBrick::HTTPResponse#chunked?, WEBrick::HTTPResponse#content_length,
WEBrick::HTTPResponse#content_type... -
OpenURI
. open _ uri(name , mode = & # 39;r& # 39; , perm = nil , options = {}) -> StringIO (156.0) -
URI である文字列 name のリソースを取得して StringIO オブジェクト として返します。
...n_uri('http://www.example.com')
p sio.last_modified
puts sio.read
OpenURI.open_uri('http://www.example.com'){|sio| sio.read }
options には Hash を与えます。理解するハッシュの
キーは以下のシンボル、
* :proxy
* :progress_proc
* :content_length_proc
* :http_basic......http_basic_authentication
* :read_timeout
* :ssl_ca_cert
* :ssl_verify_mode
* :ftp_active_mode
* :redirect
です。
「:content_length_proc」と「:progress_proc」はプログレスバーに
利用されることを想定しています。
require 'open-uri'
sio = OpenURI.open_uri('http......{ :proxy => 'http://proxy.example.com:8000/',
:http_basic_authentication => [username, password] })
: :proxy
プロクシの設定をします。
値には以下のいずれかを与えます。
//emlist{
文字列: "http://proxy.example.com:800... -
OpenURI
. open _ uri(name , mode = & # 39;r& # 39; , perm = nil , options = {}) {|sio| . . . } -> nil (156.0) -
URI である文字列 name のリソースを取得して StringIO オブジェクト として返します。
...n_uri('http://www.example.com')
p sio.last_modified
puts sio.read
OpenURI.open_uri('http://www.example.com'){|sio| sio.read }
options には Hash を与えます。理解するハッシュの
キーは以下のシンボル、
* :proxy
* :progress_proc
* :content_length_proc
* :http_basic......http_basic_authentication
* :read_timeout
* :ssl_ca_cert
* :ssl_verify_mode
* :ftp_active_mode
* :redirect
です。
「:content_length_proc」と「:progress_proc」はプログレスバーに
利用されることを想定しています。
require 'open-uri'
sio = OpenURI.open_uri('http......{ :proxy => 'http://proxy.example.com:8000/',
:http_basic_authentication => [username, password] })
: :proxy
プロクシの設定をします。
値には以下のいずれかを与えます。
//emlist{
文字列: "http://proxy.example.com:800... -
cgi (138.0)
-
CGI プログラムの支援ライブラリです。
...GI プロトコルの詳細については以下の文書を参照してください。
* https://tools.ietf.org/html/draft-coar-cgi-v11-03
* 3875: The Common Gateway Interface (CGI) Version 1.1
* https://www.w3.org/CGI/
=== 使用例
==== フォームフィールドの値を得る
//emlis......* CONTENT_LENGTH
* CONTENT_TYPE
* GATEWAY_INTERFACE
* PATH_INFO
* PATH_TRANSLATED
* QUERY_STRING
* REMOTE_ADDR
* REMOTE_HOST
* REMOTE_IDENT
* REMOTE_USER
* REQUEST_METHOD
* SCRIPT_NAME
* SERVER_NAME
* SERVER_PORT
* SERVER_PROTOCOL
* SERVER_SOFTWARE
#content_length......ます。
HTTP_COOKIE と HTTP_COOKIE2 には
それぞれ raw_cookie と raw_cookie2 が対応します。
//emlist[][ruby]{
value = cgi.raw_cookie # ENV["HTTP_COOKIE"]
value = cgi.raw_cookie2 # ENV["HTTP_COOKIE2"]
//}
最後に、以下の HTTP 関連の環境変数は HTTP_ を除い...