Project

General

Profile

Actions

Bug #2704

closed

CGI::rfc1123_date causes NameError

Added by takai (Naoto Takai) over 12 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
Backport:
[ruby-dev:40293]

Description

=begin
cgi/util.rb に定義されている CGI::rfc1123_date が cgi/core.rb に定義されている CGI::RFC822_DAYS に依存しているにもかかわらず、 cgi/util.rb では cgi/core.rb を require していないため、次のようなエラーが発生します。

$ ruby -rcgi/util -e 'CGI::rfc1123_date Time.now'
/usr/local/ruby-1.9.1/lib/ruby/1.9.1/cgi/util.rb:150:in rfc1123_date': uninitialized constant CGI::RFC822_DAYS (NameError) from -e:1:in '
=end

Actions #1

Updated by xibbar (Takeyuki FUJIOKA) over 12 years ago

  • Assignee set to xibbar (Takeyuki FUJIOKA)

=begin

=end

Actions #2

Updated by znz (Kazuhiro NISHIYAMA) over 12 years ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Target version set to 1.9.2

=begin

=end

Actions #3

Updated by mame (Yusuke Endoh) about 12 years ago

=begin
xibber さん
遠藤です。

このチケットはどうにかなってますでしょうか。

RFC822_DAYS などは他で使われていないようなので、cgi/util.rb に
定義をささっと移してしまえばよいような気がします。

require "cgi/core"; p CGI::RFC822_DAYS が動かなくなるのは困る!

という人はいるだろうか

diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index f3e2300..698c7ce 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -40,12 +40,6 @@ class CGI
"VARIANT_ALSO_VARIES" => "506 Variant Also Negotiates"
}

  • Abbreviated day-of-week names specified by RFC 822

  • RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]

  • Abbreviated month names specified by RFC 822

  • RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]

  • :startdoc:

    def env_table
    diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
    index 42f1336..7be3e92 100644
    --- a/lib/cgi/util.rb
    +++ b/lib/cgi/util.rb
    @@ -141,6 +141,12 @@ class CGI
    unescapeElement(str)
    end

  • Abbreviated day-of-week names specified by RFC 822

  • RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
  • Abbreviated month names specified by RFC 822

  • RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
  • Format a +Time+ object as a String using the format specified by RFC 1123.

    CGI::rfc1123_date(Time.now)

--
Yusuke Endoh
=end

Actions #4

Updated by xibbar (Takeyuki FUJIOKA) about 12 years ago

  • Status changed from Assigned to Closed

=begin

=end

Actions

Also available in: Atom PDF