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 2014/01/29 12:28:35 UTC

svn commit: r1562414 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/websocket/server/UpgradeUtil.java webapps/docs/changelog.xml

Author: markt
Date: Wed Jan 29 11:28:35 2014
New Revision: 1562414

URL: http://svn.apache.org/r1562414
Log:
Fix bug handling the Sec-WebSocket-Protocol header returned to the client

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1562411

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1562414&r1=1562413&r2=1562414&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Wed Jan 29 11:28:35 2014
@@ -130,7 +130,8 @@ public class UpgradeUtil {
                 Constants.CONNECTION_HEADER_VALUE);
         resp.setHeader(HandshakeResponse.SEC_WEBSOCKET_ACCEPT,
                 getWebSocketAccept(key));
-        if (subProtocol != null) {
+        if (subProtocol != null && subProtocol.length() > 0) {
+            // RFC6455 4.2.2 explicitly states "" is not valid here
             resp.setHeader("Sec-WebSocket-Protocol", subProtocol);
         }
         if (!extensions.isEmpty()) {

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1562414&r1=1562413&r2=1562414&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jan 29 11:28:35 2014
@@ -42,8 +42,8 @@
 <body>
 <!--
   Subsection ordering:
-  General, Catalina, Coyote, Jasper, Cluster, Web applications, Extras, Tribes,
-  jdbc-pool, Other
+  General, Catalina, Coyote, Jasper, Cluster, WebSocket, Web applications,
+  Extras, Tribes, jdbc-pool, Other
 
   Item Ordering:
 
@@ -191,6 +191,15 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="WebSocket">
+    <changelog>
+      Do not return an empty string for the <code>Sec-WebSocket-Protocol</code>
+      HTTP header when no sub-protocol has been requested or no sub-protocol
+      could be agreed as RFC6455 requires that no
+      <code>Sec-WebSocket-Protocol</code> header is returned in this case.
+      (markt)
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>



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