Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 478e4284efac50cf5a811aac3728b210fc929a5c #7

Open
wants to merge 1 commit into
base: openjdk7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alpn-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.mortbay.jetty.alpn</groupId>
<artifactId>alpn-project</artifactId>
<version>7.1.0.v20141016</version>
<version>7.0.0.1-dev</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
57 changes: 34 additions & 23 deletions alpn-boot/src/main/java/sun/security/ssl/ClientHandshaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ public Subject run() throws Exception {
}

setHandshakeSessionSE(session);

// ALPN_CHANGES_BEGIN
if (isInitialHandshake)
alpnSelected(mesg);
// ALPN_CHANGES_END

return;
}

Expand Down Expand Up @@ -596,42 +602,47 @@ public Subject run() throws Exception {

// ALPN_CHANGES_BEGIN
if (isInitialHandshake)
alpnSelected(mesg);
// ALPN_CHANGES_END
}

// ALPN_CHANGES_BEGIN
private void alpnSelected(ServerHello mesg) throws IOException
{
ALPN.ClientProvider provider = (ALPN.ClientProvider)(conn != null ? ALPN.get(conn) : ALPN.get(engine));
Object ssl = conn != null ? conn : engine;
if (provider != null)
{
ALPN.ClientProvider provider = (ALPN.ClientProvider)(conn != null ? ALPN.get(conn) : ALPN.get(engine));
Object ssl = conn != null ? conn : engine;
if (provider != null)
ALPNExtension extension = (ALPNExtension)mesg.extensions.get(ExtensionType.EXT_ALPN);
if (extension != null)
{
ALPNExtension extension = (ALPNExtension)mesg.extensions.get(ExtensionType.EXT_ALPN);
if (extension != null)
List<String> protocols = extension.getProtocols();
try
{
List<String> protocols = extension.getProtocols();
try
{
String protocol = protocols == null || protocols.isEmpty() ? null : protocols.get(0);
if (ALPN.debug)
System.err.println("[C] ALPN protocol '" + protocol + "' selected by server for " + ssl);
provider.selected(protocol);
}
catch (Throwable x)
{
fatalSE(Alerts.alert_no_application_protocol, "Could not negotiate application protocol", x);
}
String protocol = protocols == null || protocols.isEmpty() ? null : protocols.get(0);
if (ALPN.debug)
System.err.println("[C] ALPN protocol '" + protocol + "' selected by server for " + ssl);
provider.selected(protocol);
}
else
catch (Throwable x)
{
if (ALPN.debug)
System.err.println("[C] ALPN not supported by server for " + ssl);
provider.unsupported();
fatalSE(Alerts.alert_no_application_protocol, "Could not negotiate application protocol", x);
}
}
else
{
if (ALPN.debug)
System.err.println("[C] ALPN client provider not present for " + ssl);
System.err.println("[C] ALPN not supported by server for " + ssl);
provider.unsupported();
}
}
// ALPN_CHANGES_END
else
{
if (ALPN.debug)
System.err.println("[C] ALPN client provider not present for " + ssl);
}
}
// ALPN_CHANGES_END

/*
* Server's own key was either a signing-only key, or was too
Expand Down
2 changes: 1 addition & 1 deletion alpn-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.mortbay.jetty.alpn</groupId>
<artifactId>alpn-project</artifactId>
<version>7.1.0.v20141016</version>
<version>7.0.0.1-dev</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Loading