Introduced configuration properties for ALPN/NPN advertised protocols.
No more need to copy protonego-alpn.xml to a jetty.base to specify which protocols are advertised and in which order. Instead, simply specify: alpn.protocols=h2-14,http/1.1 alpn.defaultProtocol=http/1.1 in start.ini (in the example above for http2).
This commit is contained in:
parent
e147ce9528
commit
814c84a212
|
@ -16,10 +16,10 @@
|
|||
<Arg>
|
||||
<New id="protonego" class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory">
|
||||
<Arg type="String">
|
||||
<Property name="protonego.protocols" default="http/1.1" />
|
||||
<Property name="alpn.protocols" default="" />
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">
|
||||
<Property name="protonego.defaultProtocol" default="http/1.1" />
|
||||
<Property name="alpn.defaultProtocol" />
|
||||
</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
|
|
|
@ -31,3 +31,7 @@ lib/jetty-alpn-server-${jetty.version}.jar
|
|||
lib/
|
||||
lib/alpn/
|
||||
|
||||
[ini-template]
|
||||
# alpn.protocols=h2-14,http/1.1
|
||||
# alpn.defaultProtocol=http/1.1
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFact
|
|||
|
||||
public ALPNServerConnectionFactory(String protocols)
|
||||
{
|
||||
this(protocols.split(","));
|
||||
this(protocols.trim().split(",", 0));
|
||||
}
|
||||
|
||||
|
||||
public ALPNServerConnectionFactory(@Name("protocols") String... protocols)
|
||||
{
|
||||
super("alpn", protocols);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# SSL Protocol Negotiatiation Module
|
||||
# SSL Protocol Negotiation Module
|
||||
#
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -14,8 +14,4 @@ etc/jetty-http2.xml
|
|||
[ini-template]
|
||||
## HTTP2 Configuration
|
||||
|
||||
# Advertised protocols
|
||||
protonego.protocols=h2-14,http/1.1
|
||||
protonego.defaultProtocol=http/1.1
|
||||
|
||||
# http2.maxConcurrentStreams=1024
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<Arg>
|
||||
<New id="protonego" class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory">
|
||||
<Arg type="String">
|
||||
<Property name="protonego.protocols" default="http/1.1" />
|
||||
<Property name="npn.protocols" default="" />
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">
|
||||
<Property name="protonego.defaultProtocol" default="http/1.1" />
|
||||
<Property name="npn.defaultProtocol" />
|
||||
</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
|
|
|
@ -30,3 +30,7 @@ lib/jetty-npn-server-${jetty.version}.jar
|
|||
[files]
|
||||
lib/
|
||||
lib/npn/
|
||||
|
||||
[ini-template]
|
||||
# npn.protocols=spdy/3,http/1.1
|
||||
# npn.defaultProtocol=http/1.1
|
||||
|
|
|
@ -36,7 +36,7 @@ public class NPNServerConnectionFactory extends NegotiatingServerConnectionFacto
|
|||
|
||||
public NPNServerConnectionFactory(String protocols)
|
||||
{
|
||||
this(protocols.split(","));
|
||||
this(protocols.trim().split(",", 0));
|
||||
}
|
||||
|
||||
public NPNServerConnectionFactory(@Name("protocols") String... protocols)
|
||||
|
|
|
@ -59,9 +59,16 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
{
|
||||
super(protocol);
|
||||
this.protocols = new ArrayList<>();
|
||||
// Trim the values, as they may come from XML configuration.
|
||||
for (String p : protocols)
|
||||
this.protocols.add(p.trim());
|
||||
if (protocols != null)
|
||||
{
|
||||
// Trim the values, as they may come from XML configuration.
|
||||
for (String p : protocols)
|
||||
{
|
||||
p = p.trim();
|
||||
if (!p.isEmpty())
|
||||
this.protocols.add(p.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getDefaultProtocol()
|
||||
|
@ -72,7 +79,8 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
public void setDefaultProtocol(String defaultProtocol)
|
||||
{
|
||||
// Trim the value, as it may come from XML configuration.
|
||||
this.defaultProtocol = defaultProtocol.trim();
|
||||
String dft = defaultProtocol == null ? "" : defaultProtocol.trim();
|
||||
this.defaultProtocol = dft.isEmpty() ? null : dft;
|
||||
}
|
||||
|
||||
public List<String> getProtocols()
|
||||
|
@ -91,7 +99,9 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
while (i.hasNext())
|
||||
{
|
||||
String protocol = i.next();
|
||||
if ("SSL".equalsIgnoreCase(protocol) || "alpn".equalsIgnoreCase("protocol"))
|
||||
if ("ssl".equalsIgnoreCase(protocol) ||
|
||||
"alpn".equalsIgnoreCase(protocol) ||
|
||||
"npn".equalsIgnoreCase(protocol))
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
|
|
|
@ -15,8 +15,5 @@ etc/jetty-spdy.xml
|
|||
[ini-template]
|
||||
## SPDY Configuration
|
||||
|
||||
# Advertised protocols
|
||||
protonego.protocols=spdy/3,http/1.1
|
||||
protonego.defaultProtocol=http/1.1
|
||||
|
||||
# spdy.initialWindowSize=65536
|
||||
# Initial Window Size for SPDY
|
||||
#spdy.initialWindowSize=65536
|
||||
|
|
Loading…
Reference in New Issue