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 2013/10/25 21:15:48 UTC

svn commit: r1535828 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/upgrade/AprServletInputStream.java java/org/apache/coyote/http11/upgrade/LocalStrings.properties webapps/docs/changelog.xml

Author: markt
Date: Fri Oct 25 19:15:47 2013
New Revision: 1535828

URL: http://svn.apache.org/r1535828
Log:
Fix the unexpected closure issues with APR/native, SSL and the drawboard example

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1534619

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java?rev=1535828&r1=1535827&r2=1535828&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java Fri Oct 25 19:15:47 2013
@@ -21,6 +21,8 @@ import java.io.IOException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.jni.OS;
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.jni.Status;
@@ -28,6 +30,8 @@ import org.apache.tomcat.util.net.Socket
 
 public class AprServletInputStream extends AbstractServletInputStream {
 
+    private static final Log log = LogFactory.getLog(AprServletInputStream.class);
+
     private final SocketWrapper<Long> wrapper;
     private final long socket;
     private volatile boolean eagain = false;
@@ -92,6 +96,18 @@ public class AprServletInputStream exten
         } else if (-result == Status.EAGAIN) {
             eagain = true;
             return 0;
+        } else if (-result == Status.APR_EGENERAL && wrapper.isSecure()) {
+            // Not entirely sure why this is necessary. Testing to date has not
+            // identified any issues with this but log it so it can be tracked
+            // if it is suspected of causing issues in the future.
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("apr.read.sslGeneralError",
+                        Long.valueOf(socket), wrapper));
+            }
+            eagain = true;
+            return 0;
+        } else if (-result == Status.APR_EOF) {
+            throw new EOFException(sm.getString("apr.clientAbort"));
         } else if ((OS.IS_WIN32 || OS.IS_WIN64) &&
                 (-result == Status.APR_OS_START_SYSERR + 10053)) {
             // 10053 on Windows is connection aborted

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1535828&r1=1535827&r2=1535828&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties Fri Oct 25 19:15:47 2013
@@ -26,6 +26,7 @@ upgrade.sis.write.ise=It is illegal to c
 
 apr.clientAbort=The client aborted the connection.
 apr.read.error=Unexpected error [{0}] reading data from the APR/native socket [{1}] with wrapper [{2}].
+apr.read.sslGeneralError=An APR general error was returned by the SSL read operation on APR/native socket [{0}] with wrapper [{1}]. It will be treated as EAGAIN and the socket returned to the poller.
 apr.write.error=Unexpected error [{0}] writing data to the APR/native socket [{1}] with wrapper [{2}].
 apr.closed=The socket [{0}] associated with this connection has been closed.
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1535828&r1=1535827&r2=1535828&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Oct 25 19:15:47 2013
@@ -91,6 +91,11 @@
         Implement a number of small refactorings to the APR/native handler for
         upgraded HTTP connections. (markt)
       </scode>
+      <fix>
+        Fix an issue with upgraded HTTP connections over HTTPS (e.g. secure
+        WebSocket) when using the APR/native connector that resulted in the
+        unexpected closure of the connection. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">



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