You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/07/07 13:53:14 UTC

[tomcat] branch 9.0.x updated: support of schemes "wss" and "ws" in WsHandshakeRequest.buildRequestUri() requests with scheme "wss" or "ws", as outlined in [RFC 6455 section 11.1](https://tools.ietf.org/html/rfc6455#section-11.1), will cause an `IllegalArgumentException` with message "wsHandshakeRequest.unknownScheme"

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 7fe71d1  support of schemes "wss" and "ws" in WsHandshakeRequest.buildRequestUri() requests with scheme "wss" or "ws", as outlined in [RFC 6455 section 11.1](https://tools.ietf.org/html/rfc6455#section-11.1), will cause an `IllegalArgumentException` with message "wsHandshakeRequest.unknownScheme"
7fe71d1 is described below

commit 7fe71d1df99bc1567bb1549dc505c87f0e46f77a
Author: sephiroth-j <se...@sephiroth-j.de>
AuthorDate: Thu Jul 2 20:41:53 2020 +0200

    support of schemes "wss" and "ws" in WsHandshakeRequest.buildRequestUri()
    requests with scheme "wss" or "ws", as outlined in [RFC 6455 section 11.1](https://tools.ietf.org/html/rfc6455#section-11.1), will cause an `IllegalArgumentException` with message "wsHandshakeRequest.unknownScheme"
    
    this fixes a regression from e09e6b04e41d3dae27fcfe060e6f8f89f1c0d6b5 / BZ 62731
---
 .../apache/tomcat/websocket/server/WsHandshakeRequest.java   |  4 ++++
 webapps/docs/changelog.xml                                   | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java b/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
index cb8bd2f..2bfc441 100644
--- a/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
+++ b/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
@@ -156,6 +156,8 @@ public class WsHandshakeRequest implements HandshakeRequest {
             uri.append("ws");
         } else if ("https".equals(scheme)) {
             uri.append("wss");
+        } else if ("wss".equals(scheme) || "ws".equals(scheme)) {
+            uri.append(scheme);
         } else {
             // Should never happen
             throw new IllegalArgumentException(
@@ -166,6 +168,8 @@ public class WsHandshakeRequest implements HandshakeRequest {
         uri.append(req.getServerName());
 
         if ((scheme.equals("http") && (port != 80))
+            || (scheme.equals("ws") && (port != 80))
+            || (scheme.equals("wss") && (port != 443))
             || (scheme.equals("https") && (port != 443))) {
             uri.append(':');
             uri.append(port);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8f4fefe..61039de 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -45,10 +45,20 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.38 (markt)" rtext="in development">
+  <subsection name="WebSocket">
+    <changelog>
+      <fix>
+        Requests received via proxies may be marked as using the <code>ws</code>
+        or <code>wss</code> protocol rather than <code>http</code> or
+        <code>https</code>. Ensure that such requests are not rejected. PR
+        provided by Ronny Perinke. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>
-        Remove the localization of the text output of the Manager application 
+        Remove the localization of the text output of the Manager application
         list of contexts and the Host Manager application list of hosts so that
         the output is more consistent. PR provided by Holomark. (markt)
       </fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org