Bug #2704
closedCGI::rfc1123_date causes NameError
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
Updated by xibbar (Takeyuki FUJIOKA) almost 15 years ago
- Assignee set to xibbar (Takeyuki FUJIOKA)
=begin
=end
Updated by znz (Kazuhiro NISHIYAMA) over 14 years ago
- Category set to lib
- Status changed from Open to Assigned
- Target version set to 1.9.2
=begin
=end
Updated by mame (Yusuke Endoh) over 14 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
Updated by xibbar (Takeyuki FUJIOKA) over 14 years ago
- Status changed from Assigned to Closed
=begin
=end