Author: markt
Date: Sun Oct 13 09:42:32 2013
New Revision: 1531659

URL: http://svn.apache.org/r1531659
Log:
Fix the regression in r1530269. Enabling/disabling sendfile should occur during 
bind not during start.
Add a warning message if the user tries to explicitly enable sendfile with SSL.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1531659&r1=1531658&r2=1531659&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Sun Oct 13 
09:42:32 2013
@@ -457,8 +457,11 @@ public class AprEndpoint extends Abstrac
             Socket.optSet(serverSock, Socket.APR_SO_REUSEADDR, 1);
         }
 
-        // Sendfile usage on systems which don't support it cause major 
problems
-        if (useSendfile && !Library.APR_HAS_SENDFILE) {
+        // Enable Sendfile by default if it has not been configured but usage 
on
+        // systems which don't support it cause major problems
+        if (!useSendFileSet) {
+            useSendfile = Library.APR_HAS_SENDFILE;
+        } else if (useSendfile && !Library.APR_HAS_SENDFILE) {
             useSendfile = false;
         }
 
@@ -583,7 +586,12 @@ public class AprEndpoint extends Abstrac
             }
             SSLContext.setVerify(sslContext, value, SSLVerifyDepth);
             // For now, sendfile is not supported with SSL
-            useSendfile = false;
+            if (useSendfile) {
+                useSendfile = false;
+                if (useSendFileSet) {
+                    log.warn(sm.getString("endpoint.apr.noSendfileWithSSL"));
+                }
+            }
         }
     }
 
@@ -617,9 +625,6 @@ public class AprEndpoint extends Abstrac
             pollerThread.start();
 
             // Start sendfile thread
-            if (!useSendFileSet) {
-                useSendfile = Library.APR_HAS_SENDFILE;
-            }
             if (useSendfile) {
                 sendfile = new Sendfile();
                 sendfile.init();

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties?rev=1531659&r1=1531658&r2=1531659&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties 
Sun Oct 13 09:42:32 2013
@@ -55,4 +55,5 @@ endpoint.apr.pollAddInvalid=Invalid atte
 endpoint.apr.pollError=Poller failed with error [{0}] : [{1}]
 endpoint.apr.pollUnknownEvent=A socket was returned from the poller with an 
unrecognized event [{0}]
 endpoint.apr.invalidSslProtocol=An invalid value [{0}] was provided for the 
SSLProtocol attribute
+endpoint.apr.noSendfileWithSSL=Sendfile is not supported for the APR/native 
connector when SSL is enabled
 endpoint.nio.selectorCloseFail=Failed to close selector when closing the poller



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

Reply via email to