458354 - ALPNServerConnection.select negotiation.

Prefer the server protocols rather than the client protocols.
This commit is contained in:
Simone Bordet 2015-01-29 11:21:08 +01:00
parent af312dbca0
commit f02da0cc33
1 changed files with 7 additions and 3 deletions

View File

@ -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();