Bug 31659 - Connection must be closed in case of Web Socket handshake error
Summary: Connection must be closed in case of Web Socket handshake error
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Alexey Proskuryakov
Depends on:
Reported: 2009-11-18 20:53 PST by Yuzo Fujishima
Modified: 2009-11-30 15:49 PST (History)
4 users (show)

See Also:

proposed fix (2.48 KB, patch)
2009-11-30 15:44 PST, Alexey Proskuryakov
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuzo Fujishima 2009-11-18 20:53:36 PST
Currently, WebKit times out in case of Web Socket handshake error (as caught by LayoutTests/websocket/tests/handshake-error.html)

It must close the connection instead.

4 The WebSocket interface
If the "establish a Web Socket connection" algorithm fails, it triggers the "fail the Web Socket connection" algorithm, which then invokes the "close the Web Socket connection" algorithm, which then establishes that the "Web Socket connection is closed", which fires the close event as described below.
Comment 1 Yuzo Fujishima 2009-11-18 21:29:09 PST
Note: this bug was found while examining:

Comment 2 Alexey Proskuryakov 2009-11-26 13:03:34 PST
I don't understand what exactly fails here. According to <http://build.webkit.org/waterfall>, all tests currently pass. Does this particular test have identical output in success and failure cases? Or does it only fail with a patch from bug 31465 applied?
Comment 3 Yuzo Fujishima 2009-11-26 16:43:55 PST
Without 31465, the server calls a non-existent method, raises exception, and closes the socket.

With 31645, the server writes an invalid handshake response to the socket.

It seems that the client side can handle the socket closure case properly but not
the invalid response case -- the client times out for the latter.

Comment 4 Yuzo Fujishima 2009-11-26 16:45:44 PST
Sorry, s/31645/31465/g in #3.
Comment 5 Alexey Proskuryakov 2009-11-30 15:44:49 PST
Created attachment 44045 [details]
proposed fix
Comment 6 Oliver Hunt 2009-11-30 15:45:58 PST
Comment on attachment 44045 [details]
proposed fix

Comment 7 Alexey Proskuryakov 2009-11-30 15:49:43 PST
Committed <http://trac.webkit.org/changeset/51516>.