summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/date/date_parse.c4
-rw-r--r--test/date/test_date_parse.rb6
-rw-r--r--version.h2
4 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 19d07b742a..56d67dafcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Aug 23 01:16:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
+ can be omitted.
+
Fri Aug 23 00:55:02 2013 Tanaka Akira <akr@fsij.org>
* gc.c (getrusage_time): Fallback clock_gettime to getrusage when
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 765f9a7292..29dbb239bb 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -2848,7 +2848,9 @@ rfc2822_cb(VALUE m, VALUE hash)
s[i] = rb_reg_nth_match(i, m);
}
- set_hash("wday", INT2FIX(day_num(s[1])));
+ if (!NIL_P(s[1])) {
+ set_hash("wday", INT2FIX(day_num(s[1])));
+ }
set_hash("mday", str2num(s[2]));
set_hash("mon", INT2FIX(mon_num(s[3])));
y = str2num(s[4]);
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index a3ade3f86b..30976067a4 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -1062,10 +1062,16 @@ class TestDateParse < Test::Unit::TestCase
d = Date.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
assert_equal(Date.new(2001,2,3), d)
assert_equal(Date::ITALY + 10, d.start)
+ d = Date.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+ assert_equal(Date.new(2001,2,3), d)
+ assert_equal(Date::ITALY + 10, d.start)
d = DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
assert_equal(Date::ITALY + 10, d.start)
+ d = DateTime.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+ assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
+ assert_equal(Date::ITALY + 10, d.start)
end
def test_httpdate
diff --git a/version.h b/version.h
index 1a6666773c..2e0e2f960a 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-08-23"
-#define RUBY_PATCHLEVEL 296
+#define RUBY_PATCHLEVEL 297
#define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 8