Issue #689 disable http2 draft versions

This commit is contained in:
Greg Wilkins 2016-07-06 13:17:50 +10:00
parent 0c0ed00747
commit cc842aff2b
4 changed files with 39 additions and 4 deletions

View File

@ -53,12 +53,15 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
public AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
{
this(httpConfiguration,"h2","h2-17","h2-16","h2-15","h2-14");
this(httpConfiguration,"h2");
}
protected AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration, String... protocols)
{
super(protocols);
for (String p:protocols)
if (!HTTP2ServerConnection.isSupportedProtocol(p))
throw new IllegalArgumentException("Unsupported HTTP2 Protocol variant: "+p);
this.httpConfiguration = Objects.requireNonNull(httpConfiguration);
addBean(httpConfiguration);
}

View File

@ -51,7 +51,15 @@ public class HTTP2CServerConnectionFactory extends HTTP2ServerConnectionFactory
public HTTP2CServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
{
super(httpConfiguration,"h2c","h2c-17","h2c-16","h2c-15","h2c-14");
this(httpConfiguration,"h2c");
}
public HTTP2CServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration, String... protocols)
{
super(httpConfiguration,protocols);
for (String p:protocols)
if (!HTTP2ServerConnection.isSupportedProtocol(p))
throw new IllegalArgumentException("Unsupported HTTP2 Protocol variant: "+p);
}
@Override

View File

@ -58,6 +58,31 @@ import org.eclipse.jetty.util.thread.ExecutionStrategy;
public class HTTP2ServerConnection extends HTTP2Connection implements Connection.UpgradeTo
{
/**
* @param protocol A HTTP2 protocol variant
* @return True if the protocol version is supported
*/
public static boolean isSupportedProtocol(String protocol)
{
switch(protocol)
{
case "h2":
case "h2-17":
case "h2-16":
case "h2-15":
case "h2-14":
case "h2c":
case "h2c-17":
case "h2c-16":
case "h2c-15":
case "h2c-14":
return true;
default:
return false;
}
}
private final Queue<HttpChannelOverHTTP2> channels = new ConcurrentArrayQueue<>();
private final ServerSessionListener listener;
private final HttpConfiguration httpConfig;

View File

@ -64,8 +64,7 @@ public class HTTP2ServerConnectionFactory extends AbstractHTTP2ServerConnectionF
@Override
public boolean isAcceptable(String protocol, String tlsProtocol, String tlsCipher)
{
// TODO remove this draft 14 protection
// Implement 9.2.2
// Implement 9.2.2 for draft 14
boolean acceptable = "h2-14".equals(protocol) || !(HTTP2Cipher.isBlackListProtocol(tlsProtocol) && HTTP2Cipher.isBlackListCipher(tlsCipher));
if (LOG.isDebugEnabled())
LOG.debug("proto={} tls={} cipher={} 9.2.2-acceptable={}",protocol,tlsProtocol,tlsCipher,acceptable);