tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1528424 - in /tomcat/trunk/java/org/apache: coyote/http11/upgrade/AprServletInputStream.java coyote/http11/upgrade/LocalStrings.properties tomcat/util/net/AprEndpoint.java tomcat/websocket/server/WsHttpUpgradeHandler.java
Date Wed, 02 Oct 2013 10:56:25 GMT
Author: markt
Date: Wed Oct  2 10:56:24 2013
New Revision: 1528424

URL: http://svn.apache.org/r1528424
Log:
IOExceptions need to trigger the closing of the WebSocket connection.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java?rev=1528424&r1=1528423&r2=1528424&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletInputStream.java Wed Oct
 2 10:56:24 2013
@@ -16,10 +16,12 @@
  */
 package org.apache.coyote.http11.upgrade;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
+import org.apache.tomcat.jni.OS;
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.jni.Status;
 import org.apache.tomcat.util.net.SocketWrapper;
@@ -92,6 +94,10 @@ public class AprServletInputStream exten
         } else if (-result == Status.EAGAIN) {
             eagain = true;
             return 0;
+        } else if ((OS.IS_WIN32 || OS.IS_WIN64) &&
+                (-result == Status.APR_OS_START_SYSERR + 10053)) {
+            // 10053 on Windows is connection aborted
+            throw new EOFException(sm.getString("apr.clientAbort"));
         } else {
             throw new IOException(sm.getString("apr.read.error",
                     Integer.valueOf(-result)));

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1528424&r1=1528423&r2=1528424&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties Wed Oct  2
10:56:24 2013
@@ -24,6 +24,7 @@ upgrade.sos.canWrite.ise=It is illegal t
 upgrade.sos.writeListener.null=It is illegal to pass null to setWriteListener()
 upgrade.sis.write.ise=It is illegal to call any of the write() methods in non-blocking mode
without first checking that there is space available by calling isReady()
 
+apr.clientAbort=The client aborted the connection.
 apr.read.error=Unexpected error [{0}] reading data from the APR/native socket.
 apr.write.error=Unexpected error [{0}] writing data to the APR/native socket.
 apr.closed=The socket associated with this connection has been closed.

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=1528424&r1=1528423&r2=1528424&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Oct  2 10:56:24 2013
@@ -1826,7 +1826,7 @@ public class AprEndpoint extends Abstrac
                                 } else if (((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
                                         || ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)
                                         || ((desc[n*2] & Poll.APR_POLLNVAL) == Poll.APR_POLLNVAL))
{
-                                    if (wrapper.isAsync()) {
+                                    if (wrapper.isAsync() || wrapper.isUpgraded()) {
                                         // Must be using non-blocking IO for the socket to
be in the
                                         // poller during async processing. Need to trigger
error
                                         // handling. Poller may return error codes plus the
flags it

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java?rev=1528424&r1=1528423&r2=1528424&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java Wed Oct
 2 10:56:24 2013
@@ -198,6 +198,9 @@ public class WsHttpUpgradeHandler implem
                 wsProtocolHandler.close(cr);
             } catch (IOException ioe) {
                 onError(ioe);
+                CloseReason cr = new CloseReason(
+                        CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage());
+                wsProtocolHandler.close(cr);
             }
         }
 



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


Mime
View raw message