Project

General

Profile

Bug #2704

CGI::rfc1123_date causes NameError

Added by takai (Naoto Takai) almost 10 years ago. Updated over 8 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

Associated revisions

Revision 2b222b9b
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

Revision 27415
Added by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS): move the constant because used only util.rb. [Bug #2704]

History

#1

Updated by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • Assignee set to xibbar (Takeyuki FUJIOKA)

=begin

=end

#2

Updated by znz (Kazuhiro NISHIYAMA) almost 10 years ago

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

=begin

=end

#3

Updated by mame (Yusuke Endoh) almost 10 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 mame@tsg.ne.jp
=end

#4

Updated by xibbar (Takeyuki FUJIOKA) almost 10 years ago

  • Status changed from Assigned to Closed

=begin

=end

Also available in: Atom PDF