281287 Handle date headers before 1 Jan 1970

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@524 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-07-09 03:48:38 +00:00
parent 57c9074b28
commit c116cd7e63
4 changed files with 8 additions and 3 deletions

View File

@ -5,6 +5,7 @@ jetty-7.0.0.RC0 8 June 2009
+ JETTY-1058 Handle trailing / with aliases
+ 280843 Buffer pool uses isHeader
+ 271535 Adding integration tests, and enabling RFC2616 tests
+ 281287 Handle date headers before 1 Jan 1970
jetty-7.0.0.M4 1 June 2009
+ 281059 NPE in QTP with debug on

View File

@ -815,7 +815,7 @@ public class HttpFields
return -1;
final long date = __dateParser.get().parse(val);
if (date<0)
if (date==-1)
throw new IllegalArgumentException("Cannot convert date: " + val);
field._numValue=date;
return date;

View File

@ -404,18 +404,21 @@ public class HttpFieldsTest extends TestCase
throws Exception
{
HttpFields fields = new HttpFields();
fields.put("D0", "Wed, 31 Dec 1969 23:59:59 GMT");
fields.put("D1", "Fri, 31 Dec 1999 23:59:59 GMT");
fields.put("D2", "Friday, 31-Dec-99 23:59:59 GMT");
fields.put("D3", "Fri Dec 31 23:59:59 1999");
fields.put("D4", "Mon Jan 1 2000 00:00:01");
fields.put("D5", "Tue Feb 29 2000 12:00:00");
long d1 = fields.getDateField("D1");
long d0 = fields.getDateField("D0");
long d2 = fields.getDateField("D2");
long d3 = fields.getDateField("D3");
long d4 = fields.getDateField("D4");
long d5 = fields.getDateField("D5");
assertTrue(d0!=-1);
assertTrue(d1>0);
assertTrue(d2>0);
assertEquals(d1,d2);

View File

@ -535,6 +535,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
/* ------------------------------------------------------------ */
private boolean hasDefinedRange(Enumeration reqRanges)
{
return (reqRanges!=null && reqRanges.hasMoreElements());