View | Details | Raw Unified | Return to bug 46403
Collapse All | Expand All

(-)java/org/apache/tomcat/util/http/ServerCookie.java (-13 / +13 lines)
Lines 288-309 Link Here
288
        // Max-Age=secs ... or use old "Expires" format
288
        // Max-Age=secs ... or use old "Expires" format
289
        // TODO RFC2965 Discard
289
        // TODO RFC2965 Discard
290
        if (maxAge >= 0) {
290
        if (maxAge >= 0) {
291
            if (version == 0) {
291
            if (version > 0) {
292
                // Wdy, DD-Mon-YY HH:MM:SS GMT ( Expires Netscape format )
293
                buf.append ("; Expires=");
294
                // To expire immediately we need to set the time in past
295
                if (maxAge == 0)
296
                    buf.append( ancientDate );
297
                else
298
                    DateTool.formatOldCookie
299
                        (new Date( System.currentTimeMillis() +
300
                                   maxAge *1000L), buf,
301
                         new FieldPosition(0));
302
303
            } else {
304
                buf.append ("; Max-Age=");
292
                buf.append ("; Max-Age=");
305
                buf.append (maxAge);
293
                buf.append (maxAge);
306
            }
294
            }
295
            
296
            // Append old-stlye Expires parameter, required by IE6 & IE7            
297
            // Wdy, DD-Mon-YY HH:MM:SS GMT ( Expires Netscape format )
298
            buf.append ("; Expires=");
299
            // To expire immediately we need to set the time in past
300
            if (maxAge == 0)
301
                buf.append( ancientDate );
302
            else
303
                DateTool.formatOldCookie
304
                    (new Date( System.currentTimeMillis() +
305
                               maxAge *1000L), buf,
306
                     new FieldPosition(0));
307
        }
307
        }
308
308
309
        // Path=path
309
        // Path=path

Return to bug 46403