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:55:47 UTC

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


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

commit 223f1bbfe62e8874233d5164211d8faf2c39d2c3
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 70c5078..8ba161f 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 9e3e6a8..bcac7a0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -60,10 +60,20 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 7.0.106 (violetagg)" 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