[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-commit] r1340 - in jetty/trunk: . jetty-http/src/main/java/org/eclipse/jetty/http jetty-http/src/test/java/org/eclipse/jetty/http

Author: jbartel
Date: 2010-03-05 04:26:01 -0500 (Fri, 05 Mar 2010)
New Revision: 1340

Modified:
   jetty/trunk/VERSION.txt
   jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
   jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java
Log:
304658
304698


Modified: jetty/trunk/VERSION.txt
===================================================================
--- jetty/trunk/VERSION.txt	2010-03-05 08:19:24 UTC (rev 1339)
+++ jetty/trunk/VERSION.txt	2010-03-05 09:26:01 UTC (rev 1340)
@@ -22,6 +22,8 @@
  + 303526 Added include cyphers
  + 304307 Handle ;jsessionid in FROM Auth
  + 304532 Skip some tests on IBM JVMs until resolved
+ + 304658 Inconsistent Expires date format in Set-Cookie headers with maxAge=0
+ + 304698 org.eclipse.jetty.http.HttpFields$DateGenerator.formatCookieDate() uses wrong (?) date format
  + JETTY-776 Make new session-tests module to concentrate all reusable session clustering test code
  + JETTY-910 Allow request listeners to access session
  + JETTY-983 Range handling cleanup

Modified: jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
===================================================================
--- jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java	2010-03-05 08:19:24 UTC (rev 1339)
+++ jetty/trunk/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java	2010-03-05 09:26:01 UTC (rev 1340)
@@ -131,7 +131,7 @@
             int day_of_month = gc.get(Calendar.DAY_OF_MONTH);
             int month = gc.get(Calendar.MONTH);
             int year = gc.get(Calendar.YEAR);
-            year = year % 100;
+            year = year % 10000;
 
             int epoch = (int) ((date / 1000) % (60 * 60 * 24));
             int seconds = epoch % 60;
@@ -147,8 +147,9 @@
             buf.append('-');
             buf.append(MONTHS[month]);
             buf.append('-');
-            StringUtil.append2digits(buf, year);
-
+            StringUtil.append2digits(buf, year/100);
+            StringUtil.append2digits(buf, year%100);
+            
             buf.append(' ');
             StringUtil.append2digits(buf, hours);
             buf.append(':');
@@ -183,12 +184,24 @@
 
     /* ------------------------------------------------------------ */
     /**
-     * Format "EEE, dd-MMM-yy HH:mm:ss 'GMT'" for cookies
+     * Format "EEE, dd-MMM-yyyy HH:mm:ss 'GMT'" for cookies
      */
     public static void formatCookieDate(StringBuilder buf, long date)
     {
         __dateGenerator.get().formatCookieDate(buf,date);
     }
+    
+    /* ------------------------------------------------------------ */
+    /**
+     * Format "EEE, dd-MMM-yyyy HH:mm:ss 'GMT'" for cookies
+     */
+    public static String formatCookieDate(long date)
+    {
+        StringBuilder buf = new StringBuilder(28);
+        formatCookieDate(buf, date);
+        return buf.toString();
+    }
+    
 
 
     /* ------------------------------------------------------------ */
@@ -274,14 +287,16 @@
     
     
     
-    public final static String __01Jan1970 = formatDate(0).trim();
-    public final static Buffer __01Jan1970_BUFFER = new ByteArrayBuffer(__01Jan1970);
+    public final static String __01Jan1970=formatCookieDate(0);
+    public final static Buffer __01Jan1970_BUFFER=new ByteArrayBuffer(__01Jan1970);
 
     /* -------------------------------------------------------------- */
     protected final ArrayList<Field> _fields = new ArrayList<Field>(20);
     protected final HashMap<Buffer,Field> _bufferMap = new HashMap<Buffer,Field>(32);
     protected int _revision;
 
+   
+    
     /* ------------------------------------------------------------ */
     /**
      * Constructor.

Modified: jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java
===================================================================
--- jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java	2010-03-05 08:19:24 UTC (rev 1339)
+++ jetty/trunk/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java	2010-03-05 09:26:01 UTC (rev 1340)
@@ -369,7 +369,7 @@
 
         fields.clear();
         fields.addSetCookie("everything","value","domain","path",0,"comment",true,true,0);
-        assertEquals("everything=value;Path=path;Domain=domain;Expires=Thu, 01 Jan 1970 00:00:00 GMT;Secure;HttpOnly",fields.getStringField("Set-Cookie"));
+        assertEquals("everything=value;Path=path;Domain=domain;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",fields.getStringField("Set-Cookie"));
  
         fields.clear();
         fields.addSetCookie("ev erything","va lue","do main","pa th",1,"co mment",true,true,2);