Skip to content

Commit

Permalink
Fix ALPN negotiation with JSSE
Browse files Browse the repository at this point in the history
When using a JSSE TLS connector that supported ALPN (Java 9 onwards) and
a protocol was not negotiated, Tomcat failed to fallback to HTTP/1.1 and
instead dropped the connection.
  • Loading branch information
markt-asf committed Mar 27, 2019
1 parent 085c041 commit a938b51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion java/org/apache/coyote/AbstractProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ public SocketState process(SocketWrapperBase<S> wrapper, SocketEvent status) {
try {
if (processor == null) {
String negotiatedProtocol = wrapper.getNegotiatedProtocol();
if (negotiatedProtocol != null) {
// OpenSSL typically returns null whereas JSSE typically
// returns "" when no protocol is negotiated
if (negotiatedProtocol != null && negotiatedProtocol.length() > 0) {
UpgradeProtocol upgradeProtocol =
getProtocol().getNegotiatedProtocol(negotiatedProtocol);
if (upgradeProtocol != null) {
Expand Down
5 changes: 5 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
<fix>
Harmonize NIO2 isReadyForWrite with isReadyForRead code. (remm)
</fix>
<fix>
When using a JSSE TLS connector that supported ALPN (Java 9 onwards) and
a protocol was not negotiated, Tomcat failed to fallback to HTTP/1.1 and
instead dropped the connection. (markt)
</fix>
</changelog>
</subsection>
<subsection name="Jasper">
Expand Down

0 comments on commit a938b51

Please sign in to comment.