tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
Date Wed, 13 Aug 2003 00:13:43 GMT
luehe       2003/08/12 17:13:43

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteResponse.java
  Log:
  Optimizations:
  
  - Bugtraq 4730584 ("HttpResponseBase should create date format only
    when needed")
  
  - Bugtraq 4701695 ("avoid reformatting constant Expires header on every
    request")
  
  Revision  Changes    Path
  1.6       +22 -12    jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java
  
  Index: CoyoteResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CoyoteResponse.java	23 Jun 2003 19:14:41 -0000	1.5
  +++ CoyoteResponse.java	13 Aug 2003 00:13:43 -0000	1.6
  @@ -113,7 +113,7 @@
   import org.apache.catalina.util.CharsetMapper;
   import org.apache.catalina.util.RequestUtil;
   import org.apache.catalina.util.StringManager;
  -
  +import org.apache.catalina.util.DateTool;
   
   /**
    * Wrapper object for the Coyote response.
  @@ -131,10 +131,7 @@
   
   
       public CoyoteResponse() {
  -
  -        format.setTimeZone(TimeZone.getTimeZone("GMT"));
           urlEncoder.addSafeCharacter('/');
  -
       }
   
   
  @@ -143,8 +140,7 @@
       /**
        * The date format we will use for creating date headers.
        */
  -    protected final SimpleDateFormat format =
  -        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
  +    protected SimpleDateFormat format = null;
   
   
       /**
  @@ -939,8 +935,15 @@
               return;
   
           // Ignore any call from an included servlet
  -        if (included)
  +        if (included) {
               return;
  +        }
  +
  +        if (format == null) {
  +            format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
  +                                          Locale.US);
  +            format.setTimeZone(TimeZone.getTimeZone("GMT"));
  +        }
   
           addHeader(name, FastHttpDateFormat.formatDate(value, format));
   
  @@ -1190,8 +1193,15 @@
               return;
   
           // Ignore any call from an included servlet
  -        if (included)
  +        if (included) {
               return;
  +        }
  +
  +        if (format == null) {
  +            format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
  +                                          Locale.US);
  +            format.setTimeZone(TimeZone.getTimeZone("GMT"));
  +        }
   
           setHeader(name, FastHttpDateFormat.formatDate(value, format));
   
  
  
  

Mime
View raw message