diff options
author | Simone Bordet | 2015-01-29 10:21:08 +0000 |
---|---|---|
committer | Simone Bordet | 2015-01-29 10:21:08 +0000 |
commit | f02da0cc339ace0a663c6bd16bfd3012f1f94879 (patch) | |
tree | 437e81ad85a08c0afefdb9d5b2b48d6f006a107f /jetty-alpn | |
parent | af312dbca0968f75fd3a50521ed3c780084caa31 (diff) | |
download | org.eclipse.jetty.project-f02da0cc339ace0a663c6bd16bfd3012f1f94879.tar.gz org.eclipse.jetty.project-f02da0cc339ace0a663c6bd16bfd3012f1f94879.tar.xz org.eclipse.jetty.project-f02da0cc339ace0a663c6bd16bfd3012f1f94879.zip |
458354 - ALPNServerConnection.select negotiation.
Prefer the server protocols rather than the client protocols.
Diffstat (limited to 'jetty-alpn')
-rw-r--r-- | jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnection.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnection.java b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnection.java index 2e130ef20c..88abfd3cb2 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnection.java +++ b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnection.java @@ -50,14 +50,18 @@ public class ALPNServerConnection extends NegotiatingServerConnection implements { List<String> serverProtocols = getProtocols(); String negotiated = null; - for (String clientProtocol : clientProtocols) + + // RFC 7301 states that the server picks the protocol + // that it prefers that is also supported by the client. + for (String serverProtocol : serverProtocols) { - if (serverProtocols.contains(clientProtocol)) + if (clientProtocols.contains(serverProtocol)) { - negotiated = clientProtocol; + negotiated = serverProtocol; break; } } + if (negotiated == null) { negotiated = getDefaultProtocol(); |