Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314352

Summary: sec-websocket-origin header missing
Product: [RT] Jetty Reporter: Tilman Schlenker <tilman.schlenker>
Component: serverAssignee: Greg Wilkins <gregw>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jetty-inbox
Version: unspecified   
Target Milestone: 7.0.2.RC0   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Tilman Schlenker CLA 2010-05-25 16:10:54 EDT
Build Identifier: 20100523

When trying to connect to jetty websockets from WebKit nightly (6531.22.7, r60082) it fails with the message:

Error during WebSocket handshake: 'sec-websocket-origin' header is missing

It works with Chrome on mac


Reproducible: Always

Steps to Reproduce:
against below servlet code try to open a WebSocket connection. As stated the same code works against Chrome, so this might be a WebKit nightly bug, I am unsure if this is required per spec.

package com.avid.osgi.services.websocket;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;

public class ChatSocketServlet extends WebSocketServlet {
    private final List<ChatSocket> members = new ArrayList<ChatSocket>();
    
    @Override
    protected WebSocket doWebSocketConnect(HttpServletRequest httpServletRequest, String s) {
        return new ChatSocket();     
    }

    class ChatSocket implements WebSocket {
        private Outbound outbound;

        @Override
        public void onConnect(Outbound outbound) {
            this.outbound = outbound;
            members.add(this);
        }

        @Override
        public void onMessage(byte frame, String data) {
            for (ChatSocket s : members) {
                try {
                    s.outbound.sendMessage(frame,data);
                } catch (IOException e) {
                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                }
            }
        }

        @Override
        public void onMessage(byte b, byte[] bytes, int i, int i1) {
        }

        @Override
        public void onDisconnect() {
            members.remove(this);
        }
    }

}
Comment 1 Greg Wilkins CLA 2010-05-26 06:55:22 EDT
This is a change in the websocket protocol from version -75 to -76 of the whatwg draft proposal.

I have been waiting for a browser that implements it before supporting it in the server.  

So it looks like we'll have to get the webkit nightly and try that out.
Comment 2 Greg Wilkins CLA 2010-06-09 03:31:04 EDT
ready for 7.1.4
Comment 3 Jesse McConnell CLA 2011-09-20 15:51:46 EDT
Resolved -> Closed