Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > library webrick/httpresponse > class WEBrick::HTTPResponse > chunked=
chunked? -> boolchunked=(flag)クライアントに返す内容(エンティティボディ)を chunk に分けるかどうかを真偽で表すアクセサです。
自身の WEBrick::HTTPResponse#request_http_version が 1.0 以下である場合、この値は無視されます。
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
Server:
Transfer-Encoding: chunked
4
hoge
0
#