Author: markt Date: Fri Feb 27 15:01:43 2015 New Revision: 1662711 URL: http://svn.apache.org/r1662711 Log: Ensure write timeouts when using SSL propogate up the stack.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 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=1662711&r1=1662710&r2=1662711&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Fri Feb 27 15:01:43 2015 @@ -2629,16 +2629,18 @@ public class AprEndpoint extends Abstrac // APR + SSL requires that exactly the same parameters are // passed when re-attempting the write } - int sslWritten = Socket.sendb(getSocket().longValue(), sslOutputBuffer, + thisTime = Socket.sendb(getSocket().longValue(), sslOutputBuffer, sslOutputBuffer.position(), sslOutputBuffer.limit()); - if (sslWritten > 0) { - sslOutputBuffer.position( - sslOutputBuffer.position() + sslWritten); + if (thisTime > 0) { + sslOutputBuffer.position(sslOutputBuffer.position() + thisTime); } } else { socketBufferHandler.configureWriteBufferForRead(); thisTime = Socket.sendb(getSocket().longValue(), socketWriteBuffer, socketWriteBuffer.position(), socketWriteBuffer.remaining()); + if (thisTime > 0) { + socketWriteBuffer.position(socketWriteBuffer.position() + thisTime); + } } if (Status.APR_STATUS_IS_EAGAIN(-thisTime)) { thisTime = 0; @@ -2652,7 +2654,6 @@ public class AprEndpoint extends Abstrac throw new IOException(sm.getString("socket.apr.write.error", Integer.valueOf(-thisTime), getSocket(), this)); } - socketWriteBuffer.position(socketWriteBuffer.position() + thisTime); } while ((thisTime > 0 || getBlockingStatus()) && socketWriteBuffer.hasRemaining()); // If there is data left in the buffer the socket will be registered for --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org