You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/08/25 20:38:52 UTC
cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse JSSESocketFactory.java
luehe 2003/08/25 11:38:52
Modified: util/java/org/apache/tomcat/util/net/jsse
JSSESocketFactory.java
Log:
Also consider last element in comma-separated list of ciphers, or the
case where the list contains a single element and no commas
Revision Changes Path
1.8 +44 -19 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
Index: JSSESocketFactory.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JSSESocketFactory.java 13 Aug 2003 05:32:53 -0000 1.7
+++ JSSESocketFactory.java 25 Aug 2003 18:38:52 -0000 1.8
@@ -172,28 +172,53 @@
if (requestedCiphers != null) {
Vector vec = null;
- int fromIndex = 0;
- int index = requestedCiphers.indexOf(',', fromIndex);
- while (index != -1) {
- String cipher
- = requestedCiphers.substring(fromIndex, index).trim();
- /*
- * Check to see if the requested cipher is among the supported
- * ciphers, i.e., may be enabled
- */
- for (int i=0; supportedCiphers != null
- && i<supportedCiphers.length; i++) {
- if (supportedCiphers[i].equals(cipher)) {
- if (vec == null) {
- vec = new Vector();
+ String cipher = requestedCiphers;
+ int index = requestedCiphers.indexOf(',');
+ if (index != -1) {
+ int fromIndex = 0;
+ while (index != -1) {
+ cipher = requestedCiphers.substring(fromIndex, index).trim();
+ if (cipher.length() > 0) {
+ /*
+ * Check to see if the requested cipher is among the
+ * supported ciphers, i.e., may be enabled
+ */
+ for (int i=0; supportedCiphers != null
+ && i<supportedCiphers.length; i++) {
+ if (supportedCiphers[i].equals(cipher)) {
+ if (vec == null) {
+ vec = new Vector();
+ }
+ vec.addElement(cipher);
+ break;
+ }
}
- vec.addElement(cipher);
- break;
}
- }
- fromIndex = index+1;
- index = requestedCiphers.indexOf(',', fromIndex);
+ fromIndex = index+1;
+ index = requestedCiphers.indexOf(',', fromIndex);
+ } // while
+ cipher = requestedCiphers.substring(fromIndex);
}
+
+ if (cipher != null) {
+ cipher = cipher.trim();
+ if (cipher.length() > 0) {
+ /*
+ * Check to see if the requested cipher is among the
+ * supported ciphers, i.e., may be enabled
+ */
+ for (int i=0; supportedCiphers != null
+ && i<supportedCiphers.length; i++) {
+ if (supportedCiphers[i].equals(cipher)) {
+ if (vec == null) {
+ vec = new Vector();
+ }
+ vec.addElement(cipher);
+ break;
+ }
+ }
+ }
+ }
if (vec != null) {
enabledCiphers = new String[vec.size()];