Open Bug 873773 Opened 12 years ago Updated 3 years ago

WebSocket client does not close TCP connection after incorrect handshake response from server

Categories

(Core :: Networking: WebSockets, defect, P3)

21 Branch
x86
Windows 8
defect

Tracking

()

UNCONFIRMED

People

(Reporter: kwakwakwi17, Unassigned)

Details

(Whiteboard: [necko-backlog])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.2; rv:21.0) Gecko/20100101 Firefox/21.0 (Beta/Release) Build ID: 20130511120803 Steps to reproduce: I've created simple C++ server, which handles TCP connections. When I connect to the server via simple javascript, it receives bad handshake response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: asds= Actual results: javascript fired onClose event callback in the script, but TCP connection was _not_ closed, which is wrong. For the next handshake attempt client opened another connection with server. Expected results: TCP connection should have been closed by client. rfc 6455: Once the client's opening handshake has been sent, the client MUST wait for a response from the server before sending any further data. The client MUST validate the server's response as follows: 2. If the response lacks an |Upgrade| header field or the |Upgrade| header field contains a value that is not an ASCII case- insensitive match for the value "websocket", the client MUST _Fail the WebSocket Connection_. 3. If the response lacks a |Connection| header field or the |Connection| header field doesn't contain a token that is an ASCII case-insensitive match for the value "Upgrade", the client MUST _Fail the WebSocket Connection_. 4. If the response lacks a |Sec-WebSocket-Accept| header field or the |Sec-WebSocket-Accept| contains a value other than the base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket- Key| (as a string, not base64-decoded) with the string "258EAFA5- E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and trailing whitespace, the client MUST _Fail the WebSocket Connection_.
Attachment #751373 - Attachment mime type: text/plain → text/html
Whiteboard: [necko-backlog]
Priority: -- → P1
Priority: P1 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: