394383 - NPNServerConnection not upgraded causes spin.

We now guard the case where fill() returns, the TLS handshake is completed,
but we have no next protocol.
If that happens, we force the default protocol.
This commit is contained in:
Simone Bordet 2012-11-15 14:21:50 +01:00
parent 4ff9bdc54d
commit a736ebc062
1 changed files with 10 additions and 1 deletions

View File

@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.server;
import java.io.IOException;
import java.util.List;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Connection;
@ -69,7 +70,15 @@ public class NextProtoNegoServerConnection extends AbstractConnection implements
if (filled <= 0 || nextProtocol != null)
break;
}
if (nextProtocol == null && engine.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING)
{
// The client sent the NPN extension, but did not send the NextProtocol
// message with the chosen protocol so we need to force the default protocol
LOG.debug("{} forcing default protocol", this);
unsupported();
}
if (nextProtocol != null)
{
ConnectionFactory connectionFactory = connector.getConnectionFactory(nextProtocol);