Closed Bug 659216 Opened 14 years ago Closed 14 years ago

send header in websocket

Categories

(Core :: Networking: WebSockets, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: gufophp, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 send header (arrgggggh) Reproducible: Always Steps to Reproduce: function WebSocketTest() { if ("WebSocket" in window){ }else{ alert("No socket"); return } var cp = 'raw'; var socket = new WebSocket('ws://127.0.0.1:9004/',cp); socket.onopen = function (e) { alert(e); socket.send("admin"); // socket.send("more from browser"); }; socket.onclose = function(){ // alert(" socket closed"); }; socket.onmessage = function (evt) { alert(evt.data); }; } Actual Results: in server: GET / HTTP/1.1 Cookie: fontSize=100; ja_purity_tpl=ja_purity; PHPSESSID=42ed883cb629b2aba1c4b6ddc88abb92 Sec-WebSocket-Key2: D'2 ' 56 5 %0 Connection: Upgrade Upgrade: WebSocket Sec-WebSocket-Key1: v<)2X2-J /.{<1 9&2 Host: 127.0.0.1:9004 Sec-WebSocket-Protocol: raw Origin: http://127.0.0.1 &��wB�R Expected Results: no header send default to soket please add a function to NOT send browser header example read raw soket (mail, telnet, http, *non web service*)
Version: unspecified → 4.0 Branch
That's the handshake of the Web Socket protocol, see <http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07>. Web Sockets are not raw sockets !
Severity: critical → minor
Component: General → Networking: WebSockets
Product: Firefox → Core
QA Contact: general → networking.websockets
Version: 4.0 Branch → unspecified
As comment 1 states, WebSockets are not raw sockets. You can only connect the websocket by going through a HTTP upgrade procedure, so there will always be headers. You should have your server properly handle the handshake.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.