[ruby-list:41799] Re: expires header の指定

From: 舘石 <tateishi@...>
Date: 2006-01-26 04:08:53 UTC
List: ruby-list #41799
舘石といいます。

cgi.header("type" => "text/html",
           "charset" => "euc-jp",
           "language" => "jp",
           "Last-Modified" => CGI.rfc1123_date(Time.now),
           "expires" => Time.local(1970,1,1),
           "progma" => "no-cache",
           "Cache-Control" => "no-cache"
           )

とかではダメですか?
意図していることが間違っていたらごめんなさい。

Takayuki Suzuki wrote:
> 鈴木と申します。
> 
> CGIクラスのheaderメソッドで
> Expires: 0
> というHTTPヘッダを生成したいのですが、
> 可能なのでしょうか?
> 
> % ruby --version
> ruby 1.8.3 (2005-09-21) [i386-freebsd4.7]
> 
> で以下のように試してみましたがだめでした。
> 
> irb(main):021:0> cgi.header({'expires'=>nil})
> TypeError: can't clone NilClass
>         from /usr/local/lib/ruby/1.8/cgi.rb:455:in `clone'
>         from /usr/local/lib/ruby/1.8/cgi.rb:455:in `rfc1123_date'
>         from /usr/local/lib/ruby/1.8/cgi.rb:601:in `header'
>         from (irb):21
>         from :0
> irb(main):022:0> cgi.header({'expires'=>0})
> TypeError: can't clone Fixnum
>         from /usr/local/lib/ruby/1.8/cgi.rb:455:in `clone'
>         from /usr/local/lib/ruby/1.8/cgi.rb:455:in `rfc1123_date'
>         from /usr/local/lib/ruby/1.8/cgi.rb:601:in `header'
>         from (irb):22
>         from :0
> irb(main):023:0> cgi.header({'expires'=>"0"})
> NoMethodError: undefined method `gmtime' for "0":String
>         from /usr/local/lib/ruby/1.8/cgi.rb:455:in `rfc1123_date'
>         from /usr/local/lib/ruby/1.8/cgi.rb:601:in `header'
>         from (irb):23
>         from :0
> 
> --
> 鈴木
> 
> 
> 


-- 
日本テクト株式会社
テクノセンター
舘石裕史
tel. 055-983-3737
add. 411-0853 静岡県三島市大社町18-7 小林ビル2F


In This Thread