Author: remy.maucherat(a)jboss.com
Date: 2012-04-12 11:02:30 -0400 (Thu, 12 Apr 2012)
New Revision: 2020
Modified:
trunk/java/org/apache/catalina/Globals.java
trunk/java/org/apache/coyote/http11/Http11Processor.java
trunk/java/org/apache/tomcat/util/buf/EncodingToCharset.java
trunk/java/org/apache/tomcat/util/net/Constants.java
trunk/java/org/apache/tomcat/util/net/SSLSupport.java
trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
trunk/webapps/docs/changelog.xml
Log:
AS7-4469: Also fix session id attribute that got standardized in Servlet 3.
Modified: trunk/java/org/apache/catalina/Globals.java
===================================================================
--- trunk/java/org/apache/catalina/Globals.java 2012-04-12 14:22:08 UTC (rev 2019)
+++ trunk/java/org/apache/catalina/Globals.java 2012-04-12 15:02:30 UTC (rev 2020)
@@ -119,6 +119,8 @@
* for this SSL connection (as an object of type java.lang.String).
*/
public static final String SSL_SESSION_ID_ATTR =
+ "javax.servlet.request.ssl_session_id";
+ public static final String SSL_SESSION_ID_OLD_ATTR =
"javax.servlet.request.ssl_session";
Modified: trunk/java/org/apache/coyote/http11/Http11Processor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Processor.java 2012-04-12 14:22:08 UTC (rev
2019)
+++ trunk/java/org/apache/coyote/http11/Http11Processor.java 2012-04-12 15:02:30 UTC (rev
2020)
@@ -1054,20 +1054,16 @@
if (sslSupport != null) {
Object sslO = sslSupport.getCipherSuite();
if (sslO != null)
- request.setAttribute
- (SSLSupport.CIPHER_SUITE_KEY, sslO);
+
request.setAttribute(org.apache.tomcat.util.net.Constants.CIPHER_SUITE_KEY, sslO);
sslO = sslSupport.getPeerCertificateChain(false);
if (sslO != null)
- request.setAttribute
- (SSLSupport.CERTIFICATE_KEY, sslO);
+
request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, sslO);
sslO = sslSupport.getKeySize();
if (sslO != null)
- request.setAttribute
- (SSLSupport.KEY_SIZE_KEY, sslO);
+
request.setAttribute(org.apache.tomcat.util.net.Constants.KEY_SIZE_KEY, sslO);
sslO = sslSupport.getSessionId();
if (sslO != null)
- request.setAttribute
- (SSLSupport.SESSION_ID_KEY, sslO);
+
request.setAttribute(org.apache.tomcat.util.net.Constants.SESSION_ID_KEY, sslO);
}
} catch (Exception e) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
@@ -1142,9 +1138,8 @@
}
try {
Object sslO = sslSupport.getPeerCertificateChain(true);
- if( sslO != null) {
- request.setAttribute
- (SSLSupport.CERTIFICATE_KEY, sslO);
+ if (sslO != null) {
+
request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, sslO);
}
} catch (Exception e) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
Modified: trunk/java/org/apache/tomcat/util/buf/EncodingToCharset.java
===================================================================
--- trunk/java/org/apache/tomcat/util/buf/EncodingToCharset.java 2012-04-12 14:22:08 UTC
(rev 2019)
+++ trunk/java/org/apache/tomcat/util/buf/EncodingToCharset.java 2012-04-12 15:02:30 UTC
(rev 2020)
@@ -35,6 +35,9 @@
private static final Map<String, Charset> encodingToCharsetCache =
new HashMap<String, Charset>();
+ public static final Charset ISO_8859_1;
+ public static final Charset UTF_8;
+
static {
for (Charset charset: Charset.availableCharsets().values()) {
encodingToCharsetCache.put(charset.name().toUpperCase(Locale.US), charset);
@@ -42,6 +45,8 @@
encodingToCharsetCache.put(alias.toUpperCase(Locale.US), charset);
}
}
+ ISO_8859_1 = encodingToCharsetCache.get("ISO-8859-1");
+ UTF_8 = encodingToCharsetCache.get("UTF-8");
}
public static Charset toCharset(String encoding)
Modified: trunk/java/org/apache/tomcat/util/net/Constants.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/Constants.java 2012-04-12 14:22:08 UTC (rev
2019)
+++ trunk/java/org/apache/tomcat/util/net/Constants.java 2012-04-12 15:02:30 UTC (rev
2020)
@@ -47,7 +47,7 @@
* The Request attribute key for the session id.
* This one is a Tomcat extension to the Servlet spec.
*/
- public static final String SESSION_ID_KEY =
"javax.servlet.request.ssl_session";
+ public static final String SESSION_ID_KEY =
"javax.servlet.request.ssl_session_id";
}
Modified: trunk/java/org/apache/tomcat/util/net/SSLSupport.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/SSLSupport.java 2012-04-12 14:22:08 UTC (rev
2019)
+++ trunk/java/org/apache/tomcat/util/net/SSLSupport.java 2012-04-12 15:02:30 UTC (rev
2020)
@@ -27,28 +27,8 @@
*/
public interface SSLSupport {
- /**
- * The Request attribute key for the cipher suite.
- */
- public static final String CIPHER_SUITE_KEY =
"javax.servlet.request.cipher_suite";
/**
- * The Request attribute key for the key size.
- */
- public static final String KEY_SIZE_KEY =
"javax.servlet.request.key_size";
-
- /**
- * The Request attribute key for the client certificate chain.
- */
- public static final String CERTIFICATE_KEY =
"javax.servlet.request.X509Certificate";
-
- /**
- * The Request attribute key for the session id.
- * This one is a Tomcat extension to the Servlet spec.
- */
- public static final String SESSION_ID_KEY =
"javax.servlet.request.ssl_session";
-
- /**
* A mapping table to determine the number of effective bits in the key
* when using a cipher suite containing the specified cipher name. The
* underlying data came from the TLS Specification (RFC 2246), Appendix C.
Modified: trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2012-04-12 14:22:08 UTC
(rev 2019)
+++ trunk/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2012-04-12 15:02:30 UTC
(rev 2020)
@@ -31,6 +31,7 @@
import javax.net.ssl.SSLSocket;
import javax.security.cert.X509Certificate;
+import org.apache.tomcat.util.net.Constants;
import org.apache.tomcat.util.net.SSLSupport;
/** JSSESupport
@@ -195,7 +196,7 @@
SSLSupport.CipherData c_aux[]=ciphers;
if (session == null)
return null;
- Integer keySize = (Integer) session.getValue(KEY_SIZE_KEY);
+ Integer keySize = (Integer) session.getValue(Constants.KEY_SIZE_KEY);
if (keySize == null) {
int size = 0;
String cipherSuite = session.getCipherSuite();
@@ -205,8 +206,8 @@
break;
}
}
- keySize = new Integer(size);
- session.putValue(KEY_SIZE_KEY, keySize);
+ keySize = Integer.valueOf(size);
+ session.putValue(Constants.KEY_SIZE_KEY, keySize);
}
return keySize;
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2012-04-12 14:22:08 UTC (rev 2019)
+++ trunk/webapps/docs/changelog.xml 2012-04-12 15:02:30 UTC (rev 2020)
@@ -34,6 +34,9 @@
<fix>
<jboss-jira>AS7-4469</jboss-jira>: Rebase SSL valve used by
mod_headers. (remm)
</fix>
+ <fix>
+ <jboss-jira>AS7-4469</jboss-jira>: Fix SSL session id attribute name
(standardized in Servlet 3). (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">