You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/07/22 16:36:16 UTC

svn commit: r966692 - in /tomcat/trunk: java/org/apache/catalina/connector/Request.java webapps/docs/changelog.xml

Author: markt
Date: Thu Jul 22 14:36:15 2010
New Revision: 966692

URL: http://svn.apache.org/viewvc?rev=966692&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49613
Improve performance for multiple calls to Request.getAttributeNames() when using SSL. Patch provided by Sampo Savolainen.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=966692&r1=966691&r2=966692&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Jul 22 14:36:15 2010
@@ -194,6 +194,13 @@ public class Request
 
 
     /**
+     * Flag that indicates if SSL attributes have been parsed to improve
+     * performance for applications (usually frameworks) that make multiple
+     * calls to {@link Request#getAttributeNames()}.
+     */
+    protected boolean sslAttributesParsed = false;
+
+    /**
      * List of read only attributes for this Request.
      */
     private HashMap<String,Object> readOnlyAttributes =
@@ -478,6 +485,7 @@ public class Request
         localName = null;
 
         attributes.clear();
+        sslAttributesParsed = false;
         notes.clear();
         cookies = null;
 
@@ -937,6 +945,7 @@ public class Request
                 attributes.put(Globals.SSL_SESSION_MGR_ATTR, attr);
             }
             attr = attributes.get(name);
+            sslAttributesParsed = true;
         }
         return attr;
     }
@@ -981,7 +990,7 @@ public class Request
      * attributes and may also support additional attributes.
      */
     public Enumeration<String> getAttributeNames() {
-        if (isSecure()) {
+        if (isSecure() && !sslAttributesParsed) {
             getAttribute(Globals.CERTIFICATES_ATTR);
         }
         return new Enumerator<String>(attributes.keySet(), true);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=966692&r1=966691&r2=966692&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Jul 22 14:36:15 2010
@@ -184,6 +184,11 @@
         by checking the <code>DirContext</code> or the cache. Test case based on
         a patch provided by Marc Guillemot. (markt)
       </fix>
+      <fix>
+        <bug>49613</bug>: Improve performance when using SSL for applications
+        that make multiple class to <code>Request.getAttributeNames()</code>.
+        Patch provided by Sampo Savolainen. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org