Bug 54067

Summary: Upgrade Response with Transfer-Encoding: chunked invalid
Product: Tomcat 7 Reporter: Joakim Erdfelt <joakime>
Component: ExamplesAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 7.0.32   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Joakim Erdfelt 2012-10-29 17:23:09 UTC
WebSocket upgrade response from Tomcat 7.0.32 contains an invalid response header "Transfer-Encoding: chunked"

Full Request/Response is as follows (against example URI ws://localhost:8080/examples/websocket/echoMessage from distribution) ...

GET /examples/websocket/echoMessage HTTP/1.1
Host: localhost:8080
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: ZDTIRU5vU9xOfkg8JAgN3A==
Sec-WebSocket-Version: 13

HTTP/1.1 101 Switching Protocols
Server: Apache-Coyote/1.1
Upgrade: websocket
Connection: upgrade
Sec-WebSocket-Accept: Kgo85/8KVE8YPONSeyhgL3GwqhI=
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2012 16:32:53 GMT

The Jetty project is working this issue from the Jetty WebSocket client point of view.
Comment 1 Mark Thomas 2012-10-29 19:21:30 UTC
This is certainly a Tomcat bug in that the header should not be sent. It could also be argued that the Jetty client should ignore it based on point 1 of section 4.4 of RFC 2616.

I'll take a look at a fix now.
Comment 2 Joakim Erdfelt 2012-10-29 19:55:08 UTC
Good call on RFC-2616 Section 4.4, some of us suspected something wrong on our handling of upgrade (from a client point of view) as well.
Comment 3 Mark Thomas 2012-10-29 19:56:49 UTC
Thanks for the report. There was a more general issue with 1xx responses that has now been fixed in trunk and 7.0.x. The fix will be in the 7.0.33 release onwards.