Author: markt Date: Wed Aug 5 19:30:23 2015 New Revision: 1694294 URL: http://svn.apache.org/r1694294 Log: Align org.apache.tomcat.jni with 7.0.x and 8.0.x Backport improvements to AprLifecycleListener
Added: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Buffer.java - copied unchanged from r1694292, tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Buffer.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/LibraryNotFoundError.java - copied unchanged from r1694292, tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/LibraryNotFoundError.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Thread.java - copied unchanged from r1694292, tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Thread.java Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Address.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Error.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Library.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/OS.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Poll.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSL.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSLContext.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Socket.java tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Aug 5 19:30:23 2015 @@ -28,36 +28,6 @@ None PATCHES PROPOSED TO BACKPORT: [ New proposals should be added at the end of the list ] -* Align org.apache.tomcat.jni with 7.0.x and 8.0.x - Backport improvements to AprLifecycleListener - svn cp the following o.a.t.jni classes from 7.0.x: - Buffer - LibraryNotFoundError - Thread - http://people.apache.org/~markt/patches/2015-04-08-jni-align-tc6-v1.patch - +1: markt, kkolinko (comment below), remm - -1: - - kkolinko: - I do not see much benefit in adding classes Buffer and Thread that - Tomcat 6 code does not use. But I see no technical issue to really - object adding them. If someone sees a benefit, feel free to go on. - - Historical context: - 1) Initial Tomcat 6 commit (r389146) does not have those classes - https://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/?pathrev=389146 - - 2) They were added to trunk in r1442914 (2013-02-06) - https://svn.apache.org/r1442914 - - A thread of that time mentions that those classes originate from - Apache Mina. "Again: Java classes in tcnative" (2013-02-05) - http://markmail.org/message/pohmyvfznjrpmtr2 - - 3) "Re: r1672047" thread (2015-04-08) - http://markmail.org/message/ey2agr4eg5ws5stc - - * Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57896 Backport org.apache.tomcat.util.http.ServerCookie.PRESERVE_COOKIE_HEADER option Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java Wed Aug 5 19:30:23 2015 @@ -28,6 +28,7 @@ import org.apache.catalina.util.StringMa import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jni.Library; +import org.apache.tomcat.jni.LibraryNotFoundError; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.util.ExceptionUtils; @@ -39,20 +40,17 @@ import org.apache.tomcat.util.ExceptionU * * @author Remy Maucherat * @author Filip Hanik - * * @since 4.1 */ - public class AprLifecycleListener implements LifecycleListener { - private static Log log = LogFactory.getLog(AprLifecycleListener.class); - + private static final Log log = LogFactory.getLog(AprLifecycleListener.class); private static boolean instanceCreated = false; /** * The string manager for this package. */ - protected static StringManager sm = + protected static final StringManager sm = StringManager.getManager(Constants.Package); @@ -62,6 +60,7 @@ public class AprLifecycleListener protected static final int TCN_REQUIRED_MAJOR = 1; protected static final int TCN_REQUIRED_MINOR = 1; protected static final int TCN_REQUIRED_PATCH = 30; + protected static final int TCN_RECOMMENDED_MINOR = 1; protected static final int TCN_RECOMMENDED_PV = 33; @@ -71,6 +70,7 @@ public class AprLifecycleListener protected static String SSLRandomSeed = "builtin"; protected static boolean sslInitialized = false; protected static boolean aprInitialized = false; + @Deprecated protected static boolean sslAvailable = false; protected static boolean aprAvailable = false; protected static boolean fipsModeActive = false; @@ -145,11 +145,7 @@ public class AprLifecycleListener terminateAPR(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - if (!log.isDebugEnabled()) { log.info(sm.getString("aprListener.aprDestroy")); - } else { - log.debug(sm.getString("aprListener.aprDestroy"), t); - } } } } @@ -178,34 +174,33 @@ public class AprLifecycleListener int patch = 0; int apver = 0; int rqver = TCN_REQUIRED_MAJOR * 1000 + TCN_REQUIRED_MINOR * 100 + TCN_REQUIRED_PATCH; - int rcver = TCN_REQUIRED_MAJOR * 1000 + TCN_REQUIRED_MINOR * 100 + TCN_RECOMMENDED_PV; + int rcver = TCN_REQUIRED_MAJOR * 1000 + TCN_RECOMMENDED_MINOR * 100 + TCN_RECOMMENDED_PV; + if (aprInitialized) { return; } aprInitialized = true; try { - String methodName = "initialize"; - Class<?> paramTypes[] = new Class[1]; - paramTypes[0] = String.class; - Object paramValues[] = new Object[1]; - paramValues[0] = null; - Class<?> clazz = Class.forName("org.apache.tomcat.jni.Library"); - Method method = clazz.getMethod(methodName, paramTypes); - method.invoke(null, paramValues); - major = clazz.getField("TCN_MAJOR_VERSION").getInt(null); - minor = clazz.getField("TCN_MINOR_VERSION").getInt(null); - patch = clazz.getField("TCN_PATCH_VERSION").getInt(null); + Library.initialize(null); + major = Library.TCN_MAJOR_VERSION; + minor = Library.TCN_MINOR_VERSION; + patch = Library.TCN_PATCH_VERSION; apver = major * 1000 + minor * 100 + patch; + } catch (LibraryNotFoundError lnfe) { + // Library not on path + if (log.isDebugEnabled()) { + log.debug(sm.getString("aprListener.aprInitDebug", + lnfe.getLibraryNames(), System.getProperty("java.library.path"), + lnfe.getMessage()), lnfe); + } + log.info(sm.getString("aprListener.aprInit", + System.getProperty("java.library.path"))); + return; } catch (Throwable t) { + // Library present but failed to load ExceptionUtils.handleThrowable(t); - if (!log.isDebugEnabled()) { - log.info(sm.getString("aprListener.aprInit", - System.getProperty("java.library.path"))); - } else { - log.debug(sm.getString("aprListener.aprInit", - System.getProperty("java.library.path")), t); - } + log.warn(sm.getString("aprListener.aprInitError", t.getMessage()), t); return; } if (apver < rqver) { @@ -224,31 +219,19 @@ public class AprLifecycleListener return; } if (apver < rcver) { - if (!log.isDebugEnabled()) { - log.info(sm.getString("aprListener.tcnVersion", major + "." - + minor + "." + patch, + log.info(sm.getString("aprListener.tcnVersion", + major + "." + minor + "." + patch, TCN_REQUIRED_MAJOR + "." + - TCN_REQUIRED_MINOR + "." + + TCN_RECOMMENDED_MINOR + "." + TCN_RECOMMENDED_PV)); - } else { - log.debug(sm.getString("aprListener.tcnVersion", major + "." - + minor + "." + patch, - TCN_REQUIRED_MAJOR + "." + - TCN_REQUIRED_MINOR + "." + - TCN_RECOMMENDED_PV)); - } - } - if (!log.isDebugEnabled()) { - log.info(sm.getString("aprListener.tcnValid", major + "." - + minor + "." + patch, - Library.APR_MAJOR_VERSION + "." - + Library.APR_MINOR_VERSION + "." - + Library.APR_PATCH_VERSION)); - } - else { - log.debug(sm.getString("aprListener.tcnValid", major + "." - + minor + "." + patch)); } + + log.info(sm.getString("aprListener.tcnValid", + major + "." + minor + "." + patch, + Library.APR_MAJOR_VERSION + "." + + Library.APR_MINOR_VERSION + "." + + Library.APR_PATCH_VERSION)); + // Log APR flags log.info(sm.getString("aprListener.flags", Boolean.valueOf(Library.APR_HAVE_IPV6), Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties Wed Aug 5 19:30:23 2015 @@ -37,6 +37,7 @@ applicationRequest.badRequest=Request is applicationResponse.badParent=Cannot locate parent Response implementation applicationResponse.badResponse=Response is not a javax.servlet.ServletResponseWrapper aprListener.aprInit=The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: {0} +aprListener.aprInitError=The APR based Apache Tomcat Native library failed to load. The error reported was [{0}] aprListener.tcnInvalid=An incompatible version {0} of the APR based Apache Tomcat Native library is installed, while Tomcat requires version {1} aprListener.tcnVersion=An older version {0} of the APR based Apache Tomcat Native library is installed, while Tomcat recommends version greater than {1} aprListener.aprDestroy=Failed shutdown of APR based Apache Tomcat Native library Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Address.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Address.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Address.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Address.java Wed Aug 5 19:30:23 2015 @@ -23,7 +23,7 @@ package org.apache.tomcat.jni; */ public class Address { - static public String APR_ANYADDR = "0.0.0.0"; + public static final String APR_ANYADDR = "0.0.0.0"; /** * Fill the Sockaddr class from apr_sockaddr_t * @param info Sockaddr class to fill Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Error.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Error.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Error.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Error.java Wed Aug 5 19:30:23 2015 @@ -23,15 +23,17 @@ package org.apache.tomcat.jni; */ public class Error extends Exception { + private static final long serialVersionUID = 1L; + /** * APR error type. */ - private int error; + private final int error; /** * A description of the problem. */ - private String description; + private final String description; /** * Construct an APRException. Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Library.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Library.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Library.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Library.java Wed Aug 5 19:30:23 2015 @@ -17,6 +17,8 @@ package org.apache.tomcat.jni; +import java.io.File; + /** Library * * @author Mladen Turk @@ -24,34 +26,52 @@ package org.apache.tomcat.jni; public final class Library { /* Default library names */ - private static String [] NAMES = {"tcnative-1", "libtcnative-1"}; + private static final String [] NAMES = {"tcnative-1", "libtcnative-1"}; /* * A handle to the unique Library singleton instance. */ private static Library _instance = null; - private Library() - { + private Library() throws Throwable { boolean loaded = false; - String err = ""; + String path = System.getProperty("java.library.path"); + String [] paths = path.split(File.pathSeparator); + StringBuilder err = new StringBuilder(); for (int i = 0; i < NAMES.length; i++) { try { System.loadLibrary(NAMES[i]); loaded = true; + } catch (ThreadDeath t) { + throw t; + } catch (VirtualMachineError t) { + // Don't use a Java 7 multiple exception catch so we can keep + // the JNI code identical between Tomcat 6/7/8 + throw t; + } catch (Throwable t) { + String name = System.mapLibraryName(NAMES[i]); + for (int j = 0; j < paths.length; j++) { + java.io.File fd = new java.io.File(paths[j] , name); + if (fd.exists()) { + // File exists but failed to load + throw t; + } + } + if (i > 0) { + err.append(", "); + } + err.append(t.getMessage()); } - catch (Throwable e) { - if ( i > 0) - err += ", "; - err += e.getMessage(); - } - if (loaded) + if (loaded) { break; + } } if (!loaded) { - err += "("; - err += System.getProperty("java.library.path"); - err += ")"; - throw new UnsatisfiedLinkError(err); + StringBuilder names = new StringBuilder(); + for (String name : NAMES) { + names.append(name); + names.append(", "); + } + throw new LibraryNotFoundError(names.substring(0, names.length() -2), err.toString()); } } @@ -83,8 +103,6 @@ public final class Library { public static int TCN_PATCH_VERSION = 0; /* TCN_IS_DEV_VERSION */ public static int TCN_IS_DEV_VERSION = 0; - /* TCN_FULL_VERSION */ - public static int TCN_FULL_VERSION = 0; /* APR_MAJOR_VERSION */ public static int APR_MAJOR_VERSION = 0; /* APR_MINOR_VERSION */ @@ -150,7 +168,7 @@ public final class Library { * @param libraryName the name of the library to load */ public static boolean initialize(String libraryName) - throws Exception + throws Throwable { if (_instance == null) { if (libraryName == null) @@ -161,9 +179,6 @@ public final class Library { TCN_MINOR_VERSION = version(0x02); TCN_PATCH_VERSION = version(0x03); TCN_IS_DEV_VERSION = version(0x04); - TCN_FULL_VERSION = TCN_MAJOR_VERSION * 1000 + - TCN_MINOR_VERSION * 100 + - TCN_PATCH_VERSION; APR_MAJOR_VERSION = version(0x11); APR_MINOR_VERSION = version(0x12); APR_PATCH_VERSION = version(0x13); Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/OS.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/OS.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/OS.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/OS.java Wed Aug 5 19:30:23 2015 @@ -31,6 +31,7 @@ public class OS { private static final int LINUX = 5; private static final int SOLARIS = 6; private static final int BSD = 7; + private static final int MACOSX = 8; public static final int LOG_EMERG = 1; public static final int LOG_ERROR = 2; @@ -52,6 +53,7 @@ public class OS { public static final boolean IS_LINUX = is(LINUX); public static final boolean IS_SOLARIS = is(SOLARIS); public static final boolean IS_BSD = is(BSD); + public static final boolean IS_MACOSX = is(MACOSX); /** * Get the name of the system default character set. Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Poll.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Poll.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Poll.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Poll.java Wed Aug 5 19:30:23 2015 @@ -87,6 +87,16 @@ public class Poll { int reqevents); /** + * Add a socket to a pollset with a specific timeout. + * @param pollset The pollset to which to add the socket + * @param sock The sockets to add + * @param reqevents requested events + * @param timeout requested timeout in microseconds (-1 for infinite) + */ + public static native int addWithTimeout(long pollset, long sock, + int reqevents, long timeout); + + /** * Remove a descriptor from a pollset * @param pollset The pollset from which to remove the descriptor * @param sock The socket to remove Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSL.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSL.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSL.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSL.java Wed Aug 5 19:30:23 2015 @@ -74,7 +74,7 @@ public final class SSL { public static final int SSL_PROTOCOL_TLSV1 = (1<<2); public static final int SSL_PROTOCOL_TLSV1_1 = (1<<3); public static final int SSL_PROTOCOL_TLSV1_2 = (1<<4); - public static final int SSL_PROTOCOL_ALL = (SSL_PROTOCOL_TLSV1); + public static final int SSL_PROTOCOL_ALL = (SSL_PROTOCOL_TLSV1 | SSL_PROTOCOL_TLSV1_1 | SSL_PROTOCOL_TLSV1_2); /* * Define the SSL verify levels @@ -118,6 +118,10 @@ public final class SSL { public static final int SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 0x00010000; /* Don't use compression even if supported */ public static final int SSL_OP_NO_COMPRESSION = 0x00020000; + /* Permit unsafe legacy renegotiation */ + public static final int SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 0x00040000; + /* If set, always create a new key when using tmp_eddh parameters */ + public static final int SSL_OP_SINGLE_ECDH_USE = 0x00080000; /* If set, always create a new key when using tmp_dh parameters */ public static final int SSL_OP_SINGLE_DH_USE = 0x00100000; /* Set to always use the tmp_rsa key when doing RSA operations, @@ -135,10 +139,23 @@ public final class SSL { public static final int SSL_OP_NO_SSLv2 = 0x01000000; public static final int SSL_OP_NO_SSLv3 = 0x02000000; public static final int SSL_OP_NO_TLSv1 = 0x04000000; + public static final int SSL_OP_NO_TLSv1_2 = 0x08000000; + public static final int SSL_OP_NO_TLSv1_1 = 0x10000000; - /* The next flag deliberately changes the ciphertest, this is a check - * for the PKCS#1 attack */ + public static final int SSL_OP_NO_TICKET = 0x00004000; + + // SSL_OP_PKCS1_CHECK_1 and SSL_OP_PKCS1_CHECK_2 flags are unsupported + // in the current version of OpenSSL library. See ssl.h changes in commit + // 7409d7ad517650db332ae528915a570e4e0ab88b (30 Apr 2011) of OpenSSL. + /** + * @deprecated Unsupported in the current version of OpenSSL + */ + @Deprecated public static final int SSL_OP_PKCS1_CHECK_1 = 0x08000000; + /** + * @deprecated Unsupported in the current version of OpenSSL + */ + @Deprecated public static final int SSL_OP_PKCS1_CHECK_2 = 0x10000000; public static final int SSL_OP_NETSCAPE_CA_DN_BUG = 0x20000000; public static final int SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0x40000000; Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSLContext.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSLContext.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSLContext.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/SSLContext.java Wed Aug 5 19:30:23 2015 @@ -90,6 +90,13 @@ public final class SSLContext { public static native void setOptions(long ctx, int options); /** + * Clears OpenSSL Options. + * @param ctx Server or Client context to use. + * @param options See SSL.SSL_OP_* for option flags. + */ + public static native void clearOptions(long ctx, int options); + + /** * Sets the "quiet shutdown" flag for <b>ctx</b> to be * <b>mode</b>. SSL objects created from <b>ctx</b> inherit the * <b>mode</b> valid at the time and may be 0 or 1. Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Socket.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Socket.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Socket.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/jni/Socket.java Wed Aug 5 19:30:23 2015 @@ -249,6 +249,30 @@ public class Socket { */ public static native int sendb(long sock, ByteBuffer buf, int offset, int len); + + /** + * Send data over a network without retry + * <PRE> + * This functions acts like a blocking write by default. To change + * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK + * socket option. + * + * It is possible for both bytes to be sent and an error to be returned. + * + * </PRE> + * @param sock The socket to send the data over. + * @param buf The Byte buffer which contains the data to be sent. + * @param offset The offset within the buffer array of the first buffer from + * which bytes are to be retrieved; must be non-negative + * and no larger than buf.length + * @param len The maximum number of buffers to be accessed; must be non-negative + * and no larger than buf.length - offset + * @return The number of bytes send. + * + */ + public static native int sendib(long sock, ByteBuffer buf, + int offset, int len); + /** * Send data over a network using internally set ByteBuffer */ @@ -256,6 +280,13 @@ public class Socket { int offset, int len); /** + * Send data over a network using internally set ByteBuffer + * without internal retry. + */ + public static native int sendibb(long sock, + int offset, int len); + + /** * Send multiple packets of data over a network. * <PRE> * This functions acts like a blocking write by default. To change @@ -534,4 +565,20 @@ public class Socket { * @param buf The ByteBuffer */ public static native void setrbb(long sock, ByteBuffer buf); + + /** + * Set the data associated with the current socket. + * @param sock The currently open socket. + * @param data The user data to associate with the socket. + * @param key The key to associate with the data. + */ + public static native int dataSet(long sock, String key, Object data); + + /** + * Return the data associated with the current socket + * @param key The key to associate with the user data. + * @param sock The currently open socket. + * @return Data or null in case of error. + */ + public static native Object dataGet(long sock, String key); } Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Aug 5 19:30:23 2015 @@ -733,54 +733,30 @@ public class AprEndpoint extends Abstrac if (SSLEnabled) { // SSL protocol - int value; - // This branch can be removed, once the required version is at least 1.1.21. - if (Library.TCN_FULL_VERSION <= 1120) { + int value = SSL.SSL_PROTOCOL_NONE; + if (SSLProtocol == null || SSLProtocol.length() == 0) { value = SSL.SSL_PROTOCOL_ALL; - if ("SSLv2".equalsIgnoreCase(SSLProtocol)) { - value = SSL.SSL_PROTOCOL_SSLV2; - } else if ("SSLv3".equalsIgnoreCase(SSLProtocol)) { - value = SSL.SSL_PROTOCOL_SSLV3; - } else if ("TLSv1".equalsIgnoreCase(SSLProtocol)) { - value = SSL.SSL_PROTOCOL_TLSV1; - } else if ("SSLv2+SSLv3".equalsIgnoreCase(SSLProtocol)) { - value = SSL.SSL_PROTOCOL_SSLV2 | SSL.SSL_PROTOCOL_SSLV3; - } else if ("all".equalsIgnoreCase(SSLProtocol) || - SSLProtocol == null || SSLProtocol.length() == 0) { - // NOOP, use the default defined above - } else { - // Protocol not recognized, fail to start as it is safer than - // continuing with the default which might enable more than the - // is required - throw new Exception(sm.getString( - "endpoint.apr.invalidSslProtocol", SSLProtocol)); - } } else { - value = SSL.SSL_PROTOCOL_NONE; - if (SSLProtocol == null || SSLProtocol.length() == 0) { - value = SSL.SSL_PROTOCOL_ALL; - } else { - for (String protocol : SSLProtocol.split("\\+")) { - protocol = protocol.trim(); - if ("SSLv2".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_SSLV2; - } else if ("SSLv3".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_SSLV3; - } else if ("TLSv1".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_TLSV1; - } else if ("TLSv1.1".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_TLSV1_1; - } else if ("TLSv1.2".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_TLSV1_2; - } else if ("all".equalsIgnoreCase(protocol)) { - value |= SSL.SSL_PROTOCOL_ALL; - } else { - // Protocol not recognized, fail to start as it is safer than - // continuing with the default which might enable more than the - // is required - throw new Exception(sm.getString( - "endpoint.apr.invalidSslProtocol", SSLProtocol)); - } + for (String protocol : SSLProtocol.split("\\+")) { + protocol = protocol.trim(); + if ("SSLv2".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_SSLV2; + } else if ("SSLv3".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_SSLV3; + } else if ("TLSv1".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_TLSV1; + } else if ("TLSv1.1".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_TLSV1_1; + } else if ("TLSv1.2".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_TLSV1_2; + } else if ("all".equalsIgnoreCase(protocol)) { + value |= SSL.SSL_PROTOCOL_ALL; + } else { + // Protocol not recognized, fail to start as it is safer than + // continuing with the default which might enable more than the + // is required + throw new Exception(sm.getString( + "endpoint.apr.invalidSslProtocol", SSLProtocol)); } } } Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1694294&r1=1694293&r2=1694294&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Aug 5 19:30:23 2015 @@ -44,6 +44,23 @@ General, Catalina, Coyote, Jasper, Cluster, Web applications, Other --> <section name="Tomcat 6.0.45 (jfclere)"> + <subsection name="Catalina"> + <changelog> + <fix> + Back-port various improvements to the <code>AprLifecycleListener</code> + including the fix for <bug>57021</bug> that improves logging when the + Tomcat-Native DLL fails to load. (markt) + </fix> + </changelog> + </subsection> + <subsection name="Coyote"> + <changelog> + <add> + Align the Java side of the tc-native connector with the Tomcat 7 + implementation to ease future maintenance. (markt) + </add> + </changelog> + </subsection> <subsection name="Web applications"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org