るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.061秒)
トップページ > クエリ:new[x] > クエリ:>[x] > クエリ:to_s[x] > クラス:WEBrick::HTTPResponse[x]

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. integer >
  4. float >
  5. module >

ライブラリ

キーワード

検索結果

WEBrick::HTTPResponse#to_s -> String (18214.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:
Conte...

WEBrick::HTTPResponse#content_length -> Integer | nil (119.0)

Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

...ことは出来ません。

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...

WEBrick::HTTPResponse#http_version -> WEBrick::HTTPVersion (113.0)

レスポンスの HTTP のバージョンを表す WEBrick::HTTPVersion オブジェクトを返します。

...TTPVersion オブジェクトを返します。

require 'webrick'
res = WEBrick::HTTPResponse.new( { :HTTPVersion => "1.1" } )
p res.http_version.class #=> WEBrick::HTTPVersion
p res.http_version.to_s #=> "1.1"...