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:54:42 UTC

[tomcat] branch 8.5.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 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 2315511  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"
2315511 is described below

commit 231551164426c6578fc5b4bcffd84d4af0abf3dc
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 cb32064..333fbc7 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 8.5.58 (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