Bug 53641

Summary: Wrong websocket's subprotocol implementation
Product: Tomcat 7 Reporter: Stephan Wolf <wolfst>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: wolfst
Priority: P2    
Version: 7.0.29   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Stephan Wolf 2012-08-02 12:52:08 UTC
According to RFC6455 Section 4.3. the handling of subprotocol requests is not correct.
It must be checked for "Sec-WebSocket-Protocol" instead of "Sec-WebSocket-Protocol-Client" in WebSocketServlet class.
Comment 1 Mark Thomas 2012-08-07 21:54:56 UTC
Fixed in trunk and 7.0.x and will be included in 7.0.30 onwards.

Thanks for the report.
Comment 2 Stephan Wolf 2012-08-14 10:30:45 UTC
Thanks a lot!

By the way, here is workaround for those who can't wait:
Just add the following code into your WebsocketServlet:

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
  HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(req){
    public Enumeration<String>  getHeaders(String name) {
       return super.getHeaders("Sec-Websocket-Protocol");
      return super.getHeaders(name);
  super.doGet(wrapper, resp);