Author: markt
Date: Fri Oct 3 19:10:40 2014
New Revision: 1629294
URL: http://svn.apache.org/r1629294
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57054
Correctly handle the case in the WebSocket client when the HTTP response to the
upgrade request can not be read in a single pass; either because the buffer is
too small or the server sent the response in multiple packets.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1629293
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1629294&r1=1629293&r2=1629294&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
Fri Oct 3 19:10:40 2014
@@ -567,6 +567,9 @@ public class WsWebSocketContainer
boolean readHeaders = false;
String line = null;
while (!readHeaders) {
+ // On entering loop buffer will be empty and at the start of a new
+ // loop the buffer will have been fully read.
+ response.clear();
// Blocking read
Future<Integer> read = channel.read(response);
Integer bytesRead = read.get(timeout, TimeUnit.MILLISECONDS);
Modified:
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1629294&r1=1629293&r2=1629294&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
(original)
+++
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Fri Oct 3 19:10:40 2014
@@ -92,6 +92,9 @@ public class TestWsWebSocketContainer ex
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
+ // Set this artificially small to trigger
+ // https://issues.apache.org/bugzilla/show_bug.cgi?id=57054
+ wsContainer.setDefaultMaxBinaryMessageBufferSize(64);
Session wsSession = wsContainer.connectToServer(
TesterProgrammaticEndpoint.class,
ClientEndpointConfig.Builder.create().build(),
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=1629294&r1=1629293&r2=1629294&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Oct 3 19:10:40 2014
@@ -69,6 +69,16 @@
</fix>
</changelog>
</subsection>
+ <subsection name="WebSocket">
+ <changelog>
+ <fix>
+ <bug>57054</bug>: Correctly handle the case in the WebSocket client
+ when the HTTP response to the upgrade request can not be read in a
+ single pass; either because the buffer is too small or the server sent
+ the response in multiple packets. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Web applications">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]