Bug 53641 - Wrong websocket's subprotocol implementation
Summary: Wrong websocket's subprotocol implementation
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.29
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2012-08-02 12:52 UTC by Stephan Wolf
Modified: 2012-08-14 10:30 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
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);