Author: markt Date: Mon Nov 24 09:37:03 2014 New Revision: 1641343 URL: http://svn.apache.org/r1641343 Log: Fix SSL for NIO that was broken by AJP refactoring. Add some TODO markers as this is only a temporary fix.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1641343&r1=1641342&r2=1641343&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java Mon Nov 24 09:37:03 2014 @@ -62,6 +62,8 @@ public class NioChannel implements ByteC */ public void reset() throws IOException { bufHandler.getReadBuffer().clear(); + // TODO AJP and HTTPS have different expectations for the state of + // the buffer at the start of a read. These need to be reconciled. bufHandler.getReadBuffer().limit(0); bufHandler.getWriteBuffer().clear(); this.sendFile = false; Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1641343&r1=1641342&r2=1641343&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Nov 24 09:37:03 2014 @@ -1635,6 +1635,8 @@ public class NioEndpoint extends Abstrac readbuf = ByteBuffer.allocate(readsize); writebuf = ByteBuffer.allocate(writesize); } + // TODO AJP and HTTPS have different expectations for the state of + // the buffer at the start of a read. These need to be reconciled. readbuf.limit(0); } Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1641343&r1=1641342&r2=1641343&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Mon Nov 24 09:37:03 2014 @@ -196,6 +196,10 @@ public class SecureNioChannel extends Ni } else if ( handshake.getStatus() == Status.BUFFER_UNDERFLOW ){ //read more data, reregister for OP_READ return SelectionKey.OP_READ; + } else if (handshake.getStatus() == Status.BUFFER_OVERFLOW) { + // TODO AJP and HTTPS have different expectations for the state of + // the buffer at the start of a read. These need to be reconciled. + bufHandler.getReadBuffer().compact(); } else { throw new IOException(sm.getString("channel.nio.ssl.unexpectedStatusDuringWrap", handshakeStatus)); }//switch --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org